Interface Action

All Known Subinterfaces:
All Known Implementing Classes:
BasicAction, DynamicRegisteredAction, RegisteredAction, StopAreaSelectionAction

public interface Action
The Action provides the content of all kind of buttons or menu items.
  • Method Details

    • getLabel

      String getLabel()
      Returns the label of the action which should be displayed in the toolbar or context menu.
      the label
    • getDescription

      String getDescription()
      Returns the description of the action which should be displayed when hovering over the GUI component containing this action.
      the description
    • getIcon

      StateIcon getIcon()
      Returns the StateIcon for this action.
      the icon
    • getCommand

      Command getCommand()
      Returns the Command for this action.
      the command
    • getAcceleratorKey

      KeyStroke getAcceleratorKey()
      Returns the accelerator key stroke (e.g. CTRL + S) for this action.
      the accelerator key; null if undefined
    • getAlternativeAcceleratorKey

      KeyStroke getAlternativeAcceleratorKey()
      Returns a second, alternative accelerator key stroke for this action.
      the accelerator key; null if undefined
    • setAlternativeAcceleratorKey

      void setAlternativeAcceleratorKey(KeyStroke alternativeAcceleratorKey) throws RegistrationException
      Sets the given KeyStroke to this action as an alternative KeyStroke. Resetting the KeyStroke is not supported.
      alternativeAcceleratorKey - the alternative KeyStroke
      UnsupportedOperationException - if this action already has an alternative KeyStroke or the action doesn't support KeyStrokes.
      RegistrationException - when the given KeyStroke is already bound to an action that was previously registered with the ActionManager
    • getCloseOnExecution

      boolean getCloseOnExecution()
      If this action is contained in an ContextMenu, this value indicates whether the context menu should be closed after executing the command contained in this action.
      whether the context menu should be closed or not
    • getContext

      Collection<Object> getContext()
      The context this action is bound to.
      the context objects used to execute the command
    • setCommand

      void setCommand(Command command)
      Should be only used for sub-menu actions. The Command is set by the button.
      command - the open sub-menu command