|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--kiwi.ui.model.TreeModelTableAdapter
An adapter that allows a Swing JTable
to be used with the
StaticTreeModel
and DynamicTreeModel
data models.
The adapter translates messages and events between the JTable
and the ITreeModel
implementation.
JTable
,
ITreeModel
Inner Class Summary | |
class |
TreeModelTableAdapter.TableEntry
Internal class for managing table items. |
Constructor Summary | |
TreeModelTableAdapter(JTable jtable)
Construct a new tree model table adapter. |
Method Summary | |
void |
addTableModelListener(TableModelListener listener)
Add a table model listener. |
void |
dispose()
Dispose of the adapter. |
protected void |
fireIntervalAdded(int first,
int last)
Fire an interval added event. |
protected void |
fireIntervalRemoved(int first,
int last)
Fire an interval removed event. |
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. |
int |
getRowForNode(ITreeNode node)
Get the table row number for a given node. |
ITreeModel |
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. |
void |
nodeAdded(TreeModelEvent evt)
Invoked after a node has been added to the model. |
void |
nodeChanged(TreeModelEvent evt)
Invoked after a node in the model has changed in some way. |
void |
nodeCollapsed(TreeModelEvent evt)
Invoked after a node in the model has been collapsed. |
void |
nodeCollapsing(TreeModelEvent evt)
Invoked when a node in the model is about to be collapsed. |
void |
nodeExpanded(TreeModelEvent evt)
Invoked after a node in the model has been expanded. |
void |
nodeExpanding(TreeModelEvent evt)
Invoked when a node in the model is about to be expanded. |
void |
nodeRemoved(TreeModelEvent evt)
Invoked after a node has been removed from the model. |
void |
nodeStructureChanged(TreeModelEvent evt)
Invoked after the subtree rooted at a node has changed its structure in some significant way. |
void |
removeTableModelListener(TableModelListener listener)
Remove a table model listener. |
void |
setTreeModel(ITreeModel 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. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public TreeModelTableAdapter(JTable jtable)
jtable
- The JFC table component to be associated with this adapter.Method Detail |
public void setTreeModel(ITreeModel model)
model
- The model to set.getTreeModel()
public ITreeModel getTreeModel()
setTreeModel(kiwi.ui.model.ITreeModel)
public void addTableModelListener(TableModelListener listener)
TableModelListener
to
this adapter's list of table model listeners.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.listener
- The listener to remove.addTableModelListener(javax.swing.event.TableModelListener)
public int getColumnCount()
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.public Object getValueAt(int row, int col)
TableModel
.)row
- The row.col
- The column.public boolean isCellEditable(int row, int col)
TreeTable
s are currently
not editable.public int getRowCount()
TableModel
.)public Class getColumnClass(int col)
Object.class
. This may change in a
future implementation to reflect the actual data type.public String getColumnName(int col)
TableModel
.)col
- The index of the column.protected void fireIntervalAdded(int first, int last)
TreeTable
to insert new rows when a given node is expanded.first
- The index of the first row added.last
- The index of the last row added.protected void fireIntervalRemoved(int first, int last)
TreeTable
to remove rows when a given node is collapsed.first
- The index of the first row removed.last
- The index of the last row removed.public void nodeExpanding(TreeModelEvent evt)
public void nodeExpanded(TreeModelEvent evt)
public void nodeCollapsing(TreeModelEvent evt)
public void nodeCollapsed(TreeModelEvent evt)
public void nodeAdded(TreeModelEvent evt)
public void nodeRemoved(TreeModelEvent evt)
public void nodeChanged(TreeModelEvent evt)
public void nodeStructureChanged(TreeModelEvent evt)
public final int getRowForNode(ITreeNode node)
node
- The node.row
- The row in the table at which this node is currently
displayed. Note that this value will become invalid when any node in the
table is expanded or collapsed, as this could potentially change the
position of node
in the table.public void dispose()
JTable
component, and then null out its
references to the JTable
and to the associated
ITreeModel
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |