|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnextapp.echo2.app.Component
nextapp.echo2.app.Table
echopointng.table.TableEx
echopointng.TreeTable
public class TreeTable
TreeTable is a specialized
table consisting of a single column in which
to display hierarchical data, and any number of other columns in which to
display regular data.
The interface for the data model used by a TreeTable
is TreeTableModel. It extends the
TreeModelinterface to allow access to
cell data by column indices within each node of the tree hierarchy.
The most straightforward way create and use a TreeTable, is
to first create a suitable data model for it, and pass that to a
TreeTable constructor
A single treetable model instance may be shared among more than one
TreeTable instances. To access the treetable model, always
call getTreeTableModeland
setTreeTableModel.
TreeTable wraps the supplied treetable model inside a private
adapter class to adapt it to a TableModel.
Although the model adapter is accessible through the
getModelmethod, you should avoid accessing and
manipulating it in any way. In particular, each model adapter instance is
tightly bound to a single table instance, and any attempt to share it with
another table (for example, by calling setModel)
will throw an IllegalArgumentException!
| Field Summary |
|---|
| Constructor Summary | |
|---|---|
TreeTable()
Constructs a TreeTable using a DefaultTreeTableModel. |
|
TreeTable(TreeTableModel treeModel)
Constructs a TreeTable using the specified TreeTableModel. |
|
| Method Summary | |
|---|---|
void |
collapseAll()
Collapses all nodes in the treetable. |
void |
collapsePath(TreePath path)
Collapses the node at the specified path in the treetable. |
void |
collapseRow(int row)
Collapses the row in the treetable. |
void |
expandAll()
Expands all nodes in the treetable. |
void |
expandPath(TreePath path)
Expands the the node at the specified path in the treetable. |
void |
expandRow(int row)
Expands the specified row in the treetable. |
java.util.Enumeration |
getExpandedDescendants(TreePath parent)
Returns an Enumeration of the descendants of the path
parent that are currently expanded. |
TreePath |
getPathForRow(int row)
Returns the TreePath for a given row. |
boolean |
getShowsRootHandles()
Returns the value of the showsRootHandles property. |
TreeSelectionModel |
getTreeSelectionModel()
Returns the selection model for the tree portion of the this treetable. |
TreeTableModel |
getTreeTableModel()
Returns the underlying TreeTableModel for this TreeTable. |
boolean |
isCollapsed(int row)
Returns true if the node at the specified display row is collapsed. |
boolean |
isCollapsed(TreePath path)
Returns true if the node identified by path is currently collapsed, this will return false if any of the values in path are currently not being displayed. |
boolean |
isExpanded(int row)
Returns true if the node at the specified display row is currently expanded. |
boolean |
isExpanded(TreePath path)
Returns true if the node identified by path is currently expanded. |
boolean |
isHierarchical(int column)
Determines if the specified column contains hierarchical nodes. |
boolean |
isRootAutoExpanded()
Returns true if the root node of the tree is expanded when the TreeModel is first set. |
boolean |
isRootVisible()
Returns true if the root node of the tree is displayed. |
boolean |
isVisible(TreePath path)
Returns true if the value identified by path is currently viewable, which means it is either the root or all of its parents are expanded. |
void |
processInput(java.lang.String inputName,
java.lang.Object inputValue)
We forward the TreePath input into out internal Tree. |
void |
setCellRenderer(TreeCellRenderer cellRenderer)
Sets the specified TreeCellRenderer |
void |
setModel(TableModel tableModel)
Overrides superclass version to make sure that the specified TableModelis compatible with TreeTable before invoking the
inherited version. |
void |
setRootAutoExpanded(boolean rootExpanded)
Determines whether or not the root node from the TreeModel is automatically expanded when the model is set into the Tree. |
void |
setRootVisible(boolean visible)
Determines whether or not the root node from the TreeModel is visible. |
void |
setSelectionMode(int mode)
Overridden to ensure that private treeAndTableCellRenderer state is kept in sync with the state of the component. |
void |
setShowsRootHandles(boolean visible)
Sets the value of the showsRootHandles property for the
tree part. |
void |
setTreeTableModel(TreeTableModel treeModel)
Sets the data model for this TreeTable to the specified TreeTableModel. |
void |
validate()
A life-cycle method invoked before the component is rendered to ensure it is in a valid state. |
| Methods inherited from class echopointng.table.TableEx |
|---|
getAttribute, getAttributeNames, init, setAttribute |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TreeTable()
DefaultTreeTableModel.
public TreeTable(TreeTableModel treeModel)
TreeTableModel.
treeModel - model for the TreeTable| Method Detail |
|---|
public void processInput(java.lang.String inputName,
java.lang.Object inputValue)
processInput in class TableinputName - the name of the inputinputValue - the value of the inputTable.processInput(java.lang.String, java.lang.Object)public void setTreeTableModel(TreeTableModel treeModel)
TreeTableModel. The same data model may be
shared by any number of TreeTable instances.
treeModel - data model for this TreeTablepublic TreeTableModel getTreeTableModel()
public final void setModel(TableModel tableModel)
Overrides superclass version to make sure that the specified
TableModelis compatible with TreeTable before invoking the
inherited version.
Because TreeTable internally adapts an
TreeTableModelto make it a compatible
TableModel, this method should never be called directly . Use
setTreeTableModel
instead.
While it is possible to obtain a reference to this adapted version of the
TableModel by calling Table.getModel(), any attempt to call
setModel() with that adapter will fail because the adapter might have
been bound to a different TreeTable instance. If you want to extract the
underlying TreeTableModel, which, by the way, can be shared,
use getTreeTableModelinstead
setModel in class TabletableModel - must be a TreeTableModelAdapter, which general calles will not
have access to.
java.lang.IllegalArgumentException - if the specified tableModel is not an instance of
TreeTableModelAdapterpublic void setSelectionMode(int mode)
Overridden to ensure that private treeAndTableCellRenderer state is kept in sync with the state of the component. Calls the inherited version after performing the necessary synchronization. If you override this method, make sure you call this version from your version of this method.
This version maps the selection mode used by the treeAndTableCellRenderer to match the selection mode specified for the table. Specifically, the modes are mapped as follows:
ListSelectionModel.SINGLE_SELECTION: TreeSelectionModel.CONTIGUOUS_TREE_SELECTION;
ListSelectionModel.MULTIPLE__SELECTION: TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION;
any other (default): TreeSelectionModel.SINGLE_TREE_SELECTION;
mode - any of the table selection modespublic void setCellRenderer(TreeCellRenderer cellRenderer)
cellRenderer - to use for rendering tree cells.public void collapseAll()
public void expandAll()
public void collapsePath(TreePath path)
path - path of the node to collapsepublic void expandPath(TreePath path)
path - path of the node to expandpublic void collapseRow(int row)
public void expandRow(int row)
public void setRootVisible(boolean visible)
visible - true, if the root node is visible; false, otherwisepublic boolean isRootVisible()
public boolean isVisible(TreePath path)
public boolean isExpanded(TreePath path)
path - path
public boolean isExpanded(int row)
row - row
public boolean isCollapsed(TreePath path)
path - path
public boolean isCollapsed(int row)
row - row
public java.util.Enumeration getExpandedDescendants(TreePath parent)
Enumeration of the descendants of the path
parent that are currently expanded. If parent
is not currently expanded, this will return null. If you
expand/collapse nodes while iterating over the returned
Enumeration this may not return all the expanded paths, or
may return paths that are no longer expanded.
parent - the path which is to be examined
Enumeration of the descendents of
parent, or null if
parent is not currently expandedpublic TreePath getPathForRow(int row)
row -
TreePath for the given row.public void setShowsRootHandles(boolean visible)
showsRootHandles property for the
tree part. This property specifies whether the node handles should be
displayed. If handles are not supported by a particular look and feel,
this property may be ignored.
visible - true, if root handles should be shown; false, otherwisepublic boolean getShowsRootHandles()
showsRootHandles property.
showsRootHandles propertypublic boolean isRootAutoExpanded()
public void setRootAutoExpanded(boolean rootExpanded)
By default it is and hence the 2nd child level of the TreeModel will be accessed and shown.
If this is false, then only the root node will be accessed and displayed when a TreeModel is first set and the Tree is rendered.
public TreeSelectionModel getTreeSelectionModel()
public boolean isHierarchical(int column)
column - zero-based index of the column
TreeNodeinterface; false otherwise.public void validate()
Componentsuper.validate()
out of convention.
validate in class TableTable.validate()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||