Interface FilterTableModel<R,C>

Type Parameters:
R - the type representing the rows in this table model
C - the type used to identify columns in this table model, Integer for indexed identification for example
All Superinterfaces:
FilterModel<R>, TableModel
All Known Implementing Classes:
SwingEntityTableModel

public interface FilterTableModel<R,C> extends TableModel, FilterModel<R>
Specifies a table model supporting selection as well as filtering. A FilterTableModel can not contain null items.
See Also:
  • Method Details

    • columns

      Returns:
      the table columns
    • getStringAt

      String getStringAt(int rowIndex, C identifier)
      Returns a String representation of the value for the given row and column.
      Parameters:
      rowIndex - the row index
      identifier - the column identifier
      Returns:
      the string value
    • values

      <T> Collection<T> values(C identifier)
      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

      Class<?> getColumnClass(C identifier)
      Returns the class of the column with the given identifier
      Parameters:
      identifier - the column identifier
      Returns:
      the Class representing the given column
    • selectedValues

      <T> Collection<T> selectedValues(C identifier)
      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

      Returns:
      the Value controlling the refresh strategy
    • selection

      Specified by:
      selection in interface FilterModel<R>
      Returns:
      the FilterTableModel.TableSelection instance used by this table model
    • filters

      Returns:
      the TableConditionModel used to filter this table model
    • refresh

      void refresh()
      Refreshes the items in this model using its FilterModel.Refresher.

      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:
      refresh in interface FilterModel<R>
      See Also:
    • refresh

      void refresh(Consumer<Collection<R>> onRefresh)
      Refreshes the data in this filter model using its FilterModel.Refresher. Note that this method only throws exceptions when run synchronously off the user interface thread. Use FilterModel.Refresher.failure() to listen for exceptions that happen during asynchronous 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:
      refresh in interface FilterModel<R>
      Parameters:
      onRefresh - called after a successful refresh, may be null
      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 index
      toIndex - the to index
    • builder

      static <R, C> FilterTableModel.Builder<R,C> builder(FilterTableModel.Columns<R,C> columns)
      Instantiates a new table model builder.
      Type Parameters:
      R - the row type
      C - the column identifier type
      Parameters:
      columns - the columns
      Returns:
      a new builder instance
      Throws:
      NullPointerException - in case columnValues is null