Interface FreezeColumnsManager

All Known Implementing Classes:
FreezeColumnsManagerImpl, NullFreezeColumnManager

public interface FreezeColumnsManager
A Freeze Column manager allows the user to freeze columns so that they are always in view.
  • Method Details

    • freezeColumnsSupported

      boolean freezeColumnsSupported()
      Indicates if freeze columns are supported.
      Returns:
      true if freeze columns are supported, false otherwise
    • getFreezeColumns

      List<String> getFreezeColumns()
      Gets a list of the columns that are frozen.
      Returns:
      a list of freeze columns
    • getOtherColumnSet

      default Set<String> getOtherColumnSet​(GuiTable guiTable)
      Gets the subset of columns that are used in the other GuiTable (including hidden columns).
      Parameters:
      guiTable - the table requesting the columns
      Returns:
      the columns for the other table
    • getFrozenColumnSet

      Set<String> getFrozenColumnSet()
      Gets the freeze columns as a set.
      Returns:
      the freeze columns
    • getNormalColumnSet

      Set<String> getNormalColumnSet()
      Gets the normal (unfrozen) columns as a set.
      Returns:
      the normal columns
    • setFreezeColumns

      void setFreezeColumns​(Collection<String> columns)
      Clears any previous freeze columns and sets them to the columns in a list.
      Parameters:
      columns - the list of columns to freeze
    • getMainTable

      @NotNull GuiTable getMainTable()
      Gets the main table. This is useful for when we should operate on the main table, but the user clicks on the freeze table.
      Returns:
      the main table
    • getFreezeTable

      @Nullable GuiTable getFreezeTable()
      Gets the freeze table.
      Returns:
      the freeze table, null if freezing is not supported or no columns have been frozen
    • hideFreezeTable

      void hideFreezeTable()
      Hides the freeze table.
    • showFreezeTable

      void showFreezeTable()
      Shows the freeze table.
    • isFreezeTable

      boolean isFreezeTable​(GuiTable table)
      Indicates if a table is the freeze table.
      Parameters:
      table - the table to check
      Returns:
      true if it is the freeze table, false otherwise
    • freezeColumn

      void freezeColumn​(@NotNull TableColumn column)
      Freezes a column.
      Parameters:
      column - the column to freeze
    • unfreezeColumn

      void unfreezeColumn​(@NotNull TableColumn column)
      Unfreezes a column.
      Parameters:
      column - the column to unfreeze
    • freezeColumn

      void freezeColumn​(@NotNull String column)
      Freezes a column.
      Parameters:
      column - the column to freeze
    • unfreezeColumn

      void unfreezeColumn​(@NotNull String column)
      Unfreezes a column.
      Parameters:
      column - the column to unfreeze
    • repaint

      void repaint()
      Requests the freeze table to repaint.
    • isModified

      boolean isModified()
      Indicates if the freeze columns have been altered since the table was first created (e.g. the freeze columns are different than what was specified in the layout hints)
      Returns:
      true if the columns have been modified, false otherwise
    • setModified

      void setModified​(boolean modified)
      Marks if the freeze columns have been modified.
      Parameters:
      modified - true if they have been modified, false otherwise
    • getTotalColumnCount

      default int getTotalColumnCount()
      Gets the total column count for both the freeze table and the main table.
      Returns:
      the total column count
    • getSelectedColumns

      default int[] getSelectedColumns()
      Gets the selected columns taking into account both the freeze table and the main table.
      Returns:
      the selected columns
    • convertColumnIndexToModel

      default int convertColumnIndexToModel​(int viewColumnIndex)
      Converts a view column index to a model column index taking into account both the freeze table and main table. Specifically, the input index for this method is one that is treating the two tables as one big table.
      Parameters:
      viewColumnIndex - the view column index
      Returns:
      the model column index
    • getColumnName

      default String getColumnName​(int column)
      Gets the column name at view column position taking into account both the freeze table and the main table.
      Parameters:
      column - the view column index
      Returns:
      the column name
    • getHiddenColumns

      default Collection<TableColumn> getHiddenColumns()
      Gets all the hidden columns taking into account both the freeze table and the main table.
      Returns:
      a collection of hidden columns
    • getVisibleColumns

      default Collection<TableColumn> getVisibleColumns()
      Gets all the visible columns taking into account both the freeze table and the main table.
      Returns:
      a collection of visible columns
    • hideAllColumns

      default void hideAllColumns()
      Hides all columns in both the freeze table and main table.
    • showColumn

      default void showColumn​(TableColumn tableColumn)
      Shows a column in the correct table (freeze table or main table)
      Parameters:
      tableColumn - the column to show
    • mayHideOrFreezeColumn

      default boolean mayHideOrFreezeColumn​(@NotNull TableColumn tableColumn)
      Identifies if a specific column is eligible for hiding/freezing. We must not hide/freeze the final column in our mainTable, or we will have scrolling and viewport issues
      Parameters:
      tableColumn - a column within our table
      Returns:
      true if the column may be hidden or frozen, else false
    • close

      default void close()
      Cleans up all resources related to this instance