WebFXTreeAbstractNode
Abstract object with common functions and methods shared by WebFXTree and WebFXTreeItem. The two of those inherites from this object.
Constructor
Abstract object - no instances of it should be created
Properties
Name | Type | Description |
id | Number | Read only property that can be used to find the related HTMLElement. It can also be used the other way around. If you know the id of the HTMLElement you can get the JS object by looking in the webFXTreeHandler.all collection. |
text | String | The text label for the node. |
action | String | The action (uri) associated with the node. |
open | Boolean | Read only. Boolean property that tells if the node is expanded or collapsed (will always return false if there are no child nodes). |
icon | String | Image file to use as icon. Uses default if not specified. |
openIcon | String | Image file to use as the open icon (if child nodes only). Uses default if not specified. |
parentNode | Reference | A reference to the parent node. |
childNodes | Array | Collection of references to all child nodes. |
Methods
Name | Returns | Description |
add(oNode, [bNoIdent]) | Reference | Adds a tree item to the current item. This method takes two argument, the first is the WebFXTreeItem object to add and the second is an optional boolean value, that if specified and set to true will prevent the tree from executing the indent method automatically once the node has been added. This parameter has no effect on calls to the add method before the tree is rendered, but settings this flag when adding nodes after the tree has been rendered will greatly reduce the time needed to complete the operation, this can be quite useful while adding more than one node at a time, but requires that the indent method is manually executed on the top most node affected by the changes afterwards. Returns a reference to the added node. |
indent() | Void | Redraws the traces between nodes and makes sure the tree is properly layed out. |
toggle() | Void | Toggles the expand/collapse. |
expand() | Void | Expands the tree item. |
collapse() | Void | Collapses the tree item. |
expandAll() | Void | Expands the tree item and all sub items recursively. |
collapseAll() | Void | Collapses the tree root and all sub items recursively. |
expandChildren() | Void | Expands all sub items recursively (same as executing expandAll and the collapse). |
collapseChildren() | Void | Collapses all sub items recursively (same as executing collapseAll and the expand). |
getNextSibling() | Reference | Returns a reference to the next sibling. |
getPreviousSibling() | Reference | Returns a reference to the previous sibling. |
toString() | String | Genereates the HTML string needed to render the tree item. |
WebFXTree
The WebFXTree object is used to create the actual tree root that can later be populated with tree items. All properties and methods from the WebFXTreeAbstractNode are inherited.
Constructor
new WebFXTree([text], [action], [behavior])
Name | Type | Description |
text | String | Optional. The text label for the tree root. |
action | String | Optional. The action (uri) associated with the tree root. |
behavior | String | Optional. Name of the behavior to use, check the setBehavior() method for details. |
icon | String | Optional. Image to use as the icon. |
openIcon | String | Optional. Image to use as the open icon. |
Properties
Name | Type | Description |
rendered | Boolean | Flag that indicates whatever or no the tree has been generated and rendered. |
Methods
Name | Returns | Description |
getSelected() | Reference | Returns the id of the selected object, if any. |
setBehavior(sBehavior) | Void | Has to be specified before the tree is created and can be used to change the way the tree behaves, possible values are classic (default) and explorer. Check the usage page for more information about this. |
getBehavior() | String | Returns the name of the behavior used. |
WebFXTreeItem
Used to create tree items, can be added (uisng the add method) to a WebFXTree or to another WebFXTreeItem object. All properties and methods from the WebFXTreeAbstractNode are inherited.
Constructor
new WebFXTreeItem([text], [action], [parent], [icon], [openIcon])
Name | Type | Description |
text | String | Optional. The text label for the tree item. |
action | String | Optional. The action (uri) associated with the tree item. |
parent | Reference | Optional. Reference to an object to witch the node should be added. |
icon | String | Optional. Image to use as the icon. |
openIcon | String | Optional. Image to use as the open icon. |
Properties
Name | Type | Description |
None but the inherited ones |
Methods
Name | Returns | Description |
getFirst() | Reference | Returns a reference to the first child node, if any. |
getLast() | Reference | Returns a reference to the last child node, if any. |
History & Introduction
Usage
API
下载代码地址
/Files/wuzk2008/xtree/xtree117.zipImplementation
Demo
Download