|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--org.fopps.model.AbstractItem
|
+--org.fopps.model.TreeItem
TreeItem is the base class for all entities with a tree-like structure. Each tree item has a unique parant and may have zero or more children. In addition it provides some convenience methods for tree maintenance (depth, complete path, etc.)
Note: Class TreeItem has a different behaviour regarding events. An event will also passed to the parent node, if present. Normally you only have to listen to the root node of the tree.
| Field Summary | |
protected java.util.List |
mChildren
|
protected TreeItem |
mParent
|
| Fields inherited from class org.fopps.model.AbstractItem |
ADDED_EVENT, CHANGE_EVENT, name, REMOVED_EVENT |
| Constructor Summary | |
TreeItem(java.lang.String pName)
Same as TreeItem(pName, null). |
|
TreeItem(java.lang.String pName,
TreeItem pParent)
Creates a tree item with a given parent node. |
|
TreeItem(java.lang.String pName,
TreeItem pParent,
boolean pChildrenAllowed)
Creates a tree item with a given parent node |
|
| Method Summary | |
void |
addChildren(TreeItem pChildren)
Adds one element to association Children |
int |
allChildrenCount()
Returns the number of all children. |
boolean |
childrenAllowed()
Returns true, if tree item may have child nodes. |
int |
childrenCount()
Returns the number of children |
void |
delete()
Deletes the feature (unlink connection to parent) |
TreeItem |
first()
Returns the first child or null, if TreeItem is a leaf |
TreeItem |
getChildAt(int i)
Returns child node by index |
java.util.Collection |
getChildren()
Getter Association Children. |
int |
getDepth()
Retuns depth of current TreeItem. |
int |
getIndexOfChild(TreeItem pChild)
Returns the index of a given child |
TreeItem |
getParent()
Getter of association Parent |
TreeItem[] |
getPath()
Returns the path from root to this TreeItem (useful for tree display) |
TreeItem |
getRoot()
Returns the root TreeItem. |
boolean |
isLeaf()
Returns true, if TreeItem has no children |
TreeItem |
last()
Returns the last child or null, if TreeItem is a leaf |
void |
notifyListeners(ModelEvent pEvent)
Notify all listeners of the item |
void |
removeAllChildren()
Removes one element to association Children |
void |
removeAllChildrenRecursive()
Drops whole subtree of TreeItem |
void |
removeChildren(TreeItem pChildren)
Removes one element to association Children |
void |
setChildren(java.util.Collection pChildren)
Setter Association Children |
void |
setParent(TreeItem pParent)
Setter of association Parent |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected TreeItem mParent
protected java.util.List mChildren
| Constructor Detail |
public TreeItem(java.lang.String pName)
TreeItem(pName, null). Children are allowed.
pName - Name of the tree item
public TreeItem(java.lang.String pName,
TreeItem pParent)
pName - Name of the tree itempParent - Parent node of item
public TreeItem(java.lang.String pName,
TreeItem pParent,
boolean pChildrenAllowed)
pName - Name of the tree itempParent - Parent node of itempChildrenAllowed - Flag which determines, if children are allowed or not| Method Detail |
public void setParent(TreeItem pParent)
public TreeItem getParent()
public java.util.Collection getChildren()
public void setChildren(java.util.Collection pChildren)
public void addChildren(TreeItem pChildren)
public void removeChildren(TreeItem pChildren)
public void removeAllChildren()
public void removeAllChildrenRecursive()
public int childrenCount()
public TreeItem getChildAt(int i)
public int getIndexOfChild(TreeItem pChild)
public boolean isLeaf()
public TreeItem first()
public TreeItem last()
public TreeItem[] getPath()
public TreeItem getRoot()
public int getDepth()
public int allChildrenCount()
public void notifyListeners(ModelEvent pEvent)
notifyListeners in class AbstractItempublic void delete()
delete in class AbstractItemdelete()public boolean childrenAllowed()
getChildren() will alwas return an empty list.
Default is true.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||