|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.swing.table.AbstractTableModel
org.jurvis.swing.table.JvMappedObjectTableModel
public class JvMappedObjectTableModel
A JvMappedObjectTableModel is a TableModel in which
each row is actually a single object and columns are determined via a
specified JvMappedObjectTableModel.ColumnMapper. The columns of a row typically represent
different fields of the row object.
This class is an improvement over JvAbstractObjectTableModel in that
a JvObjectTableRow object isn't needed for each row.
| Nested Class Summary | |
|---|---|
static interface |
JvMappedObjectTableModel.ColumnMapper
Interface for object mapping row objects to columns. |
| Field Summary | |
|---|---|
protected JvMappedObjectTableModel.ColumnMapper |
columnMapper
The object mapping from the row data to table columns. |
protected boolean |
editable
True if the data within this model is editable. |
protected List |
rowData
The List of row objects. |
| Fields inherited from class javax.swing.table.AbstractTableModel |
|---|
listenerList |
| Constructor Summary | |
|---|---|
JvMappedObjectTableModel(JvMappedObjectTableModel.ColumnMapper columnMapper)
Construct a JvMappedObjectTableModel with the given column
mapper. |
|
JvMappedObjectTableModel(List rowData,
JvMappedObjectTableModel.ColumnMapper columnMapper)
Construct a JvMappedObjectTableModel with the given
row data and column mapper. |
|
| Method Summary | |
|---|---|
void |
addRow(JvObjectTableRow row)
Adds a row to the end of the model. |
Class |
getColumnClass(int columnIndex)
Return the class of object displayed in the specified column. |
int |
getColumnCount()
Returns 0 for the number of columns in this data table. |
Collection |
getEmptyCollection()
Return an empty collection suitable for putting the selected items within. |
Object |
getObjectAt(int row)
Return the domain object associated with the specified row. |
int |
getRowCount()
Returns the number of rows in this data table. |
Object |
getValueAt(int row,
int column)
Returns an attribute value for the cell at row
and column. |
boolean |
isCellEditable(int row,
int column)
Returns true if the cell at row and column is
editable. |
boolean |
isEditable()
Determine if the cell within this table is editable. |
void |
remove(int row,
int col)
Method called when the drop operation is MOVE. |
void |
removeRow(int row)
Removes the row at row from the model. |
void |
setEditable(boolean editable)
Set whether the data within this table is editable. |
void |
setRowData(List rowData)
Set the list of objects representing the table rows. |
void |
setValueAt(Object value,
int row,
int column)
Sets the object value for the cell at column and
row. |
| Methods inherited from class javax.swing.table.AbstractTableModel |
|---|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnName, 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, getColumnName, removeTableModelListener |
| Field Detail |
|---|
protected List rowData
List of row objects.
protected boolean editable
protected JvMappedObjectTableModel.ColumnMapper columnMapper
| Constructor Detail |
|---|
public JvMappedObjectTableModel(JvMappedObjectTableModel.ColumnMapper columnMapper)
JvMappedObjectTableModel with the given column
mapper.
columnMapper - the object mapping from the row data to table columns
public JvMappedObjectTableModel(List rowData,
JvMappedObjectTableModel.ColumnMapper columnMapper)
JvMappedObjectTableModel with the given
row data and column mapper.
rowData - the list of objects representing the table rowscolumnMapper - the object mapping from the row data to table columns| Method Detail |
|---|
public void setEditable(boolean editable)
editable - true if the data is editablepublic boolean isEditable()
public void setRowData(List rowData)
public int getRowCount()
getRowCount in interface TableModelpublic Object getObjectAt(int row)
getObjectAt in interface JvObjectTableModelrow - the index of the desired row
public Collection getEmptyCollection()
getEmptyCollection in interface JvObjectTableModelpublic int getColumnCount()
TableColumnModel should not be
created from this TableModel. Columns should be created
using the JvSwingFactory.createTableColumn(javax.swing.JTable, java.lang.String, int) method.
getColumnCount in interface TableModelpublic Class getColumnClass(int columnIndex)
Object is returned.
getColumnClass in interface TableModelgetColumnClass in class AbstractTableModelcolumnIndex - the column being queried
public Object getValueAt(int row,
int column)
row
and column.
getValueAt in interface TableModelrow - the row whose value is to be queriedcolumn - the column whose value is to be queried
public void setValueAt(Object value,
int row,
int column)
column and
row. value is the new value. This method
will generate a tableChanged notification.
setValueAt in interface TableModelsetValueAt in class AbstractTableModelvalue - the new value; this can be nullrow - the row whose value is to be changedcolumn - the column whose value is to be changed
public boolean isCellEditable(int row,
int column)
row and column is
editable. Otherwise, setValueAt on the cell will not
change the value of that cell.
isCellEditable in interface TableModelisCellEditable in class AbstractTableModelrow - the row whose value to be queriedcolumn - the column whose value to be queried
public void addRow(JvObjectTableRow row)
row - data of the row being addedpublic void removeRow(int row)
row from the model. Notification
of the row being removed will be sent to all the listeners.
row - the row index of the row to be removed
public void remove(int row,
int col)
JvObjectTableModel, each row corresponds to a single object,
so the column index is ignored and removeRow(int) is called.
row - the row index of the data that will be removedcol - the column index of the data that will be removed
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||