|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.cc.framework.util.TreeHelp
Helper class for managing tree structures.
Field Summary | |
private static org.apache.commons.logging.Log |
log
Logging instance |
Constructor Summary | |
private |
TreeHelp()
Constructor |
Method Summary | |
private static int |
calcCheckState(TreeIterator.LevelIterator iter)
Returns the check state of a given tree node. |
static int |
calcVisibleNodes(TreeNodeDataModel node,
TreeStateModel state,
Principal principal)
Expand nodes top down |
static void |
checkNode(TreeNodeDataModel node,
boolean check)
Sets the checked state for the specified Node |
static void |
checkNodes(TreeNodeDataModel root,
boolean check)
Sets the checked state for all items on the specified (Sub-) Tree. |
static void |
checkNodes(TreeNodeDataModel root,
java.util.Set checked)
Applies the checked nodes from the key set |
static void |
connectOutline(java.util.Collection nodes)
Connects all nodes with a parent child relationship a collection. |
static java.util.Map |
createHashtable(TreeNodeDataModel root)
Inserts all nodes of the specified tree in a Hashtable |
static TreeGroupDataModel |
createOutline(java.util.Collection nodes)
Creates a Tree from a Collection. |
static TreeGroupDataModel |
createOutline(TreeGroupDataModel root,
java.util.Collection nodes)
Creates a Tree from an ArrayList. |
static TreeGroupDataModel |
createOutline(TreeGroupDataModel root,
java.util.Map elements)
Creates a Tree from an Hashtable. |
static void |
expandToLevel(TreeGroupDataModel root,
int level,
TreeStateModel state)
Expand nodes top down |
static java.util.Map |
getCheckedItems(TreeNodeDataModel node)
Returns an Array including all the matching row beans of the tree. |
static java.util.Map |
getCheckedItems(TreeNodeDataModel node,
java.lang.String property)
Returns an Array including all the matching row beans in a tree. |
static int |
getCheckState(TreeNodeDataModel root)
Returns the check state of a given tree node. |
static java.util.Map |
getItemsByState(TreeNodeDataModel node,
CheckState state)
Returns a collection for all element in the tree which fits the specified check state. |
static java.util.Map |
getItemsByState(TreeNodeDataModel node,
java.lang.String property,
CheckState state)
Returns a collection for all element in the tree which fits the specified check state. |
static TreeNodeDataModel |
getNodeByKey(TreeNodeDataModel root,
java.lang.String key)
Returns a node for a given key |
static java.util.Map |
getUncheckedItems(TreeNodeDataModel node)
Returns an Array including all the matching row beans of the tree. |
static java.util.Map |
getUncheckedItems(TreeNodeDataModel node,
java.lang.String property)
Returns an Array including all the matching row beans of the tree. |
static boolean |
isNodeInSubtree(TreeGroupDataModel subTreeRoot,
TreeGroupDataModel node)
Checks if the given node is a member of the subtree. |
static TreeNodeDataModel |
iterateNodes(TreeIterator iter,
Algorithm alg)
This method processes an algorithm for all elements (nodes) in the tree. |
static TreeNodeDataModel |
iterateNodes(TreeIterator iter,
Algorithm alg,
AlgorithmFilter filter)
This method processes an algorithm for all elements (nodes) in the tree. |
static TreeNodeDataModel |
iterateNodes(TreeNodeDataModel root,
Algorithm alg)
This method processes an algorithm for all elements (nodes) in the tree. |
static TreeNodeDataModel |
iterateNodes(TreeNodeDataModel root,
Algorithm alg,
AlgorithmFilter filter)
This method processes an algorithm for all elements (nodes) in the tree. |
static TreeNodeDataModel |
iterateNodes(TreeNodeDataModel root,
TreeStateModel state,
Algorithm alg,
AlgorithmFilter filter)
This method processes an algorithm for all elements (nodes) in the tree. |
static void |
uncheck(TreeNodeDataModel root,
java.lang.String property,
AlgorithmFilter filter)
Unchecks all tree nodes |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static org.apache.commons.logging.Log log
Constructor Detail |
private TreeHelp()
Method Detail |
public static int getCheckState(TreeNodeDataModel root)
root
- TreeNodeDataModel
CheckState
private static int calcCheckState(TreeIterator.LevelIterator iter)
iter
- Iterator
CheckState
public static boolean isNodeInSubtree(TreeGroupDataModel subTreeRoot, TreeGroupDataModel node)
subTreeRoot
- the root node of the subtreenode
- the node to check
true
when the node is a member of the subtreepublic static void expandToLevel(TreeGroupDataModel root, int level, TreeStateModel state)
root
- Root of the current sub treelevel
- a value greater or equal to zero indicates that this node
should be expandedstate
- The TreeStateModel that holds the expansion informationpublic static int calcVisibleNodes(TreeNodeDataModel node, TreeStateModel state, Principal principal)
node
- Root of the current sub treestate
- The TreeStateModel that holds the expansion informationprincipal
- The principal Object that has the information which node is
visible for the current user
public static void checkNode(TreeNodeDataModel node, boolean check)
node
- TreeNodecheck
- true or falsepublic static void connectOutline(java.util.Collection nodes) throws TreeStructureException
TreeNodeDataModel
interface.
nodes
- Collection of TreeNodeDataModel's
TreeStructureException
- if an error in the structure of the tree is detectedpublic static TreeGroupDataModel createOutline(java.util.Collection nodes) throws TreeStructureException
TreeNodeDataModel
interface. The List must contain one root element
nodes
- Collection of TreeNodeDataModel's
TreeStructureException
- if an error in the structure of the tree is detectedpublic static TreeGroupDataModel createOutline(TreeGroupDataModel root, java.util.Collection nodes) throws TreeStructureException
TreeNodeDataModel
interface. The Nodes in the ArrayList will be appended to the specified
Node (root Argument).
root
- TreeGroupDataModelnodes
- Collection of TreeNodeDataModel's
TreeStructureException
- if an error in the structure of the tree is detectedpublic static TreeGroupDataModel createOutline(TreeGroupDataModel root, java.util.Map elements) throws TreeStructureException
TreeNodeDataModel
interface. The Nodes in the ArrayList will be appended to the specified
Node (root Argument).
root
- the root elementelements
- Hashtable
TreeStructureException
- if an error in the structur of the tree is detectedpublic static java.util.Map createHashtable(TreeNodeDataModel root)
root
- TreeNodeDataModel
public static TreeNodeDataModel getNodeByKey(TreeNodeDataModel root, java.lang.String key)
root
- TreeNodeDataModelkey
- The key
public static void checkNodes(TreeNodeDataModel root, boolean check)
root
- TreeNodecheck
- true or falsepublic static void checkNodes(TreeNodeDataModel root, java.util.Set checked) throws java.lang.Exception
root
- The root nodechecked
- Set with all the checked keys
java.lang.Exception
- Indicates an error while iterating and executing the
algorithmpublic static void uncheck(TreeNodeDataModel root, java.lang.String property, AlgorithmFilter filter) throws java.lang.Exception
root
- TreeNodeproperty
- The check propertyfilter
- Node filter
java.lang.Exception
- Indicates an error while iterating and executing the
algorithmpublic static java.util.Map getCheckedItems(TreeNodeDataModel node) throws java.lang.Exception
checkabel
interface.
Only the checked itmes (1) will be returned!
node
- The root node
java.lang.Exception
- Indicates an error while iterating and
executing the algorithmpublic static java.util.Map getCheckedItems(TreeNodeDataModel node, java.lang.String property) throws java.lang.Exception
node
- The root nodeproperty
- The check property
java.lang.Exception
- Indicates an error while iterating and
executing the algorithmpublic static java.util.Map getUncheckedItems(TreeNodeDataModel node) throws java.lang.Exception
checkabel
interface.
Only the unchecked itmes (0) will be returned!
node
- The root node
java.lang.Exception
- Indicates an error while iterating and
executing the algorithmpublic static java.util.Map getUncheckedItems(TreeNodeDataModel node, java.lang.String property) throws java.lang.Exception
node
- The root nodeproperty
- The check property
java.lang.Exception
- Indicates an error while iterating and
executing the algorithmpublic static java.util.Map getItemsByState(TreeNodeDataModel node, CheckState state) throws java.lang.Exception
checkabel
interface.
node
- The root nodestate
- The checkstate
java.lang.Exception
- Indicates an error while iterating and
executing the algorithmpublic static java.util.Map getItemsByState(TreeNodeDataModel node, java.lang.String property, CheckState state) throws java.lang.Exception
node
- The root nodeproperty
- The check propertystate
- The checkstate
java.lang.Exception
- Indicates an error while iterating and
executing the algorithmpublic static TreeNodeDataModel iterateNodes(TreeNodeDataModel root, Algorithm alg) throws java.lang.Exception
root
- TreeNodeDataModelalg
- Algorithm to execute
null
java.lang.Exception
- Indicates an error while iterating and executing the
algorithmAlgorithm.execute(String, Object)
public static TreeNodeDataModel iterateNodes(TreeNodeDataModel root, Algorithm alg, AlgorithmFilter filter) throws java.lang.Exception
root
- TreeNodeDataModelalg
- Algorithm to executefilter
- The row filter
null
java.lang.Exception
- Indicates an error while iterating and executing the
algorithmAlgorithm.execute(String, Object)
public static TreeNodeDataModel iterateNodes(TreeNodeDataModel root, TreeStateModel state, Algorithm alg, AlgorithmFilter filter) throws java.lang.Exception
root
- TreeNodeDataModelstate
- TreeStateModelalg
- Algorithm to executefilter
- The row filter
null
java.lang.Exception
- Indicates an error while iterating and executing the
algorithmAlgorithm.execute(String, Object)
public static TreeNodeDataModel iterateNodes(TreeIterator iter, Algorithm alg) throws java.lang.Exception
iter
- TreeIteratoralg
- Algorithm to execute
null
java.lang.Exception
- Indicates an error while iterating and executing the
algorithmAlgorithm.execute(String, Object)
public static TreeNodeDataModel iterateNodes(TreeIterator iter, Algorithm alg, AlgorithmFilter filter) throws java.lang.Exception
iter
- TreeIteratoralg
- Algorithm to executefilter
- The row filter
null
java.lang.Exception
- Indicates an error while iterating and executing the
algorithmAlgorithm.execute(String, Object)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |