Interface Action

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Action
A function that is executed when an interaction occurs in a gui.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    act(Window window)
    Executes the action.
    static Action
    Returns an action mapping the viewer to an Audience.
    static Action
    Returns an action that goes back to the previous window.
    static Action
    back(int depth)
    Returns an action that goes back to the window at the given depth.
    static Action
    command(String name, String... arguments)
    Returns an action that invoke a command for the viewer.
    static <T> Action
    compute(Key<T> key, Function<T,T> function)
    Returns an action that computes a state entry if it exists.
    static <T> Action
    compute(Key<T> key, T def, Function<T,T> function)
    Returns an action that computes a state entry.
    static Action
    Returns an action that hides all windows in the hierarchy.
    static Action
    Returns an action that does nothing.
    static Action
    run(Runnable runnable)
    Returns an action that runs the given runnable.
    default Action
    then(Action next)
    Returns a new action that first executes this action and then the given action.
    static <T> Action
    with(Key<T> key, T value)
    Returns an action that sets a state entry with the given value.
    static Action
    without(Key<?> key)
    Returns an action that removes a state entry.
  • Method Details

    • none

      static Action none()
      Returns an action that does nothing.
    • with

      static <T> Action with(Key<T> key, T value)
      Returns an action that sets a state entry with the given value.
      Type Parameters:
      T - the type of the value
      Parameters:
      key - the key
      value - the value
      Returns:
      the action
    • compute

      static <T> Action compute(Key<T> key, T def, Function<T,T> function)
      Returns an action that computes a state entry. If not present, the default value is used.
      Type Parameters:
      T - the type of the value
      Parameters:
      key - the key
      def - the default value
      function - the function to compute the value
      Returns:
      the action
    • compute

      static <T> Action compute(Key<T> key, Function<T,T> function)
      Returns an action that computes a state entry if it exists.
      Type Parameters:
      T - the type of the value
      Parameters:
      key - the key
      function - the function to compute the value
      Returns:
      the action
    • without

      static Action without(Key<?> key)
      Returns an action that removes a state entry.
      Parameters:
      key - the key
      Returns:
      the action
    • back

      static Action back()
      Returns an action that goes back to the previous window.
    • back

      static Action back(int depth)
      Returns an action that goes back to the window at the given depth.
      Parameters:
      depth - the depth
      Returns:
      the action
    • hideAll

      static Action hideAll()
      Returns an action that hides all windows in the hierarchy.
    • audience

      static Action audience(Consumer<Audience> consumer)
      Returns an action mapping the viewer to an Audience.
      Parameters:
      consumer - the sub action running on the audience
      Returns:
      the action
    • run

      static Action run(Runnable runnable)
      Returns an action that runs the given runnable.
      Parameters:
      runnable - the runnable
      Returns:
      the action
    • command

      static Action command(String name, String... arguments)
      Returns an action that invoke a command for the viewer.
    • act

      void act(Window window)
      Executes the action.
      Parameters:
      window - the window
    • then

      default Action then(Action next)
      Returns a new action that first executes this action and then the given action.
      Parameters:
      next - the action to execute after this action
      Returns:
      the new action