Module is.codion.swing.common.model
Interface FilterTableModel<R,C>
- Type Parameters:
R- the type representing the rows in this table modelC- the type used to identify columns in this table model, Integer for indexed identification for example
- All Superinterfaces:
is.codion.common.model.FilterModel<R>,TableModel
Specifies a table model supporting selection as well as filtering
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA builder for aFilterTableModel.static interfaceSpecifies the columns for a table modelstatic enumSpecifies how the data in a table model is refreshed.static interfaceA selection model for aFilterTableModel.Nested classes/interfaces inherited from interface is.codion.common.model.FilterModel
is.codion.common.model.FilterModel.AbstractRefresher<T extends Object>, is.codion.common.model.FilterModel.FilteredItems<T extends Object>, is.codion.common.model.FilterModel.Items<T extends Object>, is.codion.common.model.FilterModel.Refresher<T extends Object>, is.codion.common.model.FilterModel.VisibleItems<T extends Object> -
Field Summary
Fields inherited from interface is.codion.common.model.FilterModel
ASYNC_REFRESH -
Method Summary
Modifier and TypeMethodDescriptionstatic <R,C> FilterTableModel.Builder<R, C> builder(FilterTableModel.Columns<R, C> columns) Instantiates a new table model builder.columns()is.codion.common.model.condition.TableConditionModel<C>voidNotifies all listeners that all cell values in the table's rows may have changed.voidfireTableRowsUpdated(int fromIndex, int toIndex) Notifies all listeners that the given rows have changedClass<?>getColumnClass(C identifier) Returns the class of the column with the given identifiergetStringAt(int rowIndex, C identifier) Returns a String representation of the value for the given row and column.voidrefresh()
Retains the selection and filtering.voidrefresh(Consumer<Collection<R>> onRefresh)
Retains the selection and filtering.is.codion.common.value.Value<FilterTableModel.RefreshStrategy><T> Collection<T>selectedValues(C identifier) <T> Collection<T>Methods inherited from interface is.codion.common.model.FilterModel
items, refresherMethods inherited from interface javax.swing.table.TableModel
addTableModelListener, getColumnClass, getColumnCount, getColumnName, getRowCount, getValueAt, isCellEditable, removeTableModelListener, setValueAt
-
Method Details
-
columns
FilterTableModel.Columns<R,C> columns()- Returns:
- the table columns
-
getStringAt
Returns a String representation of the value for the given row and column.- Parameters:
rowIndex- the row indexidentifier- the column identifier- Returns:
- the string value
-
values
- Type Parameters:
T- the value type- Parameters:
identifier- the identifier of the column for which to retrieve the values- Returns:
- the values (including nulls) of the column identified by the given identifier from the visible rows in the table model
-
getColumnClass
Returns the class of the column with the given identifier- Parameters:
identifier- the column identifier- Returns:
- the Class representing the given column
-
selectedValues
- Type Parameters:
T- the value type- Parameters:
identifier- the identifier of the column for which to retrieve the values- Returns:
- the values (including nulls) of the column identified by the given identifier from the selected rows in the table model
-
refreshStrategy
is.codion.common.value.Value<FilterTableModel.RefreshStrategy> refreshStrategy()- Returns:
- the
Valuecontrolling the refresh strategy
-
selection
FilterTableModel.TableSelection<R> selection()- Specified by:
selectionin interfaceis.codion.common.model.FilterModel<R>- Returns:
- the
FilterTableModel.TableSelectioninstance used by this table model
-
conditions
is.codion.common.model.condition.TableConditionModel<C> conditions()- Returns:
- the filter condition model used by this table model
-
refresh
void refresh()
Retains the selection and filtering. Sorts the refreshed data unless merging on refresh is enabled. Note that an empty selection event will be triggered during a normal refresh, since the model is cleared before it is repopulated, during which the selection is cleared as well. Using merge on refresh (refreshStrategy()) will prevent that at a considerable performance cost.- Specified by:
refreshin interfaceis.codion.common.model.FilterModel<R>- See Also:
-
refresh
Retains the selection and filtering. Sorts the refreshed data unless merging on refresh is enabled. Note that an empty selection event will be triggered during a normal refresh, since the model is cleared before it is repopulated, during which the selection is cleared as well. Using merge on refresh (refreshStrategy()) will prevent that at a considerable performance cost.- Specified by:
refreshin interfaceis.codion.common.model.FilterModel<R>- See Also:
-
fireTableDataChanged
void fireTableDataChanged()Notifies all listeners that all cell values in the table's rows may have changed. The number of rows may also have changed and the JTable should redraw the table from scratch. The structure of the table (as in the order of the columns) is assumed to be the same. -
fireTableRowsUpdated
void fireTableRowsUpdated(int fromIndex, int toIndex) Notifies all listeners that the given rows have changed- Parameters:
fromIndex- the from indextoIndex- the to index
-
builder
Instantiates a new table model builder.- Type Parameters:
R- the row typeC- the column identifier type- Parameters:
columns- the columns- Returns:
- a new builder instance
- Throws:
NullPointerException- in casecolumnValuesis null
-