public class DefaultTreeTableModel extends DefaultTreeModel implements TreeTableModel, SortableTableModel
Modifier and Type | Field and Description |
---|---|
protected ArrayList |
columnIdentifiers
The list of column identifiers.
|
protected HashMap |
sortComparators
The set of comparators used for sorting.
|
asksAllowsChildren, listenerList, root
Constructor and Description |
---|
DefaultTreeTableModel(TreeTableNode root,
ArrayList columnNames)
Creates a DefaultTreeTableModel in which any node can have children and
with as many columns as there are elements in columnNames
|
DefaultTreeTableModel(TreeTableNode root,
boolean asksAllowsChildren,
ArrayList columnNames)
Creates a DefaultTreeTableModel specifying whether any node can have
children, or whether only certain nodes can have children.
|
DefaultTreeTableModel(TreeTableNode root,
boolean asksAllowsChildren,
Object[] columnNames)
Creates a DefaultTreeTableModel specifying whether any node can have
children, or whether only certain nodes can have children.
|
DefaultTreeTableModel(TreeTableNode root,
Object[] columnNames)
Creates a DefaultTreeTableModel in which any node can have children and
with as many columns as there are elements in columnNames
|
Modifier and Type | Method and Description |
---|---|
void |
addNodeInto(TreeTableNode newChild,
TreeTableNode parent)
Invoke this to insert newChild at a specific location in parents
children.
|
protected static ArrayList |
convertToArrayList(Object[] anArray)
Returns an array list that contains the same objects as the array.
|
protected void |
fireTreeTableSorted(Object source,
Object[] path)
Notify all listeners that have registered interest for
notification on this event type.
|
Class |
getColumnClass(int column)
Returns the type for column number
column . |
int |
getColumnCount()
Returns the number of columns in the tree table.
|
String |
getColumnName(int column)
Returns the name for column number
column . |
Object |
getValueAt(Object node,
int column)
Returns the value to be displayed for node
node ,
at column number column . |
void |
insertNodeInto(MutableTreeNode newChild,
MutableTreeNode parent,
int index) |
boolean |
isCellEditable(Object node,
int column)
Indicates whether the the value for node
node ,
at column number column is editable. |
void |
nodeSorted(TreeNode node)
Invoke this method if you've sorted the node
|
void |
nodesSorted()
Invoke this method if you've sorted the entire tree model
|
void |
setAllCellsEditable(boolean editable)
Set all cells in the model editable or not editable.
|
void |
setColumnIdentifiers(ArrayList newIdentifiers)
Replaces the column identifiers in the model.
|
void |
setColumnIdentifiers(Object[] newIdentifiers)
Replaces the column identifiers in the model.
|
void |
setSortComparatorForColumn(TreeTableNodeComparator comparator,
int column)
Specify a comparator to use when sorting the tree table based on
column . |
void |
setValueAt(Object aValue,
Object node,
int row,
int column)
Sets the value for node
node ,
at row number row . |
void |
sort(int column,
boolean ascending)
Sort the entire tree model according to the values of the specified
column . |
void |
valueForPathChanged(TreePath path,
Object newValue) |
addTreeModelListener, asksAllowsChildren, fireTreeNodesChanged, fireTreeNodesInserted, fireTreeNodesRemoved, fireTreeStructureChanged, getChild, getChildCount, getIndexOfChild, getListeners, getPathToRoot, getPathToRoot, getRoot, getTreeModelListeners, isLeaf, nodeChanged, nodesChanged, nodeStructureChanged, nodesWereInserted, nodesWereRemoved, reload, reload, removeNodeFromParent, removeTreeModelListener, setAsksAllowsChildren, setRoot
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addTreeModelListener, getChild, getChildCount, getIndexOfChild, getRoot, isLeaf, removeTreeModelListener
protected ArrayList columnIdentifiers
protected HashMap sortComparators
public DefaultTreeTableModel(TreeTableNode root, Object[] columnNames)
root
- - a TreeTableNode object that is the root of the treecolumnNames
- - array containing the names of the new columns; if
this is null then the model has no columnspublic DefaultTreeTableModel(TreeTableNode root, ArrayList columnNames)
root
- - a TreeTableNode object that is the root of the treecolumnNames
- - list containing the names of the new columns; if
this is null then the model has no columnspublic DefaultTreeTableModel(TreeTableNode root, boolean asksAllowsChildren, Object[] columnNames)
root
- - a TreeTableNode object that is the root of the treeasksAllowsChildren
- - if false, any node without children is a leafcolumnNames
- - array containing the names of the new columns; if
this is null then the model has no columnspublic DefaultTreeTableModel(TreeTableNode root, boolean asksAllowsChildren, ArrayList columnNames)
root
- - a TreeTableNode object that is the root of the treeasksAllowsChildren
- - if false, any node without children is a leafcolumnNames
- - list containing the names of the new columns; if
this is null then the model has no columnspublic int getColumnCount()
getColumnCount
in interface TreeTableModel
public String getColumnName(int column)
column
.getColumnName
in interface TreeTableModel
public Class getColumnClass(int column)
column
.getColumnClass
in interface TreeTableModel
public Object getValueAt(Object node, int column)
node
,
at column number column
.getValueAt
in interface TreeTableModel
public void setAllCellsEditable(boolean editable)
editable
- public boolean isCellEditable(Object node, int column)
node
,
at column number column
is editable.isCellEditable
in interface TreeTableModel
public void setValueAt(Object aValue, Object node, int row, int column)
node
,
at row number row
.
at column number column
.setValueAt
in interface TreeTableModel
public void valueForPathChanged(TreePath path, Object newValue)
valueForPathChanged
in interface TreeModel
valueForPathChanged
in class DefaultTreeModel
public void setColumnIdentifiers(Object[] newIdentifiers)
newIdentifier
s is greater than the current number
of columns, new columns are added to the end of each row in the model.
If the number of newIdentifier
s is less than the current
number of columns, all the extra columns at the end of a row are
discarded. newIdentifiers
- array of column identifiers. If
null
, set the model
to zero columns#setNumRows
public void setColumnIdentifiers(ArrayList newIdentifiers)
newIdentifier
s is greater than the current number
of columns, new columns are added to the end of each row in the model.
If the number of newIdentifier
s is less than the current
number of columns, all the extra columns at the end of a row are
discarded. newIdentifiers
- vector of column identifiers. If
null
, set the model
to zero columns#setNumRows
public void addNodeInto(TreeTableNode newChild, TreeTableNode parent)
public void insertNodeInto(MutableTreeNode newChild, MutableTreeNode parent, int index)
insertNodeInto
in class DefaultTreeModel
public void setSortComparatorForColumn(TreeTableNodeComparator comparator, int column)
column
. The comparator will be used to compare the values at the
specified column
within the nodes, not to compare the nodes
themselves.public void sort(int column, boolean ascending)
column
. A comparator can be specified for comparing these values
by calling setSortComparatorForColumn
prior to calling this
method.sort
in interface SortableTableModel
column
- - specifies the column identifier used to compare the nodesascending
- - whether to sort in ascending order as opposed to
descending orderpublic void nodesSorted()
public void nodeSorted(TreeNode node)
protected void fireTreeTableSorted(Object source, Object[] path)
EventListenerList
Copyright © 2003, 2023, Oracle and/or its affiliates.