|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--fri.gui.swing.polytreetable.AbstractPolyTreeNode | +--fri.gui.swing.polytreetable.DefaultPolyTreeNode
Implements a basic MutablePolyTreeNode. Such nodes can appear more than
once in the tree view, as polyhierarchies can contain cycles (you get
an array of rows if you request a PolyTreeNode from the view with
treeTable.getTree().getViewRowsForNode(polyTreeNode)
).
The usage of this class moves the responsibility for caching nodes
to the client (use DefaultCachedPolyTreeNode!).
Override getChildCount() and getParentCount() to read data for the rendered structure, as they get messaged when a tree expansion takes place.
Remark:
This class is not derived from DefaultMutableTreeNode as
DefaultMutableTreeNode does not satisfy the needs of PolyTreeNode.
Its loops hardcode the fact that the root is the node that has a null
parent: while ((node = getParent()) != null) ...
.
Furthermore the root of a PolyTreeTableModel is view dependent and can
change at any time.
The PolyTreeTableModel is not a hierarchy but a network
and can contain cycles, so even the Enumerations of DefaultMutableTreeNode
would fail.
DefaultCachedPolyTreeNode
Field Summary |
Fields inherited from class fri.gui.swing.polytreetable.AbstractPolyTreeNode |
allowsChildren, allowsParents, children, EMPTY_ENUMERATION, parents, userObject |
Constructor Summary | |
protected |
DefaultPolyTreeNode()
|
|
DefaultPolyTreeNode(java.lang.Object userObject)
Create a node that allows children and parents and hosts an user object. |
|
DefaultPolyTreeNode(java.lang.Object userObject,
boolean allowsChildren,
boolean allowsParents)
Create a node that with an user object and parent/child flags. |
Method Summary | |
boolean |
getAllowsChildren()
Returns true if the receiver allows children. |
boolean |
getAllowsParents()
Returns true if the receiver allows parents. |
int |
getChildCount()
Returns the number of children the receiver contains. |
java.lang.Object |
getColumnObject(int column)
Convenience implementation for column objects in conjunction with DefaultPolyTreeTableModel.getValueAt(). |
int |
getParentCount()
Returns the number of parents the receiver contains. |
void |
insertChild(PolyTreeNode newNode,
int index)
Insert a new child at passed index if not alreay contained. |
void |
insertParent(PolyTreeNode newNode,
int index)
Insert a new parent at passed index if not alreay contained. |
boolean |
isCellEditable(int column)
Convenience implementation for column objects in conjunction with CellEditor. |
void |
removeChild(int index)
Remove the passed index from children list |
void |
removeParent(int index)
Remove the passed index from parent list |
boolean |
setColumnObject(int column,
java.lang.Object aValue)
Convenience implementation for column objects in conjunction with DefaultPolyTreeTableModel.setValueAt(). |
void |
setUserObject(java.lang.Object userObject)
Sets the object representing the File or Document or whatever. |
Methods inherited from class fri.gui.swing.polytreetable.AbstractPolyTreeNode |
children, getChildAt, getChildIndex, getElementCount, getParentAt, getParentIndex, getUserObject, isChildLeaf, isNodeChild, isNodeParent, isParentLeaf, parents, setAllowsChildren, setAllowsParents, 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 |
children, getChildAt, getChildIndex, getParentAt, getParentIndex, getUserObject, isChildLeaf, isParentLeaf, parents |
Constructor Detail |
protected DefaultPolyTreeNode()
public DefaultPolyTreeNode(java.lang.Object userObject)
public DefaultPolyTreeNode(java.lang.Object userObject, boolean allowsChildren, boolean allowsParents)
Method Detail |
public boolean isCellEditable(int column)
public java.lang.Object getColumnObject(int column)
public boolean setColumnObject(int column, java.lang.Object aValue)
public int getChildCount()
getChildCount
in interface PolyTreeNode
public int getParentCount()
getParentCount
in interface PolyTreeNode
public boolean getAllowsParents()
getAllowsParents
in interface PolyTreeNode
getAllowsParents
in class AbstractPolyTreeNode
public boolean getAllowsChildren()
getAllowsChildren
in interface PolyTreeNode
getAllowsChildren
in class AbstractPolyTreeNode
public void setUserObject(java.lang.Object userObject)
setUserObject
in interface MutablePolyTreeNode
public void insertParent(PolyTreeNode newNode, int index)
insertParent
in interface MutablePolyTreeNode
public void insertChild(PolyTreeNode newNode, int index)
insertChild
in interface MutablePolyTreeNode
public void removeParent(int index)
removeParent
in interface MutablePolyTreeNode
public void removeChild(int index)
removeChild
in interface MutablePolyTreeNode
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |