Holger's Java API

## com.antelmann.util.table
Class StringMapTableModel

    java.lang.Object
      javax.swing.table.AbstractTableModel
          javax.swing.table.DefaultTableModel
              com.antelmann.util.table.StringMapTableModel

All Implemented Interfaces:
  Serializable, TableModel

    public class StringMapTableModel

extends DefaultTableModel

a table model that allows to edit the values of a given Map based on String objects

Author:
  Holger Antelmann
See Also:
  Serialized Form

Field Summary

Fields inherited from class javax.swing.table.DefaultTableModel
`columnIdentifiers, dataVector`

Fields inherited from class javax.swing.table.AbstractTableModel
`listenerList`

Constructor Summary
`StringMapTableModel()`
`StringMapTableModel(Map<?,?> map)` the given map is copied into this model
`StringMapTableModel(Map<?,?> map, String keyColumnName, String valueColumnName)` the given map is copied into this model
`StringMapTableModel(String keyColumnName, String valueColumnName)`

Method Summary
`Class<?>` `getColumnClass(int column)`
`Map<String,String>` `getProperties()` provides direct access to the embedded properties; altering the return value while still working with the model may have unexpected results.
`int` `getRow(String key)`
`String` `getValueAt(int row, int column)`
`boolean` `isCellEditable(int row, int column)`
`void` `removeKey(String key)`
`void` `setProperties(Map<?,?> props)` the given map is copied into the properties of this instance (the given map itself remains untouched if edited here).
`void` `setProperty(String key, String value)`
`void` `setValueAt(Object value, int row, int column)` setting values is an unsave operation depending on the types of the properties map

Methods inherited from class javax.swing.table.DefaultTableModel
`addColumn, addColumn, addColumn, addRow, addRow, convertToVector, convertToVector, getColumnCount, getColumnName, getDataVector, getRowCount, insertRow, insertRow, moveRow, newDataAvailable, newRowsAdded, removeRow, rowsRemoved, setColumnCount, setColumnIdentifiers, setColumnIdentifiers, setDataVector, setDataVector, setNumRows, setRowCount`

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`

Constructor Detail

### StringMapTableModel

    public StringMapTableModel()

### StringMapTableModel

    public StringMapTableModel(String keyColumnName,
                               String valueColumnName)

### StringMapTableModel

    public StringMapTableModel(Map<?,?> map)

  the given map is copied into this model

### StringMapTableModel

    public StringMapTableModel(Map<?,?> map,
                               String keyColumnName,
                               String valueColumnName)

  the given map is copied into this model

Method Detail

### getProperties

    public Map<String,String> getProperties()

  provides direct access to the embedded properties; altering the return value while still working with the model may have unexpected results.

### setProperties

    public void setProperties(Map<?,?> props)

  the given map is copied into the properties of this instance (the given map itself remains untouched if edited here). If you seek changes to be reflected in the properties, use the props as a parameter in the constructor instead.

### setProperty

    public void setProperty(String key,
                            String value)

### removeKey

    public void removeKey(String key)

### getValueAt

    public String getValueAt(int row,
                             int column)

  Specified by:
    `getValueAt` in interface `TableModel`
  Overrides:
    `getValueAt` in class `DefaultTableModel`

### getColumnClass

    public Class<?> getColumnClass(int column)

  Specified by:
    `getColumnClass` in interface `TableModel`
  Overrides:
    `getColumnClass` in class `AbstractTableModel`

### isCellEditable

    public boolean isCellEditable(int row,
                                  int column)

  Specified by:
    `isCellEditable` in interface `TableModel`
  Overrides:
    `isCellEditable` in class `DefaultTableModel`

### getRow

    public int getRow(String key)

### setValueAt

    public void setValueAt(Object value,
                           int row,
                           int column)

  setting values is an unsave operation depending on the types of the properties map

  Specified by:
    `setValueAt` in interface `TableModel`
  Overrides:
    `setValueAt` in class `DefaultTableModel`

(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads