Package swingtree

Enum Class UI.Editability

All Implemented Interfaces:
Serializable, Comparable<UI.Editability>, Constable, UIEnum<UI.Editability>
Enclosing class:
UI

@Immutable public static enum UI.Editability extends Enum<UI.Editability> implements UIEnum<UI.Editability>
Defines whether the user may edit the cells of a JTable or only read them.

Note that permitting edits is only half of what an editable table needs: the data also has to live in a mutable Var property, so that an edit has somewhere to go. Data bound through a read only Val yields a read only table whatever this says.

See UIFactoryMethods.table(swingtree.UI.Editability, TableMapDataSource) or TableData.withEditability(swingtree.UI.Editability) for more information about the usage of this enum.

See Also:
  • Enum Constant Details

    • EDITABLE

      public static final UI.Editability EDITABLE
      The user may type into the cells of the table.
    • READ_ONLY

      public static final UI.Editability READ_ONLY
      The user may read the cells of the table but not change them.
  • Method Details

    • values

      public static UI.Editability[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static UI.Editability valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • of

      public static UI.Editability of(boolean editable)
      Turns a boolean into the matching constant, so that editability which already lives in a flag, such as a view model property derived from a permission, can become one of these two constants at the single place it enters the user interface.
      Parameters:
      editable - Whether the user should be permitted to edit the cells.
      Returns:
      EDITABLE if editable is true, READ_ONLY otherwise.
    • isEditable

      public final boolean isEditable()
      Tells if the cells of a table using this setting may be edited by the user.
      Returns:
      True if this is EDITABLE.