|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--fri.gui.swing.polytreetable.AbstractPolyTreeNode
Implements a basic PolyTreeNode. Such nodes can appear more than once in the tree view, as polyhierarchies can contain cycles. You get an array of rows where it occurs if you request a PolyTreeNode from PolyTreeTable.
Implement getChildCount() and getParentCount() to read data for the rendered structure, as they get messaged when a tree expansion takes place. Override getAllowsParents() and getAllowsChildren() if you can decide the fact of allowing children without reading child data. This saves performance. The model is preset to consider these properties, but if model.asksAllowsChildren or model.asksAllowsParents was set to false, these methods will not be called.
PolyTreeNode| Field Summary | |
protected boolean |
allowsChildren
The allowsChildren property, considered only if model.asksAllowsChildren was set to true, which is default. |
protected boolean |
allowsParents
The allowsParents property, considered only if model.asksAllowsParents was set to true, which is default. |
protected java.util.Vector |
children
The list of children, preset to null. |
static java.util.Enumeration |
EMPTY_ENUMERATION
An enumeration that is always empty. |
protected java.util.Vector |
parents
The list of parents, preset to null. |
protected java.lang.Object |
userObject
The user object, a File or Document or whatever. |
| Constructor Summary | |
protected |
AbstractPolyTreeNode()
Friendly to override do-nothing constructor. |
|
AbstractPolyTreeNode(java.lang.Object userObject)
Create a node that allows children and parents and hosts an user object. |
|
AbstractPolyTreeNode(java.lang.Object userObject,
boolean allowsChildren,
boolean allowsParents)
Create a node with an user object and parent/child flags. |
| Method Summary | |
java.util.Enumeration |
children()
Returns the children of the reciever as an Enumeration. |
boolean |
getAllowsChildren()
Returns true if the receiver allows children. |
boolean |
getAllowsParents()
Returns true if the receiver allows parents. |
PolyTreeNode |
getChildAt(int childIndex)
Returns the child PolyTreeNode at index childIndex. |
int |
getChildIndex(PolyTreeNode aChild)
Returns the index of aChild in the receivers children. |
protected int |
getElementCount(java.util.Vector list)
Returns size of passed list if not null, else zero. |
PolyTreeNode |
getParentAt(int parentIndex)
Returns the parent PolyTreeNode at index parentIndex. |
int |
getParentIndex(PolyTreeNode aParent)
Returns the index of aParent in the receivers parents. |
java.lang.Object |
getUserObject()
Returns the object representing the File or Document or whatever. |
boolean |
isChildLeaf()
Returns true if this node has no children. |
boolean |
isNodeChild(PolyTreeNode aNode)
Returns true if passed node is a child of this. |
boolean |
isNodeParent(PolyTreeNode aNode)
Returns true if passed node is a parent of this. |
boolean |
isParentLeaf()
Returns true if this node has no parents. |
java.util.Enumeration |
parents()
Returns the parents of the reciever as an Enumeration. |
void |
setAllowsChildren(boolean allows)
Set the fact that the receiver allows children. |
void |
setAllowsParents(boolean allows)
Set the fact that the receiver allows parents. |
java.lang.String |
toString()
Returns userObject.toString(). |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface fri.gui.swing.polytreetable.PolyTreeNode |
getChildCount, getParentCount |
| Field Detail |
protected java.lang.Object userObject
protected java.util.Vector parents
protected java.util.Vector children
protected boolean allowsParents
protected boolean allowsChildren
public static final java.util.Enumeration EMPTY_ENUMERATION
| Constructor Detail |
protected AbstractPolyTreeNode()
public AbstractPolyTreeNode(java.lang.Object userObject)
public AbstractPolyTreeNode(java.lang.Object userObject,
boolean allowsChildren,
boolean allowsParents)
| Method Detail |
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.Object getUserObject()
getUserObject in interface PolyTreeNodepublic java.util.Enumeration children()
children in interface PolyTreeNodepublic java.util.Enumeration parents()
parents in interface PolyTreeNodepublic boolean getAllowsParents()
getAllowsParents in interface PolyTreeNodepublic boolean getAllowsChildren()
getAllowsChildren in interface PolyTreeNodepublic void setAllowsParents(boolean allows)
public void setAllowsChildren(boolean allows)
public PolyTreeNode getChildAt(int childIndex)
getChildAt in interface PolyTreeNodepublic PolyTreeNode getParentAt(int parentIndex)
getParentAt in interface PolyTreeNodeprotected int getElementCount(java.util.Vector list)
public int getParentIndex(PolyTreeNode aParent)
getParentIndex in interface PolyTreeNodepublic int getChildIndex(PolyTreeNode aChild)
getChildIndex in interface PolyTreeNodepublic boolean isNodeParent(PolyTreeNode aNode)
public boolean isNodeChild(PolyTreeNode aNode)
public boolean isChildLeaf()
isChildLeaf in interface PolyTreeNodepublic boolean isParentLeaf()
isParentLeaf in interface PolyTreeNode
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||