|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.util.AbstractCollection | +--java.util.AbstractList | +--java.util.Vector | +--fri.gui.swing.polytreetable.PolyTreeView
Instead of a JTree this tree view proxy holds information about
expandable nodes and count of visible rows.
This is the most complex class of polytreetable package.
It is a Vector that represents the tree column of all rows in JTable.
It implements all the algorithms to insert/delete rows and set
a new "lead term".
It gets messaged by the BasicPolyTreeTableUI when nodes expand or
collapse and then adds or removes rows and sends expansion events.
It listens for model changes and inserts or removes rows when an
event happens.
Use treeTable.getTree().getNodeForViewRow(row)
in conjunction with treeTable.getTree().getViewRowCount()
to retrieve all currently visible nodes. The method
getLevelForRow()
gives the hierarchy of the nodes,
negative if parent, zero if root, positive if child.
PolyTreeTableModelAdapter
,
PolyTreeTableModelListener
,
PolyTreeExpansionListener
,
Serialized FormField Summary | |
static int |
CHILDREN_BELOW
Flag to set the fact that children are shown below root and parents above root. |
static int |
PARENTS_BELOW
Flag to set the fact that parents are shown below root and children above root. |
Fields inherited from class java.util.Vector |
capacityIncrement, elementCount, elementData |
Fields inherited from class java.util.AbstractList |
modCount |
Constructor Summary | |
PolyTreeView(PolyTreeTableModel model)
Create a tree view proxy for a PolyTreeTable. |
|
PolyTreeView(PolyTreeTableModel model,
int parentChildOrientation)
Create a tree view proxy for a PolyTreeTable, set optional horizontal orientation of children and parents. |
Method Summary | |
void |
addPolyTreeExpansionListener(PolyTreeExpansionListener lsnr)
|
void |
addPolyTreeWillExpandListener(PolyTreeWillExpandListener lsnr)
|
void |
clearRowCache()
Utility method to cler the row cache, that holds nodes that are currently not visible, as their container has been collapsed. |
protected boolean |
equalNodes(PolyTreeNode n1,
PolyTreeNode n2)
Returns true if userObject of first node equals userObject of second node. |
int |
expandChildPath(java.util.Vector path)
Expands child pathes packed by getPathForRow() into a list containing Strings that represent all nodes to expand. |
int |
expandChildPathes(java.util.Vector pathes)
Expands child pathes packed by getOpenPathes() into a list of lists containing Strings that represent all pathes to expand. |
int |
expandParentPath(java.util.Vector path)
Expands parent pathes packed by getPathForRow() into a list containing Strings that represent all nodes to expand. |
int |
expandParentPathes(java.util.Vector pathes)
Expands parent pathes packed by getOpenPathes() into a list of lists containing Strings that represent all pathes to expand. |
protected void |
fireTreeCollapsed(PolyTreeNode node,
int firstRow,
int lastRow)
|
protected void |
fireTreeExpanded(PolyTreeNode node,
int firstRow,
int lastRow)
|
protected void |
fireTreeStructureChanged(PolyTreeNode newRoot)
|
protected void |
fireTreeWillCollapse(PolyTreeNode node)
|
protected void |
fireTreeWillExpand(PolyTreeNode node)
|
protected void |
fireTreeWillStructureChange(PolyTreeNode node)
|
int |
getLevelForRow(int row)
Returns a tree level for a row. |
PolyTreeTableModel |
getModel()
Returns the PolyTreeTableModel of this view. |
PolyTreeNode |
getNodeForViewRow(int row)
Returns a PolyTreeNode for a view row. |
java.util.Vector |
getOpenChildPathes()
Returns a list of lists containing Strings representing open child pathes from current root (== start node), inclusive. |
java.util.Vector |
getOpenParentPathes()
Returns a list of lists containing Strings representing open parent pathes from current root (== start node), inclusive. |
java.util.Vector |
getPathForRow(int row)
Returns a list containing Strings representing the open path for given row, root label inclusive. |
java.lang.String |
getRootLabelFromPath(java.util.Vector pathes)
A way to get the root label string from a set of packed pathes, made by getExpandedPathes(). |
int |
getRootRow()
Returns the row in which the current root resides. |
int |
getViewRowCount()
Returns the row count of all visible rows. |
int[] |
getViewRowsForNode(PolyTreeNode node)
Sequential search that uses "==" to find the view rows of the passed node. |
boolean |
isChildLeaf(int row)
Delegates to model.isChildLeaf(). |
boolean |
isChildLevel(int level)
PolyTreeView convenience method that returns true if level > 0. |
boolean |
isChildRow(int row)
Returns true if passed row is in child part of view. |
boolean |
isEmpty(int row)
Calls isChildLeaf() or isParentLeaf() to decide if node is empty. |
boolean |
isExpanded(int row)
Returns expanded state for a row. |
boolean[] |
isExpanded(PolyTreeNode node)
Return expansion states of all visible occurences of the passed node. |
boolean |
isLeaf(int row)
Returns true if node in row is a parent leaf (if the node has a parent level) or is a child leaf (if node has a child level). |
boolean |
isParentLeaf(int row)
Delegates to model.isParentLeaf(). |
boolean |
isParentLevel(int level)
PolyTreeView convenience method that returns true if level < 0. |
boolean |
isParentRow(int row)
Returns true if passed row is in parent part of view. |
static boolean |
isRootLevel(int level)
PolyTreeView convenience method that returns true if level == 0. |
boolean |
isRootRow(int row)
Returns true if passed row root row of view. |
void |
removePolyTreeExpansionListener(PolyTreeExpansionListener lsnr)
|
void |
removePolyTreeWillExpandListener(PolyTreeWillExpandListener lsnr)
|
void |
setModel(PolyTreeTableModel model)
Set a (new) model into this tree. |
void |
setRoot(PolyTreeNode node)
Set a new root node. |
void |
setRootRow(int row)
Change to new root node. |
int |
toggleExpandedState(int row)
Toggles the expansion state for a row. |
int[] |
toggleExpandedState(PolyTreeNode node)
Toggles the expansion state for all rows containing passed PolyTreeNode. |
java.lang.String |
toString()
Write all NodeWrappers of this Vector from 0-n and all cached nodes. |
void |
treeNodeChanged(PolyTreeTableModelEvent e)
The name of a node was changed by the CellEditor. |
void |
treeNodesInserted(PolyTreeTableModelEvent e)
One or mode nodes were inserted into model. |
void |
treeNodesRemoved(PolyTreeTableModelEvent e)
One or mode nodes were removed from model. |
Methods inherited from class java.util.Vector |
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, trimToSize |
Methods inherited from class java.util.AbstractList |
iterator, listIterator, listIterator |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.List |
iterator, listIterator, listIterator |
Field Detail |
public static final int CHILDREN_BELOW
public static final int PARENTS_BELOW
Constructor Detail |
public PolyTreeView(PolyTreeTableModel model)
model
- the data model of the polyhierarchy.public PolyTreeView(PolyTreeTableModel model, int parentChildOrientation)
model
- the data model of the polyhierarchy.parentChildOrientation
- CHILDREN_BELOW (default) or PARENTS_BELOW, default children are
shown below root.Method Detail |
public boolean isParentLevel(int level)
public boolean isChildLevel(int level)
public static boolean isRootLevel(int level)
public PolyTreeTableModel getModel()
public void setModel(PolyTreeTableModel model)
public void setRoot(PolyTreeNode node)
public int getRootRow()
public int getViewRowCount()
public PolyTreeNode getNodeForViewRow(int row)
public int getLevelForRow(int row)
public boolean isChildRow(int row)
public boolean isParentRow(int row)
public boolean isRootRow(int row)
public boolean isExpanded(int row)
public boolean isLeaf(int row)
public boolean isParentLeaf(int row)
public boolean isChildLeaf(int row)
public boolean isEmpty(int row)
public void setRootRow(int row)
protected boolean equalNodes(PolyTreeNode n1, PolyTreeNode n2)
public int toggleExpandedState(int row)
public void treeNodesInserted(PolyTreeTableModelEvent e)
PolyTreeTableModelListener
treeNodesInserted
in interface PolyTreeTableModelListener
public void treeNodesRemoved(PolyTreeTableModelEvent e)
PolyTreeTableModelListener
treeNodesRemoved
in interface PolyTreeTableModelListener
public void treeNodeChanged(PolyTreeTableModelEvent e)
PolyTreeTableModelListener
treeNodeChanged
in interface PolyTreeTableModelListener
public void addPolyTreeExpansionListener(PolyTreeExpansionListener lsnr)
public void removePolyTreeExpansionListener(PolyTreeExpansionListener lsnr)
protected void fireTreeStructureChanged(PolyTreeNode newRoot)
protected void fireTreeExpanded(PolyTreeNode node, int firstRow, int lastRow)
protected void fireTreeCollapsed(PolyTreeNode node, int firstRow, int lastRow)
public void addPolyTreeWillExpandListener(PolyTreeWillExpandListener lsnr)
public void removePolyTreeWillExpandListener(PolyTreeWillExpandListener lsnr)
protected void fireTreeWillExpand(PolyTreeNode node) throws javax.swing.tree.ExpandVetoException
javax.swing.tree.ExpandVetoException
protected void fireTreeWillCollapse(PolyTreeNode node) throws javax.swing.tree.ExpandVetoException
javax.swing.tree.ExpandVetoException
protected void fireTreeWillStructureChange(PolyTreeNode node) throws javax.swing.tree.ExpandVetoException
javax.swing.tree.ExpandVetoException
public java.lang.String toString()
toString
in class java.util.Vector
public void clearRowCache()
public int[] getViewRowsForNode(PolyTreeNode node)
public int[] toggleExpandedState(PolyTreeNode node)
public boolean[] isExpanded(PolyTreeNode node)
public java.util.Vector getOpenParentPathes()
getNodeForViewRow().toString()
method is used to
generate the path Strings.
public java.util.Vector getOpenChildPathes()
getNodeForViewRow().toString()
method is used to
generate the path Strings.
public int expandParentPathes(java.util.Vector pathes)
pathes
- Vector of Vectors that hold pathes to open visible.
public int expandChildPathes(java.util.Vector pathes)
pathes
- Vector of Vectors that hold pathes to open visible.
public java.util.Vector getPathForRow(int row)
getNodeForViewRow().toString()
method is used to
generate the path Strings.
Use this in conjunction with isChildRow(row) and isParentRow(row)
to decide if it is a child or parent path.
row
- view row to retrieve path for
public int expandParentPath(java.util.Vector path)
path
- Vector of Strings that hold nodes to open visible.
public int expandChildPath(java.util.Vector path)
path
- Vector of Strings that hold nodes to open visible.
public java.lang.String getRootLabelFromPath(java.util.Vector pathes)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |