Package swingtree

Enum Class UI.Active

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

@Immutable public static enum UI.Active extends Enum<UI.Active> implements UIEnum<UI.Active>
A three way answer to "should this be here?": NEVER says no whatever happens, ALWAYS says yes whatever happens, and AS_NEEDED hands the question on to the situation at hand.

SwingTree uses it for the scroll bar policy of a scroll pane, where the situation is whether the content is taller or wider than the viewport. Nothing about it is specific to scroll bars though, and decide(boolean) applies the same three way choice to a condition of your own.

See Also:
  • Enum Constant Details

    • NEVER

      public static final UI.Active NEVER
      Keep the thing away, whatever the situation.
    • AS_NEEDED

      public static final UI.Active AS_NEEDED
      Let the situation decide, so the thing is there exactly when it is called for.
    • ALWAYS

      public static final UI.Active ALWAYS
      Keep the thing present, whatever the situation.
  • Method Details

    • values

      public static UI.Active[] 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.Active 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
    • decide

      public boolean decide(boolean needed)
      Answers whether the thing this policy governs should be present, given whether the situation calls for it. NEVER and ALWAYS are answers the user of your program already gave, so they ignore the argument; only AS_NEEDED passes it through. Writing the decision as policy == ALWAYS || needed instead lets a runtime condition overrule a NEVER the user asked for.
      Parameters:
      needed - Whether the situation calls for the thing being decided about.
      Returns:
      false for NEVER, true for ALWAYS, and needed for AS_NEEDED.