|
||||||||||
| 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.
|
Distribution Licence: JSword is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. The License is available on the internet here, or by writing to: Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA The copyright to this program is held by it's authors. |
Licence,
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 |
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 value)
|
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 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 |
void |
remove(String key)
|
void |
setColumnName(int col,
String name)
The name of the of the colth 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 model| Method Detail |
|---|
public void setMap(Map map)
map - The map we are getting our data from
public void add(String key,
String value)
key - value - 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 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
|
Copyright ? 2003-2004 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||