Class TableViewOptions

java.lang.Object
com.dua3.utility.fx.controls.TableViewOptions

public final class TableViewOptions extends Object
Represents configuration options for a table view. This class allows the specification and retrieval of various behaviors associated with the table view by using predefined options.
  • READ_ONLY: Makes the table view read-only, preventing any editing of its content.
  • DRAGGABLE_ROWS: Enables row reordering within the table view through drag-and-drop.
Instances of this class are immutable and can be created using the of method by specifying the desired options.
  • Field Details

    • EDITABLE

      public static final TableViewOptions.Option EDITABLE
      Make the TableView editable.
    • SORTABLE

      public static final TableViewOptions.Option SORTABLE
      Make the TableView sortable by clicking on a column header.
    • REORDERABLE_COLUMNS

      public static final TableViewOptions.Option REORDERABLE_COLUMNS
      Allow dragging columns for reordering.
    • REORDERABLE_ROWS

      public static final TableViewOptions.Option REORDERABLE_ROWS
      Allow dragging rows for reordering.
    • MULTIPLE_ROWS_SELECTABLE

      public static final TableViewOptions.Option MULTIPLE_ROWS_SELECTABLE
      Allow selecting multiple rows at once.
    • ALLOW_DELETING_ROWS

      public static final TableViewOptions.Option ALLOW_DELETING_ROWS
      Allow deleting rows.
  • Method Details

    • ALLOW_INSERTING_ROWS

      public static <S> TableViewOptions.Option ALLOW_INSERTING_ROWS(Supplier<S> itemFactory)
      Allow inserting rows.

      Note: The unconventional method name is intentional to match the other options that are simple constants.

      Type Parameters:
      S - the generic item type
      Parameters:
      itemFactory - the item factory used to create new rows
      Returns:
      the option to pass
    • of

      public static TableViewOptions of(TableViewOptions.Option... options)
      Creates an instance of TableViewOptions by combining the specified options. Each option is represented by a bitmask, and the resulting object encapsulates the bitwise combination of the options provided.
      Parameters:
      options - an array of Option enums specifying the desired table view behaviors. If no options are provided, the resulting TableViewOptions will have no behaviors enabled.
      Returns:
      a new TableViewOptions instance configured with the specified options.
    • isEnabled

      public boolean isEnabled(TableViewOptions.Option option)
      Checks if the specified option is enabled for this table view configuration. Each option is evaluated based on the internal bitmask representation.
      Parameters:
      option - the Option to check; must not be null
      Returns:
      true if the specified option is enabled, false otherwise
    • isEnabled

      public boolean isEnabled(String option)
      Checks if the specified option is enabled for this table view configuration.
      Parameters:
      option - the name of the option to check
      Returns:
      true if the specified option is enabled, otherwise false
    • with

      public TableViewOptions with(TableViewOptions.Option... options)
      Creates a new TableViewOptions instance by combining the current options with the specified additional options.
      Parameters:
      options - an array of Option enums specifying additional table view configurations to be combined with the current state.
      Returns:
      a new TableViewOptions instance that combines the current options with the specified additional options.
    • without

      public TableViewOptions without(TableViewOptions.Option... options)
      Creates a new TableViewOptions instance by disabling the specified options in the current configuration.
      Parameters:
      options - an array of Option enums to be disabled.
      Returns:
      a new TableViewOptions instance with the specified options disabled.
    • equals

      public boolean equals(@Nullable Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object