Holger's Java API

## com.antelmann.util.table
Class ConvertedObjectTableModel<X,T>

    java.lang.Object
      com.antelmann.util.table.TableModelWrapper
          com.antelmann.util.table.ConvertedObjectTableModel<X,T>

All Implemented Interfaces:
  EditableComponent, Refreshable, ObjectTableModel<T>, TableCustomizer, Wrapped<TableModel>, TableModel

    public class ConvertedObjectTableModel<X,T>

extends TableModelWrapper
implements ObjectTableModel<T>

allows to use an ObjectTableModel for a different type by providing a conversion

Since:
  06.01.2017, 00:53:00
Author:
  holger

Field Summary

Fields inherited from class com.antelmann.util.table.TableModelWrapper
`DATE_CONVERTER`

Constructor Summary
`ConvertedObjectTableModel(ObjectTableModel<X> model, Converter<X,T> converter)`

Method Summary
`int` `getRowFor(T entry)` locates the row where the given entry can be found in this model
`T` `getRowValue(int row)` retrieves the value that is represented by the given row in this model.
`void` `refreshContent()` refreshes the embedded content
`void` `setRowValues(Iterable<? extends T> updatedList)` allows to change the underlying table data based on the given collection.
`ObjectTableModel<X>` `unwrap()` returns the embedded instance that this wrapper encloses

Methods inherited from class com.antelmann.util.table.TableModelWrapper
`addTableModelListener, applyStyle, applyStyleFor, getColumnClass, getColumnCount, getColumnName, getRowCount, getValueAt, isCellEditable, isEditable, removeTableModelListener, setColumnClass, setColumnClass, setColumnClassBasedOnRow, setConverter, setConverter, setConverter, setConverter, setEditable, setEditor, setEditor, setReadOnly, setRenderer, setRenderer, setValueAt, wrap`

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, getColumnClass, getColumnCount, getColumnName, getRowCount, getValueAt, isCellEditable, removeTableModelListener, setValueAt`

Constructor Detail

### ConvertedObjectTableModel

    public ConvertedObjectTableModel(ObjectTableModel<X> model,
                                     Converter<X,T> converter)

Method Detail

### unwrap

    public ObjectTableModel<X> unwrap()

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

  Specified by:
    `unwrap` in interface `Wrapped<TableModel>`
  Overrides:
    `unwrap` in class `TableModelWrapper`

### refreshContent

    public void refreshContent()
                        throws IOException

  Description copied from interface: `Refreshable`
  refreshes the embedded content

  Specified by:
    `refreshContent` in interface `Refreshable`
  Throws:
    `IOException` - if the refresh failed

### getRowValue

    public T getRowValue(int row)

  Description copied from interface: `ObjectTableModel`
  retrieves the value that is represented by the given row in this model. If the given row does not exist in the model, various RuntimeExceptions may occur.

  Specified by:
    `getRowValue` in interface `ObjectTableModel<T>`
  Returns:
    the Object value representing the given row

### getRowFor

    public int getRowFor(T entry)

  Description copied from interface: `ObjectTableModel`
  locates the row where the given entry can be found in this model

  Specified by:
    `getRowFor` in interface `ObjectTableModel<T>`
  Returns:
    the row where the entry is found in the model or -1 if the entry doesn't exist in this model

### setRowValues

    public void setRowValues(Iterable<? extends T> updatedList)
                      throws UnsupportedOperationException

  Description copied from interface: `ObjectTableModel`
  allows to change the underlying table data based on the given collection. Unless specified otherwise, the given collection remains untouched and the elements are copied into the internal data structure of the model.

  Specified by:
    `setRowValues` in interface `ObjectTableModel<T>`
  Throws:
    `UnsupportedOperationException` - if this model doesn't allow such changes

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