Name

LzDataNode — The base class for a node of hierarchical data.

Synopsis

JavaScript: LzDataNode
Type: Class
Access: public
Topic: LFC.Data
Declared in: WEB-INF/lps/lfc/data/LzDataNode.lzs

Description

LzDataNode is the base class for the classes that represent OpenLaszlo's hierarchical data format.

 <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 = 
           setAttribute('text', 'Add some children');
           break;
         case 1:
           for (var i = 1; i < 11 ; i++){
             
 
           }
           setAttribute('text', 'Add linebreaks');
           break;
         case 2:
           var dp = new LzDatapointer();
           dp.setPointer(this.n.getFirstChild());
           do {
             
           } while (dp.selectNext())
           dp.p.parentNode.appendChild(new LzDataText('\n')); 
           setAttribute('visible', false);
           break;
       }
       display.setText(display.escapeText(n.serialize()));
       ]]>
     </handler>
   </button>
 </canvas>
 

Development Note

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.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!

Superclass Chain

LzDataNode

Known Subclasses

Details

Static Properties (5)

DOCUMENT_NODE
static public var DOCUMENT_NODE = 9;
ELEMENT_NODE
static public var ELEMENT_NODE = 1;
__LZescapechars
static private var __LZescapechars = { ... };
this is similar to the escape routine in LzText, but that one's shorter since flash it's just for escaping ><
TEXT_NODE
static public var TEXT_NODE = 3;
whitespaceChars
static public var whitespaceChars = { ... };

Static Methods (2)

stringToLzData()
static public function stringToLzData(str : String, trimwhitespace : boolean, nsprefix : boolean) : LzDataElement;
Converts string to XML data.
trim()
static private function trim(str);
trim whitespace from start and end of string

Properties (1)

nodeType
public abstract var nodeType : Number;
The type of this node -- ELEMENT_NODE or TEXT_NODE

Methods (7)

childOf()
public function childOf(el : LzDataElement, allowself : Boolean);
Tells whether the given node is above this one in the node hierarchy.
getNextSibling()
public function getNextSibling() : LzDataNode;
Returns the sibling after this one this node's parentNodes List of children
getPreviousSibling()
public function getPreviousSibling() : LzDataNode;
Returns the sibling before this one this node's parentNodes List of children
__LZlockFromUpdate()
private function __LZlockFromUpdate(locker);
__LZunlockFromUpdate()
private function __LZunlockFromUpdate(locker);
__LZXMLescape()
private function __LZXMLescape(t);
setOwnerDocument()
public function setOwnerDocument(ownerDoc : LzDataNode);
Sets the LzDataNode which is the ownerDocument for this node.

Events (1)

onownerDocument
public event onownerDocument;

JavaScript Synopsis

public LzDataNode {
  static public var DOCUMENT_NODE  = 9;
  static public var ELEMENT_NODE  = 1;
  static private var __LZescapechars  = { ... };
  static public function stringToLzData (str : String, trimwhitespace : boolean, nsprefix : boolean) : LzDataElement;
  static public var TEXT_NODE  = 3;
  static private function trim (str);
  static public var whitespaceChars  = { ... };
  public abstract var nodeType  : Number;
  prototype public function childOf (el : LzDataElement, allowself : Boolean);
  prototype public function getNextSibling () : LzDataNode;
  prototype public function getPreviousSibling () : LzDataNode;
  prototype private function __LZlockFromUpdate (locker);
  prototype private function __LZunlockFromUpdate (locker);
  prototype private function __LZXMLescape (t);
  prototype public event onownerDocument ;
  prototype public function setOwnerDocument (ownerDoc : LzDataNode);
}