Package docking.widgets.table

# Class TableModelWrapper<ROW_OBJECT>

java.lang.Object
docking.widgets.table.TableModelWrapper<ROW_OBJECT>

Type Parameters:
  `ROW_OBJECT` - the row object type

All Implemented Interfaces:
  `RowObjectFilterModel<ROW_OBJECT>`, `RowObjectTableModel<ROW_OBJECT>`, `SelectionStorage<ROW_OBJECT>`, `WrappingTableModel`, `TableModel`

public class TableModelWrapper<ROW_OBJECT> extends Object implements RowObjectFilterModel<ROW_OBJECT>, SelectionStorage<ROW_OBJECT>, WrappingTableModel
A wrapper that will take a table model and decorate it with filtering capability. This is only needed when the given model does not have filtering.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected List<Integer>`
  `filteredIndexList`

  ### Fields inherited from interface docking.widgets.table.RowObjectFilterModel

  `SUB_FILTERING_DISABLED_PROPERTY`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TableModelWrapper(RowObjectTableModel<ROW_OBJECT> wrappedModel)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addTableModelListener(TableModelListener l)`
  `void`
  `fireTableChanged(TableModelEvent event)`
  This method allows us to call the delegate model with a translated event
  `void`
  `fireTableDataChanged()`
  Sends an event to all listeners that all the data inside of this model may have changed.
  `Class<?>`
  `getColumnClass(int columnIndex)`
  `int`
  `getColumnCount()`
  `String`
  `getColumnName(int columnIndex)`
  `Object`
  `getColumnValueForRow(ROW_OBJECT t, int columnIndex)`
  Implementors are expected to return a value at the given column index for the specified row object.
  `List<ROW_OBJECT>`
  `getLastSelectedObjects()`
  `List<ROW_OBJECT>`
  `getModelData()`
  Implementors should return the current data of the model.
  `int`
  `getModelIndex(ROW_OBJECT t)`
  Returns the model index of the given item.
  `int`
  `getModelRow(int viewRow)`
  Returns the unwrapped model's row for the given view row.
  `String`
  `getName()`
  Returns the name of this model
  `int`
  `getRowCount()`
  `int`
  `getRowIndex(ROW_OBJECT t)`
  Returns the row number for the given object.
  `ROW_OBJECT`
  `getRowObject(int viewRow)`
  Returns the row object for the given row.
  `TableFilter<ROW_OBJECT>`
  `getTableFilter()`
  `List<ROW_OBJECT>`
  `getUnfilteredData()`
  `int`
  `getUnfilteredRowCount()`
  `Object`
  `getValueAt(int rowIndex, int columnIndex)`
  `int`
  `getViewIndex(ROW_OBJECT t)`
  Returns the view index of the given item.
  `int`
  `getViewRow(int modelRow)`
  `TableModel`
  `getWrappedModel()`
  Returns the wrapped model
  `boolean`
  `isCellEditable(int rowIndex, int columnIndex)`
  `boolean`
  `isFiltered()`
  `void`
  `removeTableModelListener(TableModelListener l)`
  `void`
  `setLastSelectedObjects(List<ROW_OBJECT> lastSelectedObjects)`
  `void`
  `setTableFilter(TableFilter<ROW_OBJECT> tableFilter)`
  `void`
  `setValueAt(Object value, int rowIndex, int columnIndex)`
  `void`
  `wrappedModelChangedFromTableChangedEvent()`
  Allows this wrapping model to get update notifications directly from the filtering framework

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### filteredIndexList

    protected List<Integer> filteredIndexList

- ## Constructor Details

  - ### TableModelWrapper

    public TableModelWrapper(RowObjectTableModel<ROW_OBJECT> wrappedModel)

- ## Method Details

  - ### getName

    public String getName()
    Description copied from interface: `RowObjectTableModel`
    Returns the name of this model
    Specified by:
      `getName` in interface `RowObjectTableModel<ROW_OBJECT>`
    Returns:
      the name of this model

  - ### getLastSelectedObjects

    public List<ROW_OBJECT> getLastSelectedObjects()
    Specified by:
      `getLastSelectedObjects` in interface `SelectionStorage<ROW_OBJECT>`

  - ### setLastSelectedObjects

    public void setLastSelectedObjects(List<ROW_OBJECT> lastSelectedObjects)
    Specified by:
      `setLastSelectedObjects` in interface `SelectionStorage<ROW_OBJECT>`

  - ### setTableFilter

    public void setTableFilter(TableFilter<ROW_OBJECT> tableFilter)
    Specified by:
      `setTableFilter` in interface `RowObjectFilterModel<ROW_OBJECT>`

  - ### getTableFilter

    public TableFilter<ROW_OBJECT> getTableFilter()
    Specified by:
      `getTableFilter` in interface `RowObjectFilterModel<ROW_OBJECT>`

  - ### getModelRow

    public int getModelRow(int viewRow)
    Description copied from interface: `WrappingTableModel`
    Returns the unwrapped model's row for the given view row.
    Specified by:
      `getModelRow` in interface `RowObjectFilterModel<ROW_OBJECT>`
    Specified by:
      `getModelRow` in interface `WrappingTableModel`
    Parameters:
      `viewRow` - the row in the GUI
    Returns:
      the row in the wrapped model's indexing

  - ### getViewRow

    public int getViewRow(int modelRow)
    Specified by:
      `getViewRow` in interface `RowObjectFilterModel<ROW_OBJECT>`

  - ### wrappedModelChangedFromTableChangedEvent

    public void wrappedModelChangedFromTableChangedEvent()
    Description copied from interface: `WrappingTableModel`
    Allows this wrapping model to get update notifications directly from the filtering framework
    Specified by:
      `wrappedModelChangedFromTableChangedEvent` in interface `WrappingTableModel`

  - ### fireTableChanged

    public void fireTableChanged(TableModelEvent event)
    Description copied from interface: `WrappingTableModel`
    This method allows us to call the delegate model with a translated event
    Specified by:
      `fireTableChanged` in interface `WrappingTableModel`
    Parameters:
      `event` - the event

  - ### fireTableDataChanged

    public void fireTableDataChanged()
    Description copied from interface: `RowObjectTableModel`
    Sends an event to all listeners that all the data inside of this model may have changed.
    Specified by:
      `fireTableDataChanged` in interface `RowObjectTableModel<ROW_OBJECT>`

  - ### isFiltered

    public boolean isFiltered()
    Specified by:
      `isFiltered` in interface `RowObjectFilterModel<ROW_OBJECT>`

  - ### addTableModelListener

    public void addTableModelListener(TableModelListener l)
    Specified by:
      `addTableModelListener` in interface `TableModel`

  - ### removeTableModelListener

    public void removeTableModelListener(TableModelListener l)
    Specified by:
      `removeTableModelListener` 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`

  - ### getUnfilteredRowCount

    public int getUnfilteredRowCount()
    Specified by:
      `getUnfilteredRowCount` in interface `RowObjectFilterModel<ROW_OBJECT>`

  - ### getUnfilteredData

    public List<ROW_OBJECT> getUnfilteredData()
    Specified by:
      `getUnfilteredData` in interface `RowObjectFilterModel<ROW_OBJECT>`

  - ### getModelData

    public List<ROW_OBJECT> getModelData()
    Description copied from interface: `RowObjectTableModel`
    Implementors should return the current data of the model. For models that support filtering, this will be the filtered version of the data. Furthermore, the data should be the underlying data and not a copy, as this method will potentially sort the given data.

    For those subclasses using an array, you may use the `Arrays` class to create a list backed by the array (`Arrays.asList(Object...)`).

    Specified by:
      `getModelData` in interface `RowObjectTableModel<ROW_OBJECT>`
    Returns:
      the model data.

  - ### getModelIndex

    public int getModelIndex(ROW_OBJECT t)
    Description copied from interface: `RowObjectFilterModel`
    Returns the model index of the given item. When filtered, this is the index is the larger, set of data; when unfiltered, this index is the same as that returned by `RowObjectFilterModel.getModelIndex(Object)`.

    This operation will be O(n) unless the implementation is sorted, in which case the operation is O(log n), as it uses a binary search.

    Specified by:
      `getModelIndex` in interface `RowObjectFilterModel<ROW_OBJECT>`
    Parameters:
      `t` - the item
    Returns:
      the model index

  - ### getViewIndex

    public int getViewIndex(ROW_OBJECT t)
    Description copied from interface: `RowObjectFilterModel`
    Returns the view index of the given item. When filtered, this is the index is the smaller, visible set of data; when unfiltered, this index is the same as that returned by `RowObjectFilterModel.getModelIndex(Object)`.

    This operation will be O(n) unless the implementation is sorted, in which case the operation is O(log n), as it uses a binary search.

    Specified by:
      `getViewIndex` in interface `RowObjectFilterModel<ROW_OBJECT>`
    Parameters:
      `t` - the item
    Returns:
      the view index

  - ### getRowIndex

    public int getRowIndex(ROW_OBJECT t)
    Description copied from interface: `RowObjectTableModel`
    Returns the row number for the given object.

    Note: the index returned is always the 'view' index. For non-filtering table models, the 'view' and the 'model' index are the same. However, for filtering table models, the 'view' may be a subset of the 'model' index. Thus, it is possible, if this model is a filtering model, that the given `t` may not have a row value for the current state of the model (i.e., when the model is filtered in the view. If you really need to get the model index in such a situation, see `RowObjectFilterModel`.

    Specified by:
      `getRowIndex` in interface `RowObjectTableModel<ROW_OBJECT>`
    Parameters:
      `t` - the object
    Returns:
      the row number

  - ### getRowObject

    public ROW_OBJECT getRowObject(int viewRow)
    Description copied from interface: `RowObjectTableModel`
    Returns the row object for the given row. This is the row in the UI. For models that know how to filter, the model row value will not match the view row value. For non-filtering models the view and model rows will always be the same.
    Specified by:
      `getRowObject` in interface `RowObjectTableModel<ROW_OBJECT>`
    Parameters:
      `viewRow` - the row for which to return a row object.
    Returns:
      the row object

  - ### getColumnValueForRow

    public Object getColumnValueForRow(ROW_OBJECT t, int columnIndex)
    Description copied from interface: `RowObjectTableModel`
    Implementors are expected to return a value at the given column index for the specified row object. This is essentially a more specific version of the `TableModel.getValueAt(int, int)` that allows this class's comparator objects to work.
    Specified by:
      `getColumnValueForRow` in interface `RowObjectTableModel<ROW_OBJECT>`
    Parameters:
      `t` - The object that represents a given row.
      `columnIndex` - The column index for which a value is requested.
    Returns:
      a value at the given column index for the specified row object.

  - ### getValueAt

    public Object getValueAt(int rowIndex, int columnIndex)
    Specified by:
      `getValueAt` in interface `TableModel`

  - ### isCellEditable

    public boolean isCellEditable(int rowIndex, int columnIndex)
    Specified by:
      `isCellEditable` in interface `TableModel`

  - ### setValueAt

    public void setValueAt(Object value, int rowIndex, int columnIndex)
    Specified by:
      `setValueAt` in interface `TableModel`

  - ### getWrappedModel

    public TableModel getWrappedModel()
    Description copied from interface: `WrappingTableModel`
    Returns the wrapped model
    Specified by:
      `getWrappedModel` in interface `WrappingTableModel`
    Returns:
      the model