Author: max
Date: 2008-03-20 17:46:28 -0700 (Thu, 20 Mar 2008)
New Revision: 8338

Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloCanvas.lzs
   openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs
   openlaszlo/trunk/lps/components/utils/replicator/replicator.lzx
Log:
Change 20080320-maxcarlson-I by [EMAIL PROTECTED] on 2008-03-20 13:19:40 PDT
    in /Users/maxcarlson/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: UPDATED: Fix replicators, view and canvas cleanup

New Features:

Bugs Fixed: LPP-5641 - replicator broken after r8279

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

Documentation:

Release Notes:

Details: LaszloView.lzs - Per Tucker's suggestions, set _ignoreAttribute for 
args.stretches to avoid duplicate calls to stretchResource().  Clean up early 
resource setter.  Fix clip and stretches with constraint expressions.  Add 
Debug.deprecated() calls for @deprecated methods.  Moved setVisible(), 
setResource() and stretchResource() method bodies to $lzc$set_... and replaced 
original methods with a warning and trampoline to the setter method.  Call 
$lzc$set_... methods instead of deprecated setVisible(),         
setResource() and stretchResource().  Remove tests for if (this.sprite).

LaszloCanvas.lzs - UNCHANGED: Update __LZcallInit to match LzNode.  Update 
comment on sprite init()

replicator.lzx - UNCHANGED: Copy first slot of array instead of using pop() to 
preserve state of children array.  Add setter method for setNodes - can no 
longer use setters.nodes.

Tests: trunk/test/style/metasuite.lzx?lzr=swf8&debug=true passes, 
trunk/test/explicit-replicators/lazy-replicator.lzx and 
trunk/test/explicit-replicators/lazy-replicator.lzx



Modified: openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloCanvas.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloCanvas.lzs     2008-03-20 
23:28:57 UTC (rev 8337)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloCanvas.lzs     2008-03-21 
00:46:28 UTC (rev 8338)
@@ -492,7 +492,8 @@
     this.isinited = true;
 
     this.__LZresolveReferences();
-    if (this.__LZstyleConstraints) this.__LZapplyStyleConstraints();
+
+    // Install computed initializations
     var sl = this.subnodes;
     if (sl) {
         var i = 0;
@@ -523,7 +524,7 @@
     }
 
     this.init();
-    // Canvas-only: Why? TODO: [2008-02-01 ptw] Ask max
+    // Canvas-only: This is so the canvas sprite knows when to show its 
children
     this.sprite.init(true);
     if (this.oninit.ready) this.oninit.sendEvent( this );
     if (this.datapath && this.datapath.__LZApplyDataOnInit) {

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs       2008-03-20 
23:28:57 UTC (rev 8337)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs       2008-03-21 
00:46:28 UTC (rev 8338)
@@ -349,20 +349,17 @@
         this.__LZcheckheight = false;
     }
 
-    var r =null;
+    if ('clip' in args && args['clip'] && (! (args.clip instanceof 
LzInitExpr)) ){
+        this.makeMasked();
+    }
+    if ('stretches' in args && args['stretches'] != null && (! (args.stretches 
instanceof LzInitExpr)) ){
+        this.$lzc$set_stretches(args.stretches);
+        args.stretches = LzNode._ignoreAttribute;
+    }
     if ('resource' in args && args['resource'] != null && (! (args.resource 
instanceof LzInitExpr)) ){
-        r = args.resource;
+        this.$lzc$set_resource( args.resource );
         args.resource = LzNode._ignoreAttribute;
     }
-    if ('clip' in args && args['clip']){
-        if (this.sprite) this.makeMasked();
-    }
-    if (args['stretches']){
-        if (this.sprite) this.stretchResource(args.stretches);
-    }
-    if ( r  != null ){
-        if (this.sprite) this.setResource( r );
-    }
     if($debug){
         if( 'valign' in args && args['valign'] && 'y' in args && args['y']){
             Debug.warn("y attribute ignored; superseded by valign 
constraint.");
@@ -479,7 +476,6 @@
 function $lzc$set_opacity(v) { this.setOpacity(v); }
 /** @access private */
 function $lzc$set_alpha(v) { this.setOpacity(v); }
-function $lzc$set_visible(v) { this.setVisible(v) }
 /** @access private */
 function $lzc$set_visibility(v) { this.setVisibility(v) }
 
@@ -527,7 +523,6 @@
   * @type String
   */
 var resource;
-function $lzc$set_resource(v) { this.setResource(v) }
 
 /** If true, this view intercepts click events; otherwise they are passed
   * to its container.  This defaults to true if the view defines a mouse
@@ -590,7 +585,6 @@
   * @lzxdefault "none"
   */
 var stretches = "none"; 
-function $lzc$set_stretches(v) { this.stretchResource(v); }
 /** If true, the resource attached to this view begins playing when
   * the view is instantiated.
   * @lzxtype boolean
@@ -1067,6 +1061,7 @@
   * @deprecated
   */
 function releaseLayouts( ) {
+    if ($debug) Debug.deprecated(this, arguments.callee, this.setAttribute);
     if (this.layouts) {
         for ( var i = this.layouts.length - 1; i >= 0; i-- ){
             this.layouts[ i ].releaseLayout();
@@ -1079,9 +1074,15 @@
   * view's <attribute>isVisible</attribute> property is true, the
   * resource will be displayed when it is attached
   * 
+  * @deprecated Use setAttribute('stretches', ...) instead.
   * @param String resourceName: a string naming the id of the resource to 
attach
   */
-function setResource ( resourceName ) {
+function setResource(v) {
+    if ($debug) Debug.deprecated(this, arguments.callee, this.setAttribute);
+    this.$lzc$set_resource(v);    
+}
+
+function $lzc$set_resource( resourceName ) {
     if (resourceName == null || resourceName == this._resource) return;
     /*if (LzLoader.__LZmonitorState) {
         Debug.monitor(this, 'isloaded');
@@ -1232,7 +1233,7 @@
 
     //this.__LZFinishDestroyOnIdle();
 
-    this.setVisible ( false );
+    this.$lzc$set_visible ( false );
 
     if ( this.addedToParent ){
          if ( ('__LZoutliewidth' in this.immediateparent) && 
(this.immediateparent.__LZoutliewidth == this) ) {
@@ -1280,8 +1281,14 @@
   * @param Boolean|Null amVisible: Controls the visibility of a view.
   * `true` makes the view visible, `false` makes the view hidden,
   * `null` will make the view visible only if it has a data binding.
+  * @deprecated Use setAttribute('visible', ...) instead.
   */
-function setVisible( amVisible ) {
+function setVisible(v) { 
+    if ($debug) Debug.deprecated(this, arguments.callee, this.setAttribute);
+    this.$lzc$set_visible(v)
+}
+
+function $lzc$set_visible( amVisible ) {
     if (this._visible == amVisible) return;
     this._visible = amVisible;
 
@@ -1837,6 +1844,7 @@
   * @deprecated use the width attribute directly
   */
 function getWidth (){
+    if ($debug) Debug.deprecated(this, arguments.callee, this.setAttribute);
     return this.width;
 }
 
@@ -1846,6 +1854,7 @@
   * @deprecated use the height attribute directly
   */
 function getHeight (){
+    if ($debug) Debug.deprecated(this, arguments.callee, this.setAttribute);
     return this.height;
 }
 
@@ -2361,10 +2370,16 @@
   * the coordinate system for all children of this view, so use this method
   * with care.
   * 
+  * @deprecated Use setAttribute('stretches', ...) instead.
   * @param String stretch: Set the resource to stretch only in the given axis 
("width" or
   * "height") or in both axes ("both"). 
   */
-function stretchResource ( stretch ){
+function stretchResource(v) { 
+    if ($debug) Debug.deprecated(this, arguments.callee, this.setAttribute);
+    this.$lzc$set_stretches(v); 
+}
+
+function $lzc$set_stretches( stretch ){
     if (!(stretch == "none" || stretch == "both" || stretch == "width" || 
stretch == "height")) {
         //TODO: Remove null, x, y options from here when components are moved
         var newstretch = (stretch == null ? "both" : stretch == "x" ? "width" 
: stretch == "y" ? "height" : "none");
@@ -2373,6 +2388,8 @@
                 this, arguments.callee, stretch, this, arguments.callee, 
newstretch);
         }
         stretch = newstretch;
+    } else if (this.stretches == stretch) {
+        return;
     }
     
     this.stretches = stretch;
@@ -2430,14 +2447,14 @@
   * @access private
   */
 function makeMasked ( ){
-    if (this.sprite) this.sprite.setClip(true);
+    this.sprite.setClip(true);
     this.masked = true;
     this.mask = this;
 }
 
 /** @access private */
 function removeMask () {
-    if (this.sprite) this.sprite.setClip(false);
+    this.sprite.setClip(false);
     this.masked = false;
     this.mask = null;
 }

Modified: openlaszlo/trunk/lps/components/utils/replicator/replicator.lzx
===================================================================
--- openlaszlo/trunk/lps/components/utils/replicator/replicator.lzx     
2008-03-20 23:28:57 UTC (rev 8337)
+++ openlaszlo/trunk/lps/components/utils/replicator/replicator.lzx     
2008-03-21 00:46:28 UTC (rev 8338)
@@ -1,4 +1,4 @@
-<!-- Copyright 2001-2007 Laszlo Systems, Inc.  All Rights Reserved. -->
+<!-- Copyright 2001-2008 Laszlo Systems, Inc.  All Rights Reserved. -->
 <library>
   <!--- This is a declared replicator for visual elements. Unlike
       OpenLaszlo''s data-replication feature, a replicator can take an
@@ -160,10 +160,9 @@
     //     @keywords private
     function createChildren (c) {
         super.createChildren( [] ); 
-        this.replicated = c.pop();
+        this.replicated = c[0];
         
-        //Debug.write( 'replicated', replicated );
-        if ( c.length ) {
+        if ( c.length > 1 ) {
           Debug.warn("%s: only a single child view is replicated", this);
           this.container.createChildren( c );
         } else {
@@ -176,7 +175,7 @@
     /**
      * @access private
      */
-    setters.nodes = "setNodes";
+    function $lzc$set_nodes(n) { this.setNodes(n) }
 
     // Replicate over the given list of elements
     // @param Array n: The list of elements over which to replicate
@@ -274,7 +273,6 @@
 
     //  @keywords private
     function _makeClone () {
-
         var v = this.container.makeChild( this.replicated );
         v.setAttribute( "clonenumber", null );
         // emulate datapath behavior


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

Reply via email to