Enum Class StatusTone

java.lang.Object
java.lang.Enum<StatusTone>
org.apache.juneau.console.widgets.StatusTone
All Implemented Interfaces:
Serializable, Comparable<StatusTone>, Constable

public enum StatusTone extends Enum<StatusTone>
The one closed status-tone palette shared by every surface that paints a semantic status colour: info / success / warning / error / neutral.

Exactly five values, and no synonyms. Server-side checks accept a wire() token from WIRE_TOKENS and reject anything else; the client-side painters (the pill, the QuickStats tiles and the dialog-bar badge) silently ignore an off-palette token and apply no tone class. The same five names therefore mean the same five things in Java, in the emitted is-<tone> CSS class, and in the juneau-renders.js tone map.

Badge.tone uses this same enum and serializes it as the enum name.

Example:

boolean ok = StatusTone.isValid("warning"); // true String token = StatusTone.WARNING.wire(); // "warning"

Since:
10.0.0
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Failed / over a hard limit; maps to is-error.
    Informational (neither good nor bad); maps to is-info.
    No semantic colour; inherits the surrounding text colour and emits no tone class.
    Healthy / completed; maps to is-success.
    Approaching a limit or needing attention; maps to is-warning.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Set<String>
    The five legal wire tokens, in declaration order.
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    isValid(String token)
    Returns true if the specified token is one of the five legal tones.
    static StatusTone
    Returns the enum constant of this class with the specified name.
    static StatusTone[]
    Returns an array containing the constants of this enum class, in the order they are declared.
    Returns the lowercase wire token for this tone.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • INFO

      public static final StatusTone INFO
      Informational (neither good nor bad); maps to is-info.
    • SUCCESS

      public static final StatusTone SUCCESS
      Healthy / completed; maps to is-success.
    • WARNING

      public static final StatusTone WARNING
      Approaching a limit or needing attention; maps to is-warning.
    • ERROR

      public static final StatusTone ERROR
      Failed / over a hard limit; maps to is-error.
    • NEUTRAL

      public static final StatusTone NEUTRAL
      No semantic colour; inherits the surrounding text colour and emits no tone class.
  • Field Details

    • WIRE_TOKENS

      public static final Set<String> WIRE_TOKENS
      The five legal wire tokens, in declaration order.

      The single source of truth every server-side tone check reads, so no caller can hand-roll a fourth or sixth value.

  • Method Details

    • values

      public static StatusTone[] 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 StatusTone 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
    • wire

      public String wire()
      Returns the lowercase wire token for this tone.
      Returns:
      The wire token (e.g. "warning").
    • isValid

      public static boolean isValid(String token)
      Returns true if the specified token is one of the five legal tones.
      Parameters:
      token - The candidate wire token. Can be null.
      Returns:
      true if the token is a legal tone; false for null, blank, differently-cased, or off-palette values.