|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.table.AbstractTableModel
org.crosswire.common.swing.MapTableModel
public class MapTableModel
TableModel using a Map internally. Note that an AbstractTableModel (this is-a AbstractTableModel) reports changes to the data to the table itself. However since a Map does not have a addChangeListener interface we can't do the same - SO if you change the Map whilst we are displaying it then don't expect the changes to be automatically reflected in the JTable.
for license details.
The copyright to this program is held by it's authors.
,
Serialized FormNested Class Summary | |
---|---|
private static class |
MapTableModel.StringPair
A simple holder of a key/value pair of Strings. |
Field Summary | |
---|---|
private String[] |
colNames
The default column names |
private List |
list
The List that is a copy of the list. |
private Map |
map
The backing map |
private static long |
serialVersionUID
Serialization ID |
Fields inherited from class javax.swing.table.AbstractTableModel |
---|
listenerList |
Constructor Summary | |
---|---|
MapTableModel()
Create an internal store from a 2D array |
|
MapTableModel(Map map)
Create an internal store from a 2D array |
Method Summary | |
---|---|
void |
add(String key,
String aValue)
|
Class |
getColumnClass(int col)
Get the default class |
int |
getColumnCount()
How many Cols are there in this store |
String |
getColumnName(int col)
The name of the of the col th column |
int |
getRowCount()
How many Rows are there in this store |
String |
getValue()
Return a string version of the current value |
Object |
getValueAt(int row,
int col)
Return the Object at row, col |
void |
remove(String key)
|
void |
setColumnName(int col,
String name)
The name of the of the col th column |
void |
setMap(Map map)
Change the map that we report on |
void |
update(String oldkey,
String newkey,
String newvalue)
|
Methods inherited from class javax.swing.table.AbstractTableModel |
---|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private List list
private Map map
private String[] colNames
private static final long serialVersionUID
Constructor Detail |
---|
public MapTableModel()
public MapTableModel(Map map)
map
- The table to modelMethod Detail |
---|
public void setMap(Map map)
map
- The map we are getting our data frompublic void add(String key, String aValue)
key
- aValue
- public void remove(String key)
key
- public void update(String oldkey, String newkey, String newvalue)
oldkey
- newkey
- newvalue
- public String getValue()
public int getColumnCount()
public int getRowCount()
public Object getValueAt(int row, int col)
row
- The element in the listcol
- 1=keys, 2=values
public Class getColumnClass(int col)
getColumnClass
in interface TableModel
getColumnClass
in class AbstractTableModel
col
- 1=keys, 2=values
public String getColumnName(int col)
col
th column
getColumnName
in interface TableModel
getColumnName
in class AbstractTableModel
col
- The column index
public void setColumnName(int col, String name)
col
th column
col
- The column indexname
- The column name
|
Copyright ยจ 2003-2006 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |