|
Copyright © 2005 Scientific Applications. All Rights Reserved. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.swing.table.AbstractTableModel
com.sciapp.treetable.TreeTableModelAdapter
public class TreeTableModelAdapter
TreeTableModelAdapter sits between a TreeTable and a TreeTableModel. Methods inherited from the TableModel interface are passed to the inner treetable model.
| Field Summary | |
|---|---|
protected boolean |
delayed
flag that controls whether the adapter will fire table change events immediatelly or add them to the swing event queue for later processing. |
protected JTree |
tree
the tree |
protected TreeTableModel |
treeTableModel
the treetable model |
| Fields inherited from class javax.swing.table.AbstractTableModel |
|---|
listenerList |
| Fields inherited from interface com.sciapp.treetable.TreeTableModelAdapterIF |
|---|
TREE_PROPERTY, TREE_TABLE_MODEL_PROPERTY |
| Constructor Summary | |
|---|---|
TreeTableModelAdapter()
Constructs a TreeTableModelAdapter. |
|
TreeTableModelAdapter(TreeTableModel treeTableModel)
Constructs a TreeTableModelAdapter. |
|
TreeTableModelAdapter(TreeTableModel treeTableModel,
JTree tree)
Constructs a TreeTableModelAdapter. |
|
| Method Summary | |
|---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list to be notified when the TreeTableModel or the JTree changes. |
void |
collapseAll()
Convenience method to collapse all rows. |
protected JTree |
createDefaultTree()
Returns a new instance of the JTree that will be associated with this TreeTableModelAdapter. |
protected TreeTableModel |
createDefaultTreeTableModel()
Creates and returns a new instance of the treetable model associated with this TreeTableModelAdapter. |
void |
expandAll()
Convenience method to expand all rows. |
void |
fireTableChanged(TableModelEvent e)
Forwards the given notification event to all TableModelListeners that registered
themselves as listeners for this table model. |
Class |
getColumnClass(int column)
Returns Object.class regardless of columnIndex. |
int |
getColumnCount()
Returns the number of columns in the model. |
String |
getColumnName(int column)
Returns a default name for the column using spreadsheet conventions: A, B, C, ... |
boolean |
getDelayed()
Returns true if events received from the treemodel are to be added to the swing event queue. |
protected int |
getPreviousRowCount()
Called from subclasses during events to find what was the row count before the event. |
int |
getRowCount()
Returns the number of rows in the model. |
JTree |
getTree()
Returns the associated tree. |
TreeTableModel |
getTreeTableModel()
Returns the associated treetable model. |
Object |
getValueAt(int row,
int column)
Returns the value for the cell at columnIndex and
rowIndex. |
boolean |
isAggregate(int rowIndex)
Determines if the row at rowIndex is an aggregate row. |
boolean |
isCellEditable(int row,
int column)
Returns false. |
boolean |
isFooter(int rowIndex)
Determines if the row at rowIndex is a footer. |
boolean |
isHeader(int rowIndex)
Determines if the row at rowIndex is a header. |
protected void |
nodeCollapsed(TreePath path)
Notification that the specified path was collapsed. |
protected void |
nodeExpanded(TreePath path)
Notification that the specified path was expanded. |
Object |
nodeForRow(int rowIndex)
Returns the node at row rowIndex. |
protected void |
nodesChanged(TreeModelEvent e)
Notification that children nodes at the specified path have changed. |
protected void |
nodesInserted(TreeModelEvent e)
Notification that children nodes at the specified path have been added. |
protected void |
nodesRemoved(TreeModelEvent e)
Notification that children nodes at the specified path have been removed. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list that is notified when the TreeTableColumnModel or the JTree changes. |
void |
setDelayed(boolean delayed)
Sets the delay property, which if true, events received from the treemodel are to be added to the swing event queue. |
void |
setTree(JTree newTree)
Sets a new tree. |
void |
setTreeTableModel(TreeTableModel newTreeModel)
Sets a new treetable model. |
void |
setValueAt(Object value,
int row,
int column)
This empty implementation is provided so users don't have to implement this method if their data model is not editable. |
protected void |
structureChanged(TreeModelEvent e)
Notification that the structure of the nodes at the specified path has changed. |
| Methods inherited from class javax.swing.table.AbstractTableModel |
|---|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface javax.swing.table.TableModel |
|---|
addTableModelListener, removeTableModelListener |
| Field Detail |
|---|
protected JTree tree
protected TreeTableModel treeTableModel
protected boolean delayed
| Constructor Detail |
|---|
public TreeTableModelAdapter()
public TreeTableModelAdapter(TreeTableModel treeTableModel)
public TreeTableModelAdapter(TreeTableModel treeTableModel,
JTree tree)
| Method Detail |
|---|
public void addPropertyChangeListener(PropertyChangeListener listener)
addPropertyChangeListener in interface TreeTableModelAdapterIFlistener - the listener to add.public void collapseAll()
protected JTree createDefaultTree()
protected TreeTableModel createDefaultTreeTableModel()
By default, this method returns a DefaultMutableTreeTableModel.
public void expandAll()
public void fireTableChanged(TableModelEvent e)
TableModelListeners that registered
themselves as listeners for this table model.
fireTableChanged in class AbstractTableModele - the event to be forwardedAbstractTableModel.addTableModelListener(javax.swing.event.TableModelListener),
TableModelEvent,
EventListenerListpublic Class getColumnClass(int column)
Object.class regardless of columnIndex.
getColumnClass in interface TableModelgetColumnClass in class AbstractTableModelcolumn - the column being queried
public int getColumnCount()
JTable uses this method to determine how many columns it
should create and display by default.
getColumnCount in interface TableModelTableModel.getRowCount()public String getColumnName(int column)
column cannot be found,
returns an empty string.
getColumnName in interface TableModelgetColumnName in class AbstractTableModelcolumn - the column being queried
columnpublic boolean getDelayed()
protected int getPreviousRowCount()
public int getRowCount()
JTable uses this method to determine how many rows it
should display. This method should be quick, as it
is called frequently during rendering.
getRowCount in interface TableModelTableModel.getColumnCount()public JTree getTree()
getTree in interface TreeTableModelAdapterIFpublic TreeTableModel getTreeTableModel()
getTreeTableModel in interface TreeTableModelAdapterIF
public Object getValueAt(int row,
int column)
columnIndex and
rowIndex.
getValueAt in interface TableModelrow - the row whose value is to be queriedcolumn - the column whose value is to be queried
public boolean isAggregate(int rowIndex)
rowIndex - the row to query
public boolean isCellEditable(int row,
int column)
isCellEditable in interface TableModelisCellEditable in class AbstractTableModelrow - the row being queriedcolumn - the column being queried
TableModel.setValueAt(java.lang.Object, int, int)public boolean isFooter(int rowIndex)
rowIndex - the row to query
public boolean isHeader(int rowIndex)
rowIndex - the row to query
protected void nodeCollapsed(TreePath path)
path - the path that was collapsedprotected void nodeExpanded(TreePath path)
path - the path that was expandedpublic Object nodeForRow(int rowIndex)
rowIndex.
rowIndex - the index of the row
rowIndexprotected void nodesChanged(TreeModelEvent e)
e - the event identifying the changeprotected void nodesInserted(TreeModelEvent e)
e - the event identifying the insertionprotected void nodesRemoved(TreeModelEvent e)
e - the event identifying the removalpublic void removePropertyChangeListener(PropertyChangeListener listener)
removePropertyChangeListener in interface TreeTableModelAdapterIFlistener - the listener to remove.public void setDelayed(boolean delayed)
delayed - set to true if events received from the treemodel are to be added to the swing event queue.public void setTree(JTree newTree)
newTree - the new tree to assign.public void setTreeTableModel(TreeTableModel newTreeModel)
newTreeModel - the new treetable model to assign.
public void setValueAt(Object value,
int row,
int column)
setValueAt in interface TableModelsetValueAt in class AbstractTableModelvalue - value to assign to cellrow - row of cellcolumn - column of cellTableModel.getValueAt(int, int),
TableModel.isCellEditable(int, int)protected void structureChanged(TreeModelEvent e)
e - the event identifying the structure change
|
Copyright © 2005 Scientific Applications. All Rights Reserved. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||