public class KTreeModelTreeTableAdapter extends Object implements TableModel, KTreeModelListener
KTreeTable
to be used
with a KTreeModel
. The adapter translates messages
and events between the KTreeTable
and the
KTreeModel
implementation. This class is for internal
use, and does not normally need to be instantiated by application
code.KTreeTable
Modifier and Type | Field and Description |
---|---|
private JTree |
_tree |
private String[] |
columns |
private Vector |
listeners |
private KTreeModel |
model |
Constructor and Description |
---|
KTreeModelTreeTableAdapter(JTree tree)
Construct a new tree model table adapter.
|
Modifier and Type | Method and Description |
---|---|
private void |
_init() |
void |
addTableModelListener(TableModelListener listener)
Add a table model listener.
|
void |
dataChanged(KTreeModelEvent evt)
Invoked when the structure of the entire model has changed.
|
void |
dispose()
Dispose of the adapter.
|
protected void |
fireTableDataChanged()
Notify listeners that the table data has changed.
|
Class |
getColumnClass(int col)
Get the class type for the given column.
|
int |
getColumnCount()
Get the column count for this model.
|
String |
getColumnName(int col)
Get the name of a given column.
|
int |
getRowCount()
Get the row count for this table model.
|
KTreeModel |
getTreeModel()
Get the tree model in use by this adapter.
|
Object |
getValueAt(int row,
int col)
Get the value at the given row and column in the table model.
|
boolean |
isCellEditable(int row,
int col)
Determine if a given cell is editable.
|
protected Object |
nodeForRow(int row)
Get the node at the specified row.
|
void |
nodesAdded(KTreeModelEvent evt)
Invoked after a node has been added to the model.
|
void |
nodesChanged(KTreeModelEvent evt)
Invoked when nodes are changed in the model.
|
void |
nodesRemoved(KTreeModelEvent evt)
Invoked after a node has been removed from the model.
|
void |
removeTableModelListener(TableModelListener listener)
Remove a table model listener.
|
void |
setTreeModel(KTreeModel model)
Set the tree model to be used by this adapter.
|
void |
setValueAt(Object obj,
int row,
int col)
Set the value at the given row and column in the table model.
|
void |
structureChanged(KTreeModelEvent evt)
Invoked when the structure of a portion of the model is changed.
|
private KTreeModel model
public KTreeModelTreeTableAdapter(JTree tree)
public void setTreeModel(KTreeModel model)
model
- The model to set.getTreeModel()
public KTreeModel getTreeModel()
null
if no
model has been set).setTreeModel(kiwi.ui.model.KTreeModel)
private void _init()
public void addTableModelListener(TableModelListener listener)
TableModelListener
to
this adapter's list of table model listeners.addTableModelListener
in interface TableModel
listener
- The listener to add.removeTableModelListener(javax.swing.event.TableModelListener)
public void removeTableModelListener(TableModelListener listener)
TableModelListener
from this adapter's list of table model listeners.removeTableModelListener
in interface TableModel
listener
- The listener to remove.addTableModelListener(javax.swing.event.TableModelListener)
public int getColumnCount()
TableModel
.)getColumnCount
in interface TableModel
public void setValueAt(Object obj, int row, int col)
TableModel
.) In this implementation, this
method does nothing, since TreeTable
s are currently not
editable.setValueAt
in interface TableModel
public Object getValueAt(int row, int col)
TableModel
.)getValueAt
in interface TableModel
row
- The row.col
- The column.public boolean isCellEditable(int row, int col)
false
because TreeTable
s are
currently not editable.isCellEditable
in interface TableModel
public int getRowCount()
TableModel
.)getRowCount
in interface TableModel
public Class getColumnClass(int col)
Object.class
. This may change in a
future implementation to reflect the actual data type.getColumnClass
in interface TableModel
public String getColumnName(int col)
TableModel
.)getColumnName
in interface TableModel
col
- The index of the column.protected void fireTableDataChanged()
protected Object nodeForRow(int row)
row
- The row numberpublic void nodesAdded(KTreeModelEvent evt)
nodesAdded
in interface KTreeModelListener
public void nodesRemoved(KTreeModelEvent evt)
nodesRemoved
in interface KTreeModelListener
public void nodesChanged(KTreeModelEvent evt)
nodesChanged
in interface KTreeModelListener
public void structureChanged(KTreeModelEvent evt)
structureChanged
in interface KTreeModelListener
public void dataChanged(KTreeModelEvent evt)
dataChanged
in interface KTreeModelListener
public void dispose()
JTree
component, and then null out its
references to the JTree
and to the associated
KTreeModel
.WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses