public class KListModelTableAdapter extends KListModelAdapter implements TableModel
KListModel
to be used with a
Swing JTable
component. This adapter wraps a
KListModel
implementation and exposes a TableModel
interface, and translates the corresponding model events.Modifier and Type | Field and Description |
---|---|
private String[] |
columnNames |
private boolean |
columnsAvailable |
private Class[] |
columnTypes |
private static String[] |
defaultColumnNames |
private static Class[] |
defaultColumnTypes |
listeners, model
Constructor and Description |
---|
KListModelTableAdapter()
Construct a new
KListModelTableAdapter . |
KListModelTableAdapter(KListModel model)
Construct a new
KListModelTableAdapter for the given
list model. |
Modifier and Type | Method and Description |
---|---|
void |
addTableModelListener(TableModelListener listener) |
void |
dataChanged(KListModelEvent evt)
Invoked after the model undergoes a substantial change.
|
protected void |
fireModelChangedEvent()
Fire the appropriate event to indicate that the wrapped data model
has changed significantly.
|
private void |
fireTableEvent(KListModelEvent evt,
int type) |
Class |
getColumnClass(int col) |
int |
getColumnCount() |
String |
getColumnName(int col) |
int |
getRowCount() |
Object |
getValueAt(int row,
int col) |
boolean |
isCellEditable(int row,
int col)
This method returns
false , since this adapter represents an
immutable model. |
void |
itemsAdded(KListModelEvent evt)
Invoked after items are inserted into the list.
|
void |
itemsChanged(KListModelEvent evt)
Invoked after items in the list are changed in some way.
|
void |
itemsRemoved(KListModelEvent evt)
Invoked after items are removed from the list.
|
void |
removeTableModelListener(TableModelListener listener) |
void |
setListModel(KListModel model)
Set the
KListModel for this adapter. |
void |
setValueAt(Object value,
int row,
int col)
This method is a no-op, since this adapter represents an immutable model.
|
addListDataListener, getListModel, removeListDataListener
private static final String[] defaultColumnNames
private String[] columnNames
private static final Class[] defaultColumnTypes
private Class[] columnTypes
private boolean columnsAvailable
public KListModelTableAdapter()
KListModelTableAdapter
.public KListModelTableAdapter(KListModel model)
KListModelTableAdapter
for the given
list model. The TableModel
will have a single column,
marked "Item".model
- The KListModel
.public void setListModel(KListModel model)
KListModelAdapter
KListModel
for this adapter.setListModel
in class KListModelAdapter
model
- The model.private void fireTableEvent(KListModelEvent evt, int type)
public void itemsAdded(KListModelEvent evt)
KListModelListener
itemsAdded
in interface KListModelListener
itemsAdded
in class KListModelAdapter
public void itemsChanged(KListModelEvent evt)
KListModelListener
itemsChanged
in interface KListModelListener
itemsChanged
in class KListModelAdapter
public void itemsRemoved(KListModelEvent evt)
KListModelListener
itemsRemoved
in interface KListModelListener
itemsRemoved
in class KListModelAdapter
public void dataChanged(KListModelEvent evt)
KListModelListener
dataChanged
in interface KListModelListener
dataChanged
in class KListModelAdapter
protected void fireModelChangedEvent()
KListModelAdapter
KListModel
for this adapter is changed.fireModelChangedEvent
in class KListModelAdapter
public Class getColumnClass(int col)
getColumnClass
in interface TableModel
public String getColumnName(int col)
getColumnName
in interface TableModel
public int getColumnCount()
getColumnCount
in interface TableModel
public int getRowCount()
getRowCount
in interface TableModel
public Object getValueAt(int row, int col)
getValueAt
in interface TableModel
public void setValueAt(Object value, int row, int col)
setValueAt
in interface TableModel
public boolean isCellEditable(int row, int col)
false
, since this adapter represents an
immutable model.isCellEditable
in interface TableModel
public void addTableModelListener(TableModelListener listener)
addTableModelListener
in interface TableModel
public void removeTableModelListener(TableModelListener listener)
removeTableModelListener
in interface TableModel
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses