org.jdesktop.swingx.util
Class ComponentTreeTableModel
- java.lang.Object
-
- org.jdesktop.swingx.treetable.AbstractTreeTableModel
-
- org.jdesktop.swingx.util.ComponentTreeTableModel
-
- All Implemented Interfaces:
- javax.swing.tree.TreeModel, TreeTableModel
public class ComponentTreeTableModel extends AbstractTreeTableModel
A static snapshot of a container hierarchy. NOTE: does not listen to any property changes of contained components - cell updates are arbitrary on repaint only!
-
-
Constructor Summary
Constructors Constructor and Description ComponentTreeTableModel(java.awt.Container root)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.lang.StringconvertValueToText(java.lang.Object node)java.lang.ObjectgetChild(java.lang.Object parent, int index)intgetChildCount(java.lang.Object parent)java.lang.Class<?>getColumnClass(int column)Returns the most specific superclass for all the cell values in the column.intgetColumnCount()Returns the number of columns in the model.java.lang.StringgetColumnName(int column)Returns the name of the column atcolumnIndex.intgetIndexOfChild(java.lang.Object parent, java.lang.Object child)java.lang.ObjectgetValueAt(java.lang.Object node, int column)Returns the value for thenodeatcolumnIndex.booleanisLeaf(java.lang.Object node)Returnstrueifnodeis a leaf.voidsetRoot(java.awt.Container root)voidsetValueAt(java.lang.Object value, java.lang.Object node, int column)Sets the value for thenodeatcolumnIndextovalue.-
Methods inherited from class org.jdesktop.swingx.treetable.AbstractTreeTableModel
addTreeModelListener, getHierarchicalColumn, getRoot, getTreeModelListeners, isCellEditable, removeTreeModelListener, valueForPathChanged
-
-
-
-
Method Detail
-
setRoot
public void setRoot(java.awt.Container root)
-
getChild
public java.lang.Object getChild(java.lang.Object parent, int index)
-
getChildCount
public int getChildCount(java.lang.Object parent)
-
getIndexOfChild
public int getIndexOfChild(java.lang.Object parent, java.lang.Object child)
-
isLeaf
public boolean isLeaf(java.lang.Object node)
Description copied from class:AbstractTreeTableModelReturnstrueifnodeis a leaf.- Specified by:
isLeafin interfacejavax.swing.tree.TreeModel- Overrides:
isLeafin classAbstractTreeTableModel- Parameters:
node- a node in the tree, obtained from this data source- Returns:
- true if
nodeis a leaf
-
convertValueToText
public java.lang.String convertValueToText(java.lang.Object node)
-
getColumnClass
public java.lang.Class<?> getColumnClass(int column)
Description copied from class:AbstractTreeTableModelReturns the most specific superclass for all the cell values in the column. This is used by theJXTreeTableto set up a default renderer and editor for the column.- Specified by:
getColumnClassin interfaceTreeTableModel- Overrides:
getColumnClassin classAbstractTreeTableModel- Parameters:
column- the index of the column- Returns:
- the common ancestor class of the object values in the model.
- See Also:
TableModel.getColumnClass(int)
-
getColumnCount
public int getColumnCount()
Description copied from interface:TreeTableModelReturns the number of columns in the model. AJXTreeTableuses this method to determine how many columns it should create and display by default.- Returns:
- the number of columns in the model
- See Also:
TableModel.getColumnCount()
-
getColumnName
public java.lang.String getColumnName(int column)
Description copied from class:AbstractTreeTableModelReturns the name of the column atcolumnIndex. This is used to initialize the table's column header name. Note: this name does not need to be unique; two columns in a table can have the same name.- Specified by:
getColumnNamein interfaceTreeTableModel- Overrides:
getColumnNamein classAbstractTreeTableModel- Parameters:
column- the index of the column- Returns:
- the name of the column
- See Also:
TableModel.getColumnName(int)
-
getValueAt
public java.lang.Object getValueAt(java.lang.Object node, int column)Description copied from interface:TreeTableModelReturns the value for thenodeatcolumnIndex. Thenodemust be managed by this model. Unamanaged nodes should throw anIllegalArgumentException.- Parameters:
node- the node whose value is to be queriedcolumn- the column whose value is to be queried- Returns:
- the value Object at the specified cell
- See Also:
TreeTableModel.setValueAt(java.lang.Object, java.lang.Object, int),TableModel.getValueAt(int, int)
-
setValueAt
public void setValueAt(java.lang.Object value, java.lang.Object node, int column)Description copied from class:AbstractTreeTableModelSets the value for thenodeatcolumnIndextovalue.- Specified by:
setValueAtin interfaceTreeTableModel- Overrides:
setValueAtin classAbstractTreeTableModel- Parameters:
value- the new valuenode- the node whose value is to be changedcolumn- the column whose value is to be changed- See Also:
TreeTableModel.getValueAt(java.lang.Object, int),AbstractTreeTableModel.isCellEditable(java.lang.Object, int),TableModel.setValueAt(Object, int, int)
-
-
DataMelt 3.0 © DataMelt by jWork.ORG