Class Actions


  • public class Actions
    extends Object
    Provides a fluent interface for constructing actions.
    • Method Detail

      • create

        public static IAction create​(String text,
                                     Runnable action)
        Concise method for creating a push action.
      • create

        public static IAction create​(String text,
                                     Listener listener)
        Concise method for creating a push action.
      • builder

        public static Actions builder()
        Defaults to a push style with no text, accelerator, or action.
      • builderCopy

        public static Actions builderCopy​(IAction action)
        Copies all behavior from the given action.
      • setText

        public Actions setText​(String text)
        Sets the text and tooltip.
      • setTooltip

        public Actions setTooltip​(String tooltip)
        Sets the tooltip.
      • setRunnable

        public Actions setRunnable​(Runnable run)
        Sets the callback to be the given Runnable.
      • setListener

        public Actions setListener​(Listener listener)
        Sets the callback to be the given Listener. It may receive a null event.
      • setCallback

        public Actions setCallback​(BiConsumer<IAction,​Event> callback)
        Sets the callback to be the given BiConsumer. Action will definitely be present, but event might be missing.
      • setAccelerator

        public Actions setAccelerator​(int accelerator)
        Sets the keyboard accelerator.
      • build

        public IAction build()
        Returns an action with the specified properties.
      • setToolTipAccelAware

        public static void setToolTipAccelAware​(IAction action,
                                                String tooltip)
        Sets the tooltip text for the given action while remaing aware of its accelerator.
      • getAcceleratorString

        public static String getAcceleratorString​(int accelerator)
        Returns the given key accelerator as a string (including shift, control, command, etc).
      • run

        public static void run​(IAction action)
        Updates the `isChecked()` property of the given IAction (if necessary), then calls IAction::run.
      • run

        public static void run​(IAction action,
                               Event e)
        Updates the `isChecked()` property of the given IAction (if necessary), then calls IAction::runWithEvent.