lz.DataNode is the base class for the classes
that represent OpenLaszlo's hierarchical data format.
<canvas 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 (this.currentstep++) {
case 0:
this.n = new lz.DataElement('numbers');
this.setAttribute('text', 'Add some children');
break;
case 1:
for (var i = 1; i < 11; i++) {
this.n.appendChild(new lz.DataElement('number', {value : i}));
}
this.setAttribute('text', 'Add linebreaks');
break;
case 2:
var dp = new lz.datapointer();
dp.setPointer(this.n.getFirstChild());
do {
dp.p.parentNode.insertBefore(new lz.DataText('\n'), dp.p);
} while (dp.selectNext())
dp.p.parentNode.appendChild(new lz.DataText('\n'));
this.setAttribute('visible', false);
break;
}
canvas.display.setAttribute('text', canvas.display.escapeText(n.serialize()));
]]></handler>
</button>
</canvas>
| Name (CSS property) | Type (tag) | Type (js) | Default | Category |
|---|---|---|---|---|
childNodes
|
[lz.DataNodeMixin] | read/write | ||
| An array of children of this node | ||||
nodeType
|
int | readonly | ||
The type of this node -- one of lz.DataElement.DOCUMENT_NODE,
lz.DataElement.ELEMENT_NODE or lz.DataElement.TEXT_NODE
|
||||
ownerDocument
|
lz.DataElementMixin | readonly | ||
| The owner document for this node. | ||||
parentNode
|
lz.DataElementMixin | readonly | ||
| The parent of this node | ||||
sel
|
read/write | |||
| Selection state of this node, used by dataselectionmanager | ||||
Methods
| childOf() |
|---|
| Parameter Name | Type | Description |
|---|---|---|
| el | lz.DataElement | The LzDataElement to test to see if it is above this one |
| allowself | Boolean | If true, this function returns true if the given node is the same as this node. |
| cloneNode() |
|---|
| Parameter Name | Type | Description |
|---|---|---|
| deep | Boolean | If true, the children of this node will be part of the new node |
| getNextSibling() |
|---|
| getOffset() |
|---|
| getParent() |
|---|
| getPreviousSibling() |
|---|
| getUserData() |
|---|
| Returns | Type | Description |
|---|---|---|
| Object | the user data associated to the given key on this node, or null if there was none. |
| serialize() |
|---|
| setUserData() |
|---|
| Parameter Name | Type | Description |
|---|---|---|
| key | String | The key to associate the object to. |
| data | Object | The object to associate to the given key, or null to remove any existing association to that key. |
| handler | Object | (optional) The handler to associate to that key, or null. |
| Returns | Type | Description |
|---|---|---|
| Object | the user data previously associated to the given key on this node, or null if there was none. |
Copyright © 2002-2010 Laszlo Systems, Inc. All Rights Reserved. Unauthorized use, duplication or distribution is strictly prohibited. This is the proprietary information of Laszlo Systems, Inc. Use is subject to license terms.