|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.tonbeller.wcf.tree.TreeModelDecorator
com.tonbeller.wcf.tree.OptimizingTreeModelDecorator
Hides branches that do not contain significant nodes.
Significance is defined by a node filter. If the filter accepts a node, its significant, else its not.
Significance is transitive. A node, that is not accepted by the filter itself, is considered significant if it has at least one descendant that is accepted by the filter.
Example usecase: hide empty directories.
Warning: This class reads the whole tree model to find "significant" nodes.
Field Summary |
Fields inherited from interface com.tonbeller.wcf.tree.TreeModel |
EMPTY_MODEL |
Constructor Summary | |
OptimizingTreeModelDecorator(NodeFilter filter,
TreeModel decoree)
creates a reduced view on a tree model that uses a HashMap for implementation |
|
OptimizingTreeModelDecorator(NodeFilter filter,
TreeModel decoree,
java.util.Comparator nodeComparator)
creates a new optimizing tree model that uses a TreeMap for implementation |
Method Summary | |
java.lang.Object[] |
getChildren(java.lang.Object node)
|
java.lang.Object |
getParent(java.lang.Object node)
|
java.lang.Object[] |
getRoots()
returns the root members of the tree. |
boolean |
hasChildren(java.lang.Object node)
|
boolean |
isOptimizeLeafs()
|
boolean |
isOptimizeRoot()
|
void |
setOptimizeLeafs(boolean b)
if true, only significant leafs will be visible. |
void |
setOptimizeRoot(boolean b)
if true, insignificant parents are not shown. |
Methods inherited from class com.tonbeller.wcf.tree.TreeModelDecorator |
addTreeModelChangeListener, fireModelChanged, getDecoree, removeTreeModelChangeListener, setDecoree |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public OptimizingTreeModelDecorator(NodeFilter filter, TreeModel decoree)
filter
- accepted nodes are considered "significant"public OptimizingTreeModelDecorator(NodeFilter filter, TreeModel decoree, java.util.Comparator nodeComparator)
filter
- accepted nodes are considered "significant"Method Detail |
public java.lang.Object[] getRoots()
TreeModel
getRoots
in interface TreeModel
getRoots
in class TreeModelDecorator
public boolean hasChildren(java.lang.Object node)
hasChildren
in interface TreeModel
hasChildren
in class TreeModelDecorator
public java.lang.Object[] getChildren(java.lang.Object node)
getChildren
in interface TreeModel
getChildren
in class TreeModelDecorator
public java.lang.Object getParent(java.lang.Object node)
getParent
in interface TreeModel
getParent
in class TreeModelDecorator
public void setOptimizeLeafs(boolean b)
public boolean isOptimizeLeafs()
public void setOptimizeRoot(boolean b)
public boolean isOptimizeRoot()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |