Author: ptw
Date: 2007-08-08 06:54:50 -0700 (Wed, 08 Aug 2007)
New Revision: 5963

Added:
   openlaszlo/branches/wafflecone/test/explicit-replicators/lazy-replicator.lzx
Removed:
   
openlaszlo/branches/wafflecone/lps/components/utils/replicator/datalistlazyreplicator.lzx
   
openlaszlo/branches/wafflecone/lps/components/utils/replicator/datalistreplicator.lzx
Modified:
   openlaszlo/branches/wafflecone/WEB-INF/lps/misc/lzx-autoincludes.properties
   
openlaszlo/branches/wafflecone/lps/components/utils/replicator/lazyreplicator.lzx
   openlaszlo/branches/wafflecone/lps/components/utils/replicator/library.lzx
   openlaszlo/branches/wafflecone/lps/components/utils/replicator/replicator.lzx
   
openlaszlo/branches/wafflecone/lps/components/utils/replicator/replicatorselectionmanager.lzx
Log:
Change 20070808-ptw-o by [EMAIL PROTECTED] on 2007-08-08 08:34:48 EDT
    in /Users/ptw/OpenLaszlo/wafflecone
    for http://svn.openlaszlo.org/openlaszlo/branches/wafflecone

Summary: Incorporate Pablo's fixes to explicit replication

Bugs Fixed:
Bug: LPP-4405 'Implement ExplicitReplication'

Technical Reviewer: hminsky (pending)
QA Reviewer: pkang (pending)

Release Notes:

Details:
    Added Pablo's test case for lazy-replicator.

    Added Pablo's changes to lazyreplicator and replicator.

    Removed obsolete datalist*replicator.

Tests:
    explicit-replicators tests



Modified: 
openlaszlo/branches/wafflecone/WEB-INF/lps/misc/lzx-autoincludes.properties
===================================================================
--- openlaszlo/branches/wafflecone/WEB-INF/lps/misc/lzx-autoincludes.properties 
2007-08-08 13:13:37 UTC (rev 5962)
+++ openlaszlo/branches/wafflecone/WEB-INF/lps/misc/lzx-autoincludes.properties 
2007-08-08 13:54:50 UTC (rev 5963)
@@ -126,8 +126,6 @@
 linechart: charts/linechart/linechart.lzx
 piechart: charts/piechart/piechart.lzx
 
-datalistlazyreplicator: utils/replicator/datalistlazyreplicator.lzx
-datalistreplicator: utils/replicator/datalistreplicator.lzx
 lazyreplicator: utils/replicator/lazyreplicator.lzx
 replicator: utils/replicator/replicator.lzx
 replicatorselectionmanager: utils/replicator/replicatorselectionmanager.lzx

Deleted: 
openlaszlo/branches/wafflecone/lps/components/utils/replicator/datalistlazyreplicator.lzx

Deleted: 
openlaszlo/branches/wafflecone/lps/components/utils/replicator/datalistreplicator.lzx

Modified: 
openlaszlo/branches/wafflecone/lps/components/utils/replicator/lazyreplicator.lzx
===================================================================
--- 
openlaszlo/branches/wafflecone/lps/components/utils/replicator/lazyreplicator.lzx
   2007-08-08 13:13:37 UTC (rev 5962)
+++ 
openlaszlo/branches/wafflecone/lps/components/utils/replicator/lazyreplicator.lzx
   2007-08-08 13:54:50 UTC (rev 5963)
@@ -28,19 +28,21 @@
     var replicatedsize = null;
     // @keywords private
     var clonedel = null;
-    
 
+
     //  @keywords private
     function construct (p,a) {
         super.construct( p, a );
         this.__emptyArray = [];
         this.clonedel = new LzDelegate( this, '__adjustVisibleClones');
+        this.mask = this.parent.parent;
+        this.container = this.parent;
     }
 
     //  @keywords private
     function init () {
         this.clonedel.register( this.mask , "on" + this._sizes[ this.axis ] );
-        this.clonedel.register( this , "on" + this.axis );
+        this.clonedel.register( this.container , "on" + this.axis );
         super.init();
     }
 
@@ -57,24 +59,25 @@
         if ( !this.replicatedsize ) this._setSize();
 
 
-        var sax =this._sizes[ this.axis ];
+        var sizeAxis = this._sizes[ this.axis ];
         if ( this.nodes.length != null ){
             this._lastNodesLength = this.nodes.length;
-        } 
+        }
         var s = this._lastNodesLength * this.replicatedsize;
 
-        if ( this[ sax ] != s ){
-            //Debug.write( sax, s, this[ sax ] );
-            this.setAttribute( sax, s );
+        if ( this.container[ sizeAxis ] != s ){
+            //Debug.write( sizeAxis, s, this.container[ sizeAxis ] );
+            this.container.setAttribute( sizeAxis, s );
         }
 
+        if (! this.mask) {
+            Debug.warn("%w: cannot find clipping parent", this);
+            return;
+        }
 
-        if (! this.mask )
-            Debug.warn("lazyreplicator _adjustVisibleClones: cannot find 
clipping parent");
+        if (! this.mask[ "hasset" + sizeAxis ] )
+            return;
 
-        if (! this.mask[ "hasset" + sax ] ) 
-            return;
-            
         //Here's the idea. Coming in, we have an old list of clones that
         //represents some window into the dataset. Let's say the nodes are
         //labelled alphabetically so to start, we have
@@ -82,14 +85,14 @@
         //When the situation changes, we end up with a situation where we
         //want the window to be like
         //this.clones=[ l , m , n , o ]
-            
+
         //This algorithm moves the old list of clones to a temporary
         //identifier and then constructs a new array for the clones going
         //through one by one It keeps an offset, which represents the
         //difference in position of the old new data windows. In the case
         //above, the offset would be -2.
 
-        var newstart = Math.floor( -this[ this.axis ] / 
+        var newstart = Math.floor( -this.container[ this.axis ] /
                                    this.replicatedsize );
 
         if ( 0 > newstart  ) newstart = 0;
@@ -98,12 +101,12 @@
         var oldlength = this.clones.length;
         var offset = newstart - this.clonesoffset;
 
-        var remainder = ( newstart * this.replicatedsize ) + 
-            this[ this.axis ];
+        var remainder = ( newstart * this.replicatedsize ) +
+            this.container[ this.axis ];
 
-        var newlength= Math.ceil( 
-            Math.min( (this.mask[ sax ] - remainder )/this.replicatedsize ,
-                      this[ sax ] /this.replicatedsize ) );
+        var newlength= Math.ceil(
+            Math.min( (this.mask[ sizeAxis ] - remainder )/this.replicatedsize 
,
+                       this.container[ sizeAxis ] /this.replicatedsize ) );
 
         //newstart is the new absolute lowerbound of the data window
         //newlength is the new length of the data window
@@ -143,7 +146,7 @@
 
             if ( cl ){
                 this.clones[ i ] = cl;
-                cl.setAttribute( this.axis , 
+                cl.setAttribute( this.axis ,
                                  ( i + newstart ) * this.replicatedsize );
                 this.unbind( cl );
                 this.bind( cl, newstart + i );

Modified: 
openlaszlo/branches/wafflecone/lps/components/utils/replicator/library.lzx
===================================================================
--- openlaszlo/branches/wafflecone/lps/components/utils/replicator/library.lzx  
2007-08-08 13:13:37 UTC (rev 5962)
+++ openlaszlo/branches/wafflecone/lps/components/utils/replicator/library.lzx  
2007-08-08 13:54:50 UTC (rev 5963)
@@ -3,6 +3,4 @@
     <include href="replicator.lzx"/>
     <include href="lazyreplicator.lzx"/>
     <include href="replicatorselectionmanager.lzx"/>
-    <include href="datalistreplicator.lzx"/>
-    <include href="datalistlazyreplicator.lzx"/>
 </library>

Modified: 
openlaszlo/branches/wafflecone/lps/components/utils/replicator/replicator.lzx
===================================================================
--- 
openlaszlo/branches/wafflecone/lps/components/utils/replicator/replicator.lzx   
    2007-08-08 13:13:37 UTC (rev 5962)
+++ 
openlaszlo/branches/wafflecone/lps/components/utils/replicator/replicator.lzx   
    2007-08-08 13:54:50 UTC (rev 5963)
@@ -125,7 +125,7 @@
     function init() {
       super.init.apply(this, arguments);
       // Set the layout in the view that will hold the replicated views
-      this.immediateparent.setAttribute('layout', {axis: this.axis, spacing: 
this.spacing});
+//      this.immediateparent.setAttribute('layout', {axis: this.axis, spacing: 
this.spacing});
       if (this.dataset && this.xpath) {
         this.setNodes(this.dataset.getPointer().xpathQuery(this.xpath))
       }

Modified: 
openlaszlo/branches/wafflecone/lps/components/utils/replicator/replicatorselectionmanager.lzx
===================================================================
--- 
openlaszlo/branches/wafflecone/lps/components/utils/replicator/replicatorselectionmanager.lzx
       2007-08-08 13:13:37 UTC (rev 5962)
+++ 
openlaszlo/branches/wafflecone/lps/components/utils/replicator/replicatorselectionmanager.lzx
       2007-08-08 13:54:50 UTC (rev 5963)
@@ -3,6 +3,27 @@
     <!--- A selection manager, similar to OpenLaszlo's LzSelectionManager
           designed to work with replicators -->
     <class name="replicatorselectionmanager" extends="node">
+        <!--- The replicator to manage -->
+        <attribute name="replicator" value="null" />
+
+        <method name="init">
+          <![CDATA[
+          super.init.apply(this, arguments);
+          // If replicator is not specified, search siblings for a replicator
+          if (! this.replicator) {
+            var s = parent.subnodes;
+            if (s == null) return;
+            for (var i = s.length-1; i >= 0; i-- ) {
+                var si = s[ i ];
+                if (si instanceof lz.replicator) {
+                    this.replicator = si;
+                    return;
+                }
+            }
+          }
+          ]]>
+        </method>
+
         <!--- If true, selecting a given clone again will deselect it -->
         <attribute name="toggle" value="false"/>
 
@@ -89,7 +110,7 @@
             if ( _selected[ vc ] ) return;
             _selected[ vc ] = true;
             this._lastsel = vc;
-            parent.setClonePropertyByCN( vc, _selectedProp, true );
+            replicator.setClonePropertyByCN( vc, _selectedProp, true );
         </method>
 
         <!--- @keywords private -->
@@ -104,7 +125,7 @@
                     break;
                 }
             }
-            parent.setClonePropertyByCN( vc, _selectedProp, false );
+            replicator.setClonePropertyByCN( vc, _selectedProp, false );
         </method>
 
 

Added: 
openlaszlo/branches/wafflecone/test/explicit-replicators/lazy-replicator.lzx


Property changes on: 
openlaszlo/branches/wafflecone/test/explicit-replicators/lazy-replicator.lzx
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native


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

Reply via email to