|
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.table.ListTableMap
public class ListTableMap
This class defines a TableModel that wraps around a ListTableModel, which is passed in the constructor. The methods of ListTableModel that are implemented are nothing more than calls to the respective methods of the underlying ListTableModel.
Additionally, events generated from the underlying ListTableModel are intercepted and sent to this object's listeners.
Field Summary | |
---|---|
protected ListTableModel |
tableModel
The underlying ListTableModel |
Fields inherited from class javax.swing.table.AbstractTableModel |
---|
listenerList |
Constructor Summary | |
---|---|
ListTableMap(ListTableModel tableModel)
Constructs a ListTableMap having tableModel as the underlying ListTableModel |
Method Summary | |
---|---|
void |
addReorderListener(ReorderListener l)
Adds a ReorderListener that is notified each time a change to the data model occurs so that the table updates the selected rows accordingly. |
void |
addRow(Object row)
Adds a row to the end of the model. |
void |
addRows(List addedRows)
Adds a list of rows to the end of the model. |
void |
clear()
Clears the model of any data. |
int |
convertRowIndexToModel(int viewRowIndex)
Determines the index of the row in the underlying model in terms of the row index in this map. |
int |
convertRowIndexToView(int modelRowIndex)
Determines the index of the row in this map in terms of the row index in the underlying model. |
void |
fireRowsMapped(int[] changedIndices)
Notifies listeners that the rows of the table have been reordered according to the changedIndices map. |
void |
fireRowsReordered(ReorderEvent event)
Notifies listeners that the rows of the table have been reordered in some way. |
Object |
getCellValue(Object o,
int index)
Returns tableModel.getCellValue |
Class |
getColumnClass(int c)
Returns tableModel.getColumnClass |
int |
getColumnCount()
Returns tableModel.getColumnCount |
String |
getColumnName(int columnIndex)
Returns tableModel.getColumnName |
ListTableModel |
getInnerModel()
In a chain of ListTableMaps, this method returns the inner most tablemodel that is not an instanceof ListTableMap. |
ListTableModel |
getModel()
Returns the underlying ListTableModel model |
int |
getRowCount()
Returns tableModel.getRowCount |
List |
getRows()
Returns tableModel.getRows |
Object |
getValueAt(int row,
int column)
Returns tableModel.getValueAt |
boolean |
isCellEditable(int rowIndex,
int columnIndex)
Returns tableModel.isCellEditable |
void |
removeReorderListener(ReorderListener l)
Removes a listener from the list that is notified each time a reorder event is generated. |
void |
removeRow(int row)
Removes a row from the data model |
void |
removeRows(int[] deletedRows)
Removes a few rows from the data model |
void |
rowsReordered(ReorderEvent e)
Called whenever the rows of a JTable have been restructured. |
void |
setModel(ListTableModel newModel)
Sets the underlying ListTableModel to newModel. |
void |
setValueAt(Object aValue,
int rowIndex,
int columnIndex)
Returns tableModel.setValueAt |
void |
tableChanged(TableModelEvent e)
This fine grain notification tells listeners the exact range of cells, rows, or columns that changed. |
Methods inherited from class javax.swing.table.AbstractTableModel |
---|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, 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, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged |
Methods inherited from interface javax.swing.table.TableModel |
---|
addTableModelListener, removeTableModelListener |
Field Detail |
---|
protected ListTableModel tableModel
Constructor Detail |
---|
public ListTableMap(ListTableModel tableModel)
Method Detail |
---|
public void addReorderListener(ReorderListener l)
addReorderListener
in interface ReorderModel
l
- the ReorderListenerpublic void addRow(Object row)
addRow
in interface ListTableModel
row
- the row being addedpublic void addRows(List addedRows)
addedRows contains objects representing the actual rows being added. e.g. java.util.Vector, for DefaultTableModel.
addRows
in interface ListTableModel
addedRows
- the rows being added.public void clear()
clear
in interface ListTableModel
public void fireRowsMapped(int[] changedIndices)
fireRowsMapped
in interface ReorderModel
changedIndices
- int array indicating how the rows have been reordered.ReorderEvent
public void fireRowsReordered(ReorderEvent event)
fireRowsReordered
in interface ReorderModel
event
- the reorder event.ReorderEvent
public Object getCellValue(Object o, int index)
getCellValue
in interface ListTableModel
o
- the row dataindex
- an index
public Class getColumnClass(int c)
getColumnClass
in interface TableModel
getColumnClass
in class AbstractTableModel
c
- the column being queried
public int getColumnCount()
getColumnCount
in interface TableModel
TableModel.getRowCount()
public String getColumnName(int columnIndex)
getColumnName
in interface TableModel
getColumnName
in class AbstractTableModel
columnIndex
- the column being queried
column
public ListTableModel getInnerModel()
public ListTableModel getModel()
public int getRowCount()
getRowCount
in interface TableModel
TableModel.getColumnCount()
public List getRows()
getRows
in interface ListTableModel
public Object getValueAt(int row, int column)
getValueAt
in interface TableModel
row
- the row whose value is to be queriedcolumn
- the column whose value is to be queried
public boolean isCellEditable(int rowIndex, int columnIndex)
isCellEditable
in interface TableModel
isCellEditable
in class AbstractTableModel
rowIndex
- the row being queriedcolumnIndex
- the column being queried
TableModel.setValueAt(java.lang.Object, int, int)
public void removeReorderListener(ReorderListener l)
removeReorderListener
in interface ReorderModel
l
- the RearrangeListenerpublic void removeRow(int row)
removeRow
in interface ListTableModel
row
- the index of the row being removedpublic void removeRows(int[] deletedRows)
removeRows
in interface ListTableModel
deletedRows
- an integer array that contains indexes of the rows being deletedpublic void rowsReordered(ReorderEvent e)
rowsReordered
in interface ReorderListener
e
- the ReorderEvent objectpublic void setModel(ListTableModel newModel)
newModel
- the new ListTableModel to setpublic void setValueAt(Object aValue, int rowIndex, int columnIndex)
setValueAt
in interface TableModel
setValueAt
in class AbstractTableModel
aValue
- value to assign to cellrowIndex
- row of cellcolumnIndex
- column of cellTableModel.getValueAt(int, int)
,
TableModel.isCellEditable(int, int)
public void tableChanged(TableModelEvent e)
tableChanged
in interface TableModelListener
public int convertRowIndexToModel(int viewRowIndex)
viewRowIndex
- the index of the row in this map
public int convertRowIndexToView(int modelRowIndex)
modelRowIndex
- the index of the row in the underlying model
|
Copyright © 2005 Scientific Applications. All Rights Reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |