|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.swing.table.AbstractTableModel
com.sciapp.table.ListTableMap
com.sciapp.tree.TreeTableModel
public class TreeTableModel
TreeTableModel is the tablemodel that the TreeTable class uses.
TreeTableModel wraps around a ListTableModel instance in order to provide a tree-like
view of the table's data.
Rows are grouped together if they are found to be equal by this class's row comparator.
The default row comparator is a TreeTableModel.RowComparator, which compares rows by using
a single column. However, more complex schemes can be employed, such as comparing using
more than one columns. The current row comparator can be assigned with
setRowComparator.
| Nested Class Summary | |
|---|---|
class |
TreeTableModel.RowComparator
RowComparator compares row data based on a single column. |
| Field Summary |
|---|
| Fields inherited from class com.sciapp.table.ListTableMap |
|---|
tableModel |
| Fields inherited from class javax.swing.table.AbstractTableModel |
|---|
listenerList |
| Constructor Summary | |
|---|---|
TreeTableModel(ListTableModel tableModel)
Constructs a TreeTableModel with tableModel as the underlying tablemodel
holding the data. |
|
| Method Summary | |
|---|---|
protected Comparator |
createDefaultRowComparator()
Creates the default row comparator that will be used to determine row similarity. |
void |
fireTableChanged(TableModelEvent e)
Forwards the given notification event to all TableModelListeners that registered
themselves as listeners for this table model. |
Comparator |
getRowComparator()
Returns the Comparator instance that will be used to determine row similarity. |
int |
getRowCount()
Returns tableModel.getRowCount |
Object |
getValueAt(int rowIndex,
int columnIndex)
Returns tableModel.getValueAt |
boolean |
isCellEditable(int rowIndex,
int columnIndex)
Returns false if the row at rowIndex is a grouping row, otherwise
returns the value of its super method. |
void |
removeRow(int row)
Removes a row from the data model |
void |
removeRows(int[] rows)
Removes a few rows from the data model |
void |
rowsReordered(ReorderEvent e)
Does nothing. |
void |
setRowComparator(Comparator rowComparator)
Sets the row comparator that will be used to determine row similarity. |
void |
setValueAt(Object aValue,
int rowIndex,
int columnIndex)
Assigns aValue to the object at columnIndex and rowIndex. |
| Methods inherited from class com.sciapp.table.ListTableMap |
|---|
addReorderListener, addRow, addRows, clear, fireRowsReordered, getCellValue, getColumnClass, getColumnCount, getColumnName, getModel, getRows, removeReorderListener, setModel, tableChanged |
| 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 com.sciapp.table.ListTableModel |
|---|
fireTableCellUpdated, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged |
| Methods inherited from interface javax.swing.table.TableModel |
|---|
addTableModelListener, removeTableModelListener |
| Constructor Detail |
|---|
public TreeTableModel(ListTableModel tableModel)
tableModel as the underlying tablemodel
holding the data.
| Method Detail |
|---|
protected Comparator createDefaultRowComparator()
TreeTableModel.RowComparator that uses the first
column of the table for the equality check.
public void fireTableChanged(TableModelEvent e)
TableModelListeners that registered
themselves as listeners for this table model.
fireTableChanged in interface ListTableModelfireTableChanged in class AbstractTableModele - the event to be forwardedAbstractTableModel.addTableModelListener(javax.swing.event.TableModelListener),
TableModelEvent,
EventListenerListpublic Comparator getRowComparator()
public int getRowCount()
getRowCount in interface TableModelgetRowCount in class ListTableMapTableModel.getColumnCount()
public Object getValueAt(int rowIndex,
int columnIndex)
getValueAt in interface TableModelgetValueAt in class ListTableMaprowIndex - the row whose value is to be queriedcolumnIndex - the column whose value is to be queried
public boolean isCellEditable(int rowIndex,
int columnIndex)
rowIndex is a grouping row, otherwise
returns the value of its super method.
isCellEditable in interface TableModelisCellEditable in class ListTableMaprowIndex - the row being queriedcolumnIndex - the column being queried
TableModel.setValueAt(java.lang.Object, int, int)public void removeRow(int row)
removeRow in interface ListTableModelremoveRow in class ListTableMaprow - the index of the row being removedpublic void removeRows(int[] rows)
removeRows in interface ListTableModelremoveRows in class ListTableMaprows - an integer array that contains indexes of the rows being deletedpublic void rowsReordered(ReorderEvent e)
rowsReordered in interface ReorderListenerrowsReordered in class ListTableMape - the ReorderEvent objectpublic void setRowComparator(Comparator rowComparator)
rowComparator - the row comparator that we want to use
public void setValueAt(Object aValue,
int rowIndex,
int columnIndex)
aValue to the object at columnIndex and rowIndex.
setValueAt in interface TableModelsetValueAt in class ListTableMapaValue - value to assign to the cellrowIndex - row of the cellcolumnIndex - column of the cellTableModel.getValueAt(int, int),
TableModel.isCellEditable(int, int)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||