www.element4solution.com

e4s.html.tree
Class E4Tree

java.lang.Object
  extended by e4s.util.E4Object
      extended by e4s.html.E4HtmlObject
          extended by e4s.html.tree.E4Tree
Direct Known Subclasses:
E4BlockMenu

public class E4Tree
extends E4HtmlObject

helper class, displaying a tree within your HTML page. The E4Tree stand somehow between the E4TreeElement and the E4TreeNode. It is more internal required in the D2S environment, rather than a class to build up applications on.

Example_Tree.java

Since:
JDK 1.4
See Also:
E4TreeElement, E4TreeNode, E4TreeNode_Intf, E4ModuleTreeHandling

Field Summary
static java.lang.String _SCRIPT_ACTIVATE_NODE
          Script name for activating nodes
static java.lang.String _SCRIPT_REFRESH_NODE
          Script name for refreshing treen nodes
static java.lang.String _SCRIPT_TOGGLE_NODE
          Script name for activating nodes
static int DEFAULT_LAYOUT
           
protected  E4Method m_ActivateNode
           
protected  E4JavaScript m_jsActivate
           
protected  E4JavaScript m_jsRefresh
           
protected  E4JavaScript m_jsToggle
           
 int m_style_layout
           
protected  E4Method m_ToggleNode
           
protected  E4TreeNode_Intf m_tree
           
static int TREE_STYLE_IMAGES_A
           
static int TREE_STYLE_IMAGES_B
           
static int TREE_STYLE_IMAGES_C
           
 
Fields inherited from class e4s.html.E4HtmlObject
m_parent_e4sID
 
Fields inherited from class e4s.util.E4Object
CRLF, E4S_CORE_SYSTEM_LANGUAGE, NBSP, NULLSTR, URL_ENCODING_CHARSET
 
Constructor Summary
  E4Tree(E4ID parent_id, java.lang.String persistantObjId, E4TreeNode_Intf tree, E4FrameName target, E4ServletImplementation_Intf servlet)
           
protected E4Tree(java.lang.String persistantObjPrefix, java.lang.String persistantObjId, E4TreeNode_Intf tree, E4FrameName target, E4ServletImplementation_Intf servlet)
           
 
Method Summary
static java.lang.String _getSVNVersionString()
          Get version info string from subversion.
protected  void buildScripting(E4ServletImplementation_Intf servlet)
          Define some screepts needed.
 void collectScripts(E4ScriptsVec v, E4ServletImplementation_Intf servlet)
           
 void collectStylesForEditing(E4StylesHash v, E4ServletImplementation_Intf servlet)
           
 void collectTranslationsForEditing(E4TranslationsVec v, E4ServletImplementation_Intf servlet)
           
 E4Tree copy()
           
 void defineMethod_Activate(E4Method activateNode, E4ServletImplementation_Intf servlet)
          Define the method which will be used when the user clicks on a tree item.
 void defineMethod_Toggle(E4Method toggleNode, E4ServletImplementation_Intf servlet)
          Define the method which will be used when the user opens/closes the node of a tree.
 void defineMethod(E4Method toggleNode, E4Method activateNode, E4ServletImplementation_Intf servlet)
          Deprecated.  
 E4ID E4ID()
          Get the E4ID of the object.
static java.lang.String Escape(java.lang.String s, boolean quote2quote)
           
 E4TreeNode_Intf findAboveNode(E4TreeNode_Intf node)
          Find the parent node to a given nodeId.
 E4TreeNode_Intf findAboveNode(long nodeId)
          Find the parent node to a given nodeId.
 E4TreeNode_Intf findNextNode(E4TreeNode_Intf node)
          Find the next node on the same level to a given nodeId.
 E4TreeNode_Intf findNextNode(long nodeId)
          Find the next node on the same level to a given nodeId.
 E4TreeNode_Intf findPrevNode(E4TreeNode_Intf node)
          Find the next node on the same level to a given nodeId.
 E4TreeNode_Intf findPrevNode(long nodeId)
          Find the previous node on the same level to a given nodeId.
 E4TreeNode_Intf findSubnode(E4CgiParams params)
           
 E4TreeNode_Intf findSubnode(long nodeId)
           
 E4TreeNode_Intf findSubnodeText(E4String text)
           
 E4TreeNode_Intf findSubnodeText(java.lang.String text)
           
 long getCreationTime()
           
 FONT getFONT()
           
 int getImageStyle()
          Get the basic layout style of the tree.
 java.lang.Object getObj()
          Get an additional object to be stored together with the tree.
 long[] getOpenNodes()
          Get an array of nodes which are open.
 java.lang.String getOpenNodesString()
          Get a list of nodes which are open.
 java.lang.String getPersistantObjectID()
           
 E4TreeNode_Intf getRootNode()
           
 java.lang.String getTableWidth()
           
 E4FrameName getTarget()
           
static E4Tree getTree(java.lang.String persistantObjId, E4ServletImplementation_Intf servlet)
          Retrieves a tree object out of the persistant list of tree objects.
static E4Tree getTree(java.lang.String persistantObjId, E4ServletImplementation_Intf servlet, boolean except_not_found)
          Retrieves a tree object out of the persistant list of tree objects.
protected  void initImages()
           
protected  void initImages(boolean force_update)
           
 void removeAllNodes()
           
 boolean removeNode(long nodeId)
          Remove a node.
static void removeTree(java.lang.String persistantObjId, E4ServletImplementation_Intf servlet)
           
 void renumberNodes()
          Renumbers the nodes, starting with 1.
 void setActive(long nodeId)
           
 void setDefaultMethod(E4Method mref)
          Define a action for all nodes, this can be overridden by E4TreeNode.setAction(e4s.html.E4Method).
 void setFONT(FONT font)
           
 void setImageStyle(int layout)
          Set the style for the images
 void setObj(java.lang.Object obj)
          Set an additional object to be stored together with the tree.
 void setOpenNodes(long[] nodes)
          Define which nodes are open in a tree.
 void setOpenNodes(java.lang.String nodes)
          Define which nodes are open in a tree.
 void setTableWidth(int width)
           
 void setTableWidthMax()
           
 void sort(Language language)
          Sort the sub-elements of this tree ascending.
 void sort(Language language, boolean ascending)
          Sort the sub-elements of this node.
 void toHtml(E4StringBufferHtml buf, E4ServletImplementation_Intf servlet)
           
protected  void toHtml(E4StringBufferHtml buf, E4TreeNode_Intf node, CLASS_Name css_name, E4ServletImplementation_Intf servlet, java.lang.String sofar, boolean islast)
           
 java.lang.String toString()
           
 
Methods inherited from class e4s.html.E4HtmlObject
E4ID, set_e4sID
 
Methods inherited from class e4s.util.E4Object
Calendar, CName, CName, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelNone, E4LabelNone, E4LabelNone, E4LabelNone, E4LabelSys, E4LabelSys, e4sCopyright, e4sVersion, encode, encode, encode, encodeHtml, encodeHtml, encodeHtml, encodeURL, encodeURL, encodeURL, finalize, getLINE, getTRACE, getTRACE, getTRACE, getTRACE, getTRACE, getTRACE, getTraceMemory, HtmlEncode, HtmlEncode, HtmlEncode, isdecimal, isdigit, isnotok, isnotok, isnumeric, isok, isok, isok, isok, lastCallingFunction, lastCallingFunction, lastCallingFunction, lastCallingFunction, lastCallingStack, mkdirs, null2nbsp, null2nbsp, null2nbsp, ok, ok, ok, ok, outPrintln, setLogFile4Trace, setTraceMemory, STACKTRACE, toDebug, toDouble, toFloat, toFloat, TRACE_CALLS, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, wait
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_tree

protected E4TreeNode_Intf m_tree

m_jsToggle

protected E4JavaScript m_jsToggle

m_jsActivate

protected E4JavaScript m_jsActivate

m_jsRefresh

protected E4JavaScript m_jsRefresh

TREE_STYLE_IMAGES_A

public static final int TREE_STYLE_IMAGES_A
See Also:
Constant Field Values

TREE_STYLE_IMAGES_B

public static final int TREE_STYLE_IMAGES_B
See Also:
Constant Field Values

TREE_STYLE_IMAGES_C

public static final int TREE_STYLE_IMAGES_C
See Also:
Constant Field Values

DEFAULT_LAYOUT

public static final int DEFAULT_LAYOUT
See Also:
Constant Field Values

m_style_layout

public int m_style_layout

m_ToggleNode

protected E4Method m_ToggleNode

m_ActivateNode

protected E4Method m_ActivateNode

_SCRIPT_REFRESH_NODE

public static final java.lang.String _SCRIPT_REFRESH_NODE
Script name for refreshing treen nodes

See Also:
Constant Field Values

_SCRIPT_ACTIVATE_NODE

public static final java.lang.String _SCRIPT_ACTIVATE_NODE
Script name for activating nodes

See Also:
Constant Field Values

_SCRIPT_TOGGLE_NODE

public static final java.lang.String _SCRIPT_TOGGLE_NODE
Script name for activating nodes

See Also:
Constant Field Values
Constructor Detail

E4Tree

protected E4Tree(java.lang.String persistantObjPrefix,
                 java.lang.String persistantObjId,
                 E4TreeNode_Intf tree,
                 E4FrameName target,
                 E4ServletImplementation_Intf servlet)

E4Tree

public E4Tree(E4ID parent_id,
              java.lang.String persistantObjId,
              E4TreeNode_Intf tree,
              E4FrameName target,
              E4ServletImplementation_Intf servlet)
Method Detail

getTree

public static E4Tree getTree(java.lang.String persistantObjId,
                             E4ServletImplementation_Intf servlet)
Retrieves a tree object out of the persistant list of tree objects. Note, that a tree object is stored one time, can be modified and used as often as required under the same ObjId. This is related to one session.

Parameters:
persistantObjId - the identification of this tree object
servlet - the servlet context
Returns:
null if not found, or the object representing the tree
See Also:
e4s.servlet

removeTree

public static void removeTree(java.lang.String persistantObjId,
                              E4ServletImplementation_Intf servlet)

getTree

public static E4Tree getTree(java.lang.String persistantObjId,
                             E4ServletImplementation_Intf servlet,
                             boolean except_not_found)
                      throws java.lang.Exception
Retrieves a tree object out of the persistant list of tree objects. Note, that a tree object is stored one time, can be modified and used as often as required under the same ObjId. This is related to one session.

Parameters:
persistantObjId - the identification of this tree object
servlet - the servlet context
Returns:
null if not found, or the object representing the tree
Throws:
java.lang.Exception
See Also:
e4s.servlet

initImages

protected void initImages()

initImages

protected void initImages(boolean force_update)

defineMethod

public void defineMethod(E4Method toggleNode,
                         E4Method activateNode,
                         E4ServletImplementation_Intf servlet)
Deprecated. 

See Also:
defineMethod_Activate(e4s.html.E4Method, e4s.servlet.E4ServletImplementation_Intf), defineMethod_Toggle(e4s.html.E4Method, e4s.servlet.E4ServletImplementation_Intf)

defineMethod_Toggle

public void defineMethod_Toggle(E4Method toggleNode,
                                E4ServletImplementation_Intf servlet)
Define the method which will be used when the user opens/closes the node of a tree.

Parameters:
toggleNode - the method to be used
servlet - the servlet context
See Also:
E4ModuleTreeHandling.toggleNode, defineMethod_Activate(e4s.html.E4Method, e4s.servlet.E4ServletImplementation_Intf)

defineMethod_Activate

public void defineMethod_Activate(E4Method activateNode,
                                  E4ServletImplementation_Intf servlet)
Define the method which will be used when the user clicks on a tree item.

Parameters:
activateNode - the method to be used
servlet - the servlet context
See Also:
E4ModuleTreeHandling.activateNode, defineMethod_Toggle(e4s.html.E4Method, e4s.servlet.E4ServletImplementation_Intf)

buildScripting

protected void buildScripting(E4ServletImplementation_Intf servlet)
Define some screepts needed.

Parameters:
servlet - the servlet context
See Also:
e4s.HTML.E4TreeElement#addScripts()

toHtml

public void toHtml(E4StringBufferHtml buf,
                   E4ServletImplementation_Intf servlet)
            throws java.lang.Exception
Throws:
java.lang.Exception

toHtml

protected void toHtml(E4StringBufferHtml buf,
                      E4TreeNode_Intf node,
                      CLASS_Name css_name,
                      E4ServletImplementation_Intf servlet,
                      java.lang.String sofar,
                      boolean islast)
               throws java.lang.Exception
Throws:
java.lang.Exception

setDefaultMethod

public void setDefaultMethod(E4Method mref)
Define a action for all nodes, this can be overridden by E4TreeNode.setAction(e4s.html.E4Method).

Parameters:
mref - the default action
See Also:
E4TreeNode.setAction(e4s.html.E4Method)

getTarget

public E4FrameName getTarget()

findAboveNode

public E4TreeNode_Intf findAboveNode(long nodeId)
Find the parent node to a given nodeId.

Parameters:
nodeId - the node-identification to search for.
Returns:
null if not found, or a valid node.
See Also:
findNextNode(long), findPrevNode(long), findAboveNode(e4s.html.tree.E4TreeNode_Intf)

findAboveNode

public E4TreeNode_Intf findAboveNode(E4TreeNode_Intf node)
Find the parent node to a given nodeId.

Parameters:
node - the node to search for.
Returns:
null if not found, or a valid node.
See Also:
findNextNode(long), findPrevNode(long), findAboveNode(long)

findNextNode

public E4TreeNode_Intf findNextNode(long nodeId)
Find the next node on the same level to a given nodeId.

Parameters:
nodeId - the node-identification to search for.
Returns:
null if not found, or a valid node.
See Also:
findAboveNode(long), findPrevNode(long), findNextNode(e4s.html.tree.E4TreeNode_Intf)

findNextNode

public E4TreeNode_Intf findNextNode(E4TreeNode_Intf node)
Find the next node on the same level to a given nodeId.

Parameters:
node - the node-identification to search for.
Returns:
null if not found, or a valid node.
See Also:
findAboveNode(long), findNextNode(long), findPrevNode(long)

findPrevNode

public E4TreeNode_Intf findPrevNode(long nodeId)
Find the previous node on the same level to a given nodeId. This search always stays in the same level as the given node.

Parameters:
nodeId - the node-identification to search for.
Returns:
null if not found, or a valid node.
See Also:
findAboveNode(long), findNextNode(long), #findPrefNode(E4TreeNode_Intf)

findPrevNode

public E4TreeNode_Intf findPrevNode(E4TreeNode_Intf node)
Find the next node on the same level to a given nodeId.

Parameters:
node - the node to search for.
Returns:
null if not found, or a valid node.
See Also:
findAboveNode(long), findPrevNode(long), findNextNode(long)

findSubnode

public E4TreeNode_Intf findSubnode(long nodeId)

findSubnode

public E4TreeNode_Intf findSubnode(E4CgiParams params)

findSubnodeText

public E4TreeNode_Intf findSubnodeText(java.lang.String text)

findSubnodeText

public E4TreeNode_Intf findSubnodeText(E4String text)

setActive

public void setActive(long nodeId)

Escape

public static java.lang.String Escape(java.lang.String s,
                                      boolean quote2quote)

collectScripts

public void collectScripts(E4ScriptsVec v,
                           E4ServletImplementation_Intf servlet)

collectStylesForEditing

public void collectStylesForEditing(E4StylesHash v,
                                    E4ServletImplementation_Intf servlet)

collectTranslationsForEditing

public void collectTranslationsForEditing(E4TranslationsVec v,
                                          E4ServletImplementation_Intf servlet)

E4ID

public E4ID E4ID()
Description copied from class: E4HtmlObject
Get the E4ID of the object. The E4ID is a unique identifier for an nested HTML element, it can be either the name of the class or any previous assigned string.

Overrides:
E4ID in class E4HtmlObject
Returns:
the E4ID
See Also:
E4HtmlObject.E4ID(String), E4HtmlObject.set_e4sID(e4s.util.E4ID)

getRootNode

public E4TreeNode_Intf getRootNode()

removeAllNodes

public void removeAllNodes()

setFONT

public void setFONT(FONT font)

getFONT

public FONT getFONT()

setTableWidth

public void setTableWidth(int width)

setTableWidthMax

public void setTableWidthMax()

getTableWidth

public java.lang.String getTableWidth()

setImageStyle

public void setImageStyle(int layout)
Set the style for the images

Parameters:
layout - TREE_STYLE_IMAGES_A or TREE_STYLE_IMAGES_B

getImageStyle

public int getImageStyle()
Get the basic layout style of the tree.

Returns:
TREE_STYLE_IMAGES_A or TREE_STYLE_IMAGES_B
See Also:
#setImageStyle()

removeNode

public boolean removeNode(long nodeId)
Remove a node.

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

sort

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

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

sort

public 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 )

getOpenNodes

public long[] getOpenNodes()
Get an array of nodes which are open. The intention of this function is, to make a possibility to store nodes that have been opened by a user for the next login of that user.

Returns:
an array of open nodes, or null if no nodes are open. The array contains the node id's (e4s.html.E4Tree_Intf#getId()).
See Also:
getOpenNodesString(), setOpenNodes(long[]), renumberNodes()

getOpenNodesString

public java.lang.String getOpenNodesString()
Get a list of nodes which are open. The intention of this function is, to make a possibility to store nodes that have been opened by a user for the next login of that user.

Returns:
a list, seperated by commas, of open nodes, or null if no nodes are open. The list contains the node id's (e4s.html.E4Tree_Intf#getId()).
See Also:
getOpenNodes(), setOpenNodes(String), renumberNodes()

setOpenNodes

public void setOpenNodes(long[] nodes)
Define which nodes are open in a tree. The intention of this function is, to make a possibility to store nodes that have been opened by a user for the next login of that user.

Parameters:
nodes - an array of nodes to open, null opens no nodes. The array must contains the node id's (e4s.html.E4Tree_Intf#getId()).
See Also:
getOpenNodes(), setOpenNodes(String), renumberNodes()

setOpenNodes

public void setOpenNodes(java.lang.String nodes)
Define which nodes are open in a tree. The intention of this function is, to make a possibility to store nodes that have been opened by a user for the next login of that user.

Parameters:
nodes - an list, seperated by commas, of nodes to open, null opens no nodes. The list must contains the node id's (e4s.html.E4Tree_Intf#getId()).
See Also:
getOpenNodes(), setOpenNodes(String), renumberNodes()

renumberNodes

public void renumberNodes()
Renumbers the nodes, starting with 1.

See Also:
setOpenNodes(e4s.html.tree.E4TreeNode_Intf, long[]), getOpenNodes(e4s.html.tree.E4TreeNode_Intf, java.util.Vector)

setObj

public void setObj(java.lang.Object obj)
Set an additional object to be stored together with the tree. Useful, if additional information must be stored persistant along with that tree object.

Parameters:
obj - the object
See Also:
getObj()

getObj

public java.lang.Object getObj()
Get an additional object to be stored together with the tree. Useful, if additional information must be stored persistant along with that tree object.

Returns:
the object or null if not any
See Also:
setObj(Object)

getPersistantObjectID

public java.lang.String getPersistantObjectID()

toString

public java.lang.String toString()
Overrides:
toString in class E4Object

getCreationTime

public long getCreationTime()

copy

public E4Tree copy()

_getSVNVersionString

public static java.lang.String _getSVNVersionString()
Get version info string from subversion.

Returns:
the version info string.
See Also:
E4Util.getRevisionCodeFromSVN(Class)

www.element4solution.com