Enum Class ToastLevel

java.lang.Object
java.lang.Enum<ToastLevel>
megamek.client.ui.clientGUI.boardview.overlay.ToastLevel
All Implemented Interfaces:
Serializable, Comparable<ToastLevel>, Constable

public enum ToastLevel extends Enum<ToastLevel>
Severity levels for board toast notifications. Each level defines a background color and how much longer than the player's base display time its messages linger, so a more urgent level always outlasts a less urgent one no matter where the player sets the base. Callers may override the duration outright for specific toasts.
  • Enum Constant Details

    • INFO

      public static final ToastLevel INFO
    • SUCCESS

      public static final ToastLevel SUCCESS
    • WARNING

      public static final ToastLevel WARNING
    • ERROR

      public static final ToastLevel ERROR
    • GAMEMASTER

      public static final ToastLevel GAMEMASTER
      A Game Master's action - purple, so it reads as the GM's hand rather than a game outcome.
  • Method Details

    • values

      public static ToastLevel[] 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 ToastLevel 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
    • getBackgroundColor

      public Color getBackgroundColor()
    • getDefaultDurationMs

      public int getDefaultDurationMs()
      Returns this level's display time, being the player's configured base duration plus this level's urgency offset. At the default base of 3 seconds this yields the long-standing 3s INFO/SUCCESS, 4s WARNING/GAMEMASTER and 5s ERROR timings.

      The settings spinner cannot go below MIN_BASE_DURATION_SECONDS, but the stored value is clamped here as well so a hand-edited or corrupted preferences file cannot produce toasts that fade instantly.

      Returns:
      the display time in milliseconds