private
Node
appendChild
(
childNode
)
Appends a node to the child collection.
- Parameters:
-
childNode <Node>
the new node
- Returns:
Node
- the child node
Node
appendTo
(
parentNode
)
Appends this node to the supplied node's child collection
- Parameters:
-
parentNode <Node>
the node to append to.
- Returns:
Node
- The appended node
boolean
applyParent
(
parentNode
)
Certain properties for the node cannot be set until the parent
is known. This is called after the node is inserted into a tree.
the parent is also applied to this node's children in order to
make it possible to move a branch from one tree to another.
- Parameters:
-
parentNode <Node>
this node's parent node
- Returns:
boolean
- true if the application was successful
void
collapse
toggle style.
(
)
Hides this nodes children (creating them if necessary), changes the
void
collapseAll
(
)
Recursively collapses all of this node's children.
string
completeRender
(
)
Called when we know we have all the child data.
- Returns:
string
- children html
void
expand
(
)
Shows this nodes children (creating them if necessary), changes the
toggle style, and collapses its siblings if multiExpand is not set.
void
expandAll
(
)
Recursively expands all of this node's children.
Node
getAncestor
(
depth
)
Returns this node's ancestor at the specified depth.
- Parameters:
-
depth <int>
the depth of the ancestor.
- Returns:
Node
- the ancestor
HTMLElement
getChildrenEl
(
)
Returns the div that was generated for this node's children
- Returns:
HTMLElement
- this node's children div
string
getChildrenElId
(
)
Returns the id for this node's children div
- Returns:
string
- the element id for this node's children div
private
string
getChildrenHtml
(
)
Called when first rendering the tree. We always build the div that will
contain this nodes children, but we don't render the children themselves
unless this node is expanded.
- Returns:
string
- the children container div html and any expanded children
string
getDepthStyle
(
depth
)
Returns the css class for the spacer at the specified depth for
this node. If this node's ancestor at the specified depth
has a next sibling the presentation is different than if it
does not have a next sibling
- Parameters:
-
depth <int>
the depth of the ancestor.
- Returns:
string
- the css class for the spacer
HTMLElement
getEl
(
)
Returns this node's container html element
- Returns:
HTMLElement
- the container html element
string
getElId
(
)
Returns the id for this node's container div
- Returns:
string
- the element id
string
getHoverStyle
(
)
Returns the hover style for the icon
- Returns:
string
- the css class hover state
string
getHtml
(
)
Returns the markup for this node and its children.
- Returns:
string
- the markup for this node and its expanded children.
int
getIconMode
(
)
Returns the current icon mode. This refers to the way childless dynamic
load nodes appear.
- Returns:
int
- 0 for collapse style, 1 for leaf node style
string
getNodeHtml
(
)
Get the markup for the node. This is designed to be overrided so that we can
support different types of nodes.
- Returns:
string
- The HTML that will render this node.
void
getSiblings
(
)
Returns a node array of this node's siblings, null if none.
string
getStyle
(
)
Returns the css style name for the toggle
- Returns:
string
- the css class for this node's toggle
HTMLElement
getToggleEl
(
)
Returns the element that is being used for this node's toggle.
- Returns:
HTMLElement
- this node's toggle html element
string
getToggleElId
(
)
Returns the id for this node's toggle element
- Returns:
string
- the toggel element id
string
getToggleLink
(
)
Generates the link that will invoke this node's toggle method
- Returns:
string
- the javascript url for toggling this node
boolean
hasChildren
(
checkForLazyLoad
)
Checks if this node has children. If this node is lazy-loading and the
children have not been rendered, we do not know whether or not there
are actual children. In most cases, we need to assume that there are
children (for instance, the toggle needs to show the expandable
presentation state). In other times we want to know if there are rendered
children. For the latter, "checkForLazyLoad" should be false.
- Parameters:
-
checkForLazyLoad <boolean>
should we check for unloaded children?
- Returns:
boolean
- true if this has children or if it might and we are
checking for this condition.
void
hideChildren
(
)
Hides this node's children
void
init
(
oData
,
oParent
,
expanded
)
Initializes this node, gets some of the properties from the parent
- Parameters:
-
oData <object>
a string or object containing the data that will
be used to render this node
-
oParent <Node>
this node's parent node
-
expanded <boolean>
the initial expanded/collapsed state
- Returns:
void
Node
insertAfter
(
node
)
Inserts this node after the supplied node
- Parameters:
-
node <Node>
the node to insert after
- Returns:
Node
- the inserted node
Node
insertBefore
(
node
)
Inserts this node before this supplied node
- Parameters:
-
node <Node>
the node to insert this node before
- Returns:
Node
- the inserted node
private
boolean
isChildOf
(
parentNode
)
Returns true if the Node is a child of supplied Node
- Parameters:
-
parentNode <Node>
the Node to check
- Returns:
boolean
- The node index if this Node is a child of
supplied Node, else -1.
boolean
isDynamic
(
)
Evaluates if this node's children should be loaded dynamically. Looks for
the property both in this instance and the root node. If the tree is
defined to load all children dynamically, the data callback function is
defined in the root node
- Returns:
boolean
- true if this node's children are to be loaded dynamically
boolean
isRoot
(
)
Evaluates if this node is the root node of the tree
- Returns:
boolean
- true if this is the root node
void
loadComplete
(
)
Load complete is the callback function we pass to the data provider
in dynamic load situations.
void
refresh
(
)
Regenerates the html for this node and its children. To be used when the
node is expanded and new children have been added.
private
string
renderChildren
(
)
Generates the markup for the child nodes. This is not done until the node
is expanded.
- Returns:
string
- the html for this node's children
void
setDynamicLoad
(
fmDataLoader
,
iconMode
)
Configures this node for dynamically obtaining the child data
when the node is first expanded. Calling it without the callback
will turn off dynamic load for the node.
- Parameters:
-
fmDataLoader <function>
the function that will be used to get the data.
-
iconMode <int>
configures the icon that is displayed when a dynamic
load node is expanded the first time without children. By default, the
"collapse" icon will be used. If set to 1, the leaf node icon will be
displayed.
- Returns:
void
void
showChildren
(
)
Shows this node's children
void
toggle
(
)
Expands if node is collapsed, collapses otherwise.
string
toString
(
)
Node toString
- Returns:
string
- string representation of the node