Class BasicAction

java.lang.Object
com.levigo.jadice.web.client.util.action.BasicAction
All Implemented Interfaces:
Action

public class BasicAction extends Object implements Action
A simple Action which is not registered in an action registry. This action can be used for dynamic content without keystrokes like AnnotationPropertyEditors, buttons in widgets or sub-menu buttons.
  • Constructor Details

    • BasicAction

      public BasicAction(String label, StateIcon stateIcon, Command command)
      Create a new BasicAction with the given parameter
      Parameters:
      label - the displayed name; it is also used as hover description
      stateIcon - the icon which should be displayed
      command - the command which should be executed
    • BasicAction

      public BasicAction(String label, String description, StateIcon icon, Command command)
      Create a new BasicAction with the given parameter
      Parameters:
      label - the displayed name
      description - the hover description
      icon - the icon which should be displayed
      command - the command which should be executed
    • BasicAction

      public BasicAction(String label, StateIcon icon, Command command, boolean closeOnExecution)
      Create a new BasicAction with the given parameter
      Parameters:
      label - the displayed name; it is also used as hover description
      icon - the icon which should be displayed
      command - the command which should be executed
      closeOnExecution - whether the containing menu should be closed after executing the command
    • BasicAction

      public BasicAction(String label, String description, StateIcon icon, Command command, boolean closeOnExecution)
      Create a new BasicAction with the given parameter
      Parameters:
      label - the displayed name
      description - the hover description
      icon - the icon which should be displayed
      command - the command which should be executed
      closeOnExecution - whether the containing menu should be closed after executing the command
  • Method Details

    • getLabel

      public String getLabel()
      Description copied from interface: Action
      Returns the label of the action which should be displayed in the toolbar or context menu.
      Specified by:
      getLabel in interface Action
      Returns:
      the label
    • getDescription

      public String getDescription()
      Description copied from interface: Action
      Returns the description of the action which should be displayed when hovering over the GUI component containing this action.
      Specified by:
      getDescription in interface Action
      Returns:
      the description
    • getIcon

      public StateIcon getIcon()
      Description copied from interface: Action
      Returns the StateIcon for this action.
      Specified by:
      getIcon in interface Action
      Returns:
      the icon
    • getCommand

      public Command getCommand()
      Description copied from interface: Action
      Returns the Command for this action.
      Specified by:
      getCommand in interface Action
      Returns:
      the command
    • getAcceleratorKey

      public KeyStroke getAcceleratorKey()
      Description copied from interface: Action
      Returns the accelerator key stroke (e.g. CTRL + S) for this action.
      Specified by:
      getAcceleratorKey in interface Action
      Returns:
      the accelerator key; null if undefined
    • getAlternativeAcceleratorKey

      public KeyStroke getAlternativeAcceleratorKey()
      Description copied from interface: Action
      Returns a second, alternative accelerator key stroke for this action.
      Specified by:
      getAlternativeAcceleratorKey in interface Action
      Returns:
      the accelerator key; null if undefined
    • setAlternativeAcceleratorKey

      public void setAlternativeAcceleratorKey(KeyStroke alternativeKeyStroke)
      Description copied from interface: Action
      Sets the given KeyStroke to this action as an alternative KeyStroke. Resetting the KeyStroke is not supported.
      Specified by:
      setAlternativeAcceleratorKey in interface Action
      Parameters:
      alternativeKeyStroke - the alternative KeyStroke
    • getCloseOnExecution

      public boolean getCloseOnExecution()
      Description copied from interface: Action
      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.
      Specified by:
      getCloseOnExecution in interface Action
      Returns:
      whether the context menu should be closed or not
    • getContext

      public Collection<Object> getContext()
      Description copied from interface: Action
      The context this action is bound to.
      Specified by:
      getContext in interface Action
      Returns:
      the context objects used to execute the command
    • setCommand

      public void setCommand(Command command)
      Description copied from interface: Action
      Should be only used for sub-menu actions. The Command is set by the button.
      Specified by:
      setCommand in interface Action
      Parameters:
      command - the open sub-menu command