Author: max
Date: 2007-09-25 19:10:53 -0700 (Tue, 25 Sep 2007)
New Revision: 6604

Modified:
   openlaszlo/trunk/lps/components/utils/replicator/replicator.lzx
Log:
Change 20070925-maxcarlson-d by [EMAIL PROTECTED] on 2007-09-25 16:15:32 PDT
    in /Users/maxcarlson/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Fix explicit replicator

New Features:

Bugs Fixed: LPP-4664 - test/explicit-replicators/replicator.lzx visually 
deletes last two items when the second-to-last item is clicked and ...

Technical Reviewer: hminsky
QA Reviewer: [EMAIL PROTECTED]
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details: Per abargull and hminsky's suggestions, changed this._pointer.p to 
this.dataset for clarity, added destroy() to prevent memory leaks, 
_updateChildren() deals with a single node correctly, createChildren() calls 
super.createChildren(), __adjustVisibleClones() uses this.container instead of 
this.parent to lock/unlock layouts.
    

Tests: See LPP-4664.



Modified: openlaszlo/trunk/lps/components/utils/replicator/replicator.lzx
===================================================================
--- openlaszlo/trunk/lps/components/utils/replicator/replicator.lzx     
2007-09-26 00:34:48 UTC (rev 6603)
+++ openlaszlo/trunk/lps/components/utils/replicator/replicator.lzx     
2007-09-26 02:10:53 UTC (rev 6604)
@@ -137,19 +137,29 @@
       super.init.apply(this, arguments);
       if (this.dataset && this.xpath) {
         this._pointer = this.dataset.getPointer();
-        this._ondatadel = new LzDelegate(this, '_updateChildren', 
this._pointer.p, 'onDocumentChange')
+        this._ondatadel = new LzDelegate(this, '_updateChildren', 
this.dataset, 'onDocumentChange')
         this._updateChildren();
       }
     }
 
+    function destroy() {
+        if (this['_ondatadel']) this._ondatadel.unregisterAll();
+        this._pointer = null;
+        this.dataset = null;
+        super.destroy.apply(this, arguments);
+    }
+
     // @keywords private
-    function _updateChildren(c) {
+    function _updateChildren() {
         // TODO: use changepackage to do something smarter here
-        this.setNodes(this._pointer.xpathQuery(this.xpath))
+        var p = this._pointer.xpathQuery(this.xpath);
+        if (p && ! p['length']) p = [p]; 
+        this.setNodes(p)
     }
 
     //     @keywords private
     function createChildren (c) {
+        super.createChildren( [] ); 
         this.replicated = c.pop();
         
         //Debug.write( 'replicated', replicated );
@@ -300,7 +310,7 @@
 
     //  @keywords private
     function __adjustVisibleClones () {
-        var p = this.parent;
+        var p = this.container;
         for (var l in p.layouts) {
             p.layouts[l].lock();
         }


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

Reply via email to