DESY ACOP Beans Home

com.cosylab.gui.components.introspection
Class MapTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by com.cosylab.gui.components.introspection.MapTableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel

public class MapTableModel
extends javax.swing.table.AbstractTableModel

A TableModel implementation that handles key-value maps to be used with JTable

Version:
$id$
Author:
Miha Kadunc
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
MapTableModel()
          Creation date: (3.1.2002 17:04:55)
MapTableModel(java.lang.String[] columnNames)
          Creation date: (3.1.2002 17:04:55)
MapTableModel(java.lang.String[] columnNames, java.util.Map map)
          Creation date: (3.1.2002 17:04:55)
MapTableModel(java.lang.String[] columnNames, java.lang.Object[] keys)
          Creation date: (3.1.2002 17:04:55)
 
Method Summary
 void addMap(int index, java.util.Map map)
          Creation date: (3.1.2002 16:34:43)
 void addMap(java.util.Map map)
          Creation date: (3.1.2002 16:34:43)
 void addRow(int index, java.lang.Object key, java.lang.Object value)
          Creation date: (3.1.2002 16:34:43)
 void addRow(int index, java.lang.Object key, java.lang.Object value, java.lang.String keyInfo)
          DOCUMENT ME!
 void addRow(java.lang.Object key, java.lang.Object value)
          Creation date: (3.1.2002 16:34:43)
 void addRow(java.lang.Object key, java.lang.Object value, java.lang.String keyInfo)
          DOCUMENT ME!
 void clear()
          Removes all mappings from this map (optional operation).
 java.lang.Object[][] getAsArray()
          Creation date: (3.1.2002 16:34:43)
 int getColumnCount()
          DOCUMENT ME!
 java.lang.String getColumnName(int index)
          DOCUMENT ME!
 java.util.Hashtable getMap()
          Creation date: (3.1.2002 16:34:43)
 int getRowCount()
          DOCUMENT ME!
 java.lang.Object getValueAt(int row, int column)
          DOCUMENT ME!
 boolean isCellEditable(int row, int column)
          DOCUMENT ME!
 boolean isKeyEditable()
          DOCUMENT ME!
 boolean isSortByKeyName()
          Returns true if contained keys are sorted by their names obtained by toString() method.
 boolean isValueEditable()
          DOCUMENT ME!
static void main(java.lang.String[] args)
          DOCUMENT ME!
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Puts new value under under specified key.
 void removeRow(int index)
          Creation date: (3.1.2002 16:34:43)
 void removeRow(java.lang.Object key)
          Creation date: (3.1.2002 16:34:43)
 void setAsArray(java.lang.Object[][] u)
          Creation date: (3.1.2002 16:34:43)
 void setKeyColumnName(java.lang.String name)
          DOCUMENT ME!
 void setKeyEditable(boolean value)
          DOCUMENT ME!
 void setKeyInfo(java.lang.String[] keyInfo)
          DOCUMENT ME!
 void setKeyInfoColumnName(java.lang.String name)
          DOCUMENT ME!
 void setKeys(java.lang.Object[] keys)
          Creation date: (3.1.2002 16:34:43)
 void setMap(java.util.Map map)
          DOCUMENT ME!
 void setSortByKeyName(boolean b)
          Set true to force contained keys to be sorted by their names obtained by toString() method.
 void setValueAt(java.lang.Object value, int row, int column)
          DOCUMENT ME!
 void setValueColumnName(java.lang.String name)
          DOCUMENT ME!
 void setValueEditable(boolean value)
          DOCUMENT ME!
 void setValues(java.lang.Object[] values)
          DOCUMENT ME!
 java.lang.String toString()
          DOCUMENT ME!
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MapTableModel

public MapTableModel()
Creation date: (3.1.2002 17:04:55)


MapTableModel

public MapTableModel(java.lang.String[] columnNames)
Creation date: (3.1.2002 17:04:55)

Parameters:
columnNames - DOCUMENT ME!

MapTableModel

public MapTableModel(java.lang.String[] columnNames,
                     java.lang.Object[] keys)
Creation date: (3.1.2002 17:04:55)

Parameters:
columnNames - String[]
keys - Object[]

MapTableModel

public MapTableModel(java.lang.String[] columnNames,
                     java.util.Map map)
Creation date: (3.1.2002 17:04:55)

Parameters:
columnNames - String[]
map - Map
Method Detail

main

public static void main(java.lang.String[] args)
DOCUMENT ME!

Parameters:
args - String[]

addMap

public void addMap(int index,
                   java.util.Map map)
Creation date: (3.1.2002 16:34:43)

Parameters:
index - int
map - Map

addMap

public void addMap(java.util.Map map)
Creation date: (3.1.2002 16:34:43)

Parameters:
map - Map

addRow

public void addRow(int index,
                   java.lang.Object key,
                   java.lang.Object value)
Creation date: (3.1.2002 16:34:43)

Parameters:
index - int
key - java.lang.Object
value - java.lang.Object

addRow

public void addRow(int index,
                   java.lang.Object key,
                   java.lang.Object value,
                   java.lang.String keyInfo)
DOCUMENT ME!

Parameters:
index - int
key - Object
value - Object
keyInfo - String

addRow

public void addRow(java.lang.Object key,
                   java.lang.Object value)
Creation date: (3.1.2002 16:34:43)

Parameters:
key - java.lang.Object
value - java.lang.Object

addRow

public void addRow(java.lang.Object key,
                   java.lang.Object value,
                   java.lang.String keyInfo)
DOCUMENT ME!

Parameters:
key - Object
value - Object
keyInfo - String

clear

public void clear()
Removes all mappings from this map (optional operation).


getAsArray

public java.lang.Object[][] getAsArray()
Creation date: (3.1.2002 16:34:43)

Returns:
Object[][]

getColumnCount

public int getColumnCount()
DOCUMENT ME!

Returns:
int
See Also:
TableModel.getColumnCount()

getColumnName

public java.lang.String getColumnName(int index)
DOCUMENT ME!

Specified by:
getColumnName in interface javax.swing.table.TableModel
Overrides:
getColumnName in class javax.swing.table.AbstractTableModel
Parameters:
index - int
Returns:
String
See Also:
AbstractTableModel.getColumnName(int)

getMap

public java.util.Hashtable getMap()
Creation date: (3.1.2002 16:34:43)

Returns:
java.util.Hashtable

getRowCount

public int getRowCount()
DOCUMENT ME!

Returns:
int
See Also:
TableModel.getRowCount()

getValueAt

public java.lang.Object getValueAt(int row,
                                   int column)
DOCUMENT ME!

Parameters:
row - int
column - int
Returns:
Object
See Also:
TableModel.getValueAt(int, int)

isCellEditable

public boolean isCellEditable(int row,
                              int column)
DOCUMENT ME!

Specified by:
isCellEditable in interface javax.swing.table.TableModel
Overrides:
isCellEditable in class javax.swing.table.AbstractTableModel
Parameters:
row - int
column - int
Returns:
boolean
See Also:
AbstractTableModel.isCellEditable(int, int)

isKeyEditable

public boolean isKeyEditable()
DOCUMENT ME!

Returns:
boolean

isValueEditable

public boolean isValueEditable()
DOCUMENT ME!

Returns:
boolean

removeRow

public void removeRow(int index)
Creation date: (3.1.2002 16:34:43)

Parameters:
index - int

removeRow

public void removeRow(java.lang.Object key)
Creation date: (3.1.2002 16:34:43)

Parameters:
key - java.lang.Object

setAsArray

public void setAsArray(java.lang.Object[][] u)
Creation date: (3.1.2002 16:34:43)

Parameters:
u - Object[][]

setKeyColumnName

public void setKeyColumnName(java.lang.String name)
DOCUMENT ME!

Parameters:
name - String
See Also:
AbstractTableModel.getColumnName(int)

setValueColumnName

public void setValueColumnName(java.lang.String name)
DOCUMENT ME!

Parameters:
name - String

setKeyInfoColumnName

public void setKeyInfoColumnName(java.lang.String name)
DOCUMENT ME!

Parameters:
name - String

setKeyEditable

public void setKeyEditable(boolean value)
DOCUMENT ME!

Parameters:
value - boolean

setKeys

public void setKeys(java.lang.Object[] keys)
Creation date: (3.1.2002 16:34:43)

Parameters:
keys - Object[]

setMap

public void setMap(java.util.Map map)
DOCUMENT ME!

Parameters:
map - Map

setValueAt

public void setValueAt(java.lang.Object value,
                       int row,
                       int column)
DOCUMENT ME!

Specified by:
setValueAt in interface javax.swing.table.TableModel
Overrides:
setValueAt in class javax.swing.table.AbstractTableModel
Parameters:
value - Object
row - int
column - int
See Also:
AbstractTableModel#setValueAt(int, int)

setValueEditable

public void setValueEditable(boolean value)
DOCUMENT ME!

Parameters:
value - boolean

toString

public java.lang.String toString()
DOCUMENT ME!

Overrides:
toString in class java.lang.Object
Returns:
String

setKeyInfo

public void setKeyInfo(java.lang.String[] keyInfo)
DOCUMENT ME!

Parameters:
keyInfo - String[]

setValues

public void setValues(java.lang.Object[] values)
DOCUMENT ME!

Parameters:
values - Object[]
See Also:
AbstractTableModel#setValueAt(int, int)

isSortByKeyName

public boolean isSortByKeyName()
Returns true if contained keys are sorted by their names obtained by toString() method.

Returns:
true if contained keys are sorted by their names obtained by toString().

setSortByKeyName

public void setSortByKeyName(boolean b)
Set true to force contained keys to be sorted by their names obtained by toString() method.

Parameters:
b -

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Puts new value under under specified key. If key does not exist, new kay-value pair is aded to the end of the table.

Parameters:
key - the key for which value is to be updated
value - new value
Returns:
old value under key or null if no previous value existed


Copyright © 2010. All Rights Reserved.