[Laszlo-checkins] r8193 - in openlaszlo/branches/devildog/WEB-INF/lps/lfc: . core data glue kernel/swf9
pbr@openlaszlo.org
pbr at openlaszlo.org
Thu Mar 6 05:57:40 PST 2008
Author: pbr
Date: 2008-03-06 05:57:35 -0800 (Thu, 06 Mar 2008)
New Revision: 8193
Modified:
openlaszlo/branches/devildog/WEB-INF/lps/lfc/LaszloLibrary.lzs
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/LzDataText.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/LzMiniNode.js
openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzReplicationManager.js
openlaszlo/branches/devildog/WEB-INF/lps/lfc/glue/LaszloInitiator.lzs
openlaszlo/branches/devildog/WEB-INF/lps/lfc/kernel/swf9/LzXMLParser.as
Log:
Change 20080306-Philip-a by Philip at Philip-DC on 2008-03-06 08:48:04 EST
in /cygdrive/f/laszlo/svn/src/svn/openlaszlo/branches/devildog
for http://svn.openlaszlo.org/openlaszlo/branches/devildog
Summary: Convert swf9 data classes to use mixin
New Features:
Bugs Fixed:
Technical Reviewer: (pending)
QA Reviewer: (pending)
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details:
Removed the manually created interstitial classes. Includes some changes to get data classes to build/run.
LzMiniNode.js Added empty methods, variables to match LzNode LzDataText.js LzDataText extends LzMiniNode with LzDataNodeMixin
LzDatNode.js Define LzDataNodeMixin. LzDataNode contains the static
definitions.
LzReplicationManager.js trace() statements added for debugging.
LzDatapointer.js setter functions needed a second argument. Added
trace() statements for debugging. Comment out dependency methods.
LzDataElement.js Define LzDataElementMixin. LzDataElement extends LzMiniNode with LzDataElementMixin, LzDataNodeMixin LzDataset.js LzDataset extends LFCNode with LzDataElementMixin, LzDataNodeMixin
Tests:
Files:
M WEB-INF/lps/lfc/kernel/swf9/LzXMLParser.as
M WEB-INF/lps/lfc/core/LzNode.js
M WEB-INF/lps/lfc/glue/LaszloInitiator.lzs
M WEB-INF/lps/lfc/LaszloLibrary.lzs
M WEB-INF/lps/lfc/data/LzDataText.js
M WEB-INF/lps/lfc/data/LzDataNode.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/LzDataElement.js
M WEB-INF/lps/lfc/data/LzDataset.js
Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20080306-Philip-a.tar
Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/LaszloLibrary.lzs
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/LaszloLibrary.lzs 2008-03-06 13:50:02 UTC (rev 8192)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/LaszloLibrary.lzs 2008-03-06 13:57:35 UTC (rev 8193)
@@ -27,7 +27,7 @@
#include "helpers/Library.lzs"
#include "data/Library.lzs"
#include "services/Library.lzs"
- //#include "glue/Library.lzs"
+#include "glue/Library.lzs"
Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/core/LzNode.js
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/core/LzNode.js 2008-03-06 13:50:02 UTC (rev 8192)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/core/LzNode.js 2008-03-06 13:57:35 UTC (rev 8193)
@@ -65,7 +65,7 @@
* @param Boolean instcall
* @access private
*/
- function LFCNode ( parent:* , attrs:* , children:* = null, instcall:* = null){
+ function LFCNode ( parent:* = null, attrs:* = null, children:* = null, instcall:* = null){
this.setters = this['constructor'].setters;
this.getters = this['constructor'].getters;
this.defaultattrs = this['constructor'].defaultattrs;
Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataElement.js
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataElement.js 2008-03-06 13:50:02 UTC (rev 8192)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataElement.js 2008-03-06 13:57:35 UTC (rev 8193)
@@ -7,7 +7,536 @@
* @subtopic Data
*/
+mixin LzDataElementMixin {
+
+public function LzDataElementMixin ( parent:* = null, attrs:* = null, children:* = null, instcall:* = null) {
+ super(parent,attrs,children,instcall);
+}
+
+/** @lzxtype event */
+var onDocumentChange = LzDeclaredEvent;
+/** @lzxtype event */
+var onparentNode = LzDeclaredEvent;
+/** @lzxtype event */
+var onchildNode = LzDeclaredEvent;
+/** @lzxtype event */
+var onchildNodes = LzDeclaredEvent;
+/** @lzxtype event */
+var onattributes = LzDeclaredEvent;
+/** @lzxtype event */
+var onnodeName = LzDeclaredEvent;
+
+/** @access private */
+var __LZchangeQ = null;
+/** @access private */
+var __LZlocker = null;
+
+/** The name of this node.
+ * @type String
+ */
+var nodeName:* = null;
+
+/** The dictionary of attributes for this node.
+ * @type Object
+ */
+var attributes:* = null;
+
+/** Inserts the given LzDataNode before another node in this node's childNodes
+ * @param LzDataNode newChild: the LzDataNode to insert
+ * @param LzDataNode refChild: the LzDataNode to insert newChild before
+ * @return LzDataElement: The new child, or null if the refChild wasn't found
+ */
+function insertBefore (newChild, refChild){
+ this.__LZcoDirty = true;
+
+ for ( var i = 0; i < this.childNodes.length; i++ ){
+ if ( this.childNodes[ i ] == refChild ){
+ this.childNodes.splice( i , 0 , newChild );
+ newChild.setOwnerDocument( this.ownerDocument );
+
+ newChild.parentNode = this;
+ if (newChild.onparentNode.ready) newChild.onparentNode.sendEvent( this );
+ if (this.onchildNodes.ready) this.onchildNodes.sendEvent( newChild );
+ this.ownerDocument.handleDocumentChange( "insertBefore" ,
+ this, 0 );
+ return newChild;
+ }
+ }
+
+ //raise exception
+ return null;
+}
+
+
/**
+ * Replaces a given LzDataNode in this node's childNodes with a new one.
+ * @param LzDataNode newChild: the LzDataNode to add
+ * @param LzDataNode oldChild: the LzDataNode to be replaced by the newChild
+ * @return LzDataElement: The new child, or null if the oldChild wasn't found
+ */
+function replaceChild (newChild, oldChild){
+
+ this.__LZcoDirty = true;
+ for ( var i = 0; i < this.childNodes.length; i++ ){
+ if ( this.childNodes[ i ] == oldChild ){
+ this.childNodes[ i ] = newChild;
+
+ newChild.setOwnerDocument( this.ownerDocument );
+
+ newChild.parentNode = this;
+ if (newChild.onparentNode.ready) newChild.onparentNode.sendEvent( this );
+ if (this.onchildNodes.ready) this.onchildNodes.sendEvent( newChild );
+ this.ownerDocument.handleDocumentChange( "childNodes" , this , 0, newChild );
+ return newChild;
+ }
+ }
+ //raise exception
+ return null;
+}
+
+/**
+ * Removes a given node from this node's childNodes
+ * @param LzDataNode oldChild: The LzDataNode to remove
+ * @return LzDataNode: The removed child, or null if the oldChild was not found
+ */
+function removeChild (oldChild){
+ var reval = null;
+ this.__LZcoDirty = true;
+ for ( var i = 0; i < this.childNodes.length; i++ ){
+ if ( this.childNodes[ i ] == oldChild ){
+ this.childNodes.splice( i , 1 );
+ if (this.onchildNodes.ready) this.onchildNodes.sendEvent( oldChild );
+ reval = oldChild;
+ this.ownerDocument.handleDocumentChange("removeChild", this, 0, oldChild);
+ }
+ }
+ //raise exception if not found
+ return reval;
+}
+
+/**
+ * Adds a child to this node's list of childNodes
+ * @param LzDataNode newChild: The LzDataNode to add.
+ * @return LzDataNode: The newChild.
+ */
+function appendChild (newChild){
+ if ( this.childNodes ){
+ this.childNodes.push( newChild );
+ } else {
+ this.childNodes = [ newChild ];
+ }
+
+ newChild.setOwnerDocument( this.ownerDocument );
+
+ newChild.parentNode = this;
+ if (newChild.onparentNode.ready) newChild.onparentNode.sendEvent( this );
+
+ //instead of marking dirty, this is easy
+ newChild.__LZo = this.childNodes.length -1;
+
+ if (this.onchildNodes.ready) this.onchildNodes.sendEvent( newChild );
+ this.ownerDocument.handleDocumentChange( "appendChild" , this , 0, newChild );
+ return newChild;
+}
+
+/**
+ * Tests whether or not this node has child nodes.
+ * @return Boolean: If true, this node has child nodes.
+ */
+function hasChildNodes (){
+ return this.childNodes.length > 0;
+}
+
+/**
+ * Returns a copy of this node.
+ * @param Boolean deep: If true, the children of this node will be part of the
+ * new node
+ * @return LzDataNode: A copy of this node.
+ */
+function cloneNode ( deep ){
+ var n = new LzDataElement(this.nodeName);
+ n.setAttrs( this.attributes );
+ if ( deep ){
+ for ( var i = 0 ; i < this.childNodes.length; i++ ){
+ n.appendChild ( this.childNodes[ i ].cloneNode( true ) );
+ }
+ }
+
+ return n;
+}
+
+/**
+ * Returns the value for the give attribute
+ * @param String name: The name of the attribute whose value to return
+ * @return String: The value for the given attribute
+ */
+function getAttr (name){
+ if (this.attributes) return this.attributes[ name ];
+}
+
+/**
+ * @access private
+ */
+/*
+prototype.getAttr.dependencies = function (who , self){
+ return [ self, 'attributes' ];
+}
+*/
+
+/**
+ * Sets the given attribute to the given value
+ * @param String name: The name of the attribute to set.
+ * @param String value: The value for the attribute.
+ */
+function setAttr (name, value){
+ if ( ! this.attributes ) {
+ this.attributes = {};
+ }
+ this.attributes[ name ] = value;
+ if (this.onattributes.ready) this.onattributes.sendEvent( name );
+ this.ownerDocument.handleDocumentChange( "attributes" , this , 1, {name: name, value: value, type: 'set'});
+ return value;
+}
+
+/**
+ * Removes the named attribute
+ * @param String name: The name of the attribute to remove.
+ */
+function removeAttr (name){
+ var v = this.attributes[ name ];
+ delete this.attributes[ name ];
+ if (this.onattributes.ready) this.onattributes.sendEvent( name );
+ this.ownerDocument.handleDocumentChange( "attributes" , this , 1, {name: name, value: v, type: 'remove'});
+ return v;
+}
+
+/**
+ *This method returns a Attr object.
+ *The name parameter is of type String.
+ */
+//function getAttributeNode (name){
+//}
+
+/**
+ *This method returns a Attr object.
+ *The newAttr parameter is a Attr object.
+ */
+//function setAttrNode (newAttr){
+//}
+
+/**
+ * Tests whether or not this node has a given attribute.
+ * @param String name: The name of the attribute to test
+ * @return Boolean: If true, the named attribute is present.
+ */
+function hasAttr (name){
+ return this.attributes[ name ] != null;
+}
+
+/**
+ * Returns the first child of this node.
+ * @return LzDataNode: The first child of this node
+ */
+function getFirstChild (){
+ return this.childNodes[ 0 ];
+}
+/**
+ * @access private
+ */
+/*
+prototype.getFirstChild.dependencies = function( who, self ){
+ return [ this , "childNodes" ];
+}
+*/
+
+/**
+ * Returns the last child of this node.
+ * @return LzDataNode: The last child of this node
+ */
+function getLastChild (){
+ return this.childNodes[ this.childNodes.length-1 ];
+}
+/**
+ * @access private
+ */
+/*
+prototype.getLastChild.dependencies = function( who, self ){
+ return [ this , "childNodes" ];
+}
+*/
+
+
+
+/**
+ * @access private
+ */
+/*
+prototype.hasAttr.dependencies = function (who , self){
+ return [ self, 'attributes' ];
+}
+*/
+
+/**
+ * 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 ){
+ var a = {};
+ for ( var k in attrs ){ a[ k ] = attrs[ k ]; }
+
+ this.attributes = a;
+ if (this.onattributes.ready) this.onattributes.sendEvent( a);
+ if (this.ownerDocument) {
+ this.ownerDocument.handleDocumentChange( "attributes" , this , 1);
+ }
+}
+
+/**
+ * Sets the children of this node to the given array.
+ * @param [LzDataNode] children: An array of LzDataNodes to be the new children
+ * of this node
+ */
+function setChildNodes ( children ){
+ this.childNodes = children;
+ for ( var i = 0; i < children.length; i++ ){
+ var c = children[ i ];
+ if (c) {
+ c.setOwnerDocument( this.ownerDocument );
+ c.parentNode = this;
+ if (c.onparentNode) {
+ if (c.onparentNode.ready) c.onparentNode.sendEvent( this );
+ }
+ c.__LZo = i;
+ }
+ }
+ this.__LZcoDirty = false;
+ if (this.onchildNodes) {
+ if (this.onchildNodes.ready) this.onchildNodes.sendEvent( children );
+ }
+ this.ownerDocument.handleDocumentChange( "childNodes" , this , 0);
+}
+
+/**
+ * Sets the name of this node.
+ * @param String name: The new name for this node
+ */
+function setNodeName ( name ){
+ //Debug.write('setting node name from "',this.nodeName, '" to "', name, '"');
+ this.nodeName = name;
+ //since this can affect xpaths, send onchildNodes event
+ if (this.onnodeName.ready) this.onnodeName.sendEvent( name );
+ if (this.parentNode) {
+ if (this.parentNode.onchildNodes.ready) this.parentNode.onchildNodes.sendEvent( this );
+ if (this.parentNode.onchildNode.ready) this.parentNode.onchildNode.sendEvent( this );
+ }
+ this.ownerDocument.handleDocumentChange( "childNodeName" ,
+ this.parentNode , 0 );
+ this.ownerDocument.handleDocumentChange( "nodeName" , this, 1 );
+}
+
+/**
+ * @access private
+ */
+function __LZgetText ( ){
+ var s= "";
+ for ( var i = 0; i < this.childNodes.length; i++ ){
+ var c = this.childNodes[ i ]
+ if ( c.nodeType == LzDataNode.TEXT_NODE ){
+ s += c.data;
+ }
+ }
+ return s;
+}
+
+/**
+ * Returns a list of the childNodes of this node which have a given name
+ * @param String name: The name of the node to look for.
+ * @return [LzDataNode]: A list of childNodes which have the given name.
+ */
+function getElementsByTagName (name) {
+ var r = [];
+ for ( var i = 0; i < this.childNodes.length; i++ ){
+ if ( this.childNodes[i].nodeName == name ){
+ r.push( this.childNodes[ i ] );
+ }
+ }
+ return r;
+}
+
+/*
+//This method returns a Attr object.
+//The oldAttr parameter is a Attr object.
+//This method can raise a DOMException object.
+// function removeAttributeNode (oldAttr) {
+}
+//This method returns a String.
+//The namespaceURI parameter is of type String.
+//The localName parameter is of type String.
+// function getAttributeNS (namespaceURI, localName) {
+}
+//This method has no return value.
+//The namespaceURI parameter is of type String.
+//The qualifiedName parameter is of type String.
+//The value parameter is of type String.
+//This method can raise a DOMException object.
+// function setAttrNS (namespaceURI, qualifiedName,
+ value) {
+}
+//This method has no return value.
+//The namespaceURI parameter is of type String.
+//The localName parameter is of type String.
+//This method can raise a DOMException object.
+// function removeAttributeNS (namespaceURI, localName) {
+}
+//This method returns a Attr object.
+//The namespaceURI parameter is of type String.
+//The localName parameter is of type String.
+// function getAttributeNodeNS (namespaceURI, localName) {
+}
+//This method returns a Attr object.
+//The newAttr parameter is a Attr object.
+//This method can raise a DOMException object.
+// function setAttrNodeNS (newAttr) {
+}
+//This method returns a NodeList object.
+//The namespaceURI parameter is of type String.
+//The localName parameter is of type String.
+// function getElementsByTagNameNS (namespaceURI, localName) {
+}
+//This method returns a Boolean.
+//The namespaceURI parameter is of type String.
+//The localName parameter is of type String.
+// function hasAttrNS (namespaceURI, localName) {
+}
+*/
+
+var __LZlt = "<";
+var __LZgt = ">";
+
+
+/**
+ * Returns this node as a string of xml.
+ * @return String: The string serialization of this node.
+ */
+function serialize (){
+ return this.serializeInternal(Infinity);
+}
+
+/**
+ * Implementation of serialize with option to limit string length
+ * @access private
+ */
+function serializeInternal (len) {
+ if (arguments.length < 1) {
+ len = Infinity;
+ }
+ var s = this.__LZlt + this.nodeName;
+
+ //Debug.info('k', this.attributes);
+ for ( var k in this.attributes ){
+ s += " " + k + '="' + LzDataNode.__LZXMLescape( this.attributes[ k ] ) + '"';
+ if (s.length > len) { break; }
+ }
+
+ 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);
+ if (s.length > len) { break; }
+ }
+ s += this.__LZlt + "/" + this.nodeName + this.__LZgt;
+ } else {
+ s += "/" + this.__LZgt;
+ }
+ if (s.length > len) { s = LzDataElement.abbreviate(s, len); }
+ return s;
+}
+
+/**
+ * For debugging. Same as serialize, but will abbreviate at printLength.
+ * @access private
+ */
+override function _dbg_name () {
+ return this.serializeInternal(LzDataElement.printLength);
+}
+
+/**
+ * Nodes call this method on their ownerDocument whenever they change in any
+ * way. This method sends the onDocumentChange event, which triggers
+ * datapointer updates
+ * @param String what: A description of what changed.
+ * @param LzDataNode who: The node that changed.
+ * @param Number type: private
+ */
+function handleDocumentChange ( what , who , type, cobj=null ){
+ var o = { who: who , what: what , type : type};
+ if (cobj) o.cobj = cobj;
+ if ( this.__LZchangeQ ){
+ this.__LZchangeQ.push ( o );
+ } else {
+ if (this.onDocumentChange.ready) this.onDocumentChange.sendEvent( o );
+ }
+}
+
+/**
+ * @access private
+ */
+override function toString (){
+ //this.__LZlt = "<";
+ //this.__LZgt = ">";
+ var r = this.serialize();
+ //delete this.__LZlt;
+ //delete this.__LZgt;
+ return r;
+}
+
+/**
+ * @access private
+ */
+function __LZdoLock ( locker ){
+ if ( !this.__LZchangeQ ){
+ this.__LZchangeQ = [];
+ this.__LZlocker = locker;
+ }
+}
+
+
+/**
+ * @access private
+ */
+function __LZdoUnlock ( locker ){
+
+ if ( this.__LZlocker != locker ){
+ return;
+ }
+
+ var lzq = this.__LZchangeQ;
+ this.__LZchangeQ = null;
+
+ if (lzq != null) {
+ for ( var i = 0; i < lzq.length; i++ ){
+ var sendit = true;
+ var tc = lzq[ i ];
+ for ( var j = 0; j < i; j++ ){
+ var oc = lzq[ j ];
+ if ( tc.who == oc.who &&
+ tc.what == oc.what &&
+ tc.type == oc.type ){
+ sendit = false;
+ break;
+ }
+ }
+
+ if ( sendit ){
+ this.handleDocumentChange ( tc.what, tc.who, tc.type );
+ }
+ }
+ }
+}
+
+} // End of LzDataElementMixin
+
+/**
* <p>
* An LzDataElement represents a node a in a hierarchical dataset. An LzDataElement can contain other LzDataElements, or <classname>LzDataText</classname>, which represents a text node. See the example on <classname>LzDataNode</classname>.
* </p>
@@ -16,11 +545,12 @@
* @see LzDataNode LzDataText LzDataPointer
* @access public
*/
-class LzDataElement extends LzMiniNode_DataNode_DOM {
+class LzDataElement extends LzMiniNode with LzDataElementMixin, LzDataNodeMixin
+{
// N.B.: LzDataElement is not an LzNode so has a different
// initialize signature.
function LzDataElement ( name , attributes = null, children = null ) {
- super(name, attributes, children);
+ super();
this.nodeName = name;
this.nodeType = LzDataNode.ELEMENT_NODE
this.attributes = attributes;
@@ -46,8 +576,68 @@
return a;
}
+//TODO Used instead of Debug.abbreviate. You can remove this when Debug is
+// moved to swf9
+static var printLength = 1024;
+static function abbreviate (s, l) {
+ var ellipsis = '...'; // '\u2026' doesn't work, wah.
+ if (s.length > (l - ellipsis.length)) {
+ s = s.substring(0, l - ellipsis.length) + ellipsis;
+ }
+ return s;
+}
+
+/**
+ * Get LzDataElement representation of primitive type, array, or object value.
+ */
static function valueToElement ( o ) {
- return LzMiniNode_DataNode_DOM.prototype.valueToElement(o);
+ var n = new LzDataElement("element", { }, LzDataElement.__LZv2E(o));
+ return n;
}
+/**
+ * @param Type o: primitive type, array, or object value.
+ * @return array of LzDataElements
+ * @access private
+ */
+static function __LZv2E ( o ) {
+
+ var type = typeof( o );
+ type.toLowerCase();
+
+ var c = [];
+ if (type == "object") {
+ if ( o instanceof LzDataElement ||
+ o instanceof LzDataText ) {
+ c[0] = o;
+ } else if (o instanceof Date) {
+
+ type = "date";
+ // FIXME: [2004-04-10 pkang] what should we do with dates?
+
+ } else if (o instanceof Array) {
+ type = "array";
+ var tag = (o.__LZtag != null ? o.__LZtag : 'item');
+ for (var i=0; i < o.length; i++) {
+ var tmpC = LzDataElement.__LZv2E( o[i] );
+ c[i] = new LzDataElement(tag, null, tmpC );
+ }
+ } else {
+ type = "struct";
+ var i = 0;
+ for (var k in o) {
+ // skip any properties that start with __LZ
+ if (k.indexOf('__LZ') == 0) continue;
+ c[i++] = new LzDataElement(k, null, LzDataElement.__LZv2E(o[k]));
+ }
+ }
+ } else if (o != null) {
+ c[0] = new LzDataText( o );
+ }
+
+ if (c.length == 0) c = null;
+
+ return c;
+}
+
} // End of LzDataElement
Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataNode.js
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataNode.js 2008-03-06 13:50:02 UTC (rev 8192)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataNode.js 2008-03-06 13:57:35 UTC (rev 8193)
@@ -8,8 +8,215 @@
* @subtopic Data
*/
-// Only static methods and variables remain here
+/**
+ * <p><classname>LzDataNode</classname> is the base class for the classes
+ * that represent OpenLaszlo's hierarchical data format.</p>
+ *
+ * <example>
+ * <canvas width="300" height="300">
+ * <simplelayout axis="y"/>
+ *
+ * <text width="300" height="250" bgcolor="silver"
+ * multiline="true" name="display"/>
+ * <button>Make some data
+ * <attribute name="currentstep" value="0"/>
+ *
+ * <handler name="onclick">
+ * <![CDATA[
+ * switch(currentstep ++){
+ * case 0:
+ * this.n = <em>new LzDataElement('numbers');</em>
+ * setAttribute('text', 'Add some children');
+ * break;
+ * case 1:
+ * for (var i = 1; i < 11 ; i++){
+ * <em>this.n.appendChild(new LzDataElement('number' ,
+ * {value : i}));</em>
+ *
+ * }
+ * setAttribute('text', 'Add linebreaks');
+ * break;
+ * case 2:
+ * var dp = new LzDatapointer();
+ * dp.setPointer(this.n.getFirstChild());
+ * do {
+ * <em>dp.p.parentNode.insertBefore(new LzDataText('\n'),
+ * dp.p);</em>
+ * } while (dp.selectNext())
+ * dp.p.parentNode.appendChild(new LzDataText('\n'));
+ * setAttribute('visible', false);
+ * break;
+ * }
+ * display.setText(display.escapeText(n.serialize()));
+ * ]]>
+ * </handler>
+ * </button>
+ * </canvas>
+ * </example>
+ *
+ * @shortdesc The base class for a node of hierarchical data.
+ * @devnote LzDataNode is the abstract baseclass for LzDataElement and LzDataText.
+ * N.B.: LzDataNode may or may not be an LzNode, so _if_ it were
+ * to have an initialize method, it would have to match
+ * LzNode.initialize's signature.
+ *
+ * @devnote Also N.B.: If this _does_ descend from LzNode and has initial
+ * data, childNodes will have already been set by applyArgs, so
+ * don't set it here!
+ */
+mixin LzDataNodeMixin {
+
+public function LzDataNodeMixin ( parent:* = null, attrs:* = null, children:* = null, instcall:* = null) {
+ super(parent,attrs,children,instcall);
+}
+
+
+/** @lzxtype event */
+var onownerDocument = LzDeclaredEvent;
+
+
+/** The type of this node -- ELEMENT_NODE or TEXT_NODE
+ * @type Number
+ * @keywords abstract
+ */
+//var nodeType:Number; // This is undefined. Set elsewhere
+var nodeType:*;
+var parentNode:* = null;
+//
+var ownerDocument:*;
+var __LZo:*;
+
+/** An array of children of this node
+ * @type LzDataNode
+ */
+var childNodes:* = null;
+
+/** @access private */
+var __LZcoDirty = true;
+
+
+/**
+ * Returns the sibling before this one this node's parentNodes List of children
+ * @return LzDataNode: The node preceeding this one in this node's childNodes
+ */
+function getPreviousSibling (){
+ if (!this.parentNode) return null;
+ if ( this.parentNode.__LZcoDirty ) this.parentNode.__LZupdateCO();
+ return this.parentNode.childNodes[ this.__LZo - 1 ];
+}
+
+/**
+ * Returns the parent of this node
+ * @return LzDataNode: the parent of this node
+ */
+function getParent () {
+ return this.parentNode;
+}
+
+/**
+ * gets offset of node in parent's childNodes array
+ * @return number
+ */
+function getOffset (){
+ if (!this.parentNode) return 0;
+ if (this.parentNode.__LZcoDirty) this.parentNode.__LZupdateCO();
+
+ return this.__LZo;
+}
+
+/**
+ * @access private
+ */
+//TODO
+/*
+prototype.getPreviousSibling.dependencies = function( who, self ){
+ return [ this.parentNode , "childNodes" , this , "parentNode" ];
+}
+*/
+
+/**
+ * Returns the sibling after this one this node's parentNodes List of children
+ * @return LzDataNode: The node succeeding this one in this node's childNodes
+ */
+function getNextSibling (){
+ if (!this.parentNode) return null;
+ if ( this.parentNode.__LZcoDirty ) this.parentNode.__LZupdateCO();
+ return this.parentNode.childNodes[ this.__LZo + 1 ];
+}
+
+/**
+ * @access private
+ */
+//TODO
+/*
+prototype.getNextSibling.dependencies = function( who, self ){
+ return [ this.parentNode , "childNodes" , this , "parentNode" ];
+}
+*/
+
+/**
+ * Tells whether the given node is above this one in the node hierarchy.
+ * @param LzDataElement el: The LzDataElement to test to see if it is above
+ * this one
+ * @param Boolean allowself: If true, this function returns true if the given
+ * node is the same as this node.
+ */
+// Renamed from childOf to avoid conflict with LzNode.childOf
+function childOfNode ( el , allowself ) {
+ var p = allowself ? this : this.parentNode
+ while ( p ){
+ if ( p == el ) return true;
+ p = p.parentNode;
+ }
+ return false;
+}
+
+/**
+ * Sets the LzDataNode which is the ownerDocument for this node.
+ * @param LzDataNode ownerDoc: The LzDataNode to act as the ownerDocument for
+ * this node.
+ */
+function setOwnerDocument ( ownerDoc ){
+ this.ownerDocument = ownerDoc;
+ if (this.childNodes) {
+ for ( var i = 0; i < this.childNodes.length; i++ ){
+ this.childNodes[ i ] .setOwnerDocument( ownerDoc );
+ }
+ }
+
+ if (this.onownerDocument && this.onownerDocument.ready) {
+ this.onownerDocument.sendEvent( ownerDoc );
+ }
+}
+
+/**
+ * @access private
+ */
+function __LZlockFromUpdate ( locker ){
+ this.ownerDocument.__LZdoLock( locker );
+}
+
+/**
+ * @access private
+ */
+function __LZunlockFromUpdate ( locker ){
+ this.ownerDocument.__LZdoUnlock( locker );
+}
+
+
+/**
+ * @access private
+ */
+function __LZupdateCO (){
+ for ( var i = 0; i < this.childNodes.length; i++ ){
+ this.childNodes[ i ].__LZo = i;
+ }
+ this.__LZcoDirty = false;
+}
+} // End of LzDataNodeMixin
+
+
class LzDataNode {
//@problem: how do I document these?
Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataText.js
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataText.js 2008-03-06 13:50:02 UTC (rev 8192)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataText.js 2008-03-06 13:57:35 UTC (rev 8193)
@@ -16,14 +16,14 @@
* @fixme [2006-07-26] (LPP-2412) The Instance reference is required for lzpix
* to run.
*/
-class LzDataText extends LzMiniNode_DataNode {
+class LzDataText extends LzMiniNode with LzDataNodeMixin {
-static var setters = new LzInheritedHash(LzMiniNode_DataNode.setters);
-static var getters = new LzInheritedHash(LzMiniNode_DataNode.getters);
-static var defaultattrs = new LzInheritedHash(LzMiniNode_DataNode.defaultattrs);
-static var options = new LzInheritedHash(LzMiniNode_DataNode.options);
-static var __LZdelayedSetters:* = new LzInheritedHash(LzMiniNode_DataNode.__LZdelayedSetters);
-static var earlySetters:* = new LzInheritedHash(LzMiniNode_DataNode.earlySetters);
+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);
var ondata = LzDeclaredEvent;
@@ -37,17 +37,17 @@
}
/** @lzxtype event */
-//var onDocumentChange = LzDeclaredEvent;
+var onDocumentChange = LzDeclaredEvent;
/** @lzxtype event */
-//var onparentNode = LzDeclaredEvent;
+var onparentNode = LzDeclaredEvent;
/** @lzxtype event */
-//var onchildNode = LzDeclaredEvent;
+var onchildNode = LzDeclaredEvent;
/** @lzxtype event */
-//var onchildNodes = LzDeclaredEvent;
+var onchildNodes = LzDeclaredEvent;
/** @lzxtype event */
-//var onattributes = LzDeclaredEvent;
+var onattributes = LzDeclaredEvent;
/** @lzxtype event */
-//var onnodeName = LzDeclaredEvent;
+var onnodeName = LzDeclaredEvent;
/** This property is of type String, can raise a DOMException object on setting
* and can raise a DOMException object on retrieval. */
@@ -103,7 +103,7 @@
/**
* @access private
*/
-function toString (){
+override function toString (){
//return this.serialize();
return this.data;
}
Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDatapointer.js
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDatapointer.js 2008-03-06 13:50:02 UTC (rev 8192)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDatapointer.js 2008-03-06 13:57:35 UTC (rev 8193)
@@ -83,7 +83,7 @@
static var __LZdelayedSetters:* = new LzInheritedHash(LFCNode.__LZdelayedSetters);
static var earlySetters:* = new LzInheritedHash(LFCNode.earlySetters);
- LzDatapointer.setters.xpath = "setXpath";
+ LzDatapointer.setters.xpath = "setXPath";
LzDatapointer.setters.context = "setDataContext";
LzDatapointer.setters.pointer = "setPointer";
LzDatapointer.setters.p = "setPointer";
@@ -171,10 +171,7 @@
function LzDatapointer ( parent:* = null , attrs:* = null, children:* = null, instcall:* = null) {
-Debug.write("LzDatapointer ctor", this, parent, attrs, children, instcall);
-Debug.write("LzDatapointer pre", LzDatapointer.setters, this.setters);
- super(parent,attrs,children,instcall);
-Debug.write("LzDatapointer post", LzDatapointer.setters, this.setters);
+ super (parent, attrs, children, instcall);
}
@@ -297,6 +294,7 @@
}
/** @access private */
+/*
prototype.xpathQuery.dependencies = function ( who , self , p ){
if (this.parsePath) {
var pp = this.parsePath( p );
@@ -306,6 +304,7 @@
return [ self , "DocumentChange" ];
}
}
+*/
/** @access private */
@@ -371,13 +370,17 @@
* single node, <code>false</code> if no or multiple nodes are
* matched, <code>undefined</code> if the path is invalid.
*/
-function setXPath ( p ){
+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;
}
@@ -418,6 +421,8 @@
/** @access private */
function runXPath ( ){
+//PBR DEBUG
+trace("LzDatapointer.runXPath: parsedPath: " + this.parsedPath);
if ( !this.parsedPath ) {
return;
}
@@ -435,12 +440,18 @@
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);
this.__LZHandleMultiNodes( n );
return false;
} else {
+ //PBR DEBUG
+ trace("LzDatapointer.runXPath: single node");
this.__LZHandleSingleNode( n );
return true;
}
@@ -776,6 +787,9 @@
}
}
+ //PBR DEBUG
+ trace ("LzDatapointer.__LZgetNodes: " + p);
+
return p;
}
@@ -1350,6 +1364,8 @@
/** @access private */
function setDataContext ( dc, implicit = null ){
+//PBR DEBUG
+trace("LzDatapointer.setDataContext: " + dc);
if ( dc == null ){
this.context = this;
if (this.p) {
Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataset.js
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataset.js 2008-03-06 13:50:02 UTC (rev 8192)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataset.js 2008-03-06 13:57:35 UTC (rev 8193)
@@ -91,15 +91,14 @@
* @initarg src
* @initarg timeout
*/
-// See LzMiniNode.lzs for LzNode_DataNode_DOM
-class LzDataset extends LzNode_DataNode_DOM {
+class LzDataset extends LFCNode with LzDataElementMixin, LzDataNodeMixin {
- static var setters = new LzInheritedHash(LzNode_DataNode_DOM.setters);
- static var getters = new LzInheritedHash(LzNode_DataNode_DOM.getters);
- static var defaultattrs = new LzInheritedHash(LzNode_DataNode_DOM.defaultattrs);
- static var options = new LzInheritedHash(LzNode_DataNode_DOM.options);
- static var __LZdelayedSetters:* = new LzInheritedHash(LzNode_DataNode_DOM.__LZdelayedSetters);
- static var earlySetters:* = new LzInheritedHash(LzNode_DataNode_DOM.earlySetters);
+ static var setters = new LzInheritedHash(LFCNode.setters);
+ static var getters = new LzInheritedHash(LFCNode.getters);
+ static var defaultattrs = new LzInheritedHash(LFCNode.defaultattrs);
+ static var options = new LzInheritedHash(LFCNode.options);
+ static var __LZdelayedSetters:* = new LzInheritedHash(LFCNode.__LZdelayedSetters);
+ static var earlySetters:* = new LzInheritedHash(LFCNode.earlySetters);
LzDataset.setters.querytype = "setQueryType";
LzDataset.setters.data = "setDSData";
@@ -837,10 +836,11 @@
}
/** @access private */
-function setInitialData ( d ){
+function setInitialData ( d, val = null ){
if (d != null) {
var e = LzDataNode.stringToLzData(d, this.trimwhitespace, this.nsprefix);
- this.setDSData(e.childNodes);
+ if (e != null)
+ this.setDSData(e.childNodes);
}
}
Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzMiniNode.js
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzMiniNode.js 2008-03-06 13:50:02 UTC (rev 8192)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzMiniNode.js 2008-03-06 13:57:35 UTC (rev 8193)
@@ -28,1561 +28,13 @@
static var earlySetters:* = new LzInheritedHash({ });
var setAttribute = LzNode.prototype.setAttribute;
-}
+ var children:Array = [];
-// *************************
-// * *
-// * LzMiniNode_DataNode *
-// * *
-// *************************
+ function LzMiniNode ( parent:* = null, attrs:* = null, children:* = null, instcall:* = null){}
-// class LzMiniNode_DataNode = LzMiniNode + LzDataNode
-class LzMiniNode_DataNode extends LzMiniNode
-{
-// #include "data/LzDataNode.lzs"
-// Manual copy of LzDataNode.lzx
-
- 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);
-
-
-/** @lzxtype event */
-var onownerDocument = LzDeclaredEvent;
-
-
-/** The type of this node -- ELEMENT_NODE or TEXT_NODE
- * @type Number
- * @keywords abstract
- */
-//var nodeType:Number; // This is undefined. Set elsewhere
-var nodeType:*;
-var parentNode:* = null;
-//
-var ownerDocument:*;
-var __LZo:*;
-
-/** An array of children of this node
- * @type LzDataNode
- */
-var childNodes:* = null;
-
-/** @access private */
-var __LZcoDirty = true;
-
-/**
- * Returns the sibling before this one this node's parentNodes List of children
- * @return LzDataNode: The node preceeding this one in this node's childNodes
- */
-function getPreviousSibling (){
- if (!this.parentNode) return null;
- if ( this.parentNode.__LZcoDirty ) this.parentNode.__LZupdateCO();
- return this.parentNode.childNodes[ this.__LZo - 1 ];
+ function _dbg_name () {}
+ function toString () {}
}
-/**
- * Returns the parent of this node
- * @return LzDataNode: the parent of this node
- */
-function getParent () {
- return this.parentNode;
-}
-/**
- * gets offset of node in parent's childNodes array
- * @return number
- */
-function getOffset (){
- if (!this.parentNode) return 0;
- if (this.parentNode.__LZcoDirty) this.parentNode.__LZupdateCO();
-
- return this.__LZo;
-}
-
-/**
- * @access private
- */
-//TODO
-prototype.getPreviousSibling.dependencies = function( who, self ){
- return [ this.parentNode , "childNodes" , this , "parentNode" ];
-}
-
-/**
- * Returns the sibling after this one this node's parentNodes List of children
- * @return LzDataNode: The node succeeding this one in this node's childNodes
- */
-function getNextSibling (){
- if (!this.parentNode) return null;
- if ( this.parentNode.__LZcoDirty ) this.parentNode.__LZupdateCO();
- return this.parentNode.childNodes[ this.__LZo + 1 ];
-}
-
-/**
- * @access private
- */
-//TODO
-prototype.getNextSibling.dependencies = function( who, self ){
- return [ this.parentNode , "childNodes" , this , "parentNode" ];
-}
-
-/**
- * Tells whether the given node is above this one in the node hierarchy.
- * @param LzDataElement el: The LzDataElement to test to see if it is above
- * this one
- * @param Boolean allowself: If true, this function returns true if the given
- * node is the same as this node.
- */
-// Renamed from childOf to avoid conflict with LzNode.childOf
-function childOfNode ( el , allowself ) {
- var p = allowself ? this : this.parentNode
- while ( p ){
- if ( p == el ) return true;
- p = p.parentNode;
- }
- return false;
-}
-
-/**
- * Sets the LzDataNode which is the ownerDocument for this node.
- * @param LzDataNode ownerDoc: The LzDataNode to act as the ownerDocument for
- * this node.
- */
-function setOwnerDocument ( ownerDoc ){
- this.ownerDocument = ownerDoc;
- if (this.childNodes) {
- for ( var i = 0; i < this.childNodes.length; i++ ){
- this.childNodes[ i ] .setOwnerDocument( ownerDoc );
- }
- }
-
- if (this.onownerDocument && this.onownerDocument.ready) {
- this.onownerDocument.sendEvent( ownerDoc );
- }
-}
-
-/**
- * @access private
- */
-function __LZlockFromUpdate ( locker ){
- this.ownerDocument.__LZdoLock( locker );
-}
-
-/**
- * @access private
- */
-function __LZunlockFromUpdate ( locker ){
- this.ownerDocument.__LZdoUnlock( locker );
-}
-
-
-/**
- * @access private
- */
-function __LZupdateCO (){
- for ( var i = 0; i < this.childNodes.length; i++ ){
- this.childNodes[ i ].__LZo = i;
- }
- this.__LZcoDirty = false;
-}
-
-
-//End of manual include
-}
-
-
-// *****************************
-// * *
-// * LzMiniNode_DataNode_DOM *
-// * *
-// *****************************
-
-// class LzMiniNode_DataNode_DOM = LzMiniNode + LzDataNode + LzDataDOM
-class LzMiniNode_DataNode_DOM extends LzMiniNode_DataNode
-{
-// #include "data/LzDataDOM.lzs"
-// Manual copy of LzDataDOM.lzs
-
- static var setters = new LzInheritedHash(LzMiniNode_DataNode.setters);
- static var getters = new LzInheritedHash(LzMiniNode_DataNode.getters);
- static var defaultattrs = new LzInheritedHash(LzMiniNode_DataNode.defaultattrs);
- static var options = new LzInheritedHash(LzMiniNode_DataNode.options);
- static var __LZdelayedSetters:* = new LzInheritedHash(LzMiniNode_DataNode.__LZdelayedSetters);
- static var earlySetters:* = new LzInheritedHash(LzMiniNode_DataNode.earlySetters);
-
- LzMiniNode_DataNode_DOM.setters.attributes = "setAttrs";
- LzMiniNode_DataNode_DOM.setters.childNodes = "setChildNodes";
- LzMiniNode_DataNode_DOM.setters.nodeName = "setNodeName";
- LzMiniNode_DataNode_DOM.setters.ownerDocument = "setOwnerDocument";
-
- function LzMiniNode_DataNode_DOM ( parent:* , attrs:* , children:* = null, instcall:* = null) {
-// super(parent,attrs,children,instcall);
- this.__LZo = -1;
- }
-
-
-
-/** @lzxtype event */
-var onDocumentChange = LzDeclaredEvent;
-/** @lzxtype event */
-var onparentNode = LzDeclaredEvent;
-/** @lzxtype event */
-var onchildNode = LzDeclaredEvent;
-/** @lzxtype event */
-var onchildNodes = LzDeclaredEvent;
-/** @lzxtype event */
-var onattributes = LzDeclaredEvent;
-/** @lzxtype event */
-var onnodeName = LzDeclaredEvent;
-
-/** @access private */
-var __LZchangeQ = null;
-/** @access private */
-var __LZlocker = null;
-
-/** The name of this node.
- * @type String
- */
-var nodeName:* = null;
-
-/** The dictionary of attributes for this node.
- * @type Object
- */
-var attributes:* = null;
-
-/** Inserts the given LzDataNode before another node in this node's childNodes
- * @param LzDataNode newChild: the LzDataNode to insert
- * @param LzDataNode refChild: the LzDataNode to insert newChild before
- * @return LzDataElement: The new child, or null if the refChild wasn't found
- */
-function insertBefore (newChild, refChild){
- this.__LZcoDirty = true;
-
- for ( var i = 0; i < this.childNodes.length; i++ ){
- if ( this.childNodes[ i ] == refChild ){
- this.childNodes.splice( i , 0 , newChild );
- newChild.setOwnerDocument( this.ownerDocument );
-
- newChild.parentNode = this;
- if (newChild.onparentNode.ready) newChild.onparentNode.sendEvent( this );
- if (this.onchildNodes.ready) this.onchildNodes.sendEvent( newChild );
- this.ownerDocument.handleDocumentChange( "insertBefore" ,
- this, 0 );
- return newChild;
- }
- }
-
- //raise exception
- return null;
-}
-
-
-/**
- * Replaces a given LzDataNode in this node's childNodes with a new one.
- * @param LzDataNode newChild: the LzDataNode to add
- * @param LzDataNode oldChild: the LzDataNode to be replaced by the newChild
- * @return LzDataElement: The new child, or null if the oldChild wasn't found
- */
-function replaceChild (newChild, oldChild){
-
- this.__LZcoDirty = true;
- for ( var i = 0; i < this.childNodes.length; i++ ){
- if ( this.childNodes[ i ] == oldChild ){
- this.childNodes[ i ] = newChild;
-
- newChild.setOwnerDocument( this.ownerDocument );
-
- newChild.parentNode = this;
- if (newChild.onparentNode.ready) newChild.onparentNode.sendEvent( this );
- if (this.onchildNodes.ready) this.onchildNodes.sendEvent( newChild );
- this.ownerDocument.handleDocumentChange( "childNodes" , this , 0, newChild );
- return newChild;
- }
- }
- //raise exception
- return null;
-}
-
-/**
- * Removes a given node from this node's childNodes
- * @param LzDataNode oldChild: The LzDataNode to remove
- * @return LzDataNode: The removed child, or null if the oldChild was not found
- */
-function removeChild (oldChild){
- var reval = null;
- this.__LZcoDirty = true;
- for ( var i = 0; i < this.childNodes.length; i++ ){
- if ( this.childNodes[ i ] == oldChild ){
- this.childNodes.splice( i , 1 );
- if (this.onchildNodes.ready) this.onchildNodes.sendEvent( oldChild );
- reval = oldChild;
- this.ownerDocument.handleDocumentChange("removeChild", this, 0, oldChild);
- }
- }
- //raise exception if not found
- return reval;
-}
-
-/**
- * Adds a child to this node's list of childNodes
- * @param LzDataNode newChild: The LzDataNode to add.
- * @return LzDataNode: The newChild.
- */
-function appendChild (newChild){
- if ( this.childNodes ){
- this.childNodes.push( newChild );
- } else {
- this.childNodes = [ newChild ];
- }
-
- newChild.setOwnerDocument( this.ownerDocument );
-
- newChild.parentNode = this;
- if (newChild.onparentNode.ready) newChild.onparentNode.sendEvent( this );
-
- //instead of marking dirty, this is easy
- newChild.__LZo = this.childNodes.length -1;
-
- if (this.onchildNodes.ready) this.onchildNodes.sendEvent( newChild );
- this.ownerDocument.handleDocumentChange( "appendChild" , this , 0, newChild );
- return newChild;
-}
-
-/**
- * Tests whether or not this node has child nodes.
- * @return Boolean: If true, this node has child nodes.
- */
-function hasChildNodes (){
- return this.childNodes.length > 0;
-}
-
-/**
- * Returns a copy of this node.
- * @param Boolean deep: If true, the children of this node will be part of the
- * new node
- * @return LzDataNode: A copy of this node.
- */
-function cloneNode ( deep ){
- var n = new LzDataElement(this.nodeName);
- n.setAttrs( this.attributes );
- if ( deep ){
- for ( var i = 0 ; i < this.childNodes.length; i++ ){
- n.appendChild ( this.childNodes[ i ].cloneNode( true ) );
- }
- }
-
- return n;
-}
-
-/**
- * Returns the value for the give attribute
- * @param String name: The name of the attribute whose value to return
- * @return String: The value for the given attribute
- */
-function getAttr (name){
- if (this.attributes) return this.attributes[ name ];
-}
-
-/**
- * @access private
- */
-prototype.getAttr.dependencies = function (who , self){
- return [ self, 'attributes' ];
-}
-
-/**
- * Sets the given attribute to the given value
- * @param String name: The name of the attribute to set.
- * @param String value: The value for the attribute.
- */
-function setAttr (name, value){
- if ( ! this.attributes ) {
- this.attributes = {};
- }
- this.attributes[ name ] = value;
- if (this.onattributes.ready) this.onattributes.sendEvent( name );
- this.ownerDocument.handleDocumentChange( "attributes" , this , 1, {name: name, value: value, type: 'set'});
- return value;
-}
-
-/**
- * Removes the named attribute
- * @param String name: The name of the attribute to remove.
- */
-function removeAttr (name){
- var v = this.attributes[ name ];
- delete this.attributes[ name ];
- if (this.onattributes.ready) this.onattributes.sendEvent( name );
- this.ownerDocument.handleDocumentChange( "attributes" , this , 1, {name: name, value: v, type: 'remove'});
- return v;
-}
-
-/**
- *This method returns a Attr object.
- *The name parameter is of type String.
- */
-//function getAttributeNode (name){
-//}
-
-/**
- *This method returns a Attr object.
- *The newAttr parameter is a Attr object.
- */
-//function setAttrNode (newAttr){
-//}
-
-/**
- * Tests whether or not this node has a given attribute.
- * @param String name: The name of the attribute to test
- * @return Boolean: If true, the named attribute is present.
- */
-function hasAttr (name){
- return this.attributes[ name ] != null;
-}
-
-/**
- * Returns the first child of this node.
- * @return LzDataNode: The first child of this node
- */
-function getFirstChild (){
- return this.childNodes[ 0 ];
-}
-/**
- * @access private
- */
-prototype.getFirstChild.dependencies = function( who, self ){
- return [ this , "childNodes" ];
-}
-
-/**
- * Returns the last child of this node.
- * @return LzDataNode: The last child of this node
- */
-function getLastChild (){
- return this.childNodes[ this.childNodes.length-1 ];
-}
-/**
- * @access private
- */
-prototype.getLastChild.dependencies = function( who, self ){
- return [ this , "childNodes" ];
-}
-
-
-
-/**
- * @access private
- */
-prototype.hasAttr.dependencies = function (who , self){
- return [ self, 'attributes' ];
-}
-
-/**
- * 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 ){
- var a = {};
- for ( var k in attrs ){ a[ k ] = attrs[ k ]; }
-
- this.attributes = a;
- if (this.onattributes.ready) this.onattributes.sendEvent( a);
- if (this.ownerDocument) {
- this.ownerDocument.handleDocumentChange( "attributes" , this , 1);
- }
-}
-
-/**
- * Sets the children of this node to the given array.
- * @param [LzDataNode] children: An array of LzDataNodes to be the new children
- * of this node
- */
-function setChildNodes ( children ){
- this.childNodes = children;
- for ( var i = 0; i < children.length; i++ ){
- var c = children[ i ];
- if (c) {
- c.setOwnerDocument( this.ownerDocument );
- c.parentNode = this;
- if (c.onparentNode) {
- if (c.onparentNode.ready) c.onparentNode.sendEvent( this );
- }
- c.__LZo = i;
- }
- }
- this.__LZcoDirty = false;
- if (this.onchildNodes) {
- if (this.onchildNodes.ready) this.onchildNodes.sendEvent( children );
- }
- this.ownerDocument.handleDocumentChange( "childNodes" , this , 0);
-}
-
-/**
- * Sets the name of this node.
- * @param String name: The new name for this node
- */
-function setNodeName ( name ){
- //Debug.write('setting node name from "',this.nodeName, '" to "', name, '"');
- this.nodeName = name;
- //since this can affect xpaths, send onchildNodes event
- if (this.onnodeName.ready) this.onnodeName.sendEvent( name );
- if (this.parentNode) {
- if (this.parentNode.onchildNodes.ready) this.parentNode.onchildNodes.sendEvent( this );
- if (this.parentNode.onchildNode.ready) this.parentNode.onchildNode.sendEvent( this );
- }
- this.ownerDocument.handleDocumentChange( "childNodeName" ,
- this.parentNode , 0 );
- this.ownerDocument.handleDocumentChange( "nodeName" , this, 1 );
-}
-
-/**
- * @access private
- */
-function __LZgetText ( ){
- var s= "";
- for ( var i = 0; i < this.childNodes.length; i++ ){
- var c = this.childNodes[ i ]
- if ( c.nodeType == LzDataNode.TEXT_NODE ){
- s += c.data;
- }
- }
- return s;
-}
-
-/**
- * Returns a list of the childNodes of this node which have a given name
- * @param String name: The name of the node to look for.
- * @return [LzDataNode]: A list of childNodes which have the given name.
- */
-function getElementsByTagName (name) {
- var r = [];
- for ( var i = 0; i < this.childNodes.length; i++ ){
- if ( this.childNodes[i].nodeName == name ){
- r.push( this.childNodes[ i ] );
- }
- }
- return r;
-}
-
-/*
-//This method returns a Attr object.
-//The oldAttr parameter is a Attr object.
-//This method can raise a DOMException object.
-// function removeAttributeNode (oldAttr) {
-}
-//This method returns a String.
-//The namespaceURI parameter is of type String.
-//The localName parameter is of type String.
-// function getAttributeNS (namespaceURI, localName) {
-}
-//This method has no return value.
-//The namespaceURI parameter is of type String.
-//The qualifiedName parameter is of type String.
-//The value parameter is of type String.
-//This method can raise a DOMException object.
-// function setAttrNS (namespaceURI, qualifiedName,
- value) {
-}
-//This method has no return value.
-//The namespaceURI parameter is of type String.
-//The localName parameter is of type String.
-//This method can raise a DOMException object.
-// function removeAttributeNS (namespaceURI, localName) {
-}
-//This method returns a Attr object.
-//The namespaceURI parameter is of type String.
-//The localName parameter is of type String.
-// function getAttributeNodeNS (namespaceURI, localName) {
-}
-//This method returns a Attr object.
-//The newAttr parameter is a Attr object.
-//This method can raise a DOMException object.
-// function setAttrNodeNS (newAttr) {
-}
-//This method returns a NodeList object.
-//The namespaceURI parameter is of type String.
-//The localName parameter is of type String.
-// function getElementsByTagNameNS (namespaceURI, localName) {
-}
-//This method returns a Boolean.
-//The namespaceURI parameter is of type String.
-//The localName parameter is of type String.
-// function hasAttrNS (namespaceURI, localName) {
-}
-*/
-
-var __LZlt = "<";
-var __LZgt = ">";
-
-
-/**
- * Returns this node as a string of xml.
- * @return String: The string serialization of this node.
- */
-function serialize (){
- return this.serializeInternal(Infinity);
-}
-
-//TODO Used instead of Debug.abbreviate. You can remove this when Debug is
-// moved to swf9
-static var printLength = 1024;
-static function abbreviate (s, l) {
- var ellipsis = '...'; // '\u2026' doesn't work, wah.
- if (s.length > (l - ellipsis.length)) {
- s = s.substring(0, l - ellipsis.length) + ellipsis;
- }
- return s;
-}
-
-/**
- * Implementation of serialize with option to limit string length
- * @access private
- */
-function serializeInternal (len) {
- if (arguments.length < 1) {
- len = Infinity;
- }
- var s = this.__LZlt + this.nodeName;
-
- //Debug.info('k', this.attributes);
- for ( var k in this.attributes ){
- s += " " + k + '="' + LzDataNode.__LZXMLescape( this.attributes[ k ] ) + '"';
- if (s.length > len) { break; }
- }
-
- 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);
- if (s.length > len) { break; }
- }
- s += this.__LZlt + "/" + this.nodeName + this.__LZgt;
- } else {
- s += "/" + this.__LZgt;
- }
- if (s.length > len) { s = LzMiniNode_DataNode_DOM.abbreviate(s, len); }
- return s;
-}
-
-/**
- * For debugging. Same as serialize, but will abbreviate at printLength.
- * @access private
- */
-function _dbg_name () {
- return this.serializeInternal(LzMiniNode_DataNode_DOM.printLength);
-}
-
-/**
- * Nodes call this method on their ownerDocument whenever they change in any
- * way. This method sends the onDocumentChange event, which triggers
- * datapointer updates
- * @param String what: A description of what changed.
- * @param LzDataNode who: The node that changed.
- * @param Number type: private
- */
-function handleDocumentChange ( what , who , type, cobj=null ){
- var o = { who: who , what: what , type : type};
- if (cobj) o.cobj = cobj;
- if ( this.__LZchangeQ ){
- this.__LZchangeQ.push ( o );
- } else {
- if (this.onDocumentChange.ready) this.onDocumentChange.sendEvent( o );
- }
-}
-
-/**
- * @access private
- */
-function toString (){
- //this.__LZlt = "<";
- //this.__LZgt = ">";
- var r = this.serialize();
- //delete this.__LZlt;
- //delete this.__LZgt;
- return r;
-}
-
-/**
- * @access private
- */
-function __LZdoLock ( locker ){
- if ( !this.__LZchangeQ ){
- this.__LZchangeQ = [];
- this.__LZlocker = locker;
- }
-}
-
-
-/**
- * @access private
- */
-function __LZdoUnlock ( locker ){
-
- if ( this.__LZlocker != locker ){
- return;
- }
-
- var lzq = this.__LZchangeQ;
- this.__LZchangeQ = null;
-
- if (lzq != null) {
- for ( var i = 0; i < lzq.length; i++ ){
- var sendit = true;
- var tc = lzq[ i ];
- for ( var j = 0; j < i; j++ ){
- var oc = lzq[ j ];
- if ( tc.who == oc.who &&
- tc.what == oc.what &&
- tc.type == oc.type ){
- sendit = false;
- break;
- }
- }
-
- if ( sendit ){
- this.handleDocumentChange ( tc.what, tc.who, tc.type );
- }
- }
- }
-
-
-}
-
-/**
- * Get LzDataElement representation of primitive type, array, or object value.
- */
-static function valueToElement ( o ) {
- var n = new LzDataElement("element", { }, LzMiniNode_DataNode_DOM.__LZv2E(o));
- return n;
-}
-
-/**
- * @param Type o: primitive type, array, or object value.
- * @return array of LzDataElements
- * @access private
- */
-static function __LZv2E ( o ) {
-
- var type = typeof( o );
- type.toLowerCase();
-
- var c = [];
- if (type == "object") {
- if ( o instanceof LzDataElement ||
- o instanceof LzDataText ) {
- c[0] = o;
- } else if (o instanceof Date) {
-
- type = "date";
- // FIXME: [2004-04-10 pkang] what should we do with dates?
-
- } else if (o instanceof Array) {
- type = "array";
- var tag = (o.__LZtag != null ? o.__LZtag : 'item');
- for (var i=0; i < o.length; i++) {
- var tmpC = LzMiniNode_DataNode_DOM.__LZv2E( o[i] );
- c[i] = new LzDataElement(tag, null, tmpC );
- }
- } else {
- type = "struct";
- var i = 0;
- for (var k in o) {
- // skip any properties that start with __LZ
- if (k.indexOf('__LZ') == 0) continue;
- c[i++] = new LzDataElement(k, null, LzMiniNode_DataNode_DOM.__LZv2E(o[k]));
- }
- }
- } else if (o != null) {
- c[0] = new LzDataText( o );
- }
-
- if (c.length == 0) c = null;
-
- return c;
-}
-// End of Manual include
-}
-
-
-
-// *********************
-// * *
-// * LzNode_DataNode *
-// * *
-// *********************
-
-if ($swf9) {
-} else {
- var LFCNode = LzNode;
-}
-
-class LzNode_DataNode extends LFCNode
-{
-// #include "data/LzDataNode.lzs"
-// Manual include of LzDataNode.lzs
-
- static var setters = new LzInheritedHash(LFCNode.setters);
- static var getters = new LzInheritedHash(LFCNode.getters);
- static var defaultattrs = new LzInheritedHash(LFCNode.defaultattrs);
- static var options = new LzInheritedHash(LFCNode.options);
- static var __LZdelayedSetters:* = new LzInheritedHash(LFCNode.__LZdelayedSetters);
- static var earlySetters:* = new LzInheritedHash(LFCNode.earlySetters);
-
-
-
-var onownerDocument:* = LzDeclaredEvent;
-var parentNode:* = null;
-var ownerDocument:*;
-var __LZo:*;
-
-/** An array of children of this node
- * @type LzDataNode
- */
-var childNodes:* = null;
-
-/** @access private */
-var __LZcoDirty = true;
-
-/** The type of this node -- ELEMENT_NODE or TEXT_NODE
- * @type Number
- * @keywords abstract
- */
-var nodeType:Number; // This is undefined. Set elsewhere
-
- function LzNode_DataNode ( parent:* , attrs:* , children:* = null, instcall:* = null) {
- super(parent,attrs,children,instcall);
- }
-
-/**
- * Returns the sibling before this one this node's parentNodes List of children
- * @return LzDataNode: The node preceeding this one in this node's childNodes
- */
-function getPreviousSibling (){
- if (!this.parentNode) return null;
- if ( this.parentNode.__LZcoDirty ) this.parentNode.__LZupdateCO();
- return this.parentNode.childNodes[ this.__LZo - 1 ];
-}
-
-/**
- * Returns the parent of this node
- * @return LzDataNode: the parent of this node
- */
-function getParent () {
- return this.parentNode;
-}
-
-/**
- * gets offset of node in parent's childNodes array
- * @return number
- */
-function getOffset (){
- if (!this.parentNode) return 0;
- if (this.parentNode.__LZcoDirty) this.parentNode.__LZupdateCO();
-
- return this.__LZo;
-}
-
-/**
- * @access private
- */
-prototype.getPreviousSibling.dependencies = function( who, self ){
- return [ this.parentNode , "childNodes" , this , "parentNode" ];
-}
-
-/**
- * Returns the sibling after this one this node's parentNodes List of children
- * @return LzDataNode: The node succeeding this one in this node's childNodes
- */
-function getNextSibling (){
- if (!this.parentNode) return null;
- if ( this.parentNode.__LZcoDirty ) this.parentNode.__LZupdateCO();
- return this.parentNode.childNodes[ this.__LZo + 1 ];
-}
-
-/**
- * @access private
- */
-prototype.getNextSibling.dependencies = function( who, self ){
- return [ this.parentNode , "childNodes" , this , "parentNode" ];
-}
-
-/**
- * Tells whether the given node is above this one in the node hierarchy.
- * @param LzDataElement el: The LzDataElement to test to see if it is above
- * this one
- * @param Boolean allowself: If true, this function returns true if the given
- * node is the same as this node.
- */
-// Renamed from childOf to avoid conflict with LzNode.childOf
-function childOfNode ( el , allowself ) {
- var p = allowself ? this : this.parentNode
- while ( p ){
- if ( p == el ) return true;
- p = p.parentNode;
- }
- return false;
-}
-
-
-/**
- * Sets the LzDataNode which is the ownerDocument for this node.
- * @param LzDataNode ownerDoc: The LzDataNode to act as the ownerDocument for
- * this node.
- */
-function setOwnerDocument ( ownerDoc ){
- this.ownerDocument = ownerDoc;
- if (this.childNodes) {
- for ( var i = 0; i < this.childNodes.length; i++ ){
- this.childNodes[ i ] .setOwnerDocument( ownerDoc );
- }
- }
-
- if (this.onownerDocument && this.onownerDocument.ready) {
- this.onownerDocument.sendEvent( ownerDoc );
- }
-}
-
-
-/**
- * @access private
- */
-function __LZlockFromUpdate ( locker ){
- this.ownerDocument.__LZdoLock( locker );
-}
-
-/**
- * @access private
- */
-function __LZunlockFromUpdate ( locker ){
- this.ownerDocument.__LZdoUnlock( locker );
-}
-
-/**
- * @access private
- */
-function __LZupdateCO (){
- for ( var i = 0; i < this.childNodes.length; i++ ){
- this.childNodes[ i ].__LZo = i;
- }
- this.__LZcoDirty = false;
-}
-
-// End of Manual include
-}
-
-
-// *************************
-// * *
-// * LzNode_DataNode_DOM *
-// * *
-// *************************
-
-// class LzNode_DataNode_DOM = LzNode + LzDataNode + LzDataDOM
-class LzNode_DataNode_DOM extends LzNode_DataNode
-{
-// #include "data/LzDataDOM.lzs"
-// Manual include of LzDataDOM.lzs
-
- static var setters = new LzInheritedHash(LzNode_DataNode.setters);
- static var getters = new LzInheritedHash(LzNode_DataNode.getters);
- static var defaultattrs = new LzInheritedHash(LzNode_DataNode.defaultattrs);
- static var options = new LzInheritedHash(LzNode_DataNode.options);
- static var __LZdelayedSetters:* = new LzInheritedHash(LzNode_DataNode.__LZdelayedSetters);
- static var earlySetters:* = new LzInheritedHash(LzNode_DataNode.earlySetters);
-
-
- LzNode_DataNode_DOM.setters.attributes = "setAttrs";
- LzNode_DataNode_DOM.setters.childNodes = "setChildNodes";
- LzNode_DataNode_DOM.setters.nodeName = "setNodeName";
- LzNode_DataNode_DOM.setters.ownerDocument = "setOwnerDocument";
-
-
-/** @lzxtype event */
-var onDocumentChange = LzDeclaredEvent;
-/** @lzxtype event */
-var onparentNode = LzDeclaredEvent;
-/** @lzxtype event */
-var onchildNode = LzDeclaredEvent;
-/** @lzxtype event */
-var onchildNodes = LzDeclaredEvent;
-/** @lzxtype event */
-var onattributes = LzDeclaredEvent;
-/** @lzxtype event */
-var onnodeName = LzDeclaredEvent;
-
-/** @access private */
-var __LZchangeQ = null;
-/** @access private */
-var __LZlocker = null;
-
-var attributes:*;
-var nodeName:*;
-
- function LzNode_DataNode_DOM ( parent:* , attrs:* , children:* = null, instcall:* = null) {
- super(parent,attrs,children,instcall);
-
-if ($swf9) {
-} else {
- Debug.write("setters", LzNode_DataNode_DOM.setters);
- for (var key in LzNode_DataNode_DOM.setters) {
- Debug.write("setters", key, LzNode_DataNode_DOM.setters[key], this.setters[key]);
-}
-}
-
- }
-
-
-/** Inserts the given LzDataNode before another node in this node's childNodes
- * @param LzDataNode newChild: the LzDataNode to insert
- * @param LzDataNode refChild: the LzDataNode to insert newChild before
- * @return LzDataElement: The new child, or null if the refChild wasn't found
- */
-function insertBefore (newChild, refChild){
- this.__LZcoDirty = true;
-
- for ( var i = 0; i < this.childNodes.length; i++ ){
- if ( this.childNodes[ i ] == refChild ){
- this.childNodes.splice( i , 0 , newChild );
- newChild.setOwnerDocument( this.ownerDocument );
-
- newChild.parentNode = this;
- if (newChild.onparentNode.ready) newChild.onparentNode.sendEvent( this );
- if (this.onchildNodes.ready) this.onchildNodes.sendEvent( newChild );
- this.ownerDocument.handleDocumentChange( "insertBefore" ,
- this, 0 );
- return newChild;
- }
- }
-
- //raise exception
- return null;
-}
-
-
-/**
- * Replaces a given LzDataNode in this node's childNodes with a new one.
- * @param LzDataNode newChild: the LzDataNode to add
- * @param LzDataNode oldChild: the LzDataNode to be replaced by the newChild
- * @return LzDataElement: The new child, or null if the oldChild wasn't found
- */
-function replaceChild (newChild, oldChild){
-
- this.__LZcoDirty = true;
- for ( var i = 0; i < this.childNodes.length; i++ ){
- if ( this.childNodes[ i ] == oldChild ){
- this.childNodes[ i ] = newChild;
-
- newChild.setOwnerDocument( this.ownerDocument );
-
- newChild.parentNode = this;
- if (newChild.onparentNode.ready) newChild.onparentNode.sendEvent( this );
- if (this.onchildNodes.ready) this.onchildNodes.sendEvent( newChild );
- this.ownerDocument.handleDocumentChange( "childNodes" , this , 0, newChild );
- return newChild;
- }
- }
- //raise exception
- return null;
-}
-
-/**
- * Removes a given node from this node's childNodes
- * @param LzDataNode oldChild: The LzDataNode to remove
- * @return LzDataNode: The removed child, or null if the oldChild was not found
- */
-function removeChild (oldChild){
- var reval = null;
- this.__LZcoDirty = true;
- for ( var i = 0; i < this.childNodes.length; i++ ){
- if ( this.childNodes[ i ] == oldChild ){
- this.childNodes.splice( i , 1 );
- if (this.onchildNodes.ready) this.onchildNodes.sendEvent( oldChild );
- reval = oldChild;
- this.ownerDocument.handleDocumentChange("removeChild", this, 0, oldChild);
- }
- }
- //raise exception if not found
- return reval;
-}
-
-/**
- * Adds a child to this node's list of childNodes
- * @param LzDataNode newChild: The LzDataNode to add.
- * @return LzDataNode: The newChild.
- */
-function appendChild (newChild){
- if ( this.childNodes ){
- this.childNodes.push( newChild );
- } else {
- this.childNodes = [ newChild ];
- }
-
- newChild.setOwnerDocument( this.ownerDocument );
-
- newChild.parentNode = this;
- if (newChild.onparentNode.ready) newChild.onparentNode.sendEvent( this );
-
- //instead of marking dirty, this is easy
- newChild.__LZo = this.childNodes.length -1;
-
- if (this.onchildNodes.ready) this.onchildNodes.sendEvent( newChild );
- this.ownerDocument.handleDocumentChange( "appendChild" , this , 0, newChild );
- return newChild;
-}
-
-/**
- * Tests whether or not this node has child nodes.
- * @return Boolean: If true, this node has child nodes.
- */
-function hasChildNodes (){
- return this.childNodes.length > 0;
-}
-
-/**
- * Returns a copy of this node.
- * @param Boolean deep: If true, the children of this node will be part of the
- * new node
- * @return LzDataNode: A copy of this node.
- */
-function cloneNode ( deep ){
- var n = new LzDataElement(this.nodeName);
- n.setAttrs( this.attributes );
- if ( deep ){
- for ( var i = 0 ; i < this.childNodes.length; i++ ){
- n.appendChild ( this.childNodes[ i ].cloneNode( true ) );
- }
- }
-
- return n;
-}
-
-/**
- * Returns the value for the give attribute
- * @param String name: The name of the attribute whose value to return
- * @return String: The value for the given attribute
- */
-function getAttr (name){
- if (this.attributes) return this.attributes[ name ];
-}
-
-/**
- * @access private
- */
-prototype.getAttr.dependencies = function (who , self){
- return [ self, 'attributes' ];
-}
-
-/**
- * Sets the given attribute to the given value
- * @param String name: The name of the attribute to set.
- * @param String value: The value for the attribute.
- */
-function setAttr (name, value){
- if ( ! this.attributes ) {
- this.attributes = {};
- }
- this.attributes[ name ] = value;
- if (this.onattributes.ready) this.onattributes.sendEvent( name );
- this.ownerDocument.handleDocumentChange( "attributes" , this , 1, {name: name, value: value, type: 'set'});
- return value;
-}
-
-/**
- * Removes the named attribute
- * @param String name: The name of the attribute to remove.
- */
-function removeAttr (name){
- var v = this.attributes[ name ];
- delete this.attributes[ name ];
- if (this.onattributes.ready) this.onattributes.sendEvent( name );
- this.ownerDocument.handleDocumentChange( "attributes" , this , 1, {name: name, value: v, type: 'remove'});
- return v;
-}
-
-/**
- *This method returns a Attr object.
- *The name parameter is of type String.
- */
-//function getAttributeNode (name){
-//}
-
-/**
- *This method returns a Attr object.
- *The newAttr parameter is a Attr object.
- */
-//function setAttrNode (newAttr){
-//}
-
-/**
- * Tests whether or not this node has a given attribute.
- * @param String name: The name of the attribute to test
- * @return Boolean: If true, the named attribute is present.
- */
-function hasAttr (name){
- return this.attributes[ name ] != null;
-}
-
-/**
- * Returns the first child of this node.
- * @return LzDataNode: The first child of this node
- */
-function getFirstChild (){
- return this.childNodes[ 0 ];
-}
-/**
- * @access private
- */
-prototype.getFirstChild.dependencies = function( who, self ){
- return [ this , "childNodes" ];
-}
-
-/**
- * Returns the last child of this node.
- * @return LzDataNode: The last child of this node
- */
-function getLastChild (){
- return this.childNodes[ this.childNodes.length-1 ];
-}
-/**
- * @access private
- */
-prototype.getLastChild.dependencies = function( who, self ){
- return [ this , "childNodes" ];
-}
-
-
-/**
- * @access private
- */
-prototype.hasAttr.dependencies = function (who , self){
- return [ self, 'attributes' ];
-}
-
-/**
- * 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 ){
- var a = {};
- for ( var k in attrs ){ a[ k ] = attrs[ k ]; }
-
- this.attributes = a;
- if (this.onattributes.ready) this.onattributes.sendEvent( a);
- if (this.ownerDocument) {
- this.ownerDocument.handleDocumentChange( "attributes" , this , 1);
- }
-}
-
-/**
- * Sets the children of this node to the given array.
- * @param [LzDataNode] children: An array of LzDataNodes to be the new children
- * of this node
- */
-function setChildNodes ( children ){
- this.childNodes = children;
- for ( var i = 0; i < children.length; i++ ){
- var c = children[ i ];
- if (c) {
- c.setOwnerDocument( this.ownerDocument );
- c.parentNode = this;
- if (c.onparentNode) {
- if (c.onparentNode.ready) c.onparentNode.sendEvent( this );
- }
- c.__LZo = i;
- }
- }
- this.__LZcoDirty = false;
- if (this.onchildNodes) {
- if (this.onchildNodes.ready) this.onchildNodes.sendEvent( children );
- }
- this.ownerDocument.handleDocumentChange( "childNodes" , this , 0);
-}
-
-/**
- * Sets the name of this node.
- * @param String name: The new name for this node
- */
-function setNodeName ( name ){
- //Debug.write('setting node name from "',this.nodeName, '" to "', name, '"');
- this.nodeName = name;
- //since this can affect xpaths, send onchildNodes event
- if (this.onnodeName.ready) this.onnodeName.sendEvent( name );
- if (this.parentNode) {
- if (this.parentNode.onchildNodes.ready) this.parentNode.onchildNodes.sendEvent( this );
- if (this.parentNode.onchildNode.ready) this.parentNode.onchildNode.sendEvent( this );
- }
- this.ownerDocument.handleDocumentChange( "childNodeName" ,
- this.parentNode , 0 );
- this.ownerDocument.handleDocumentChange( "nodeName" , this, 1 );
-}
-
-/**
- * @access private
- */
-function __LZgetText ( ){
- var s= "";
- for ( var i = 0; i < this.childNodes.length; i++ ){
- var c = this.childNodes[ i ]
- if ( c.nodeType == LzDataNode.TEXT_NODE ){
- s += c.data;
- }
- }
- return s;
-}
-
-/**
- * Returns a list of the childNodes of this node which have a given name
- * @param String name: The name of the node to look for.
- * @return [LzDataNode]: A list of childNodes which have the given name.
- */
-function getElementsByTagName (name) {
- var r = [];
- for ( var i = 0; i < this.childNodes.length; i++ ){
- if ( this.childNodes[i].nodeName == name ){
- r.push( this.childNodes[ i ] );
- }
- }
- return r;
-}
-
-/*
-//This method returns a Attr object.
-//The oldAttr parameter is a Attr object.
-//This method can raise a DOMException object.
-// function removeAttributeNode (oldAttr) {
-}
-//This method returns a String.
-//The namespaceURI parameter is of type String.
-//The localName parameter is of type String.
-// function getAttributeNS (namespaceURI, localName) {
-}
-//This method has no return value.
-//The namespaceURI parameter is of type String.
-//The qualifiedName parameter is of type String.
-//The value parameter is of type String.
-//This method can raise a DOMException object.
-// function setAttrNS (namespaceURI, qualifiedName,
- value) {
-}
-//This method has no return value.
-//The namespaceURI parameter is of type String.
-//The localName parameter is of type String.
-//This method can raise a DOMException object.
-// function removeAttributeNS (namespaceURI, localName) {
-}
-//This method returns a Attr object.
-//The namespaceURI parameter is of type String.
-//The localName parameter is of type String.
-// function getAttributeNodeNS (namespaceURI, localName) {
-}
-//This method returns a Attr object.
-//The newAttr parameter is a Attr object.
-//This method can raise a DOMException object.
-// function setAttrNodeNS (newAttr) {
-}
-//This method returns a NodeList object.
-//The namespaceURI parameter is of type String.
-//The localName parameter is of type String.
-// function getElementsByTagNameNS (namespaceURI, localName) {
-}
-//This method returns a Boolean.
-//The namespaceURI parameter is of type String.
-//The localName parameter is of type String.
-// function hasAttrNS (namespaceURI, localName) {
-}
-*/
-
-var __LZlt = "<";
-var __LZgt = ">";
-
-
-/**
- * Returns this node as a string of xml.
- * @return String: The string serialization of this node.
- */
-function serialize (){
- return this.serializeInternal(Infinity);
-}
-
-//TODO Used instead of Debug.abbreviate. You can remove this when Debug is
-// moved to swf9
-static var printLength = 1024;
-static function abbreviate (s, l) {
- var ellipsis = '...'; // '\u2026' doesn't work, wah.
- if (s.length > (l - ellipsis.length)) {
- s = s.substring(0, l - ellipsis.length) + ellipsis;
- }
- return s;
-}
-
-/**
- * Implementation of serialize with option to limit string length
- * @access private
- */
-function serializeInternal (len) {
- if (arguments.length < 1) {
- len = Infinity;
- }
- var s = this.__LZlt + this.nodeName;
-
- //Debug.info('k', this.attributes);
- for ( var k in this.attributes ){
- s += " " + k + '="' + LzDataNode.__LZXMLescape( this.attributes[ k ] ) + '"';
- if (s.length > len) { break; }
- }
-
- 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);
- if (s.length > len) { break; }
- }
- s += this.__LZlt + "/" + this.nodeName + this.__LZgt;
- } else {
- s += "/" + this.__LZgt;
- }
- if (s.length > len) { s = LzNode_DataNode_DOM.abbreviate(s, len); }
- return s;
-}
-
-/**
- * For debugging. Same as serialize, but will abbreviate at printLength.
- * @access private
- */
-override function _dbg_name () {
- return this.serializeInternal(LzNode_DataNode_DOM.printLength);
-}
-
-/**
- * Nodes call this method on their ownerDocument whenever they change in any
- * way. This method sends the onDocumentChange event, which triggers
- * datapointer updates
- * @param String what: A description of what changed.
- * @param LzDataNode who: The node that changed.
- * @param Number type: private
- */
-function handleDocumentChange ( what , who , type, cobj=null ){
- var o = { who: who , what: what , type : type};
- if (cobj) o.cobj = cobj;
- if ( this.__LZchangeQ ){
- this.__LZchangeQ.push ( o );
- } else {
- if (this.onDocumentChange.ready) this.onDocumentChange.sendEvent( o );
- }
-}
-
-/**
- * @access private
- */
-override function toString (){
- //this.__LZlt = "<";
- //this.__LZgt = ">";
- var r = this.serialize();
- //delete this.__LZlt;
- //delete this.__LZgt;
- return r;
-}
-
-/**
- * @access private
- */
-function __LZdoLock ( locker ){
- if ( !this.__LZchangeQ ){
- this.__LZchangeQ = [];
- this.__LZlocker = locker;
- }
-}
-
-
-/**
- * @access private
- */
-function __LZdoUnlock ( locker ){
-
- if ( this.__LZlocker != locker ){
- return;
- }
-
- var lzq = this.__LZchangeQ;
- this.__LZchangeQ = null;
-
- if (lzq != null) {
- for ( var i = 0; i < lzq.length; i++ ){
- var sendit = true;
- var tc = lzq[ i ];
- for ( var j = 0; j < i; j++ ){
- var oc = lzq[ j ];
- if ( tc.who == oc.who &&
- tc.what == oc.what &&
- tc.type == oc.type ){
- sendit = false;
- break;
- }
- }
-
- if ( sendit ){
- this.handleDocumentChange ( tc.what, tc.who, tc.type );
- }
- }
- }
-
-
-}
-
-/**
- * Get LzDataElement representation of primitive type, array, or object value.
- */
-static function valueToElement ( o ) {
- var n = new LzDataElement("element", { }, LzNode_DataNode_DOM.__LZv2E(o));
- return n;
-}
-
-/**
- * @param Type o: primitive type, array, or object value.
- * @return array of LzDataElements
- * @access private
- */
-static function __LZv2E ( o ) {
-
- var type = typeof( o );
- type.toLowerCase();
-
- var c = [];
- if (type == "object") {
- if ( o instanceof LzDataElement ||
- o instanceof LzDataText ) {
- c[0] = o;
- } else if (o instanceof Date) {
-
- type = "date";
- // FIXME: [2004-04-10 pkang] what should we do with dates?
-
- } else if (o instanceof Array) {
- type = "array";
- var tag = (o.__LZtag != null ? o.__LZtag : 'item');
- for (var i=0; i < o.length; i++) {
- var tmpC = LzNode_DataNode_DOM.__LZv2E( o[i] );
- c[i] = new LzDataElement(tag, null, tmpC );
- }
- } else {
- type = "struct";
- var i = 0;
- for (var k in o) {
- // skip any properties that start with __LZ
- if (k.indexOf('__LZ') == 0) continue;
- c[i++] = new LzDataElement(k, null, LzNode_DataNode_DOM.__LZv2E(o[k]));
- }
- }
- } else if (o != null) {
- c[0] = new LzDataText( o );
- }
-
- if (c.length == 0) c = null;
-
- return c;
-}
-// End of Manual include
-}
Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzReplicationManager.js
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzReplicationManager.js 2008-03-06 13:50:02 UTC (rev 8192)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzReplicationManager.js 2008-03-06 13:57:35 UTC (rev 8193)
@@ -148,6 +148,8 @@
//the real parent for this is datapaths view's (immediateparent) parent
super(odp, args, children, instcall);
+//PBR DEBUG
+trace ("LzReplicationManger ctor");
this.__LZtakeDPSlot = false; // Defined in LzDatapath
this.datacontrolsvisibility = false; // Defined in LzDatapath
@@ -600,6 +602,8 @@
* @access private
*/
function getNewClone ( forceNew = null ){
+//PBR DEBUG
+trace ("LzReplicationManager.getNewClone. cloneParent = " + this.cloneParent);
if (!this.cloneParent) {
return null;
}
@@ -650,7 +654,9 @@
/**
* @access private
*/
-override function setXPath ( xp ){
+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/glue/LaszloInitiator.lzs
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/glue/LaszloInitiator.lzs 2008-03-06 13:50:02 UTC (rev 8192)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/glue/LaszloInitiator.lzs 2008-03-06 13:57:35 UTC (rev 8193)
@@ -24,7 +24,7 @@
* children: An array of child elements.
*
*
- * @copyright Copyright 2001-2007 Laszlo Systems, Inc. All Rights Reserved.
+ * @copyright Copyright 2001-2008 Laszlo Systems, Inc. All Rights Reserved.
* Use is subject to license terms.
*
* @affects laszloinitiator
@@ -63,7 +63,12 @@
// For now, intercept traits and directly construct an LzTrait object with
// the given attributes
if ( e.name == "trait" ){
+if ($swf9) {
+ Debug.error("LaszloInitiator.lzx. LzInstantiateView. Add trait support");
+}
+else {
new LzTrait( e );
+}
return;
}
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-06 13:50:02 UTC (rev 8192)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/kernel/swf9/LzXMLParser.as 2008-03-06 13:57:35 UTC (rev 8193)
@@ -24,8 +24,9 @@
* @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 = new XML(str);
+ var xmlobj:XML = XML(str);
xmlobj.normalize();
return xmlobj;
}
More information about the Laszlo-checkins
mailing list