|
QJCC homepage | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.table.AbstractTableModel biz.chitec.quarterback.swing.MapListTableModel
Model object for JTable to represent List of Maps. All Maps have the same keys which values are taken as table content. Columns can be set either explicitly or implicitly. In the first case the table only shows the Maps' elements with the given keys, in the second case the table computes the column names as union over all Maps.
The real column names can be either directly the Map keys or some content of a ResourceBundle object.
MapListModelHelper
,
Serialized FormField Summary | |
private java.util.Comparator |
comparator
|
private boolean |
doautosortonenable
|
private boolean |
isautosorting
|
private MapListModelHelper |
mlmh
|
private int |
rownum
|
private java.util.List |
thedata
|
Fields inherited from class javax.swing.table.AbstractTableModel |
listenerList |
Constructor Summary | |
MapListTableModel()
Standard empty constructor. |
|
MapListTableModel(java.util.ResourceBundle rbx)
Set ResourceBundle to find column title strings and classes |
|
MapListTableModel(java.util.ResourceBundle rbx,
java.lang.String prefix)
Set ResourceBundle and the prefix to access the resource entries |
|
MapListTableModel(java.util.ResourceBundle rbx,
java.lang.String[] hdr)
Set ResourceBundle and title columns Using this constructor, it is possible to minimize the overhead while data insertion. |
|
MapListTableModel(java.util.ResourceBundle rbx,
java.lang.String prefix,
java.lang.String[] hdr)
Set ResourceBundle, use prefix and set the title columns. |
|
MapListTableModel(java.lang.String[] hdr)
Set title columns explicitly |
Method Summary | |
void |
add(int row,
java.util.Map data)
Insert one element of data explicitly at a certain position. |
void |
add(java.util.List dtx)
Add data. |
void |
add(java.util.Map dt)
Add one new element of data. |
void |
addData(java.util.List dtx)
Deprecated. Use add(List) instead. |
void |
addDataElement(java.util.Map dt)
Deprecated. Use add(Map) instead. |
void |
clear()
Remove all data. |
void |
defaultLocaleChanged()
Called if any locale changes. |
protected void |
finishInsertion(int oldrownum,
int rownum,
boolean updated)
Called after every insertion. |
java.lang.Class |
getColumnClass(int col)
From TableModel: Return column class. |
int |
getColumnCount()
From TableModel: returns number of data columns. |
java.lang.String |
getColumnEditorClassName(int column)
Returns the column editor class for a certain column. |
int |
getColumnIndex(java.lang.String name)
Return index of column with given name. |
int |
getColumnIndexBySortReplace(java.lang.String sortkey)
Get a column index by the sortreplace key value. |
java.lang.String |
getColumnKey(int index)
Return key of colunm with given index. |
java.lang.String |
getColumnName(int column)
From TableModel: Return column name. |
java.lang.String |
getColumnRendererClassName(int column)
Returns the column renderer class for a certain column. |
java.util.Comparator |
getConstrainingComparator()
Returns the current constraining comparator |
java.util.List |
getData()
Returns all stored data. |
MapListModelHelper |
getMapListModelHelper()
Return my model helper. |
java.util.ResourceBundle |
getResourceBundle()
Returns the ResourceBundle used by the ModelHelper |
java.lang.String |
getResourcePrefix()
Returns the keys' prefix used for all resources read from the ResourceBundle |
int |
getRowCount()
From TableModel: returns number of data rows. |
java.lang.String |
getSortReplaceKey(int index)
Return maps' key for sort replace value of given row index. |
java.lang.Object |
getValueAt(int row,
int column)
From TableModel: Return a certain value. |
void |
init(java.util.List dtx)
Sets data. |
void |
insertDataAt(java.util.Map data,
int row)
Deprecated. Use add(int,Map) instead |
boolean |
isCellEditable(int row,
int column)
From TableModel: Return whether cell is editable. |
boolean |
isHeaderSet()
Returns whether the header has been set. |
java.util.Map |
remove(int row)
Remove one element of data. |
void |
removeData()
Deprecated. Use clear() instead |
void |
removeData(int row)
Deprecated. Use remove(int) instead |
void |
removeHeader()
Remove columns. |
void |
saveAsFile(java.lang.String filename)
|
void |
set(int row,
java.util.Map data)
Change data at given row. |
void |
set(int row,
java.lang.Object key,
java.lang.Object value)
Change the content of a given key in a given row to the given value Rownum must be valid. |
void |
setAutoSorting(boolean b)
Temporarily dis- and reenable autosorting with the given constraint comparator. |
void |
setConstrainingComparator(java.util.Comparator comparatorx)
Add sorting constraint handler. |
void |
setData(java.util.List dtx)
Deprecated. Use init(List) instead |
void |
setHeader(java.lang.String[] hdr)
Set header. |
void |
setMapListModelHelper(MapListModelHelper mlmhx)
Sets the model helper explicitly. |
void |
setResourceBundle(java.util.ResourceBundle rbx)
Sets ResourceBundle from which column titles are acquired without changing the prefix. |
void |
setResourceBundle(java.util.ResourceBundle rbx,
java.lang.String prefix)
Sets ResourceBundle from which column titles are acquired and adds or changes a prefix. |
void |
setValueAt(java.lang.Object value,
int row,
int column)
From TableModel: Set a certain value. |
void |
sortData()
Sort data by constraining comparator if existing. |
void |
sortData(int index)
Sort data by index |
void |
sortData(java.lang.String key)
Sort data by key |
void |
updateDataAt(java.util.Map data,
int row)
Deprecated. Use set(int,Map) instead. |
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 |
Field Detail |
private java.util.List thedata
private int rownum
private MapListModelHelper mlmh
private java.util.Comparator comparator
private boolean isautosorting
private boolean doautosortonenable
Constructor Detail |
public MapListTableModel()
public MapListTableModel(java.util.ResourceBundle rbx)
public MapListTableModel(java.lang.String[] hdr)
public MapListTableModel(java.util.ResourceBundle rbx, java.lang.String[] hdr)
public MapListTableModel(java.util.ResourceBundle rbx, java.lang.String prefix)
public MapListTableModel(java.util.ResourceBundle rbx, java.lang.String prefix, java.lang.String[] hdr)
Method Detail |
public void setResourceBundle(java.util.ResourceBundle rbx, java.lang.String prefix)
public void setResourceBundle(java.util.ResourceBundle rbx)
public java.util.ResourceBundle getResourceBundle()
public java.lang.String getResourcePrefix()
public void setHeader(java.lang.String[] hdr)
public MapListModelHelper getMapListModelHelper()
public void setMapListModelHelper(MapListModelHelper mlmhx)
protected void finishInsertion(int oldrownum, int rownum, boolean updated)
public void setData(java.util.List dtx)
public void init(java.util.List dtx)
public void addData(java.util.List dtx)
public void add(java.util.List dtx)
public void addDataElement(java.util.Map dt)
public void add(java.util.Map dt)
public void removeData()
public void clear()
public void removeData(int row)
public java.util.Map remove(int row)
public void insertDataAt(java.util.Map data, int row)
public void add(int row, java.util.Map data)
public void updateDataAt(java.util.Map data, int row)
public void set(int row, java.util.Map data)
public void set(int row, java.lang.Object key, java.lang.Object value)
row
- Row to change data inkey
- Name of the entry to changevalue
- New value to be put into the tablepublic void removeHeader()
public boolean isHeaderSet()
public java.util.List getData()
public int getColumnIndex(java.lang.String name)
public java.lang.String getColumnKey(int index)
public java.lang.String getSortReplaceKey(int index)
public int getColumnIndexBySortReplace(java.lang.String sortkey)
public void sortData(int index)
public void sortData(java.lang.String key)
public void sortData()
public void setConstrainingComparator(java.util.Comparator comparatorx)
public java.util.Comparator getConstrainingComparator()
public void setAutoSorting(boolean b)
Must only be used for short breaks in sorting, i.e. if multiple elements are changed within the same event but with distinct calls and in a way that the order must not be changed in between. Update events are not fired as long as sorting is disabled this way.
If you need longer pauses in automated sorting or want to disable it completely, set the constraining comparator to null.
b
- Indicator whether sorting should be disabled or enabled.public int getRowCount()
getRowCount
in interface javax.swing.table.TableModel
public int getColumnCount()
getColumnCount
in interface javax.swing.table.TableModel
public java.lang.Object getValueAt(int row, int column)
getValueAt
in interface javax.swing.table.TableModel
public void setValueAt(java.lang.Object value, int row, int column)
setValueAt
in interface javax.swing.table.TableModel
public java.lang.String getColumnName(int column)
getColumnName
in interface javax.swing.table.TableModel
public java.lang.Class getColumnClass(int col)
getColumnClass
in interface javax.swing.table.TableModel
public boolean isCellEditable(int row, int column)
isCellEditable
in interface javax.swing.table.TableModel
public java.lang.String getColumnRendererClassName(int column)
column
- Index of the column in question
public java.lang.String getColumnEditorClassName(int column)
column
- Index of the column in question
public void saveAsFile(java.lang.String filename) throws java.io.FileNotFoundException, java.io.IOException
java.io.FileNotFoundException
java.io.IOException
public void defaultLocaleChanged()
DefaultLocaleChangeReceiver
defaultLocaleChanged
in interface DefaultLocaleChangeReceiver
|
QJCC homepage | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |