|
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.TableMap
com.sciapp.table.ListTableModelWrapper
public class ListTableModelWrapper
ListTableModelWrapper provides a wrapping for any TableModel class.
This is sometimes required for providing sorting and/or filtering capabilities to a TableModel
that does not implement the ListTableModel interface.
For example, having tableModel as the original table model:
ListTableModelWrapper wrapper = new ListTableModelWrapper(tableModel);
FilterTableModel ftm = new FilterTableModel(wrapper);
SortTableModel stm = new SortTableModel(ftm);
JTable table = new AdvancedJTable(stm);
stm.setHeader(table.getTableHeader());
Note that the extra ListTableModel methods that are implemented will throw an UnsupportedOperationException (if throwsException is true), with the exclusion of getRows() that returns null.
| Field Summary | |
|---|---|
protected boolean |
throwsException
flag that indicates that an exception will be thrown when the ListTableModel methods are called. |
| Fields inherited from class com.sciapp.table.TableMap |
|---|
tableModel |
| Fields inherited from class javax.swing.table.AbstractTableModel |
|---|
listenerList |
| Constructor Summary | |
|---|---|
ListTableModelWrapper(TableModel model)
Constructs a ListTableModelWrapper. |
|
| Method Summary | |
|---|---|
void |
addRow(Object row)
This method throws an UnsupportedOperationException. |
void |
addRows(List addedRows)
This method throws an UnsupportedOperationException. |
void |
clear()
This method throws an UnsupportedOperationException. |
Object |
getCellValue(Object row,
int index)
This method throws an UnsupportedOperationException. |
List |
getRows()
This method returns null. |
boolean |
getThrowsException()
Determines the behaviour of the model when the ListTableModel methods are called. |
void |
removeRow(int row)
This method throws an UnsupportedOperationException. |
void |
removeRows(int[] deletedRows)
This method throws an UnsupportedOperationException. |
void |
setThrowsException(boolean throwsException)
Assigns the behaviour of the model when the ListTableModel methods are called. |
| Methods inherited from class com.sciapp.table.TableMap |
|---|
addReorderListener, fireRowsMapped, fireRowsReordered, getColumnClass, getColumnCount, getColumnName, getModel, getRowCount, getValueAt, isCellEditable, removeReorderListener, rowsReordered, setModel, setValueAt, tableChanged |
| 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, getColumnClass, getColumnCount, getColumnName, getRowCount, getValueAt, isCellEditable, removeTableModelListener, setValueAt |
| Field Detail |
|---|
protected boolean throwsException
| Constructor Detail |
|---|
public ListTableModelWrapper(TableModel model)
| Method Detail |
|---|
public void addRow(Object row)
addRow in interface ListTableModelrow - 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 ListTableModeladdedRows - the rows being added.public void clear()
clear in interface ListTableModel
public Object getCellValue(Object row,
int index)
getCellValue in interface ListTableModelrow - the row dataindex - an index
public List getRows()
getRows in interface ListTableModelpublic boolean getThrowsException()
public void removeRow(int row)
removeRow in interface ListTableModelrow - the index of the row being removedpublic void removeRows(int[] deletedRows)
removeRows in interface ListTableModeldeletedRows - an integer array that contains indexes of the rows being deletedpublic void setThrowsException(boolean throwsException)
throwsException - true if an exception should be thrown when the ListTableModel methods are called
|
Copyright © 2005 Scientific Applications. All Rights Reserved. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||