Enum Class MenuItem.Role

java.lang.Object
java.lang.Enum<MenuItem.Role>
limn.components.MenuItem.Role
All Implemented Interfaces:
Serializable, Comparable<MenuItem.Role>, Constable
Enclosing class:
MenuItem

public static enum MenuItem.Role extends Enum<MenuItem.Role>
What an item is to the system, beyond its label: one of the three every application has and a system may keep in a menu of its own, or one of the six editing commands.

ABOUT, SETTINGS and QUIT are written where the item lives in a window's menu bar (Help, Edit, File) and change nothing there. Where the system keeps the menu bar outside the window, which is macOS, the item leaves that menu: About and Settings are shown in the application's own menu under the system's label and accelerator and run the item's action, and Quit is the system's, which asks Backend.requestQuit() and does not run the item.

The editing roles make the item the command: it has no action of its own, it is enabled while the widget that has the keyboard can do the command, and choosing it does the command there, on every system. See MenuItem.of(Role).

A 1.x minor release may add constants to this enum: a switch over it needs a default branch.

  • Enum Constant Details

  • Method Details

    • values

      public static MenuItem.Role[] 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 MenuItem.Role 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
    • editCommand

      public @Nullable EditCommand editCommand()
      Returns:
      the editing command this role is, or null for the other four