|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.table.AbstractTableModel
org.springframework.richclient.table.BaseTableModel
public abstract class BaseTableModel
A skeleton TableModel
implementation that adds to the AbstractTableModel
class
from the core Java API by providing the functionality to manage the underlying collection
of data for the table.
Field Summary |
---|
Fields inherited from class javax.swing.table.AbstractTableModel |
---|
listenerList |
Constructor Summary | |
---|---|
BaseTableModel()
Creates a new uninitialized BaseTableModel . |
|
BaseTableModel(List rows)
Creates a new BaseTableModel containing the given collection of rows. |
Method Summary | |
---|---|
void |
addRow(Object row)
Adds the given row to the end of the list of existing rows in the table model. |
void |
addRows(List newRows)
Adds the given rows to the end of the list of existing rows in the table model. |
void |
clear()
Removes all rows from the table model. |
protected abstract Class[] |
createColumnClasses()
Subclasses must implement this method to return the array of class types for the columns displayed by this table model. |
protected void |
createColumnInfo()
Creates the required column information based on the value provided by the createColumnClasses() and createColumnNames() methods. |
protected abstract String[] |
createColumnNames()
Subclasses must implement this method to return the array of column headers for the columns to be displayed by this table model. |
Class |
getColumnClass(int columnIndex)
Returns the type of the object to be displayed in the given column. |
protected Class[] |
getColumnClasses()
Returns the array of class types for the columns displayed by this table model. |
int |
getColumnCount()
|
List |
getColumnData(int column)
Returns the collection of data from the given column of each row in the table model. |
String[] |
getColumnHeaders()
Returns the array of column headers. |
String |
getColumnName(int columnIndex)
Returns the name to be displayed in the header for the column at the given position. |
protected String[] |
getColumnNames()
Returns the array of column headers for the columns displayed by this table model. |
int |
getDataColumnCount()
Returns the number of columns, excluding the column that displays row numbers if present. |
String[] |
getDataColumnHeaders()
Returns the array of column headers other than the column displaying the row numbers, if present. |
Object |
getRow(int rowIndex)
Returns the object representing the row at the given zero-based index. |
int |
getRowCount()
|
List |
getRows()
Returns the collection of all the rows in this table model. |
Object |
getValueAt(int rowIndex,
int columnIndex)
|
protected abstract Object |
getValueAtInternal(Object row,
int columnIndex)
Subclasses must implement this method to return the value at the given column index for the given object. |
boolean |
hasRowNumbers()
Returns true if row numbers are to appear in the first column of the displayed table (default is true). |
boolean |
isCellEditable(int rowIndex,
int columnIndex)
|
protected boolean |
isCellEditableInternal(Object row,
int columnIndex)
Subclasses may override this method to determine if the cell at the specified row and column position can be edited. |
void |
remove(int index)
Removes from the table model the row at the given position in the list of rows. |
void |
remove(int[] indexes)
Removes the rows at each of the given positions. |
void |
remove(int firstIndex,
int lastIndex)
Removes all of the rows from firstIndex to lastIndex inclusive. |
int |
rowOf(Object obj)
Returns the index of the first row containing the specified element, or -1 if this table model does not contain this element. |
void |
setRowNumbers(boolean rowNumbers)
Sets the flag that indicates whether or not row numbers are to appear in the first column of the displayed table. |
void |
setRows(List rows)
Overwrites the existing table rows with the given collection and fires an appropriate event to all registered listeners. |
void |
setValueAt(Object value,
int rowIndex,
int columnIndex)
|
protected void |
setValueAtInternal(Object value,
Object row,
int columnIndex)
Subclasses may implement this method to set the given value on the property at the given column index of the given row object. |
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 javax.swing.table.TableModel |
---|
addTableModelListener, removeTableModelListener |
Constructor Detail |
---|
public BaseTableModel()
BaseTableModel
.
public BaseTableModel(List rows)
BaseTableModel
containing the given collection of rows.
rows
- The rows of the table model. May be null or empty.Method Detail |
---|
public void setRows(List rows)
rows
- The collection of rows that will overwrite the existing collection. May be
null or empty.public void setRowNumbers(boolean rowNumbers)
rowNumbers
- The flag to display row numbers in the first column.public boolean hasRowNumbers()
protected void createColumnInfo()
createColumnClasses()
and createColumnNames()
methods.
public int getRowCount()
getRowCount
in interface TableModel
public int getColumnCount()
getColumnCount
in interface TableModel
public int getDataColumnCount()
public Class getColumnClass(int columnIndex)
getColumnClass
in interface TableModel
getColumnClass
in class AbstractTableModel
columnIndex
- The zero-based index of the column whose type will be returned.
IndexOutOfBoundsException
- if columnIndex
is not within the bounds of the
column range for a row of the table.public String getColumnName(int columnIndex)
getColumnName
in interface TableModel
getColumnName
in class AbstractTableModel
columnIndex
- The zero-based index of the column whose name will be returned.
IndexOutOfBoundsException
- if columnInde
is not within the bounds of the
column range for a row of the table.public String[] getColumnHeaders()
public String[] getDataColumnHeaders()
public Object getValueAt(int rowIndex, int columnIndex)
getValueAt
in interface TableModel
protected abstract Object getValueAtInternal(Object row, int columnIndex)
row
- The object representing a row of data from the table.columnIndex
- The column index of the value to be returned.
public boolean isCellEditable(int rowIndex, int columnIndex)
isCellEditable
in interface TableModel
isCellEditable
in class AbstractTableModel
protected boolean isCellEditableInternal(Object row, int columnIndex)
row
- The object representing the table row.columnIndex
- The zero-based index of the column to be checked.
public void setValueAt(Object value, int rowIndex, int columnIndex)
setValueAt
in interface TableModel
setValueAt
in class AbstractTableModel
protected void setValueAtInternal(Object value, Object row, int columnIndex)
value
- The value to be set.row
- The object representing the row in the table.columnIndex
- The column position of the property on the given row object.public Object getRow(int rowIndex)
rowIndex
- The zero-based index of the row whose object should be returned.
IndexOutOfBoundsException
- if rowIndex
is not within the bounds of the
collection of rows for this table model.public List getRows()
public List getColumnData(int column)
column
- The zero-based index of the column whose data should be returned.
IndexOutOfBoundsException
- if the given column is not within the bounds of the
number of columns for the rows in this table model.public int rowOf(Object obj)
obj
- The object whose row number will be returned.
public void addRow(Object row)
addRow
in interface MutableTableModel
row
- The row to be added. Must not be null.public void addRows(List newRows)
addRows
in interface MutableTableModel
newRows
- The rows to be added. May be empty but must not be null.public void remove(int index)
remove
in interface MutableTableModel
index
- The zero-based position of the row to be removed.public void remove(int firstIndex, int lastIndex)
firstIndex
to lastIndex
inclusive. All
registered table model listeners will be notified of the removal of the rows.
remove
in interface MutableTableModel
firstIndex
- The zero-based position of the first row to be removed.lastIndex
- The zero-based position of the last row to be removed.public void remove(int[] indexes)
remove
in interface MutableTableModel
indexes
- The array of zero-based indexes of the rows to be removed. May be empty
but must not be null.public void clear()
clear
in interface MutableTableModel
protected Class[] getColumnClasses()
protected String[] getColumnNames()
protected abstract Class[] createColumnClasses()
protected abstract String[] createColumnNames()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |