|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.table.AbstractTableModel
schmitzm.swing.table.SelectionTableModel
public class SelectionTableModel
This table model extends an other TableModel
by inserting an
additional column 0 which shows and controls the row selection.
To realize this functionality it is necessary to connect this table model
to an explicit JTable
. Besides it is necessary that this table
is a SelectableJTable
to overcome the "normal" click behavior (clear
selection when no Ctrl/Shift key is hold), when clicking the selection column.
Field Summary | |
---|---|
protected TableModel |
model
Holds the base data. |
protected SelectableJTable |
table
Holds the table which controls the selection. |
Fields inherited from class javax.swing.table.AbstractTableModel |
---|
listenerList |
Constructor Summary | |
---|---|
SelectionTableModel(TableModel model,
SelectableJTable table)
Creates a new table model |
Method Summary | |
---|---|
void |
addTableModelListener(TableModelListener listener)
Adds a listener to the list that's notified each time a change to the data model occurs. |
Class<?> |
getColumnClass(int col)
Returns the type of a column. |
int |
getColumnCount()
Returns the type of a column. |
String |
getColumnName(int col)
Returns the name of a column. |
TableModel |
getPipedModel()
Returns the original TableModel . |
int |
getRowCount()
Returns the number of rows in the model. |
Object |
getValueAt(int row,
int col)
Returns the value for a cell. |
boolean |
isCellEditable(int row,
int col)
Returns the value for a cell. |
void |
removeTableModelListener(TableModelListener listener)
Removes a listener from the list that's notified each time a change to the data model occurs. |
void |
setValueAt(Object value,
int row,
int col)
Sets a value for a cell. |
Methods inherited from class javax.swing.table.AbstractTableModel |
---|
findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected SelectableJTable table
protected TableModel model
Constructor Detail |
---|
public SelectionTableModel(TableModel model, SelectableJTable table)
model
- provides the datatable
- used to determine the row selectionMethod Detail |
---|
public TableModel getPipedModel()
TableModel
.
getPipedModel
in interface PipedTableModel
public void addTableModelListener(TableModelListener listener)
addTableModelListener
in interface TableModel
addTableModelListener
in class AbstractTableModel
public void removeTableModelListener(TableModelListener listener)
removeTableModelListener
in interface TableModel
removeTableModelListener
in class AbstractTableModel
public Class<?> getColumnClass(int col)
getColumnClass
in interface TableModel
getColumnClass
in class AbstractTableModel
Boolean.class
for column 0public int getColumnCount()
getColumnCount
in interface TableModel
Boolean.class
for column 0public String getColumnName(int col)
getColumnName
in interface TableModel
getColumnName
in class AbstractTableModel
public int getRowCount()
getRowCount
in interface TableModel
public Object getValueAt(int row, int col)
getValueAt
in interface TableModel
row
- row indexcol
- column indexpublic void setValueAt(Object value, int row, int col)
setValueAt
in interface TableModel
setValueAt
in class AbstractTableModel
value
- new cell valuerow
- row indexcol
- column indexpublic boolean isCellEditable(int row, int col)
isCellEditable
in interface TableModel
isCellEditable
in class AbstractTableModel
row
- row indexcol
- column index{@code
- true} for column 0
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |