|
||||||||||
| 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 while we are displaying it then don't expect the changes to be automatically reflected in the JTable.
The GNU General Public License for details.,
Serialized Form| Nested 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<MapTableModel.StringPair> |
list
The List that is a copy of the list. |
private Map<Object,Object> |
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<String> |
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 colth 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 |
private void |
readObject(ObjectInputStream is)
Serialization support. |
void |
remove(String key)
|
void |
setColumnName(int col,
String name)
The name of the of the colth column |
void |
setMap(Map<Object,Object> 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 transient List<MapTableModel.StringPair> list
private Map<Object,Object> map
private String[] colNames
private static final long serialVersionUID
| Constructor Detail |
|---|
public MapTableModel()
public MapTableModel(Map map)
map - The table to model| Method Detail |
|---|
public final void setMap(Map<Object,Object> map)
map - The map we are getting our data from
public 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<String> getColumnClass(int col)
getColumnClass in interface TableModelgetColumnClass in class AbstractTableModelcol - 1=keys, 2=values
public String getColumnName(int col)
colth column
getColumnName in interface TableModelgetColumnName in class AbstractTableModelcol - The column index
public void setColumnName(int col,
String name)
colth column
col - The column indexname - The column name
private void readObject(ObjectInputStream is)
throws IOException,
ClassNotFoundException
is -
IOException
ClassNotFoundException
|
Copyright ยจ 2003-2015 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||