Author: pbr
Date: 2008-03-13 07:47:26 -0700 (Thu, 13 Mar 2008)
New Revision: 8247

Added:
   openlaszlo/branches/devildog/test/swf9/data-1.lzx
   openlaszlo/branches/devildog/test/swf9/data-2.lzx
   openlaszlo/branches/devildog/test/swf9/data-3.lzx
   openlaszlo/branches/devildog/test/swf9/data-4.lzx
   openlaszlo/branches/devildog/test/swf9/data-5.lzx
   openlaszlo/branches/devildog/test/swf9/data.xml
Modified:
   openlaszlo/branches/devildog/WEB-INF/lps/lfc/core/LzNode.js
   openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataElement.js
   openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataNode.js
   openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataProvider.js
   openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataRequest.js
   openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataText.js
   openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDatapath.js
   openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDatapointer.js
   openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataset.js
   openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzHTTPDatasource.js
   openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzLazyReplicationManager.js
   openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzMiniNode.js
   openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzParam.js
   openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzReplicationManager.js
   
openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzResizeReplicationManager.js
   openlaszlo/branches/devildog/WEB-INF/lps/lfc/kernel/swf9/LzSprite.as
   openlaszlo/branches/devildog/WEB-INF/lps/lfc/kernel/swf9/LzXMLParser.as
   openlaszlo/branches/devildog/WEB-INF/lps/lfc/kernel/swf9/LzXMLTranslator.as
   openlaszlo/branches/devildog/WEB-INF/lps/lfc/views/LaszloView.js
Log:
Change 20080313-Philip-8 by [EMAIL PROTECTED] on 2008-03-13 10:15:08 EDT
     in /cygdrive/f/laszlo/svn/src/svn/openlaszlo/branches/devildog
     for http://svn.openlaszlo.org/openlaszlo/branches/devildog

Summary: Databinding updates for swf9

New Features:

Bugs Fixed:

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

Documentation:

Release Notes:

Details:
Simple databinding tests now work. The most complicated one I have working is 
/t est/swf9/data-3.lzx. This comes from the docs and is modified since 
simplelayout
  isn't available yet. This example produces the same output in swf, dhtml, and 
s wf9.

<canvas height="80" width="500" >
   <dataset name="myData">
     <myXML>
         <person show="simpsons">
           <firstName>Homer</firstName>
           <lastName>Simpson</lastName>
         </person>
         <person show="simpsons">
           <firstName>Marge</firstName>
           <lastName>Simpson</lastName>
         </person>
         <person show="simpsons">
           <firstName>Montgomery</firstName>
           <lastName>Burns</lastName>
         </person>
       </myXML>
   </dataset>

   <attribute name="yvalue" value="0"/>

   <view name="myTable">

     <view name="rowOfData" datapath="myData:/myXML[1]/person">
       <handler name="oninit">
         this.setY (canvas.yvalue);
         canvas.yvalue += 15;
       </handler>

       <text x="0" datapath="firstName/text()" />
       <text x="100" datapath="lastName/text()" />
       <text x="200" datapath="@show" />
     </view>
   </view>
</canvas>


Tests:
/test/swf9/data-{1,2,3}.lzx


Files:
A      test/swf9/data-1.lzx
A      test/swf9/data-2.lzx
A      test/swf9/data-3.lzx
A      test/swf9/data-4.lzx
A      test/swf9/data-5.lzx
A      test/swf9/data.xml
M      WEB-INF/lps/lfc/kernel/swf9/LzXMLTranslator.as
M      WEB-INF/lps/lfc/kernel/swf9/LzXMLParser.as
M      WEB-INF/lps/lfc/kernel/swf9/LzSprite.as
M      WEB-INF/lps/lfc/core/LzNode.js
M      WEB-INF/lps/lfc/views/LaszloView.js
M      WEB-INF/lps/lfc/data/LzLazyReplicationManager.js
M      WEB-INF/lps/lfc/data/LzDataText.js
M      WEB-INF/lps/lfc/data/LzDataNode.js
M      WEB-INF/lps/lfc/data/LzDataProvider.js
M      WEB-INF/lps/lfc/data/LzDatapath.js
M      WEB-INF/lps/lfc/data/LzHTTPDatasource.js
M      WEB-INF/lps/lfc/data/LzParam.js
M      WEB-INF/lps/lfc/data/LzMiniNode.js
M      WEB-INF/lps/lfc/data/LzReplicationManager.js
M      WEB-INF/lps/lfc/data/LzDatapointer.js
M      WEB-INF/lps/lfc/data/LzDataRequest.js
M      WEB-INF/lps/lfc/data/LzDataElement.js
M      WEB-INF/lps/lfc/data/LzDataset.js
M      WEB-INF/lps/lfc/data/LzResizeReplicationManager.js

Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20080313-Philip-8.tar



Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/core/LzNode.js
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/core/LzNode.js 2008-03-13 
14:22:51 UTC (rev 8246)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/core/LzNode.js 2008-03-13 
14:47:26 UTC (rev 8247)
@@ -908,7 +908,7 @@
                   //then we need to notify the rest of the system that this
                   //value changed.
                   var evt = ("on" + a);
-                  if (evt in this) {
+                  if (this[evt] is LzEvent) {
                       if (this[evt].ready) this[ evt ].sendEvent( args[ a ] );
                   } 
               }
@@ -1013,7 +1013,7 @@
         }
         this[ prop ] = val;
         var evt = ("on" + prop);
-        if (evt in this) {
+        if (this[evt] is LzEvent) {
             if (this[evt].ready) this[ evt ].sendEvent( val );
         }
     }
@@ -1591,7 +1591,7 @@
    * @access public
    * @param LzDataElement data: The dataelement to use as the context
    */
-  function setData(data) {
+  function setData(data, headers = null) {
     this.data = data;
     var dp = (this.datapath != null) ? this.datapath : new LzDatapath(this);
     dp.setPointer(data);
@@ -1613,6 +1613,10 @@
 }
 }
 
+// See LzView for the real definition
+function __LZupdateShown( ) {
+}
+
 /**
   * @access private
   */
@@ -2086,7 +2090,7 @@
 /**
   * @access private
   */
-function __LZmakeDatapath( dpobj ){
+function __LZmakeDatapath( dpobj, value=null ){
     if (! (dpobj is Object)) {
         if ($debug) {
             Debug.debug('__LZmakeDatapath on non-object %w?', dpobj)

Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataElement.js
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataElement.js  
2008-03-13 14:22:51 UTC (rev 8246)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataElement.js  
2008-03-13 14:47:26 UTC (rev 8247)
@@ -280,7 +280,7 @@
   * Sets the attributes of this node to the given Object.
   * @param Object attrs: The object to use as the attrs for this node.
   */
-function setAttrs ( attrs ){
+function setAttrs ( attrs, val=null ){
     var a = {};
     for ( var k in attrs ){ a[ k ] = attrs[ k ]; }
 
@@ -296,7 +296,7 @@
   * @param [LzDataNode] children: An array of LzDataNodes to be the new 
children
   * of this node
   */
-function setChildNodes ( children ){
+function setChildNodes ( children, val=null ){
     this.childNodes = children;
     for ( var i = 0; i < children.length; i++ ){
         var c = children[ i ];
@@ -320,7 +320,7 @@
   * Sets the name of this node.
   * @param String name: The new name for this node
   */
-function setNodeName ( name ){
+function setNodeName ( name, val=null ){
     //Debug.write('setting node name from "',this.nodeName, '" to "', name, 
'"');
     this.nodeName = name;
     //since this can affect xpaths, send onchildNodes event
@@ -337,7 +337,7 @@
 /**
   * @access private
   */
-function __LZgetText ( ){
+function __LZgetText (ignore=null ){
     var s= "";
     for ( var i = 0; i < this.childNodes.length; i++ ){
         var c = this.childNodes[ i ]
@@ -419,17 +419,14 @@
   * @return String: The string serialization of this node.
   */
 function serialize (){
-    return this.serializeInternal(Infinity);
+    return this.serializeInternal();
 }
 
 /**
   * Implementation of serialize with option to limit string length
   * @access private
   */
-function serializeInternal (len) {
-    if (arguments.length < 1) {
-        len = Infinity;
-    }
+function serializeInternal (len=Infinity) {
     var s = this.__LZlt + this.nodeName;
 
     //Debug.info('k', this.attributes);
@@ -441,7 +438,7 @@
     if ( s.length <= len && this.childNodes && this.childNodes.length ){
         s += this.__LZgt;
         for ( var i = 0; i < this.childNodes.length; i++ ){
-            s += this.childNodes[ i ].serialize(len);
+            s += this.childNodes[ i ].serializeInternal(len);
             if (s.length > len) { break; }
         }
         s += this.__LZlt + "/" + this.nodeName + this.__LZgt;
@@ -547,12 +544,27 @@
   */
 class LzDataElement extends LzMiniNode with LzDataElementMixin, LzDataNodeMixin
 {
+  static var setters = new LzInheritedHash(LzMiniNode.setters);
+  static var getters = new LzInheritedHash(LzMiniNode.getters);
+  static var defaultattrs = new LzInheritedHash(LzMiniNode.defaultattrs);
+  static var options = new LzInheritedHash(LzMiniNode.options);
+  static var __LZdelayedSetters:* = new 
LzInheritedHash(LzMiniNode.__LZdelayedSetters);
+  static var earlySetters:* = new LzInheritedHash(LzMiniNode.earlySetters);
+
+  // These setters are defined in LzDataElementMizin
+  LzDataElement.setters.attributes = "setAttrs";
+  LzDataElement.setters.childNodes = "setChildNodes";
+  LzDataElement.setters.nodeName   = "setNodeName";
+
+  // These setters are defined in LzDataNodeMizin
+  LzDataElement.setters.ownerDocument = "setOwnerDocument";
+
     // N.B.: LzDataElement is not an LzNode so has a different
     // initialize signature.
     function LzDataElement ( name , attributes = null, children = null ) {
-            super();
+            super(name, attributes, children);
             this.nodeName = name;
-            this.nodeType = LzDataNode.ELEMENT_NODE
+            this.nodeType = LzDataNode.ELEMENT_NODE;
             this.attributes = attributes;
             this.ownerDocument = this;
             if (children == null) {

Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataNode.js
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataNode.js     
2008-03-13 14:22:51 UTC (rev 8246)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataNode.js     
2008-03-13 14:47:26 UTC (rev 8247)
@@ -177,7 +177,7 @@
   * @param LzDataNode ownerDoc: The LzDataNode to act as the ownerDocument for
   * this node.
   */
-function setOwnerDocument ( ownerDoc ){
+function setOwnerDocument ( ownerDoc, val=null ){
     this.ownerDocument = ownerDoc;
     if (this.childNodes) {
         for ( var i = 0; i < this.childNodes.length; i++ ){

Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataProvider.js
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataProvider.js 
2008-03-13 14:22:51 UTC (rev 8246)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataProvider.js 
2008-03-13 14:47:26 UTC (rev 8247)
@@ -37,3 +37,5 @@
     }  
 
 }
+
+ConstructorMap[LzDataProvider.tagname] = LzDataProvider;

Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataRequest.js
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataRequest.js  
2008-03-13 14:22:51 UTC (rev 8246)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataRequest.js  
2008-03-13 14:47:26 UTC (rev 8247)
@@ -52,3 +52,5 @@
     }  
 
 }
+
+ConstructorMap[LzDataRequest.tagname] = LzDataRequest;

Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataText.js
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataText.js     
2008-03-13 14:22:51 UTC (rev 8246)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataText.js     
2008-03-13 14:47:26 UTC (rev 8247)
@@ -25,6 +25,9 @@
 static var __LZdelayedSetters:* = new 
LzInheritedHash(LzMiniNode.__LZdelayedSetters);
 static var earlySetters:* = new LzInheritedHash(LzMiniNode.earlySetters);
 
+// These setters are defined in LzDataNodeMizin
+LzDataText.setters.ownerDocument = "setOwnerDocument";
+
 var ondata = LzDeclaredEvent;
 
 /**
@@ -97,9 +100,15 @@
   * @access private
   */
 function serialize (){
-    return LzDataNode.__LZXMLescape( this.data );
+    return this.serializeInternal();
+
 }
 
+function serializeInternal (len=null) {
+  return LzDataNode.__LZXMLescape( this.data );
+}
+
+
 /**
   * @access private
   */

Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDatapath.js
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDatapath.js     
2008-03-13 14:22:51 UTC (rev 8246)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDatapath.js     
2008-03-13 14:47:26 UTC (rev 8247)
@@ -159,9 +159,13 @@
   */
 function LzDatapath ( v , args:* = null, children:* = null, instcall:* = null 
){
     super(v, args, children, instcall);
+}
 
+override function construct ( v , args ) {
     this.rerunxpath = true; // Defined in LzDatapointer
 
+    super.construct.apply(this, arguments);
+
     // construct this to prevent undefined property error
     if ( ! ('data' in this.immediateparent) ){
         this.immediateparent.data = null;
@@ -175,11 +179,12 @@
         this.immediateparent.datapath = this;
         var pdp = null;
         var tarr = null;
-        if ('searchParents' in this.immediateparent) {
+//PBR DEBUG. Removed 
+//        if ('searchParents' in this.immediateparent) {
             pdp = this.immediateparent.searchParents( "datapath" ).datapath;
 
             tarr = pdp.__LZdepChildren;
-        }
+//        }
 
         //set it early, so that it's right when xpath first runs
         if ( tarr != null ){
@@ -188,7 +193,9 @@
             for ( var i =  tarr.length - 1 ; i >= 0 ; i-- ){
                 var c = tarr[ i ];
                 if ( c != this &&
-                    !c.$pathbinding &&
+                      !(c is LzDataAttrBind) &&
+//PBR TODO Changed check because swf9 doesn't like it
+//                    !c.$pathbinding &&
                     c.immediateparent != this.immediateparent &&
                     c.immediateparent.childOf( this.immediateparent )){
                     c.setDataContext( this ,true );
@@ -200,12 +207,6 @@
             }
         }
     }
-//PBR DEBUG
-if ($swf9) {
-} else {
-  Debug.write("LzDatapath ctor", this, v, args, children, instcall, "immediate 
parent:", this.immediateparent);
-  Debug.write("LzDatapath setters", LzDatapath.setters, LzDatapointer.setters);
-}
 
 }
 
@@ -320,15 +321,13 @@
   * @access private
   */
 function __LZApplyData( force = null) {
-
     var ip = this.immediateparent;
 
     if ( this.datacontrolsvisibility ){
         this.immediateparent.__LZvizDat = this.p != null; 
-/* [2008-02-08 pbr] This isn't anywhere in the code
-        if ('__LZupdateShown' in this.immediateparent)
-            this.immediateparent.__LZupdateShown();
-*/
+
+        
+        this.immediateparent.__LZupdateShown();
     }
 
     var cdat = force ||
@@ -338,7 +337,6 @@
     this.data = this.data == null ? null : this.data;
     ip.data = this.data;
 
-
     if ( cdat && ip.ondata.ready){
         ip.ondata.sendEvent( this.data );
     }
@@ -354,7 +352,10 @@
   * @access private
   */
 override function setDataContext ( p , implicit = null ){
-    if ( p == null && this.immediateparent != null && 'searchParents' in 
this.immediateparent){
+// [2008-03-12 pbr] Removed the 'in' test for swf9
+//PBR DEBUG Modified to remove in test
+//    if ( p == null && this.immediateparent != null && 'searchParents' in 
this.immediateparent){
+    if (p == null && this.immediateparent != null) {
         p = this.immediateparent.searchParents( "datapath" ).datapath;
         implicit = true;
     }
@@ -396,7 +397,9 @@
     this.__LZupdateLocked = true; //so won't set data
 
     if ( this.context && !this.context.__LZdeleted && 
-         this.context.__LZdepChildren ){
+//PBR         this.context.__LZdepChildren ){
+         this.context is LzDatapath){ // __LZdepChildren is in LzDatapath
+
         //remove self from __LZdepChildren
         var dca = this.context.__LZdepChildren;
 
@@ -458,7 +461,6 @@
   *
   */
 function updateData( ){
-
     if ( !arguments[ 0 ] && this.p){
         this.p.__LZlockFromUpdate( this );
     }
@@ -597,7 +599,7 @@
 /**
   * @access private
   */
-function __LZsetCloneManager( m ) {
+function __LZsetCloneManager( m, value=null ) {
     this.__LZisclone = true;
     this.immediateparent.cloneManager = m;
     this.parsedPath = m.parsedPath;
@@ -706,3 +708,4 @@
 
 } // End of LzDatapth
 
+ConstructorMap[LzDatapath.tagname] = LzDatapath;

Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDatapointer.js
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDatapointer.js  
2008-03-13 14:22:51 UTC (rev 8246)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDatapointer.js  
2008-03-13 14:47:26 UTC (rev 8247)
@@ -371,16 +371,12 @@
   * matched, <code>undefined</code> if the path is invalid.
   */
 function setXPath ( p, val = null ){ 
-  //PBR Debug
-  trace ("LzDatapointer.setXPath " + p);
     var hasxpath = p;
     if (! hasxpath) {
         this.xpath = null;
         this.parsedPath = null;
         // track if there's an ownerDocument
         if ( this.p ) this.__LZsetTracking( this.p.ownerDocument );
-//PBR DEBUG
-trace ("LzDatapointer.setXPath returning null");
         return;
     }
 
@@ -421,14 +417,15 @@
 
 /** @access private */
 function runXPath ( ){ 
-//PBR DEBUG
-trace("LzDatapointer.runXPath: parsedPath: " + this.parsedPath);
     if ( !this.parsedPath ) {
         return;
     }
 
     var newc = null;
-    if ( this.context && 'getContext' in this.context ){
+
+// [2008-03-12 pbr] Can't use 'in' in swf9
+//    if ( this.context && 'getContext' in this.context ){
+    if ( this.context) {
         newc = this.context.getContext();
     }
 
@@ -440,18 +437,14 @@
 
     if ( !n ){
         //no node found
-  //PBR DEBUG
-  trace("LzDatapointer.runXPath: no nodes");
         this.__LZHandleNoNodes();
         return false;
-    }else if ( n.length ) {
-  //PBR DEBUG
-  trace("LzDatapointer.runXPath: multiple nodes " + n.length);
+// [2008-03-12 pbr] Use 'is' to see if it's an array, not n.length
+//    }else if ( n.length ) {
+    }else if ( n is Array ) {
         this.__LZHandleMultiNodes( n );
         return false;
     } else {
-  //PBR DEBUG
-  trace("LzDatapointer.runXPath: single node");
         this.__LZHandleSingleNode( n );
         return true;
     }
@@ -584,7 +577,6 @@
         return false;
     }
 
-
     if ( this.__LZdchanged) {
         if (this.ondata.ready) this.ondata.sendEvent( this.data );
         this.__LZdchanged = false;
@@ -697,6 +689,7 @@
 
       var cp = pathobj.selectors[ i ];
       var specialop = this.pathSymbols [ cp ];
+
       var posnext = pathobj.selectors[ i+1 ];
       if ( posnext && posnext.pred == "range" ){
         //next is range operator
@@ -709,7 +702,7 @@
 
       np = null;
 
-      if ( null != cp.pred ){
+      if ( 'pred' in cp && null != cp.pred ){
         if ( cp.pred == "hasattr" ){
           p = p.hasAttr( cp.attr ) ? p : false;
         } else if ( cp.pred == "attrval" ){
@@ -787,9 +780,6 @@
     }
   }
 
-  //PBR DEBUG
-  trace ("LzDatapointer.__LZgetNodes: " + p);
-
   return p;
 }
 
@@ -1277,9 +1267,12 @@
     }
 
     var val = p;
+    // TODO: [2008-3-12 pbr] Verify this works in swf9 for all cases
+    //  I found that val can be an LzDataElement or a hash (from LzDataElement)
     for (var i = 0; i < parts.length; i++) {
         var pathElt = parts[i];
-        if (val == null || !(pathElt in val)) {
+//        if (val == null || !(pathElt in val)) {
+        if (val == null || (!(val is LzDataElement) && !(pathElt in val))) {
             // TODO: [2007-3-16 hqm] I'll do what Ben did, return undefined
             return;
         } else {
@@ -1364,8 +1357,6 @@
 
 /** @access private */
 function setDataContext ( dc, implicit = null ){
-//PBR DEBUG
-trace("LzDatapointer.setDataContext: " + dc);
     if ( dc == null ){
         this.context = this;
         if (this.p) {
@@ -1583,3 +1574,5 @@
 }
 
 } // End of LzDatapointer
+
+ConstructorMap[LzDatapointer.tagname] = LzDatapointer;

Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataset.js
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataset.js      
2008-03-13 14:22:51 UTC (rev 8246)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataset.js      
2008-03-13 14:47:26 UTC (rev 8247)
@@ -101,12 +101,22 @@
   static var earlySetters:* = new LzInheritedHash(LFCNode.earlySetters);
 
   LzDataset.setters.querytype = "setQueryType";
-  LzDataset.setters.data = "setDSData";
+  LzDataset.setters.data = "setData";
   LzDataset.setters.src = "setSrc";
   LzDataset.setters.autorequest = "setAutorequest";
   LzDataset.setters.request = "setRequest";
   LzDataset.setters.initialdata = "setInitialData";
 
+  // These setters are defined in LzDataElementMizin
+  LzDataset.setters.attributes = "setAttrs";
+  LzDataset.setters.childNodes = "setChildNodes";
+  LzDataset.setters.nodeName   = "setNodeName";
+
+  // These setters are defined in LzDataNodeMizin
+  LzDataset.setters.ownerDocument = "setOwnerDocument";
+
+
+
 /** @access private
   * @modifiers override 
   */
@@ -208,6 +218,12 @@
 //setters.src = "setSrc";
 
 
+/** The type of request to make, typically null or 'http'
+  * @type String
+  */
+// Necessary for sef9 to prevent addProperty from failing
+var type = null;
+
 /** @access private */
 //setters.autorequest = "setAutorequest";
 
@@ -232,10 +248,12 @@
 
     function LzDataset ( parent:* = null, args:* = null, children:* = null, 
instcall:*  = null) {
         super(parent,args,children,instcall);
+    }
 
+override function construct ( v , args ) {
+
     this.nodeType = LzDataNode.DOCUMENT_NODE;
     this.queuerequests = false; // default to false, to emulate browser default
-
     this.oncanvas = parent == canvas || parent == null;
 
     if (this._instanceAttrs['name'] == null) {
@@ -275,6 +293,7 @@
     }
 
     //support "name is global identifier on canvas" behavior
+
     if ( this.oncanvas ){
         if ($debug) {
           if (global[name] && global[name] !== this) {
@@ -384,8 +403,7 @@
   * @param headers optional HTTP response headers
   * @access private
   */
-// [2008-02-08 pbr] Name collision with LzNode.setData. Changed to setDSData
-function setDSData( data , headers = null ) {
+override function setData( data , headers = null ) {
     if ( data == null ) return;
     if (data instanceof Array) {
         this.setChildNodes( data );
@@ -491,13 +509,14 @@
   
   */
 
-function setSrc( src ) {
+function setSrc( src, value=null ) {
     this.src = src;
     if ( this.autorequest ){
         this.doRequest() ;
     }
 }
 
+
 /**
   * Sets whether or not the dataset makes its request directly to the target 
server
   * or via the LPS server proxy.
@@ -522,7 +541,7 @@
   * @param Boolean b: If true, the dataset will make its request when it is 
   * initialized
   */
-function setRequest( b ) {
+function setRequest( b, val=null ) {
     this.request = b;
     if ( ! b ) return;
     if ( !this.isinited ){
@@ -718,7 +737,7 @@
     }
     
     if (datareq.status == LzDataRequest.SUCCESS) {
-        this.setDSData(datareq.xmldata, datareq.responseheaders);
+        this.setData(datareq.xmldata, datareq.responseheaders);
     } else if (datareq.status == LzDataRequest.ERROR) {
         this.gotError(datareq.error);
     } else if (datareq.status == LzDataRequest.TIMEOUT) {
@@ -736,7 +755,7 @@
   * @access private
   * @param b: A boolean value - true to turn on autorequest, false to turn off
   */
-function setAutorequest(b) {
+function setAutorequest(b, val=null) {
     this.autorequest = b;
 }
 
@@ -793,7 +812,7 @@
   * as the raw request body (unencoded).  Use of "lzpostbody" with a request
   * that has more than one request parameter is undefined.
   */
-function setQueryType( reqtype ) {
+function setQueryType( reqtype, value=null ) {
     this.querytype = ( reqtype.toUpperCase() );
 }
 
@@ -840,7 +859,7 @@
     if (d != null) {
         var e = LzDataNode.stringToLzData(d, this.trimwhitespace, 
this.nsprefix);
         if (e != null)
-            this.setDSData(e.childNodes);
+            this.setData(e.childNodes);
     }
 }
 
@@ -913,3 +932,5 @@
   * @access private
   */
 var LzHttpDatasetPool = new __LzHttpDatasetPoolClass;
+
+ConstructorMap[LzDataset.tagname] = LzDataset;

Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzHTTPDatasource.js
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzHTTPDatasource.js       
2008-03-13 14:22:51 UTC (rev 8246)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzHTTPDatasource.js       
2008-03-13 14:47:26 UTC (rev 8247)
@@ -223,5 +223,4 @@
 } // End of LzHTTPDatasource
 
 // Install backwards-compatible alias in tag map
-ConstructorMap.httpdatasource = LzHTTPDatasource;
-
+ConstructorMap[LzHTTPDatasource.tagname] = LzHTTPDatasource;

Modified: 
openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzLazyReplicationManager.js
===================================================================
--- 
openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzLazyReplicationManager.js   
    2008-03-13 14:22:51 UTC (rev 8246)
+++ 
openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzLazyReplicationManager.js   
    2008-03-13 14:47:26 UTC (rev 8247)
@@ -76,7 +76,9 @@
   */
 function LzLazyReplicationManager ( odp , args, children:* = null, instcall:* 
= null ){
     super(odp, args, children, instcall);
+}
 
+override function construct ( odp , args ){
     //replication argument needs to control pooling
     this.pooling = true; // Defined in LzReplicationManager
 
@@ -94,6 +96,7 @@
 
     this.sizeAxis = this.axis == "x" ? "width" : "height" ;
 
+    super.construct.apply(this, arguments);
 
     this.mask = odp.immediateparent.immediateparent.mask;
 

Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzMiniNode.js
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzMiniNode.js     
2008-03-13 14:22:51 UTC (rev 8246)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzMiniNode.js     
2008-03-13 14:47:26 UTC (rev 8247)
@@ -27,14 +27,66 @@
   static var __LZdelayedSetters:* = new LzInheritedHash({ });
   static var earlySetters:* = new LzInheritedHash({ });
 
-  var setAttribute = LzNode.prototype.setAttribute;
+//TODO See copied method below
+//  var setAttribute = LzNode.prototype.setAttribute;
+
   var children:Array = [];
+  var __LZdeleted:Boolean = false;
+  var sel; // Also defined in LzDatapath
 
+  var setters:*;
+  var getters:*;
+  var defaultattrs:*;
+  var options:*;
+  var __LZdelayedSetters:*;
+  var earlySetters:*;
 
-  function LzMiniNode ( parent:* = null, attrs:* = null, children:* = null, 
instcall:*  = null){}
 
+  // swf9 initialization adapted from LzNode.js
+  function LzMiniNode ( parent:* = null, attrs:* = null, children:* = null, 
instcall:*  = null){
+      this.setters = this['constructor'].setters;
+      this.getters = this['constructor'].getters;
+      this.defaultattrs = this['constructor'].defaultattrs;
+      this.options = this['constructor'].options;
+      this.__LZdelayedSetters = this['constructor'].__LZdelayedSetters;
+      this.earlySetters = this['constructor'].earlySetters;
+  }
+
   function _dbg_name () {}
   function toString () {}
+
+  function __LZupdateShown( ) {}
+
+/**
+  * Sets the named attribute to the given value. If there is no setter for the
+  * property, this[ prop ] is set to the value, and the event this [ "on"+prop 
]
+  * is sent.
+  *
+  * @param String prop: A string naming the key of attribute to set
+  * @param any val: The value for that attribute
+  * @param Boolean ifchanged: If true, only set the attribute if the value 
+  * changed
+  */
+//TODO Copied from LzNode
+function setAttribute(prop, val, ifchanged = null) {
+    if (this.__LZdeleted || (ifchanged && (this[prop] == val))) return;
+
+    var s = this.setters;
+    if (s && (prop in s)) {
+        this[s[prop]](val);
+    } else {
+        if (s == null) {
+            if ($debug) {
+                Debug.warn('null setters on', this, prop, val);
+            }
+        }
+        this[ prop ] = val;
+        var evt = ("on" + prop);
+        if (evt in this) {
+            if (this[evt].ready) this[ evt ].sendEvent( val );
+        }
+    }
+
 }
 
-
+}

Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzParam.js
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzParam.js        
2008-03-13 14:22:51 UTC (rev 8246)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzParam.js        
2008-03-13 14:47:26 UTC (rev 8247)
@@ -62,16 +62,14 @@
   */
     function LzParam ( parent:* = null, attrs:* = null, children:* = null, 
instcall:*  = null) {
         super(parent,attrs,children,instcall);
-        this.d = {};
     }  
 
-/*
-function construct ( parent , args ){
+override function construct ( parent , args ){
     super.construct.apply(this, arguments);
     this.d = {};
 }
-*/
 
+
 /**
   * Parse a URL query string, returns an object with key-value pairs
   * @return Object
@@ -327,3 +325,4 @@
 //TODO Check
 //LzParam.prototype.toString = LzParam.prototype.serialize;
 
+ConstructorMap[LzParam.tagname] = LzParam;

Modified: 
openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzReplicationManager.js
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzReplicationManager.js   
2008-03-13 14:22:51 UTC (rev 8246)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzReplicationManager.js   
2008-03-13 14:47:26 UTC (rev 8247)
@@ -147,13 +147,15 @@
 function LzReplicationManager ( odp , args, children:* = null, instcall:* = 
null ){
     //the real parent for this is datapaths view's (immediateparent) parent
     super(odp, args, children, instcall);
+}
 
-//PBR DEBUG
-trace ("LzReplicationManger ctor");
- 
+override function construct ( odp , args ){
     this.__LZtakeDPSlot = false; // Defined in LzDatapath
     this.datacontrolsvisibility = false; // Defined in LzDatapath
 
+    if (this.pooling == null)
+        this.pooling = false; // Defined in LzDatapath
+
     //odp: original datapath
     var view = odp.immediateparent;
     if (view == canvas) {
@@ -181,7 +183,9 @@
     var id =  view._instanceAttrs.id;
     args.id = id;
     // remove any LzNode with this id
-    if (global[id] instanceof LzNode) global[id] = null;
+//PBR DEBUG
+//    if (global[id] instanceof LzNode) global[id] = null;
+    if (global[id] is LzNode) global[id] = null;
 
     //don't want to rerunxpath
     args.xpath = LFCNode._ignoreAttribute;
@@ -206,6 +210,9 @@
     }
         
 
+    //the real parent for this is datapaths view's (immediateparent) parent
+    super.construct( view.parent, args);
+
     if ( view.parent != view.immediateparent ){
         view.immediateparent[ args.name ] = this;
     }
@@ -602,8 +609,6 @@
   * @access private
   */
 function getNewClone ( forceNew = null ){
-//PBR DEBUG
-trace ("LzReplicationManager.getNewClone. cloneParent = " + this.cloneParent);
     if (!this.cloneParent) {
         return null;
     }
@@ -655,8 +660,6 @@
   * @access private
   */
 override function setXPath ( p, val = null ){ 
-    //PBR DEBUG
-    trace ("LzReplicationManager.setXPath " + p);
     if ( this.__LZpreventXPathUpdate ) return;
     super.setXPath.apply(this, arguments); 
 }

Modified: 
openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzResizeReplicationManager.js
===================================================================
--- 
openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzResizeReplicationManager.js 
    2008-03-13 14:22:51 UTC (rev 8246)
+++ 
openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzResizeReplicationManager.js 
    2008-03-13 14:47:26 UTC (rev 8247)
@@ -92,10 +92,12 @@
   */
 function LzResizeReplicationManager ( odp , args, children:* = null, 
instcall:* = null ){
     super(odp, args, children, instcall);
+}
 
+override function construct ( odp , args ){
     this.pooling = false; // Defined in LzReplicationManager
-    //Debug.write( 'making resize repl' );
 
+    super.construct.apply(this, arguments);
     this.datasizevar = '$' + this.getUID() + 'track';
 }
 

Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/kernel/swf9/LzSprite.as
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/kernel/swf9/LzSprite.as        
2008-03-13 14:22:51 UTC (rev 8246)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/kernel/swf9/LzSprite.as        
2008-03-13 14:47:26 UTC (rev 8247)
@@ -554,6 +554,8 @@
           o if recursive is true, the sprite destroys all its children as well 
       */
       public function destroy( ):void {
+       //PBR
+       if (parent)
           parent.removeChild(this);
       }
 
@@ -585,7 +587,8 @@
           o Brings this sprite to the front of its siblings 
       */
       public function bringToFront ():void {
-          if (!this.isroot) {
+//PBR
+          if (!this.isroot && parent) {
               parent.setChildIndex(this, parent.numChildren-1);
           }
       }

Modified: 
openlaszlo/branches/devildog/WEB-INF/lps/lfc/kernel/swf9/LzXMLParser.as
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/kernel/swf9/LzXMLParser.as     
2008-03-13 14:22:51 UTC (rev 8246)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/kernel/swf9/LzXMLParser.as     
2008-03-13 14:47:26 UTC (rev 8247)
@@ -24,7 +24,6 @@
   * @return nativeXMLObject: An XML DOM object native to the runtime platform
   */
 public static function parseXML( str, trimwhitespace, nsprefix ){
-    trace("Asked to parse: '" + str + "'");
     XML.ignoreWhitespace = true;
     var xmlobj:XML = XML(str);
     xmlobj.normalize();

Modified: 
openlaszlo/branches/devildog/WEB-INF/lps/lfc/kernel/swf9/LzXMLTranslator.as
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/kernel/swf9/LzXMLTranslator.as 
2008-03-13 14:22:51 UTC (rev 8246)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/kernel/swf9/LzXMLTranslator.as 
2008-03-13 14:47:26 UTC (rev 8247)
@@ -19,7 +19,7 @@
     if (lfcnode == null) {
         trace('LzXMLTranslator.copyXML: lfcnode.children is null', lfcnode);
     }
-    var fc = lfcnode.children[0];
+    var fc = lfcnode;
     if ( fc is LzDataText ) {
         return null;
     }
@@ -42,7 +42,9 @@
             nv = LzDataNode.trim(nv);
         }
         lfcnode = new LzDataText(nv);
-    } else if (node.nodeKind() == 'element') {
+//PBR Changed to match swf kernel
+//    } else if (node.nodeKind() == 'element') {
+      } else {
         var nattrs = node.attributes();
         var cattrs = {};
         for (var i:int = 0; i < nattrs.length(); i++) {
@@ -50,11 +52,13 @@
             cattrs[key] = nattrs[i];
         }
 
-        var nname;
-        if (nsprefix) {
-            var nname = node.name();
-        } else {
-            nname = node.localName();
+        var nname = node.localName();
+        if (nname && !nsprefix) {
+            // strip namespace prefix
+            var npos = nname.indexOf(':');
+            if (npos >= 0) {
+                nname = nname.substring(npos+1);
+            }
         }
 
         lfcnode = new LzDataElement(nname, cattrs);

Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/views/LaszloView.js
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/views/LaszloView.js    
2008-03-13 14:22:51 UTC (rev 8246)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/views/LaszloView.js    
2008-03-13 14:47:26 UTC (rev 8247)
@@ -1155,7 +1155,7 @@
      * TODO: max : should be made private, api call from replication should be 
cleaner
      * @access private
      */
- function __LZupdateShown( ) {
+override function __LZupdateShown( ) {
      if ( this.visibility == "collapse" ){
          var shown = this.__LZvizO && this.__LZvizDat && this.__LZvizLoad;
      } else {

Added: openlaszlo/branches/devildog/test/swf9/data-1.lzx


Property changes on: openlaszlo/branches/devildog/test/swf9/data-1.lzx
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: openlaszlo/branches/devildog/test/swf9/data-2.lzx


Property changes on: openlaszlo/branches/devildog/test/swf9/data-2.lzx
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: openlaszlo/branches/devildog/test/swf9/data-3.lzx


Property changes on: openlaszlo/branches/devildog/test/swf9/data-3.lzx
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: openlaszlo/branches/devildog/test/swf9/data-4.lzx


Property changes on: openlaszlo/branches/devildog/test/swf9/data-4.lzx
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: openlaszlo/branches/devildog/test/swf9/data-5.lzx


Property changes on: openlaszlo/branches/devildog/test/swf9/data-5.lzx
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: openlaszlo/branches/devildog/test/swf9/data.xml


Property changes on: openlaszlo/branches/devildog/test/swf9/data.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:eol-style
   + native


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

Reply via email to