|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.table.AbstractTableModel
dsto.dfc.swing.table.AbstractDfcTableModel
dsto.dfc.swing.table.MapTableModel
public class MapTableModel
Present a java.util.Map as a Swing TableModel with two columns ("Property"
and "Value"). Also supports editing map: see setEditMode(int)
.
MapTableView
,
Serialized FormNested Class Summary | |
---|---|
protected class |
MapTableModel.MapEntryComparator
Compare Map.Entry's by using keyComparator on the key. |
Field Summary | |
---|---|
static int |
EDIT_COPY
|
static int |
EDIT_DIRECT
|
static int |
EDIT_NONE
|
protected int |
editMode
The edit setting: EDIT_NONE, EDIT_DIRECT or EDIT_COPY. |
protected Comparator |
keyComparator
The comparator used to sort orderedEntries by the keys of its Map.Entry's. |
protected Map |
map
The map being presented by this model. |
protected ArrayList |
orderedEntries
A list of Map.Entry's in the row order displayed by the table. |
Fields inherited from class javax.swing.table.AbstractTableModel |
---|
listenerList |
Constructor Summary | |
---|---|
MapTableModel()
|
|
MapTableModel(Map map)
Create a table model from map. |
|
MapTableModel(Map map,
Comparator keyComparator)
|
|
MapTableModel(Map map,
Comparator keyComparator,
int editMode)
Create a table model from map. |
|
MapTableModel(Map map,
int editMode)
|
Method Summary | |
---|---|
boolean |
canDeleteRows(int rowStart,
int rowEnd)
Test if a deleteRows () operation is supported. |
protected void |
checkEditable()
Throws UnsupportedOperationException if the table is not editable. |
protected Map |
copyMap(Map srcMap)
Make a copy of the current map. |
void |
deleteRows(int rowStart,
int rowEnd)
Delete rows. |
int |
findKeyIndex(Object key)
Find the index (row) that a key has in the table. |
Class |
getColumnClass(int columnIndex)
|
int |
getColumnCount()
|
String |
getColumnName(int column)
|
int |
getEditMode()
|
Map |
getMap()
|
int |
getRowCount()
|
Object |
getValueAt(int row,
int col)
|
boolean |
isCellEditable(int row,
int column)
|
protected void |
loadOrderedEntries()
(Re)load orderedEntries from the map. |
protected void |
maybeCopyMap()
Copy map if edit mode is EDIT_COPY by calling copyMap (). |
void |
putEntry(Object key,
Object value)
Put a new entry into the map, firing the appropriate events. |
void |
setEditMode(int mode)
Set the edit mode for the table. |
void |
setMap(Map newMap)
|
void |
setValueAt(Object value,
int row,
int column)
|
Methods inherited from class dsto.dfc.swing.table.AbstractDfcTableModel |
---|
canCopyCells, canCopyRows, canDeleteCells, canDeleteColumns, canInsertColumn, canInsertRows, canMoveRows, canPasteCells, canPasteRows, copyCells, copyRows, deleteCells, deleteColumns, insertColumn, insertRows, moveRows, pasteCells, pasteRows |
Methods inherited from class javax.swing.table.AbstractTableModel |
---|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.swing.table.TableModel |
---|
addTableModelListener, removeTableModelListener |
Field Detail |
---|
public static final int EDIT_NONE
public static final int EDIT_DIRECT
public static final int EDIT_COPY
protected Map map
protected ArrayList orderedEntries
protected Comparator keyComparator
protected int editMode
Constructor Detail |
---|
public MapTableModel()
public MapTableModel(Map map)
public MapTableModel(Map map, Comparator keyComparator)
public MapTableModel(Map map, int editMode)
public MapTableModel(Map map, Comparator keyComparator, int editMode)
Method Detail |
---|
protected void loadOrderedEntries()
public void setMap(Map newMap)
public Map getMap()
public void setEditMode(int mode)
mode
- The new mode: EDIT_NONE (no editing allowed), EDIT_DIRECT
(edit the map directly), or EDIT_COPY (edit the map by copying it first
using copyMap ()).public int getEditMode()
public void putEntry(Object key, Object value) throws UnsupportedOperationException
UnsupportedOperationException
- if the model is not editable.public int findKeyIndex(Object key)
public int getColumnCount()
public String getColumnName(int column)
getColumnName
in interface TableModel
getColumnName
in class AbstractTableModel
public Class getColumnClass(int columnIndex)
getColumnClass
in interface TableModel
getColumnClass
in class AbstractTableModel
public Object getValueAt(int row, int col)
public int getRowCount()
public boolean isCellEditable(int row, int column)
isCellEditable
in interface TableModel
isCellEditable
in class AbstractTableModel
public void setValueAt(Object value, int row, int column)
setValueAt
in interface TableModel
setValueAt
in class AbstractTableModel
public boolean canDeleteRows(int rowStart, int rowEnd)
DfcTableModel
canDeleteRows
in interface DfcTableModel
canDeleteRows
in class AbstractDfcTableModel
rowStart
- The row to begin inserting.rowEnd
- The last row to delete.
public void deleteRows(int rowStart, int rowEnd) throws UnsupportedOperationException
DfcTableModel
deleteRows
in interface DfcTableModel
deleteRows
in class AbstractDfcTableModel
rowStart
- The row to begin inserting.rowEnd
- The last row to delete.
UnsupportedOperationException
- if this is not supported.DfcTableModel.canDeleteRows(int, int)
protected void checkEditable() throws UnsupportedOperationException
UnsupportedOperationException
protected void maybeCopyMap()
protected Map copyMap(Map srcMap)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |