www.element4solution.com

e4s.html.tree
Interface E4TreeNode_Intf

All Known Implementing Classes:
E4DBTreeNodeDictionary, E4TreeNode

public interface E4TreeNode_Intf

Node of a tree, holds the data. The E4TreeNode_Intf defines the required functions for the D2S environment to handle tree functionality, this does not require construction of nodes.

Example_Tree.java

See Also:
E4TreeElement, E4TreeNode, E4Tree, E4ModuleTreeHandling

Method Summary
 void addNode(E4TreeNode_Intf node)
          Add a node to the current node.
 void collectScripts(E4ScriptsVec v, E4ServletImplementation_Intf servlet)
          Append the current script to the Vector, each script is identified by a name and can only appear onece in the Vector.
 void collectStylesForEditing(E4StylesHash vec, E4ServletImplementation_Intf servlet)
          Build a list (Vector) with style definitions used so far during display of this page.
 void collectTranslationsForEditing(E4TranslationsVec v, E4ServletImplementation_Intf servlet)
           
 E4TreeNode_Intf copy()
           
 int countNodes()
           
 java.lang.Object findAdditionalElement(java.lang.Class clazz)
           
 E4TreeNode_Intf findSubnode(long nodeId)
          Find a subnode within a tree.
 E4TreeNode_Intf findSubnodeText(E4String text)
          Find a subnode within a tree.
 E4TreeNode_Intf findSubnodeText(java.lang.String text)
          Find a subnode within a tree.
 java.lang.Object getAction()
          Get the associated action.
 java.util.Enumeration getAdditionalElements()
           
 E4Color getBgColor()
           
 FONT getFONT()
           
 java.lang.String getFormattedText(Language dest_lang)
          Get the displayed text, formatted.
 long getId()
          Get the identification for a tree node.
 IMG getImage()
          Get the associated image for the node, depending on the isActive() state.
 IMG getImage(boolean mode)
          Get the associated image for the node.
 java.lang.Object getObj()
          Get the associated object.
 CLASS_Name getSTYLE()
          Get the E4CSS definition for this tree node.
 java.util.Enumeration getSubNodes()
          Get an enumeration of all direct associated sub-nodes in the next level (not recursivley deeper).
 E4TreeNode_Intf[] getSubNodesArray()
          Get an array of all direct associated sub-nodes in the next level (not recursivley deeper).
 E4Label_Intf getText()
          Get the associated text.
 boolean hasSubnodes()
          Determine, if a node has subnodes.
 boolean isActive()
          Get the active state of a tree node.
 boolean isOpen()
          Get the open state of a tree node.
 void removeAllNodes()
          Removes all subnodes from this node.
 boolean removeNode(E4TreeNode_Intf node)
          Remove a node.
 boolean removeNode(long nodeId)
          Remove a node.
 void setActive(long node_id)
          Sets the active state of this node to true (active) and resets all subnodes to false (inactive).
 void setId(long id)
          Set's the ID of an node.
 void setImage(IMG image)
           
 void setImage(IMG image0, IMG image1)
           
 void setObj(java.lang.Object obj)
          set the associated object.
 void setOpen(boolean open)
          Defines the open state of only this node.
 void setOpen(boolean open, int levels)
          Defines the open state of this and deeper node.
 void sort(Language language)
          Sort the sub-elements of this node ascending.
 void sort(Language language, boolean ascending)
          Sort the sub-elements of this node.
 

Method Detail

getId

long getId()
Get the identification for a tree node. Note each tree element has a unique node id within the tree.

Returns:
the node ID

setId

void setId(long id)
Set's the ID of an node.

Parameters:
id - the new id
See Also:
E4Tree.renumberNodes(), getId()

getText

E4Label_Intf getText()
Get the associated text.

Returns:
the associated text for this tree node.
See Also:
getFormattedText(e4s.application.Language)

getFormattedText

java.lang.String getFormattedText(Language dest_lang)
Get the displayed text, formatted. This is implementation dependant, the return value can be equal than the value returned by getText(). But for example, an implementation could hold a text but display it with some markups.

Returns:
the displayed text for this tree node.
See Also:
getText()

getObj

java.lang.Object getObj()
Get the associated object.

Returns:
the associated object for this tree node.
See Also:
setObj(Object)

setObj

void setObj(java.lang.Object obj)
set the associated object.

Parameters:
obj - the object to be stored.
See Also:
getObj()

getImage

IMG getImage(boolean mode)
Get the associated image for the node. Each node is associated with one or two images. In a tree, only one node can be the active node (see isActive() and setActive(long node_id)). In the case, that two images are defined (e.g. one for the closed inactive and another for the active node) the parameter mode defines which image to be displayed. In the case, that only one image is defined (regardless if the node is active or not), this image will be displayed. Note that the definition of images is part of the implementation, not of the interface.

Parameters:
mode - false: return the first image defined, true: return the second image if defined, or return the first image if only one is defined.
Returns:
the associated image for this mode
See Also:
setImage(IMG), setImage(IMG,IMG), isOpen()

setImage

void setImage(IMG image0,
              IMG image1)

setImage

void setImage(IMG image)

getImage

IMG getImage()
Get the associated image for the node, depending on the isActive() state. This function is equal to getImage(isActive()). See also getImage(boolean mode)

Returns:
the associated image for this mode

getAction

java.lang.Object getAction()
Get the associated action. This can be either a Integer, representing an Alias from a E4Method, or it is from type A_Multiple to avoid multiple frames to be changed. See also E4Method.findMethod(int). Note, that the definition of the E4Method is part of the implementation and not of the interface.

See Also:
E4TreeNode.setAction(A_Multiple), E4TreeNode.setAction(E4Method)

isOpen

boolean isOpen()
Get the open state of a tree node. The open state represents if subnodes of a tree are displayed in the tree view. This has nothing to do with the isActive() state. Note, that there can be many or all nodes in a tree having this isOpen() state, depending on the user's choice. See also setOpen(boolean open)

Returns:
true subnodes are shown, false otherwise
See Also:
setOpen(boolean), getImage(boolean), setImage(IMG,IMG)

isActive

boolean isActive()
Get the active state of a tree node. The active state represents if this particular node was clicked by the user to run some detailed functionality, such as display a item. If a tree node is clicked, the flag is set tu true only for this node, and reset for all other nodes. So only one node within a tree should have this flag set to true. Use the function setActive(long node_id) to do so. This has nothing to do with the isOpen() state.

Returns:
true this is the selected node by the user
See Also:
setActive(long)

hasSubnodes

boolean hasSubnodes()
Determine, if a node has subnodes. Regardless, what is the open state returned by isOpen(), a tree can have subnodes. Subnodes are defined as objects from (implementing-)type E4TreeNode_Intf. Note that the declaration of sub nodes is part of the implementation, not of the interface.

Returns:
true if there is at least one subnode

setOpen

void setOpen(boolean open)
Defines the open state of only this node. By default, tree handling is associated within module E4ModuleTreeHandling. When the user clicks on a [+] or [-] symbol near by a node, the subnodes are displayed (opened) or not displayed (not opened).

See Also:
isOpen(), setOpen(boolean,int)

setOpen

void setOpen(boolean open,
             int levels)
Defines the open state of this and deeper node. By default, tree handling is associated within module E4ModuleTreeHandling. When the user clicks on a [+] or [-] symbol near by a node, the subnodes are displayed (opened) or not displayed (not opened).

Parameters:
open - true sets the node open, false sets the node closed
levels - go throught sub levels, repeat levels - 1 recursive. A value of MAX_INTEGER means all.
See Also:
isOpen()

setActive

void setActive(long node_id)
Sets the active state of this node to true (active) and resets all subnodes to false (inactive). It is highly recommended, to use this function never on a particular node but on the root node of the whole tree. All subnodes are preocessed, and only if the parameter node_id matches with one of the subnodes getId() value, then this one node is set to true (active). By default, tree handling is associated within module E4ModuleTreeHandling.

Parameters:
node_id - the node-ID (see getId()) to be changed to active
See Also:
isActive()

findSubnode

E4TreeNode_Intf findSubnode(long nodeId)
Find a subnode within a tree. It is highly recommended, to use this function never on a particular node but on the root node of the whole tree, as all subnodes are searched recursivley.

Parameters:
nodeId - the node-ID (see getId()) to be searched for
Returns:
null if not found, a associated Tree-Node if found

findSubnodeText

E4TreeNode_Intf findSubnodeText(java.lang.String text)
Find a subnode within a tree. It is highly recommended, to use this function never on a particular node but on the root node of the whole tree, as all subnodes are searched recursivley.

Parameters:
text - the text of a tree node
Returns:
null if not found, a associated Tree-Node if found

findSubnodeText

E4TreeNode_Intf findSubnodeText(E4String text)
Find a subnode within a tree. It is highly recommended, to use this function never on a particular node but on the root node of the whole tree, as all subnodes are searched recursivley.

Parameters:
text - the text of a tree node
Returns:
null if not found, a associated Tree-Node if found

getSubNodes

java.util.Enumeration getSubNodes()
Get an enumeration of all direct associated sub-nodes in the next level (not recursivley deeper).

Returns:
null if no sub nodes are defined or an enumeration representing all subnodes in the following level
See Also:
addNode(e4s.html.tree.E4TreeNode_Intf)

getSubNodesArray

E4TreeNode_Intf[] getSubNodesArray()
Get an array of all direct associated sub-nodes in the next level (not recursivley deeper).

Returns:
null if no sub nodes are defined or an array representing all subnodes in the following level
See Also:
getSubNodes()

addNode

void addNode(E4TreeNode_Intf node)
Add a node to the current node. Each node can have more than one subnode.

Parameters:
node - the subnode to add (this can be an end node - leaf - or it can recursive have subnodes either.
See Also:
getSubNodes(), findSubnode(long), removeAllNodes()

removeNode

boolean removeNode(long nodeId)
Remove a node.

Parameters:
nodeId - the ID of the node
Returns:
true if node was found and removed

removeNode

boolean removeNode(E4TreeNode_Intf node)
Remove a node.

Parameters:
node - the node to be removed
Returns:
true if node was found and removed
See Also:
removeNode(long)

removeAllNodes

void removeAllNodes()
Removes all subnodes from this node.

See Also:
addNode(e4s.html.tree.E4TreeNode_Intf), getSubNodes(), findSubnode(long)

collectScripts

void collectScripts(E4ScriptsVec v,
                    E4ServletImplementation_Intf servlet)
Append the current script to the Vector, each script is identified by a name and can only appear onece in the Vector.

Parameters:
v - the Vector where scripts are added.
See Also:
E4JavaScript

collectStylesForEditing

void collectStylesForEditing(E4StylesHash vec,
                             E4ServletImplementation_Intf servlet)
Build a list (Vector) with style definitions used so far during display of this page. Run throught all subclasses elements and collect their styles as well. Note, that a style will only be added one time. The Vector contains elements of class E4StyleUsage.

Parameters:
v - the Vector where the styles will be collected, may not be null
See Also:
E4ServletImplementation_Intf.sessionCanEditStyles(), #collectStylesForEditing( e4s.html.style.E4StylesHash, STYLE_Name, boolean)

getAdditionalElements

java.util.Enumeration getAdditionalElements()

findAdditionalElement

java.lang.Object findAdditionalElement(java.lang.Class clazz)

getBgColor

E4Color getBgColor()

getFONT

FONT getFONT()

getSTYLE

CLASS_Name getSTYLE()
Get the E4CSS definition for this tree node.

See Also:
E4TreeNode.setSTYLE(e4s.html.style.CLASS_Name)

collectTranslationsForEditing

void collectTranslationsForEditing(E4TranslationsVec v,
                                   E4ServletImplementation_Intf servlet)

sort

void sort(Language language)
Sort the sub-elements of this node ascending.

See Also:
sort( e4s.application.Language, boolean)

sort

void sort(Language language,
          boolean ascending)
Sort the sub-elements of this node.

Parameters:
ascending - true = sort ascending, false = descending
See Also:
sort( e4s.application.Language )

countNodes

int countNodes()

copy

E4TreeNode_Intf copy()

www.element4solution.com