Author: max
Date: 2007-07-31 20:50:01 -0700 (Tue, 31 Jul 2007)
New Revision: 5888

Modified:
   openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/data/LzDataElement.lzs
   openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/events/LaszloEvents.lzs
   openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/views/LaszloView.lzs
   openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/views/LzText.lzs
   openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/views/LzViewLinkage.lzs
   openlaszlo/branches/wafflecone/lps/components/base/basedatacombobox.lzx
   openlaszlo/branches/wafflecone/lps/components/base/baselist.lzx
Log:
Change 20070731-maxcarlson-r by [EMAIL PROTECTED] on 2007-07-31 17:41:50 PDT
    in /Users/maxcarlson/openlaszlo/wafflecone
    for http://svn.openlaszlo.org/openlaszlo/branches/wafflecone

Summary: More null protection, cache view values

New Features:

Bugs Fixed: LPP-4414 - Improve startup performance (partial)

Technical Reviewer: promanik
QA Reviewer: ben
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details: LzText.lzs - Don't reset text to same value in setText().

LzViewLinkage.lzs - Check for null values.

LaszloView.lzs - Send onresourcewidth/height events for error/timeout.  Cache 
x, y, width and height values and don't reset.
    
LaszloEvents.lzs - Check for null values.

LzDataElement.lzs - Check for null values.

baselist.lzx - Check for null values.

basedatacombobox.lzx - Check for null values.

Tests: ....silver/main.lzx?lzr=dhtml&lzt=html has ~1525 fewer calls during 
startup.



Modified: openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/data/LzDataElement.lzs
===================================================================
--- openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/data/LzDataElement.lzs       
2007-08-01 01:02:46 UTC (rev 5887)
+++ openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/data/LzDataElement.lzs       
2007-08-01 03:50:01 UTC (rev 5888)
@@ -179,7 +179,7 @@
   * @return String: The value for the given attribute
   */
 function getAttr (name){
-    return this.attributes[ name ];
+    if (this.attributes) return this.attributes[ name ];
 }
 
 /**

Modified: openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/events/LaszloEvents.lzs
===================================================================
--- openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/events/LaszloEvents.lzs      
2007-08-01 01:02:46 UTC (rev 5887)
+++ openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/events/LaszloEvents.lzs      
2007-08-01 03:50:01 UTC (rev 5888)
@@ -434,7 +434,7 @@
                     evq.push(d, sd);
                 } else {
                   // d.execute( sd ); inlined
-                  d.c[d.f]( sd );
+                  if (d.c[d.f]) d.c[d.f]( sd );
                 }
             }
         }

Modified: openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/views/LaszloView.lzs
===================================================================
--- openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/views/LaszloView.lzs 
2007-08-01 01:02:46 UTC (rev 5887)
+++ openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/views/LaszloView.lzs 
2007-08-01 03:50:01 UTC (rev 5888)
@@ -967,6 +967,8 @@
 function resourceloaderror() {
     this.resourcewidth = 0;
     this.resourceheight = 0;
+    if (this.onresourcewidth.ready) this.onresourcewidth.sendEvent(0);
+    if (this.onresourceheight.ready) this.onresourceheight.sendEvent(0);
     this.reevaluateSize();
     if (this.onerror.ready) this.onerror.sendEvent();
 }
@@ -978,6 +980,8 @@
 function resourceloadtimeout() {
     this.resourcewidth = 0;
     this.resourceheight = 0;
+    if (this.onresourcewidth.ready) this.onresourcewidth.sendEvent(0);
+    if (this.onresourceheight.ready) this.onresourceheight.sendEvent(0);
     this.reevaluateSize();
     if (this.ontimeout.ready) this.ontimeout.sendEvent();
 }
@@ -1152,85 +1156,91 @@
   * @param Number v: The new value for the width
   */
 function setWidth ( v ){
-    //Debug.write('LzView.setWidth', this, v, this.sprite);
-    this.sprite.setWidth(v);
+    if (this._width != v) {
+        this._width = v;
+        //Debug.write('LzView.setWidth', this, v, this.sprite);
+        this.sprite.setWidth(v);
 
-    if ( v == null ){
-        this.hassetwidth = false;
-        // expose proto method
-        this.__LZcheckwidth = true;
+        if ( v == null ){
+            this.hassetwidth = false;
+            // expose proto method
+            this.__LZcheckwidth = true;
+            if ( this._setrescwidth ){
+                // will be updated by reevaluateSize
+                this.unstretchedwidth = null;
+                // defaults
+                this._xscale = 1;
+                //this.__LZmovieClipRef._xscale =  100;
+            }
+            this.reevaluateSize( 'width' );
+            return;
+        }
+        this.width = v;
+        if ( this.pixellock ) v = Math.floor( v );
         if ( this._setrescwidth ){
-            // will be updated by reevaluateSize
-            this.unstretchedwidth = null;
-            // defaults
-            this._xscale = 1;
-            //this.__LZmovieClipRef._xscale =  100;
-        }
-        this.reevaluateSize( 'width' );
-        return;
-    }
-    this.width = v;
-    if ( this.pixellock ) v = Math.floor( v );
-    if ( this._setrescwidth ){
         var xscale = this.unstretchedwidth == 0 ? 100 : 
v/this.unstretchedwidth;
         this._xscale = xscale;
         //this.__LZmovieClipRef._xscale = xscale * 100;
-    } else {
-        this.__LZcheckwidth = false;
-    }
-    
-    this.hassetwidth = true;
-    
-    //this.__LZbgRef._xscale = v;
+        } else {
+            this.__LZcheckwidth = false;
+        }
+        
+        this.hassetwidth = true;
+        
+        //this.__LZbgRef._xscale = v;
 
-     if (this.immediateparent.__LZcheckwidth)
-         this.immediateparent.__LZcheckwidthFunction( this );
+        if (this.immediateparent.__LZcheckwidth)
+            this.immediateparent.__LZcheckwidthFunction( this );
 
 
-    if (this.onwidth.ready) this.onwidth.sendEvent( v );
+        if (this.onwidth.ready) this.onwidth.sendEvent( v );
+    }
 }
 
-/**
-  * Sets the height of the view the given value. If the view is set to stretch
-  * its resource, the resource will be resized to the new value. If the value
-  * 'null' is given for the new height, then the height is unset, and the 
height
-  * of the view will be the size measured of its contents.
+    /**
+    * Sets the height of the view the given value. If the view is set to 
stretch
+    * its resource, the resource will be resized to the new value. If the value
+    * 'null' is given for the new height, then the height is unset, and the 
height
+    * of the view will be the size measured of its contents.
   * @param Number v: The new value for the height
   */
 function setHeight ( v ){
-    this.sprite.setHeight(v);
+    if (this._height != v) {
+        this._height = v;
+        this.sprite.setHeight(v);
 
-    if ( v == null ){
-        this.hassetheight = false;
-        // expose proto method
-        this.__LZcheckheight = true;
+        if ( v == null ){
+            this.hassetheight = false;
+            // expose proto method
+            this.__LZcheckheight = true;
 
+            if ( this._setrescheight ){
+                // will be updated by reevaluateSize
+                this.unstretchedheight = null;
+                // defaults
+                this._yscale = 1;
+                //this.__LZmovieClipRef._yscale =  100;
+            }
+            this.reevaluateSize( 'height' );
+            return;
+        }
+        this.height = v;
+        if ( this.pixellock ) v = Math.floor( v );
         if ( this._setrescheight ){
-            // will be updated by reevaluateSize
-            this.unstretchedheight = null;
-            // defaults
-            this._yscale = 1;
-            //this.__LZmovieClipRef._yscale =  100;
+            var yscale = this.unstretchedheight == 0 ? 100 : 
v/this.unstretchedheight;
+            this._yscale = yscale;
+            //this.__LZmovieClipRef._yscale = yscale * 100;
+        } else {
+            this.__LZcheckheight = false;
         }
-        this.reevaluateSize( 'height' );
-        return;
-    }
-    this.height = v;
-    if ( this.pixellock ) v = Math.floor( v );
-    if ( this._setrescheight ){
-        var yscale = this.unstretchedheight == 0 ? 100 : 
v/this.unstretchedheight;
-        this._yscale = yscale;
-        //this.__LZmovieClipRef._yscale = yscale * 100;
-    } else {
-        this.__LZcheckheight = false;
-    }
-    this.hassetheight = true;
-    
-    if (this.immediateparent.__LZcheckheight)
-        this.immediateparent.__LZcheckheightFunction( this );
+        this.hassetheight = true;
+        
+        if (this.immediateparent.__LZcheckheight)
+            this.immediateparent.__LZcheckheightFunction( this );
 
 
-    if (this.onheight.ready) this.onheight.sendEvent( v );
+        if (this.onheight.ready) this.onheight.sendEvent( v );
+    }
 }
 
 
@@ -1260,22 +1270,25 @@
   * @param Number v: The new value for <attribute>x</attribute>.
   */
 function setX ( v ){
-    this.x = v;
-    if ( this.__LZhasoffset ){
-        if (this.sprite.capabilities.rotation) {
-            v -= ( this.xoffset * this.__LZrcos  -
-                this.yoffset * this.__LZrsin );
-        } else {
-            v -= this.xoffset;
+    if (this._x != v) {
+        this._x = v;
+        this.x = v;
+        if ( this.__LZhasoffset ){
+            if (this.sprite.capabilities.rotation) {
+                v -= ( this.xoffset * this.__LZrcos  -
+                    this.yoffset * this.__LZrsin );
+            } else {
+                v -= this.xoffset;
+            }
         }
+        
+        if ( this.pixellock ) v = Math.floor( v );
+        this.sprite.setX(v)
+        
+        if (this.immediateparent.__LZcheckwidth)
+            this.immediateparent.__LZcheckwidthFunction( this );
+        if (this.onx.ready) this.onx.sendEvent( this.x );
     }
-    
-    if ( this.pixellock ) v = Math.floor( v );
-    this.sprite.setX(v)
-    
-    if (this.immediateparent.__LZcheckwidth)
-        this.immediateparent.__LZcheckwidthFunction( this );
-    if (this.onx.ready) this.onx.sendEvent( this.x );
 }
 
 
@@ -1284,21 +1297,24 @@
   * @param Number v: The new value for <attribute>y</attribute>.
   */
 function setY ( v ){
-    this.y = v;
-    if ( this.__LZhasoffset ){
-        if (this.sprite.capabilities.rotation) {
-            v -= ( this.xoffset * this.__LZrsin  +
-                this.yoffset * this.__LZrcos );
-        } else {
-            v -= this.yoffset;
+    if (this._y != v) {
+        this._y = v;
+        this.y = v;
+        if ( this.__LZhasoffset ){
+            if (this.sprite.capabilities.rotation) {
+                v -= ( this.xoffset * this.__LZrsin  +
+                    this.yoffset * this.__LZrcos );
+            } else {
+                v -= this.yoffset;
+            }
         }
+        
+        if ( this.pixellock ) v = Math.floor( v );
+        this.sprite.setY(v)
+        if (this.immediateparent.__LZcheckheight)
+            this.immediateparent.__LZcheckheightFunction( this );
+        if (this.ony.ready) this.ony.sendEvent( this.y );
     }
-    
-    if ( this.pixellock ) v = Math.floor( v );
-    this.sprite.setY(v)
-    if (this.immediateparent.__LZcheckheight)
-        this.immediateparent.__LZcheckheightFunction( this );
-    if (this.ony.ready) this.ony.sendEvent( this.y );
 }
 
 

Modified: openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/views/LzText.lzs
===================================================================
--- openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/views/LzText.lzs     
2007-08-01 01:02:46 UTC (rev 5887)
+++ openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/views/LzText.lzs     
2007-08-01 03:50:01 UTC (rev 5888)
@@ -642,6 +642,7 @@
 function setText ( t ){
     // force to a string
     t += '';
+    if (t == this.text) return;
     if (this.visible) this.sprite.setVisible(this.visible);
     this.sprite.setText(t);
     this.text =  t;

Modified: openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/views/LzViewLinkage.lzs
===================================================================
--- openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/views/LzViewLinkage.lzs      
2007-08-01 01:02:46 UTC (rev 5887)
+++ openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/views/LzViewLinkage.lzs      
2007-08-01 03:50:01 UTC (rev 5888)
@@ -83,17 +83,21 @@
     var toffset= 0;
     var scale = "_" + xory + "scale";
 
-    var ual = this.uplinkArray.length;
-    for (var i = 0 ; i < ual ; i++ ){
-      var a = this.uplinkArray[i];
-      tscale *= a[scale];
-      toffset += a[xory] / tscale;
+    if (this.uplinkArray) {
+        var ual = this.uplinkArray.length;
+        for (var i = 0 ; i < ual ; i++ ){
+            var a = this.uplinkArray[i];
+            tscale *= a[scale];
+            toffset += a[xory] / tscale;
+        }
     }
 
-    for (var i = this.downlinkArray.length -1 ; i >= 0 ; i -- ){
-      var a = this.downlinkArray[i];
-      toffset -= a[xory] / tscale;
-      tscale /= a[scale];
+    if (this.downlinkArray) {
+        for (var i = this.downlinkArray.length -1 ; i >= 0 ; i -- ){
+            var a = this.downlinkArray[i];
+            toffset -= a[xory] / tscale;
+            tscale /= a[scale];
+        }
     }
 
     this.scale[xory] = tscale;

Modified: 
openlaszlo/branches/wafflecone/lps/components/base/basedatacombobox.lzx
===================================================================
--- openlaszlo/branches/wafflecone/lps/components/base/basedatacombobox.lzx     
2007-08-01 01:02:46 UTC (rev 5887)
+++ openlaszlo/branches/wafflecone/lps/components/base/basedatacombobox.lzx     
2007-08-01 03:50:01 UTC (rev 5888)
@@ -197,7 +197,7 @@
 
             var t = dp.xpathQuery(this.textdatapath);
             // if t is null, use default text (if it exists)
-            if( ( t == null || t.length == 0 ) && this.defaulttext['length'] > 
0 )
+            if( ( t == null || t.length == 0 ) && this.defaulttext && 
this.defaulttext['length'] > 0 )
                t = this.defaulttext;
 
             if ( this._cbtext && (this.statictext == null) ) {
@@ -215,7 +215,7 @@
             if (this.ismenu) {
                 // Clear the selection
                 this._selectedIndex = -1;
-                if (this._cblist['_selector']) {
+                if (this._cblist && this._cblist['_selector']) {
                     this._cblist._selector.clearSelection();
                 }
             }

Modified: openlaszlo/branches/wafflecone/lps/components/base/baselist.lzx
===================================================================
--- openlaszlo/branches/wafflecone/lps/components/base/baselist.lzx     
2007-08-01 01:02:46 UTC (rev 5887)
+++ openlaszlo/branches/wafflecone/lps/components/base/baselist.lzx     
2007-08-01 03:50:01 UTC (rev 5888)
@@ -89,9 +89,11 @@
         <method name="_doFocus" event="onfocus">
             <![CDATA[
             // the hiliteview is used for keyboard nav hiliting
-                if (this._selector) var sel = this._selector.getSelection();
-                if (sel && sel.length > 0) {
-                    this._hiliteview = sel[0];
+                if (this['_selector']) {
+                    var sel = this._selector.getSelection();
+                    if (sel && sel.length > 0) {
+                        this._hiliteview = sel[0];
+                    }
                 }
             ]]>
         </method>


_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins

Reply via email to