public class MapTableModel extends AbstractTableModel
The GNU General Public License for details.
,
Serialized FormModifier and Type | Class and Description |
---|---|
private static class |
MapTableModel.StringPair
A simple holder of a key/value pair of Strings.
|
Modifier and Type | Field and Description |
---|---|
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
|
listenerList
Constructor and Description |
---|
MapTableModel()
Create an internal store from a 2D array
|
MapTableModel(Map map)
Create an internal store from a 2D array
|
Modifier and Type | Method and Description |
---|---|
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
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
|
private void |
readObject(ObjectInputStream is)
Serialization support.
|
void |
remove(String key) |
void |
setColumnName(int col,
String name)
The name of the of the
col th column |
void |
setMap(Map<Object,Object> map)
Change the map that we report on
|
void |
update(String oldkey,
String newkey,
String newvalue) |
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
private transient List<MapTableModel.StringPair> list
private String[] colNames
private static final long serialVersionUID
public MapTableModel()
public MapTableModel(Map map)
map
- The table to modelpublic final void setMap(Map<Object,Object> map)
map
- The map we are getting our data frompublic 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=valuespublic Class<String> getColumnClass(int col)
getColumnClass
in interface TableModel
getColumnClass
in class AbstractTableModel
col
- 1=keys, 2=valuespublic String getColumnName(int col)
col
th columngetColumnName
in interface TableModel
getColumnName
in class AbstractTableModel
col
- The column indexpublic void setColumnName(int col, String name)
col
th columncol
- The column indexname
- The column nameprivate void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException
is
- IOException
ClassNotFoundException