Class HiddenColumnModel

java.lang.Object
javax.swing.table.DefaultTableColumnModel
com.illumon.iris.gui.table.HiddenColumnModel
All Implemented Interfaces:
PropertyChangeListener, Serializable, EventListener, ListSelectionListener, TableColumnModel

public class HiddenColumnModel
extends DefaultTableColumnModel
A TableColumnModel which allows columns to be hidden and unhidden.
See Also:
Serialized Form
  • Constructor Details

  • Method Details

    • isEditable

      public boolean isEditable()
      Check if users are allowed to set column abbreviations
      Returns:
      true if users are allowed ot set column abbreviations
    • setIsEditable

      public void setIsEditable​(boolean isEditable)
      Set if users are allowed to set column abbreviations.
      Parameters:
      isEditable - if users are allowed to set column abbreviations
    • hideColumn

      public void hideColumn​(int index)
      Hide the column at the specified index.
      Parameters:
      index - the column to hide
    • hideColumn

      public void hideColumn​(@NotNull TableColumn column)
      Hide the specified column.
      Parameters:
      column - the column to hide.
    • isHiddenColumn

      public boolean isHiddenColumn​(@NotNull TableColumn tableColumn)
      Check if the specified column is hidden.
      Parameters:
      tableColumn - the column
      Returns:
      true if the column was hidden
    • isHiddenColumn

      public boolean isHiddenColumn​(@NotNull String columnName)
      Check if the specified column is hidden.
      Parameters:
      columnName - the column
      Returns:
      true if the column was hidden
    • showColumn

      public void showColumn​(@NotNull TableColumn column)
      Show the specified column.
      Parameters:
      column - the column to show
    • showColumn

      public void showColumn​(@NotNull String name)
      Show the specified column.
      Parameters:
      name - the column name to show
    • hideAllColumns

      public void hideAllColumns()
      Hide all of the columns.
    • getHiddenColumns

      @NotNull public List<TableColumn> getHiddenColumns()
      Get a list of the hidden columns.
      Returns:
      a list of hidden columns
      ImplNote:
      Users must not modify the returned value.
    • getColumn

      @Nullable public TableColumn getColumn​(@NotNull String name)
      Get the specified column by name.
      Parameters:
      name - the column name
      Returns:
      the column or null if not found.
    • addColumn

      public void addColumn​(@NotNull TableColumn column)
      Add the specified column to the table. The identifier must be an instance of a WColumn
      Specified by:
      addColumn in interface TableColumnModel
      Overrides:
      addColumn in class DefaultTableColumnModel
      Parameters:
      column - the column to add
      ImplNote:
      This will not add columns with a hidden attribute
    • addColumn

      public void addColumn​(@NotNull TableColumn column, int index)
      Add the specified column to the table at the specified index.
      Parameters:
      column - the column to insert
      index - the index to insert at
      ImplNote:
      This will not add columns with a hidden attribute
    • setColumnRename

      public void setColumnRename​(@NotNull String columnName, @Nullable String rename)
      Set the column header name. A rename value of 'null' will reset to it's original value.
      Parameters:
      columnName - the column to set the header name
      rename - the header name to set.
    • getColumnNameData

      public Object[][] getColumnNameData()
      Get an array of column data in the format: name, abbreviation
    • lockColumn

      public void lockColumn​(@NotNull String column)
      Mark the specified column as 'locked'. a 'locked' column will not be moved upon a moveColumn(int, int).
      Parameters:
      column - the column to lock
    • unlockColumn

      public void unlockColumn​(@NotNull String column)
      Unlock the specified column.
      Parameters:
      column - the coluimn to unlock.
    • isLocked

      public boolean isLocked​(@NotNull TableColumn column)
      Check if the specified column is 'locked'
      Parameters:
      column - the column
      Returns:
      true if the column was locked.
    • moveColumn

      public void moveColumn​(int columnIndex, int newIndex)
      Specified by:
      moveColumn in interface TableColumnModel
      Overrides:
      moveColumn in class DefaultTableColumnModel
    • unlockAllColumns

      public void unlockAllColumns()
      Unlock all locked columns.
    • getName

      @Nullable public static String getName​(@NotNull TableColumn column)
      Get the name of the specified TableColumn, or null if it couldn't be determined.
      Parameters:
      column - The column
      Returns:
      the name, or null.