Holger's Java API

## com.antelmann.util.table
Class TableModelWrapper

    java.lang.Object
      com.antelmann.util.table.TableModelWrapper

All Implemented Interfaces:
  EditableComponent, TableCustomizer, Wrapped<TableModel>, TableModel

Direct Known Subclasses:
  ConvertedObjectTableModel, ConvertedTableModel, ObjectTableModelWrapper

    public class TableModelWrapper

extends Object
implements TableModel, Wrapped<TableModel>, TableCustomizer, EditableComponent

allows to easily wrap a given table model and quickly just override a single method or customize the model by using appropriate methods herein.

Since:
  28.01.2010, 12:19:15
Author:
  Holger Antelmann

Field Summary
`static PatternExtractor<Object,Date>` `DATE_CONVERTER` supports `CharSequence`, `Number` and `Timed` objects

Constructor Summary
`TableModelWrapper(TableModel model)`

Method Summary
`void` `addTableModelListener(TableModelListener l)`
`void` `applyStyle(JTable table)`
`static boolean` `applyStyleFor(JTable table)`
`Class<?>` `getColumnClass(int columnIndex)`
`int` `getColumnCount()`
`String` `getColumnName(int columnIndex)`
`int` `getRowCount()`
`Object` `getValueAt(int rowIndex, int columnIndex)`
`boolean` `isCellEditable(int rowIndex, int columnIndex)`
`boolean` `isEditable()`
`void` `removeTableModelListener(TableModelListener l)`

`

`<T> void`

`

`setColumnClass(int column, Class<T> type)`

`void` `setColumnClass(String column, Class<?> type)`
`void` `setColumnClassBasedOnRow(int row)`
`Map.Entry<PatternExtractor<Object,?>,Class<?>>` `setConverter(int column, Format format)`

`

`<T> Map.Entry<PatternExtractor<Object,?>,Class<?>>`

`

`setConverter(int column, PatternExtractor<Object,T> converter, Class<T> convertedType)`

`Map.Entry<PatternExtractor<Object,?>,Class<?>>` `setConverter(String column, Format format)`

`

`<T> Map.Entry<PatternExtractor<Object,?>,Class<?>>`

`

`setConverter(String column, PatternExtractor<Object,T> converter, Class<T> convertedType)`

`void` `setEditable(boolean flag)`
`TableCellEditor` `setEditor(int column, TableCellEditor editor)`
`TableCellEditor` `setEditor(String column, TableCellEditor editor)`
`void` `setReadOnly(boolean flag)`
`TableCellRenderer` `setRenderer(int column, TableCellRenderer renderer)`
`TableCellRenderer` `setRenderer(String column, TableCellRenderer renderer)`
`void` `setValueAt(Object aValue, int rowIndex, int columnIndex)`
`TableModel` `unwrap()` returns the embedded instance that this wrapper encloses
`static TableModelWrapper` `wrap(TableModel model, TableCustomizer customizer)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DATE_CONVERTER

    public static PatternExtractor<Object,Date> DATE_CONVERTER

  supports `CharSequence`, `Number` and `Timed` objects

Constructor Detail

### TableModelWrapper

    public TableModelWrapper(TableModel model)

Method Detail

### setColumnClassBasedOnRow

    public void setColumnClassBasedOnRow(int row)

### setColumnClass

    public void setColumnClass(String column,
                               Class<?> type)

### setColumnClass

    public <T> void setColumnClass(int column,
                                   Class<T> type)

### setConverter

    public Map.Entry<PatternExtractor<Object,?>,Class<?>> setConverter(String column,
                                                                       Format format)

### setConverter

    public Map.Entry<PatternExtractor<Object,?>,Class<?>> setConverter(int column,
                                                                       Format format)

### setConverter

    public <T> Map.Entry<PatternExtractor<Object,?>,Class<?>> setConverter(String column,
                                                                           PatternExtractor<Object,T> converter,
                                                                           Class<T> convertedType)

### setConverter

    public <T> Map.Entry<PatternExtractor<Object,?>,Class<?>> setConverter(int column,
                                                                           PatternExtractor<Object,T> converter,
                                                                           Class<T> convertedType)

### setRenderer

    public TableCellRenderer setRenderer(String column,
                                         TableCellRenderer renderer)

### setRenderer

    public TableCellRenderer setRenderer(int column,
                                         TableCellRenderer renderer)

### setEditor

    public TableCellEditor setEditor(String column,
                                     TableCellEditor editor)

### setEditor

    public TableCellEditor setEditor(int column,
                                     TableCellEditor editor)

### applyStyle

    public void applyStyle(JTable table)

  Specified by:
    `applyStyle` in interface `TableCustomizer`

### applyStyleFor

    public static boolean applyStyleFor(JTable table)

### wrap

    public static TableModelWrapper wrap(TableModel model,
                                         TableCustomizer customizer)

### addTableModelListener

    public void addTableModelListener(TableModelListener l)

  Specified by:
    `addTableModelListener` in interface `TableModel`

### getColumnClass

    public Class<?> getColumnClass(int columnIndex)

  Specified by:
    `getColumnClass` in interface `TableModel`

### getColumnCount

    public int getColumnCount()

  Specified by:
    `getColumnCount` in interface `TableModel`

### getColumnName

    public String getColumnName(int columnIndex)

  Specified by:
    `getColumnName` in interface `TableModel`

### getRowCount

    public int getRowCount()

  Specified by:
    `getRowCount` in interface `TableModel`

### getValueAt

    public Object getValueAt(int rowIndex,
                             int columnIndex)

  Specified by:
    `getValueAt` in interface `TableModel`

### setReadOnly

    public void setReadOnly(boolean flag)

### isEditable

    public boolean isEditable()

  Specified by:
    `isEditable` in interface `EditableComponent`

### setEditable

    public void setEditable(boolean flag)

  Specified by:
    `setEditable` in interface `EditableComponent`

### isCellEditable

    public boolean isCellEditable(int rowIndex,
                                  int columnIndex)

  Specified by:
    `isCellEditable` in interface `TableModel`

### removeTableModelListener

    public void removeTableModelListener(TableModelListener l)

  Specified by:
    `removeTableModelListener` in interface `TableModel`

### setValueAt

    public void setValueAt(Object aValue,
                           int rowIndex,
                           int columnIndex)

  Specified by:
    `setValueAt` in interface `TableModel`

### unwrap

    public TableModel unwrap()

  Description copied from interface: `Wrapped`
  returns the embedded instance that this wrapper encloses

  Specified by:
    `unwrap` in interface `Wrapped<TableModel>`

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