Class 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
-
Field Summary
Fields inherited from interface docking.widgets.table.RowObjectFilterModel
SUB_FILTERING_DISABLED_PROPERTY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
fireTableChanged
(TableModelEvent event) This method allows us to call the delegate model with a translated eventvoid
Sends an event to all listeners that all the data inside of this model may have changed.Class
<?> getColumnClass
(int columnIndex) int
getColumnName
(int columnIndex) getColumnValueForRow
(ROW_OBJECT t, int columnIndex) Implementors are expected to return a value at the given column index for the specified row object.Implementors should return the current data of the model.int
Returns the model index of the given item.int
getModelRow
(int viewRow) Returns the unwrapped model's row for the given view row.getName()
Returns the name of this modelint
int
Returns the row number for the given object.getRowObject
(int viewRow) Returns the row object for the given row.int
getValueAt
(int rowIndex, int columnIndex) int
Returns the view index of the given item.int
getViewRow
(int modelRow) Returns the wrapped modelboolean
isCellEditable
(int rowIndex, int columnIndex) boolean
void
void
setLastSelectedObjects
(List<ROW_OBJECT> lastSelectedObjects) void
setTableFilter
(TableFilter<ROW_OBJECT> tableFilter) void
setValueAt
(Object value, int rowIndex, int columnIndex) void
Allows this wrapping model to get update notifications directly from the filtering framework
-
Field Details
-
filteredIndexList
-
-
Constructor Details
-
TableModelWrapper
-
-
Method Details
-
getName
Description copied from interface:RowObjectTableModel
Returns the name of this model- Specified by:
getName
in interfaceRowObjectTableModel<ROW_OBJECT>
- Returns:
- the name of this model
-
getLastSelectedObjects
- Specified by:
getLastSelectedObjects
in interfaceSelectionStorage<ROW_OBJECT>
-
setLastSelectedObjects
- Specified by:
setLastSelectedObjects
in interfaceSelectionStorage<ROW_OBJECT>
-
setTableFilter
- Specified by:
setTableFilter
in interfaceRowObjectFilterModel<ROW_OBJECT>
-
getTableFilter
- Specified by:
getTableFilter
in interfaceRowObjectFilterModel<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 interfaceRowObjectFilterModel<ROW_OBJECT>
- Specified by:
getModelRow
in interfaceWrappingTableModel
- 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 interfaceRowObjectFilterModel<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 interfaceWrappingTableModel
-
fireTableChanged
Description copied from interface:WrappingTableModel
This method allows us to call the delegate model with a translated event- Specified by:
fireTableChanged
in interfaceWrappingTableModel
- 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 interfaceRowObjectTableModel<ROW_OBJECT>
-
isFiltered
public boolean isFiltered()- Specified by:
isFiltered
in interfaceRowObjectFilterModel<ROW_OBJECT>
-
addTableModelListener
- Specified by:
addTableModelListener
in interfaceTableModel
-
removeTableModelListener
- Specified by:
removeTableModelListener
in interfaceTableModel
-
getColumnClass
- Specified by:
getColumnClass
in interfaceTableModel
-
getColumnCount
public int getColumnCount()- Specified by:
getColumnCount
in interfaceTableModel
-
getColumnName
- Specified by:
getColumnName
in interfaceTableModel
-
getRowCount
public int getRowCount()- Specified by:
getRowCount
in interfaceTableModel
-
getUnfilteredRowCount
public int getUnfilteredRowCount()- Specified by:
getUnfilteredRowCount
in interfaceRowObjectFilterModel<ROW_OBJECT>
-
getUnfilteredData
- Specified by:
getUnfilteredData
in interfaceRowObjectFilterModel<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 interfaceRowObjectTableModel<ROW_OBJECT>
- Returns:
- the model data.
-
getModelIndex
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 byRowObjectFilterModel.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 interfaceRowObjectFilterModel<ROW_OBJECT>
- Parameters:
t
- the item- Returns:
- the model index
-
getViewIndex
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 byRowObjectFilterModel.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 interfaceRowObjectFilterModel<ROW_OBJECT>
- Parameters:
t
- the item- Returns:
- the view index
-
getRowIndex
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, seeRowObjectFilterModel
.- Specified by:
getRowIndex
in interfaceRowObjectTableModel<ROW_OBJECT>
- Parameters:
t
- the object- Returns:
- the row number
-
getRowObject
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 interfaceRowObjectTableModel<ROW_OBJECT>
- Parameters:
viewRow
- the row for which to return a row object.- Returns:
- the row object
-
getColumnValueForRow
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 theTableModel.getValueAt(int, int)
that allows this class's comparator objects to work.- Specified by:
getColumnValueForRow
in interfaceRowObjectTableModel<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
- Specified by:
getValueAt
in interfaceTableModel
-
isCellEditable
public boolean isCellEditable(int rowIndex, int columnIndex) - Specified by:
isCellEditable
in interfaceTableModel
-
setValueAt
- Specified by:
setValueAt
in interfaceTableModel
-
getWrappedModel
Description copied from interface:WrappingTableModel
Returns the wrapped model- Specified by:
getWrappedModel
in interfaceWrappingTableModel
- Returns:
- the model
-