Class SweetDevRia.Tree
Extends
RiaComponent, RiaComponent.
Defined in: Tree.js.
Constructor Attributes | Constructor Name and Description |
---|---|
SweetDevRia.Tree(id)
This is the Tree component class
|
Field Attributes | Field Name and Description |
---|---|
<static> |
SweetDevRia.Tree.ADD_EVENT
This event type is fired when add a node
|
<static> |
SweetDevRia.Tree.COPY_EVENT
This event type is fired when copy a node
|
<static> |
SweetDevRia.Tree.CUT_EVENT
This event type is fired when cut a node
|
<static> |
SweetDevRia.Tree.DEFAULT_NODE_HEIGHT
Default node height
|
<static> |
SweetDevRia.Tree.DELETE_EVENT
This event type is fired when delete a node
|
<static> |
SweetDevRia.Tree.DRAG_PREFIXE
Suffixe for the drag and drop ids, related to each nodes
|
<static> |
SweetDevRia.Tree.LOAD_EVENT
This event type is fired when load a node
|
<static> |
SweetDevRia.Tree.MODIFY_EVENT
This event type is fired when modify a node
|
<static> |
SweetDevRia.Tree.PASTE_EVENT
This event type is fired when paste a node
|
Method Attributes | Method Name and Description |
---|---|
<private> |
Reinitializes and open the window showing the "Add Node" feature.
|
<private> |
addNodeDD(nodeId)
Adds the Drag and Drop feature to a node
|
addNodeType(nodeType)
Adds a node type for this tree
|
|
<private> |
addNodeWindowAction(evt)
Action triggered on an node creation request
Closes the window as well.
|
afterAddNode(parentNode, newLabel, nodeType)
This method is called after adding a node.
|
|
afterCopyNode(node)
This method is called after copying a node.
|
|
afterCutNode(node)
This method is called after cutting a node.
|
|
afterDeleteNode(nodeId)
This method is called after deleting a node.
|
|
afterLoadNode(node)
This method is called after having called a server request for a node.
|
|
afterModifyNode(node, newLabel, nodeType)
This method is called after editing a node.
|
|
afterOnLoadNode(node)
This method is called after having processed a node load response
|
|
afterPasteNode(parentNode, position)
This method is called after pasting a node.
|
|
beforeAddNode(parentNode, newLabel, nodeType)
This method is called before adding a node
To be overridden !!
|
|
beforeCopyNode(node)
This method is called before copying a node
To be overridden !!
|
|
beforeCutNode(node)
This method is called before cutting a node
To be overridden !!
|
|
beforeDeleteNode(nodeId)
This method is called before deleting a node
To be overridden !!
|
|
beforeLoadNode(node)
This method is called before loading a node from the server
To be overridden !!
|
|
beforeModifyNode(node, newLabel, nodeType)
This method is called before editing a node
To be overridden !!
|
|
beforeOnLoadNode(node)
This method is called before processing a node load response
To be overridden !!
|
|
beforePasteNode(parentNode, position)
This method is called before pasting a node
To be overridden !!
|
|
<private> |
copyNode(node)
Action triggered on a node copy.
|
<private> |
cutNode(node)
Action triggered on a node cut.
|
<private> |
deleteChildNodes(nodeId)
Delete the whole child nodes of a node
|
<private> |
deleteNode(nodeId)
Delete a specific node, removing its visual and JavaScript instances.
|
<private> |
Action triggered on a node deletion
|
<private> |
Generates and initializes the add window
|
generateCopiedNodeId(nodeSrcId)
Return a copy id for the node given in parameter.
|
|
<private> |
Generate the list context menu that allow to the user to add, delete or modify items.
|
<private> |
Generates and initializes the modify window
|
generateNewNodeId(parentNodeId)
Generates a new id for a node to create and add into the parentNodeId in parameter
The generated id is equivalent to "NewNode_%nextCount%", nextCount the next number created.
|
|
getAppendice(nodeSrcId)
Return the text to append to this node id,
ensuring the unicity of the node generated by appending this returned string to the nodeSrcId.
|
|
getNode(nodeId)
Get a node registered in this tree, according to its id
|
|
<private> |
getNodeData(node, createId, deep)
Return the data related to a node and allowing a cloning.
|
getNodeType(nodeTypeId)
Get a node type according to its id
|
|
<private> |
Initialization on page load
|
loadNode(node)
Load the content of a node
|
|
<private> |
Reinitializes and open the window showing the "Modify Node" feature.
|
<private> |
Action triggered on an node modification request
Closes the window as well.
|
<private> |
onClickNode(evt)
Event triggered on a node click
|
<private> |
onLoadNode(evt)
Callback method of the node loading
|
onSelect(The)
This method is called when a node is selected
To be overridden !!
|
|
<private> |
parseTreeNode(nodeData, parentNode, position)
Parses a tree node as they are sent by the server
|
<private> |
parseTreeNodeChildren(childrenData, parentNode)
Parses the children of a node
|
<private> |
pasteNode(parentNode, position)
This function paste a node at a specific position.
|
refresh(reload)
Refreshes the content of the node and its children by redrawing the content of its container
|
|
<private> |
register(node)
Register a node in this tree
Each node is registered only once
|
<private> |
setRoot(root)
Set the root of this tree, before initialization and rendering
|
<private> |
setRootData(rootData)
Set the root data in this tree, as they are sent by the server
This method parses the data, creates the TreeNodes objects and set them into the tree
|
<private> |
unregister(node)
Unregister a node in this tree
All its child nodes are unregistered as well
|
Updates the server model.
|
Class Detail
SweetDevRia.Tree(id)
This is the Tree component class
- Parameters:
- {String} id
- Id of this tree
Field Detail
<static>
SweetDevRia.Tree.ADD_EVENT
This event type is fired when add a node
<static>
SweetDevRia.Tree.COPY_EVENT
This event type is fired when copy a node
<static>
SweetDevRia.Tree.CUT_EVENT
This event type is fired when cut a node
<static>
SweetDevRia.Tree.DEFAULT_NODE_HEIGHT
Default node height
<static>
SweetDevRia.Tree.DELETE_EVENT
This event type is fired when delete a node
<static>
{String}
SweetDevRia.Tree.DRAG_PREFIXE
Suffixe for the drag and drop ids, related to each nodes
<static>
SweetDevRia.Tree.LOAD_EVENT
This event type is fired when load a node
<static>
SweetDevRia.Tree.MODIFY_EVENT
This event type is fired when modify a node
<static>
SweetDevRia.Tree.PASTE_EVENT
This event type is fired when paste a node
Method Detail
<private>
addNodeAction()
Reinitializes and open the window showing the "Add Node" feature.
<private>
addNodeDD(nodeId)
Adds the Drag and Drop feature to a node
- Parameters:
- {String} nodeId
- The id to add a drag and drop on
addNodeType(nodeType)
Adds a node type for this tree
- Parameters:
- {Object} nodeType
- the nodeType to add. This object must be the reflection of the Java one (NodeTypeBean).
<private>
addNodeWindowAction(evt)
Action triggered on an node creation request
Closes the window as well.
- Parameters:
- evt
afterAddNode(parentNode, newLabel, nodeType)
This method is called after adding a node.
- Parameters:
- {TreeNode} parentNode
- the node which will receive the new one
- {String} newLabel
- the new node label
- {String} nodeType
- the new node type To be overridden !!
afterCopyNode(node)
This method is called after copying a node.
- Parameters:
- {TreeNode} node
- the node to copy To be overridden !!
afterCutNode(node)
This method is called after cutting a node.
- Parameters:
- {TreeNode} node
- the node to cut To be overridden !!
afterDeleteNode(nodeId)
This method is called after deleting a node.
- Parameters:
- {String} nodeId
- the node id to delete To be overridden !!
afterLoadNode(node)
This method is called after having called a server request for a node.
- Parameters:
- {TreeNode} node
- the node to load To be overridden !!
afterModifyNode(node, newLabel, nodeType)
This method is called after editing a node.
- Parameters:
- {TreeNode} node
- the edited node
- {String} newLabel
- the new node label
- {String} nodeType
- the new node type To be overridden !!
afterOnLoadNode(node)
This method is called after having processed a node load response
- Parameters:
- {TreeNode} node
- the node to load To be overridden !!
afterPasteNode(parentNode, position)
This method is called after pasting a node.
- Parameters:
- {TreeNode} parentNode
- the node where the paste is performed
- {int} position
- the position where the node must be pasted in this parent To be overridden !!
{boolean}
beforeAddNode(parentNode, newLabel, nodeType)
This method is called before adding a node
To be overridden !!
- Parameters:
- {TreeNode} parentNode
- the node which will receive the new one
- {String} newLabel
- the new node label
- {String} nodeType
- the new node type
- Returns:
- True if this method can be called, else false.
{boolean}
beforeCopyNode(node)
This method is called before copying a node
To be overridden !!
- Parameters:
- {TreeNode} node
- the node to copy
- Returns:
- True if this method can be called, else false.
{boolean}
beforeCutNode(node)
This method is called before cutting a node
To be overridden !!
- Parameters:
- {TreeNode} node
- the node to cut
- Returns:
- True if this method can be called, else false.
{boolean}
beforeDeleteNode(nodeId)
This method is called before deleting a node
To be overridden !!
- Parameters:
- {String} nodeId
- the node id to delete
- Returns:
- True if this method can be called, else false.
{boolean}
beforeLoadNode(node)
This method is called before loading a node from the server
To be overridden !!
- Parameters:
- {TreeNode} node
- the node to load
- Returns:
- True if this method can be called, else false.
{boolean}
beforeModifyNode(node, newLabel, nodeType)
This method is called before editing a node
To be overridden !!
- Parameters:
- {TreeNode} node
- the edited node
- {String} newLabel
- the new node label
- {String} nodeType
- the new node type
- Returns:
- True if this method can be called, else false.
{boolean}
beforeOnLoadNode(node)
This method is called before processing a node load response
To be overridden !!
- Parameters:
- {TreeNode} node
- the node to load
- Returns:
- True if this method can be called, else false.
{boolean}
beforePasteNode(parentNode, position)
This method is called before pasting a node
To be overridden !!
- Parameters:
- {TreeNode} parentNode
- the node where the paste is performed
- {int} position
- the position where the node must be pasted in this parent
- Returns:
- True if this method can be called, else false.
<private>
copyNode(node)
Action triggered on a node copy.
This function bufferize the node being copied.
- Parameters:
- {TreeNode} node
- the node to copy
<private>
cutNode(node)
Action triggered on a node cut.
This function bufferize the node being cut.
- Parameters:
- {TreeNode} node
- the node to cut
<private>
deleteChildNodes(nodeId)
Delete the whole child nodes of a node
- Parameters:
- {String} nodeId
- the node id to remove the children
<private>
deleteNode(nodeId)
Delete a specific node, removing its visual and JavaScript instances.
- Parameters:
- {String} nodeId
- the node id to delete
<private>
deleteNodeAction()
Action triggered on a node deletion
<private>
generateAddWindow()
Generates and initializes the add window
{String}
generateCopiedNodeId(nodeSrcId)
Return a copy id for the node given in parameter.
The generated is equivalent to "%nodeSrcId%_%nextCount%", nextCount the next number copied.
- Parameters:
- {String} nodeSrcId
- the node to append the appendice.
- Returns:
- the new node id created, related to the parameter one
<private>
generateMenu()
Generate the list context menu that allow to the user to add, delete or modify items.
The generation is not performed if the 3 actions are forbidden.
<private>
generateModifyWindow()
Generates and initializes the modify window
{String}
generateNewNodeId(parentNodeId)
Generates a new id for a node to create and add into the parentNodeId in parameter
The generated id is equivalent to "NewNode_%nextCount%", nextCount the next number created.
- Parameters:
- {String} parentNodeId
- the parent node to create the new one. Not used by default.
- Returns:
- the new node id created
{String}
getAppendice(nodeSrcId)
Return the text to append to this node id,
ensuring the unicity of the node generated by appending this returned string to the nodeSrcId.
- Parameters:
- {String} nodeSrcId
- the node to append the appendice.
- Returns:
- the appendice created
{TreeNode}
getNode(nodeId)
Get a node registered in this tree, according to its id
- Parameters:
- {String} nodeId
- The id of the node to get
- Returns:
- the node defined by this id
<private>
{Array}
getNodeData(node, createId, deep)
Return the data related to a node and allowing a cloning.
- Parameters:
- {TreeNode} node
- the node to gather the data from
- {boolean} createId
- if a new id must be generated for the data extracted
- {boolean} deep
- the recursiv ability of the data gather. If true, the children will be extracted as well.
- Returns:
- the array representing the node data, as they are sent by the server on initialization
{Object}
getNodeType(nodeTypeId)
Get a node type according to its id
- Parameters:
- {String} nodeTypeId
- The id of the node type to get
- Returns:
- the node type defined by this id
<private>
initialize()
Initialization on page load
loadNode(node)
Load the content of a node
- Parameters:
- {TreeNode} node
- the node to load
<private>
modifyNodeAction()
Reinitializes and open the window showing the "Modify Node" feature.
<private>
modifyNodeWindowAction(evt)
Action triggered on an node modification request
Closes the window as well.
- Parameters:
- evt
<private>
onClickNode(evt)
Event triggered on a node click
- Parameters:
- {HTMLEvent} evt
- The event related to the click
<private>
onLoadNode(evt)
Callback method of the node loading
- Parameters:
- {RiaEvent} evt
- the RiaEvent containing the data to load
onSelect(The)
This method is called when a node is selected
To be overridden !!
- Parameters:
- {TreeNode} The
- selected node.
<private>
{TreeNode}
parseTreeNode(nodeData, parentNode, position)
Parses a tree node as they are sent by the server
- Parameters:
- {Array} nodeData
- The data of the node as they are formatted by the server
- {TreeNode} parentNode
- The parent node of this node to parse
- {int} position
- the position of this node in its parent
- Returns:
- the node parse
<private>
parseTreeNodeChildren(childrenData, parentNode)
Parses the children of a node
- Parameters:
- {Array} childrenData
- The data of the node's children
- {TreeNode} parentNode
- The node for which the children will be parsed
<private>
pasteNode(parentNode, position)
This function paste a node at a specific position. Called on copy, cut, and drag and drop
- Parameters:
- {TreeNode} parentNode
- the node where the paste is performed
- {int} position
- the position where the node must be pasted in this parent
refresh(reload)
Refreshes the content of the node and its children by redrawing the content of its container
- Parameters:
- {boolean} reload
- If true, all children are clear and so reload from server.
<private>
register(node)
Register a node in this tree
Each node is registered only once
- Parameters:
- {TreeNode} node
- The node to register
<private>
setRoot(root)
Set the root of this tree, before initialization and rendering
- Parameters:
- {TreeNode} root
- The root node.
<private>
setRootData(rootData)
Set the root data in this tree, as they are sent by the server
This method parses the data, creates the TreeNodes objects and set them into the tree
- Parameters:
- {Array} rootData
- The root data as sent by the server
<private>
unregister(node)
Unregister a node in this tree
All its child nodes are unregistered as well
- Parameters:
- {TreeNode} node
- The node to register
updateServerModel()
Updates the server model.