[Laszlo-checkins] r8597 - in openlaszlo/trunk: WEB-INF/lps/lfc/data WEB-INF/lps/lfc/views test/lfc/data

bargull@openlaszlo.org bargull at openlaszlo.org
Wed Apr 9 01:22:43 PDT 2008


Author: bargull
Date: 2008-04-09 01:22:36 -0700 (Wed, 09 Apr 2008)
New Revision: 8597

Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDatapath.lzs
   openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDatapointer.lzs
   openlaszlo/trunk/WEB-INF/lps/lfc/data/LzReplicationManager.lzs
   openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs
   openlaszlo/trunk/test/lfc/data/datapointer.lzx
   openlaszlo/trunk/test/lfc/data/datapointerServerless.lzx
Log:
Change 20080326-bargull-2 by bargull at dell--p4--2-53 on 2008-03-26 17:54:15
    in /home/Admin/src/svn/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: remove deprecated methods/fields

New Features:

Bugs Fixed: LPP-5674, LPP-5609 

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

Documentation:

Release Notes:

Details:
Removed from LzDatapointer: getXPath(), getNodeOffset(), getOtherNodeText(), _openNode, _closeNode, _closeChar
Removed from LzDatapointer: old ondata-support (canvas.__LZoldOnData): __LZspecialOndata, __LZoldOndataWarn, __LZoldDataDel, __LZHandleDocChange()
LzDatapointer: Change ppcache to static (was already implicit static, only set on prototype)
Removed from LzDatapath: retrieveData()
Removed from LzDatapath: old ondata-support (canvas.__LZoldOnData): __LZHandleDocChange
Removed from LzReplicationManager: checkDependentContexts, handleModify
Removed from LzReplicationManager: old ondata-support (canvas.__LZoldOnData): __LZHandleDocChange
---
LzView: only minor change for LPP-5609


Tests:
test/lfc/data/alldata.lzx still passes



Modified: openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDatapath.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDatapath.lzs	2008-04-09 06:43:04 UTC (rev 8596)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDatapath.lzs	2008-04-09 08:22:36 UTC (rev 8597)
@@ -232,6 +232,8 @@
             break;
     }
 
+    //TODO: [20080327 anba] "storednodes" should be passed directly 
+    // to the ReplicationManager, instead of doing this kludge 
     this.storednodes = nodes;
     var rman = new clonetype( this, this._instanceAttrs);
     this.storednodes = null;
@@ -404,7 +406,7 @@
 
     }
 
-    //if immediate parent was deleted, don't worry about the datpaths dependent
+    //if immediate parent was deleted, don't worry about the datapaths dependent
     //on this one -- they'll be deleted too
     if ( ! this.immediateparent.__LZdeleted ){
         if ( this.__LZdepChildren != null &&
@@ -476,34 +478,11 @@
     if ( !arguments[ 0 ] && this.p){
         this.p.__LZunlockFromUpdate( this );
     }
-
-
 }
 
 /**
   * @access private
   */
-function retrieveData( ){
-    if ( $debug ){
-      Debug.deprecated(this, arguments.callee, this.updateData);
-    }
-    return this.updateData( );
-}
-
-/**
-  * @access private
-  */
-override function __LZHandleDocChange ( who ){
-    if ( super.__LZHandleDocChange.apply(this, arguments) ){
-        if (this.immediateparent.ondata.ready) this.immediateparent.ondata.sendEvent( this.data );
-        if (this.onDocumentChange.ready) this.onDocumentChange.sendEvent( who );
-    }
-}
-
-
-/**
-  * @access private
-  */
 override function toString( ){
     return "Datapath for " + this.immediateparent;
 }
@@ -607,9 +586,12 @@
   * @access private
   */
 function setClonePointer( p ) {
+    //Debug.write("%s: for %w, was %w (dp.sel=%w, p.sel=%w)", arguments.callee, p, this.p, this.sel, p.sel);
     var pc = this.p !=p;
     this.p = p;
 
+    //FIXME: [20080327 anba] LPP-5328
+    //if ( pc || true ) {
     if ( pc ) {
 
         if ( p && this.sel != p.sel ){
@@ -669,7 +651,7 @@
     this.sel = torf;
 
     if ( this.immediateparent is LzDatapath){
-        LzDatapath(this.immediateparent).setSelected( torf );
+        (this.immediateparent cast LzDatapath).setSelected( torf );
     }
 }
 

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDatapointer.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDatapointer.lzs	2008-04-09 06:43:04 UTC (rev 8596)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDatapointer.lzs	2008-04-09 08:22:36 UTC (rev 8597)
@@ -272,66 +272,16 @@
     }
 }
 
-
 /**
-  * Returns the result of an XPath query without changing the pointer. 
-  * The result can be:
-  * <ul>
-  * <li>a string -- the result of an operator such as name or attribute</li>
-  * <li>a single datapointer -- if the query resolves to a single node</li>
-  * <li>an array of datapointers -- if the query resolves to multiple nodes</li>
-  * </ul>
-  * @param Object p: the XPath
-  * @deprecated Use <code>LzDatapointer.xpathQuery()</code> or a
-  * <code>$path{}</code> instead.
-  */
-function getXPath ( p ){ 
-    if ( $debug ){
-        if ( !this.didGetXPathWarn ){
-          Debug.info("%w.%s is deprecated.  Use %w.%s or a $path{} constraint instead.",
-                     this, arguments.callee, this, this.xpathQuery);
-        }
-        this.didGetXPathWarn = true;
-    }
-    var r = this.xpathQuery( p );
-    var nr;
-    //testing for nodeType is the best way I can think of to check if the
-    //return value is a node
-
-    if ( r[0].nodeType ){
-        //it's an array of dataNodes
-        nr = [];
-        for ( var i = 0; i < r.length; i++ ){
-            nr[i] = new LzDatapointer( null, { p : r[ i ] } );
-        }
-    } else if ( r.nodeType ){
-        nr = new LzDatapointer( null, { p : r } );
-    } else {
-        nr = r;
-    }
-
-    return nr;
-
-}
-/** @access private */
-function $lzc$getXPath_dependencies ( who , self , p ){
-    $lzc$xpathQuery_dependencies (who, self, p);
-}
-
-
-/**
   * Points this datapointer at p.
   * @param LzDataNode p: The new target for this datapointer.
   */
 function setPointer ( p ) {
-
-    if ( !canvas.__LZoldOnData ){
-        this.setXPath( null );
-        if ( p != null ){
-            this.setDataContext( p.ownerDocument );
-        } else {
-            this.__LZsetTracking( null );
-        }
+    this.setXPath( null );
+    if ( p != null ){
+        this.setDataContext( p.ownerDocument );
+    } else {
+        this.__LZsetTracking( null );
     }
 
     var dc = this.data != p;
@@ -395,15 +345,6 @@
         }
     }
 
-    if ( canvas.__LZoldOnData ){
-        if ( ppcontext && ! this.parsedPath.selectors.length &&
-            !this.rerunxpath ){
-            this.__LZspecialOndata = true;
-        } else if ( this.__LZspecialOndata ){
-            this.__LZspecialOndata = null;;
-        }
-    }
-
     this.setDataContext( ppcontext );
 
     return  this.runXPath(  );
@@ -476,29 +417,6 @@
 
     this.__LZupdateLocked = false;
 
-    //this prevents the datapointer from sending the ondata event when it is
-    //bound solely to the root node of a dataset. This enables backwards 
-    //compatibility with the old semantics of ondata
-    if ( this.__LZspecialOndata ){
-        if ( n.childNodes.length ){
-            if ( this.ondata && !this.__LZoldOndataWarn ){
-                if ($debug) {
-                Debug.info( "Datapointer pointing to %w," +
-                    ' relies on the ondata event from' +
-                    " a datapointer bound to the root node of a dataset."+
-                    " \n    This behavior is deprecated." +
-                    " Point the dataponter the first child " +
-                    " of the dataset, or use the dataset's ondata event.", this.context);
-                }
-                this.__LZoldOndataWarn = true;
-            }
-
-            this.p = this.context;
-            if (this.ondata.ready) this.ondata.sendEvent( this.p );
-        }
-        return;
-    }
-
     this.__LZsendUpdate();
 }
 
@@ -606,7 +524,7 @@
     this.__LZsendUpdate( dchanged );
 }
 
-var ppcache = {};
+static var ppcache = {};
 
 /**
   * Parses a fully qualified XPath and yields an object with the components
@@ -621,11 +539,14 @@
   */
 function parsePath ( pa ){
     if (pa instanceof LzDatapath) pa = pa.xpath;
-    var q = this.ppcache[ pa ];
+    
+    var ppc = LzDatapointer.ppcache;
+    var q = ppc[ pa ];
     if (q == null) {
         q = new LzParsedPath(pa, this);
-        this.ppcache[ pa ] = q;
+        ppc[ pa ] = q;
     }
+    
     return q;
 }
 
@@ -913,21 +834,6 @@
 }
 
 /**
-  * Returns the number of the node that the datapointer is pointing to.
-  * Note that XPath indices are 1-based.
-  * @return Number: The offset of the node
-  * @deprecated Use <code>position()</code> xpath instead
-  */
-function getNodeOffset (){ 
-    if ( $debug ) {
-      Debug.info("%w.%s is deprecated.  Use XPath `position()` operator instead.",
-                 this, arguments.callee);
-    }
-    this.p.parentNode.__LZupdateCO();
-    return this.p.__LZo + 1;
-}
-
-/**
   * Gets the nodeType of the node that the datapointer is pointing to.
   * @return Integer: one of LzDataNode.ELEMENT_NODE, LzDataNode.TEXT_NODE, 
   * LzDataNode.DOCUMENT_NODE or <code>undefined</code> if this datapointer 
@@ -1004,9 +910,9 @@
         return;
     }
     if (this.p.nodeType != LzDataNode.TEXT_NODE) {
-    return this.p.attributes[ name ];
+        return this.p.attributes[ name ];
+    }
 }
-}
 
 /**
   * Set the <param>name</param> attribute of the current node to the
@@ -1022,9 +928,9 @@
         return;
     }
     if (this.p.nodeType != LzDataNode.TEXT_NODE) {
-    this.p.setAttr( name, val );
+        this.p.setAttr( name, val );
+    }
 }
-}
 
 /**
   * Removes the <param>name</param> attribute from the current node.
@@ -1038,9 +944,9 @@
         return;
     }
     if (this.p.nodeType != LzDataNode.TEXT_NODE) {
-    this.p.removeAttr( name );
+        this.p.removeAttr( name );
+    }
 }
-}
 
 /**
   * Returns a string that represents a concatenation of the text nodes
@@ -1057,35 +963,8 @@
         return;
     }
     if (this.p.nodeType != LzDataNode.TEXT_NODE) {
-    return this.p.__LZgetText();
-}
-}
-
-/**
-  * Returns a string that represents a concatenation of the text nodes
-  * beneath the node <param>n</param>.  This is currently the only way
-  * to access non-element data nodes.
-  * @deprecated Use <code>LzDatapointer.getNodeText()</code> instead.
-  * @param LzDataNode n: the node to find the text of
-  * @return String: The text of the node 
-  */
-
-function getOtherNodeText (n){ 
-    if ( $debug ) {
-      Debug.deprecated(this, arguments.callee, this.getNodeText);
+        return this.p.__LZgetText();
     }
-    var s = "";
-    if (n.c != null) {
-        var nc = n.c.length;
-        // append content of children which are text nodes
-        for (var i = 0; i < nc; i++) {
-            var node = n.c[i];
-            if (node.t != undefined) {
-                s += node.t;
-            }
-        }
-    }
-    return s;
 }
 
 /**
@@ -1106,21 +985,21 @@
     }
 
     if (this.p.nodeType != LzDataNode.TEXT_NODE) {
-    // set the first text node you find; otherwise add one
-    var foundit = false;
-    for (var i = 0; i < this.p.childNodes.length; i++) {
-        if ( this.p.childNodes[i].nodeType == LzDataNode.TEXT_NODE ) {
-            this.p.childNodes[i].setData( val );
-            foundit = true;
-            break;
+        // set the first text node you find; otherwise add one
+        var foundit = false;
+        for (var i = 0; i < this.p.childNodes.length; i++) {
+            if ( this.p.childNodes[i].nodeType == LzDataNode.TEXT_NODE ) {
+                this.p.childNodes[i].setData( val );
+                foundit = true;
+                break;
+            }
         }
+        if ( !foundit ){
+            //there wasn't a text node previously
+            this.p.appendChild( new LzDataText( val ) );
+        }
     }
-    if ( !foundit ){
-        //there wasn't a text node previously
-        this.p.appendChild( new LzDataText( val ) );
-    }
 }
-}
 
 /**
   * Counts the number of element nodes that are children of the node that the
@@ -1156,7 +1035,7 @@
     }
 
     if (this.p.nodeType != LzDataNode.TEXT_NODE) {
-    this.p.appendChild( nn );
+        this.p.appendChild( nn );
     }
     
     return nn;
@@ -1199,15 +1078,6 @@
     this.getDataset().sendDataChange( chgpkg );
 }
 
-// These are the strings used for nodes when serializing...
-// [2006-07-25 pbr] These don't appear to be used anywhere
-/** @access private */
-var _openNode = "<";
-/** @access private */
-var _closeNode = ">";
-/** @access private */
-var _closeChar = "/";
-
 /**
   * Determines whether this pointer is pointing to the same node as <param>ptr</param>.
   * @param LzDatapointer ptr: The datapointer to compare to this one.
@@ -1382,18 +1252,7 @@
         }
         
         this.__LZsetTracking( dc );
-        //bwcompat olddata
-        if ( canvas.__LZoldOnData && ! this.__LZspecialOndata ){
-            if ( this.__LZoldDataDel ){
-                this.__LZoldDataDel.unregisterAll();
-            } else {
-                this.__LZoldDataDel= new LzDelegate( this , 
-                                                    "__LZHandleDocChange" );
-            }
 
-            this.__LZoldDataDel.register( this.context , 'onDocumentChange');
-        }
-
         // When you have an xpath, register on the new context
         var hasxpath = this.xpath
         if (hasxpath) {
@@ -1464,26 +1323,6 @@
 }
 
 /** @access private */
-function __LZHandleDocChange ( chgpkg ){
-    var who = chgpkg.who;
-    if ( !this.p ) return false;
-    var meorbelowme = false;
-    var track = who;
-    var i = 0;
-    var sn = this.p;
-    do { 
-        if ( track == sn ){
-            meorbelowme = true;
-            break;
-        }
-        track = track.parentNode;
-    } while( track && track != who.ownerDocument );
-
-    if ( meorbelowme && this.ondata.ready) this.ondata.sendEvent( this.data );
-    return meorbelowme;
-}
-
-/** @access private */
 function __LZcheckDotDot ( chgpkg ){
     //the case where I need a special update is the one where the 
     //change is above me, but my parent quelled it
@@ -1507,9 +1346,7 @@
     this.__LZsetTracking( null );
     if ( this.errorDel ) this.errorDel.unregisterAll();
     if ( this.timeoutDel ) this.timeoutDel.unregisterAll();
-    if ( this.__LZoldDataDel ) {
-        this.__LZoldDataDel.unregisterAll();
-    }
+
     if ( this.__LZdotdotCheckDel ) {
         this.__LZdotdotCheckDel.unregisterAll();
     }

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/data/LzReplicationManager.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/data/LzReplicationManager.lzs	2008-04-09 06:43:04 UTC (rev 8596)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/data/LzReplicationManager.lzs	2008-04-09 08:22:36 UTC (rev 8597)
@@ -160,12 +160,14 @@
 
     //odp: original datapath
     var view = odp.immediateparent;
-    if (view == canvas) {
+    if (view === canvas) {
         // Initialize vars to reduce dhtml errors
         this.nodes = [];
         this.clones = [];
         this.clonePool = [];
-        Debug.error("LzReplicationManager constructed at canvas. A datapath cannot be defined on the canvas");
+        if ($debug) {
+            Debug.error("LzReplicationManager constructed at canvas. A datapath cannot be defined on the canvas");
+        }
         return;
     }
 
@@ -356,8 +358,7 @@
 /**
   * @access private
   */
-// [2008-02-08 pbr] Renamed to avoid conflict with LzDatapointer
-function _getNodeOffset ( p ){
+function getNodeOffset ( p ){
     if (this.nodes != null) {
         var l = this.nodes.length; 
         for ( var i = 0; i < l; i++ ){
@@ -632,12 +633,6 @@
     this.clonePool.push ( v );
 }
 
-
-// [ 07-25-2006 pbr] These two variables don't appear to be used
-var checkDependentContexts = null;
-//The clone manager doesn't have a view to update
-var handleModify = null;
-
 /**
   * @access private
   */
@@ -716,16 +711,6 @@
 /**
   * @access private
   */
-override function __LZHandleDocChange ( who ){
-    //this enables the old ondata test
-    this.p = this.context.getContext();
-    super.__LZHandleDocChange.apply(this, arguments);
-    this.p = null;
-}
-
-/**
-  * @access private
-  */
 override function __LZcheckChange ( chgpkg ){
     this.p = this.nodes[ 0 ];
     var didrun = super.__LZcheckChange.apply(this, arguments);

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs	2008-04-09 06:43:04 UTC (rev 8596)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs	2008-04-09 08:22:36 UTC (rev 8597)
@@ -398,6 +398,7 @@
     }
 
     if ('clip' in args && args['clip'] && (! (args.clip instanceof LzInitExpr)) ){
+        this.clip = args.clip;
         this.makeMasked();
     }
     if ('stretches' in args && args['stretches'] != null && (! (args.stretches instanceof LzInitExpr)) ){
@@ -1136,7 +1137,7 @@
   * view's <attribute>isVisible</attribute> property is true, the
   * resource will be displayed when it is attached
   * 
-  * @deprecated Use setAttribute('stretches', ...) instead.
+  * @deprecated Use setAttribute('resource', ...) instead.
   * @param String resourceName: a string naming the id of the resource to attach
   */
 function setResource(v) {

Modified: openlaszlo/trunk/test/lfc/data/datapointer.lzx
===================================================================
--- openlaszlo/trunk/test/lfc/data/datapointer.lzx	2008-04-09 06:43:04 UTC (rev 8596)
+++ openlaszlo/trunk/test/lfc/data/datapointer.lzx	2008-04-09 08:22:36 UTC (rev 8597)
@@ -63,7 +63,7 @@
             assertFalse( dp.setXPath  ( "match2"  ) );
             assertTrue( dp.setXPath  ( dsname+ ":/data" ) );
             assertTrue( dp.setXPath  ( "match2[2]"  ) );
-            assertEquals( 5 , dp.getNodeOffset() );
+            //assertEquals( 5 , dp.getNodeOffset() );
             assertEquals( 'match2' , dp.getNodeName  () );
             dp.setNodeAttribute  ('x', 22) ;
             assertEquals( dp.p.attributes , dp.getNodeAttributes() );
@@ -145,6 +145,6 @@
 
 </library>
 <!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
-* Copyright 2001-2007 Laszlo Systems, Inc.  All Rights Reserved.              *
+* Copyright 2001-2008 Laszlo Systems, Inc.  All Rights Reserved.              *
 * Use is subject to license terms.                                            *
 * X_LZ_COPYRIGHT_END ****************************************************** -->

Modified: openlaszlo/trunk/test/lfc/data/datapointerServerless.lzx
===================================================================
--- openlaszlo/trunk/test/lfc/data/datapointerServerless.lzx	2008-04-09 06:43:04 UTC (rev 8596)
+++ openlaszlo/trunk/test/lfc/data/datapointerServerless.lzx	2008-04-09 08:22:36 UTC (rev 8597)
@@ -51,7 +51,7 @@
             assertTrue( dp.setXPath  ( dsname+ ":/data" ) );
             assertTrue( dp.setXPath  ( "match2[2]"  ) );
             Debug.write( dp.p );
-            assertEquals( 5 , dp.getNodeOffset() );
+            //assertEquals( 5 , dp.getNodeOffset() );
             assertEquals( 'match2' , dp.getNodeName  () );
             dp.setNodeAttribute  ('x', 22) ;
             assertEquals( dp.p.attributes , dp.getNodeAttributes() );
@@ -114,6 +114,6 @@
 
 </library>
 <!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
-* Copyright 2001-2007 Laszlo Systems, Inc.  All Rights Reserved.              *
+* Copyright 2001-2008 Laszlo Systems, Inc.  All Rights Reserved.              *
 * Use is subject to license terms.                                            *
 * X_LZ_COPYRIGHT_END ****************************************************** -->



More information about the Laszlo-checkins mailing list