Interface Action

All Known Subinterfaces:
DynamicAction
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.
      Returns:
      the label
    • getDescription

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

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

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

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

      KeyStroke getAlternativeAcceleratorKey()
      Returns a second, alternative accelerator key stroke for this action.
      Returns:
      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.
      Parameters:
      alternativeAcceleratorKey - the alternative KeyStroke
      Throws:
      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.
      Returns:
      whether the context menu should be closed or not
    • getContext

      Collection<Object> getContext()
      The context this action is bound to.
      Returns:
      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.
      Parameters:
      command - the open sub-menu command