Interface FilteredTableSortModel<R,C>

Type Parameters:
R - the type representing a row in the table model
C - the type representing the column identifiers in the table model

public interface FilteredTableSortModel<R,C>
Handles the column sorting states for a FilteredTableModel.
  • Method Details

    • comparator

      Comparator<R> comparator()
      Returns:
      a Comparator based on this sort model
    • setSortOrder

      void setSortOrder(C columnIdentifier, SortOrder sortOrder)
      Clears the sorting state and adds the given column sorting order.
      Parameters:
      columnIdentifier - the identifier of the column to sort by
      sortOrder - the sorting order
      Throws:
      IllegalStateException - in case sorting is disabled for the given column
      See Also:
    • addSortOrder

      void addSortOrder(C columnIdentifier, SortOrder sortOrder)
      Adds the given column sorting order to the currently sorted columns. If no column sorting is enabled, this call is the equivilent to using setSortOrder(Object, SortOrder).
      Parameters:
      columnIdentifier - the identifier of the column to sort by
      sortOrder - the sorting order
      Throws:
      IllegalStateException - in case sorting is disabled for the given column
      See Also:
    • sortOrder

      SortOrder sortOrder(C columnIdentifier)
      Parameters:
      columnIdentifier - the column identifier
      Returns:
      the SortOrder associated with the given column
    • sortPriority

      int sortPriority(C columnIdentifier)
      Parameters:
      columnIdentifier - the column identifier
      Returns:
      the sort priority for the given column, -1 if not sorted
    • sorted

      boolean sorted()
      Returns:
      true if sorting is enabled for one or more columns
    • columnSortOrder

      Returns the current column sort order, in order of priority
      Returns:
      the current column sort order, in order of priority
    • clear

      void clear()
      Clears the sorting states from this sort model. Note that only one sorting change event will happen, with the first sort column.
    • setSortingEnabled

      void setSortingEnabled(C columnIdentifier, boolean sortingEnabled)
      Disabling sorting will cause setSortOrder(Object, SortOrder) and addSortOrder(Object, SortOrder) to throw a IllegalStateException for the given column.
      Parameters:
      columnIdentifier - the column identifier
      sortingEnabled - true if sorting should be enabled for the given column
    • isSortingEnabled

      boolean isSortingEnabled(C columnIdentifier)
      Parameters:
      columnIdentifier - the column identifier
      Returns:
      true if sorting is enabled for the given column
    • sortingChangedEvent

      EventObserver<C> sortingChangedEvent()
      Returns:
      an observer notified each time the sorting state changes, with the column identifier as event data
    • nextSortOrder

      static SortOrder nextSortOrder(SortOrder currentSortOrder)
      Parameters:
      currentSortOrder - the current sort order
      Returns:
      the next sort order