Interface StatefulCommand<T>

Type Parameters:
T - The type of object that the command operates on.
All Superinterfaces:
SemiStatefulCommand
All Known Subinterfaces:
KeyedStatefulCommand
All Known Implementing Classes:
AbstractTransform, ExtrudeCmd, OrbitCmd, PrismCmd, QuickTranslateCmd, RotateSelection, ScaleSelection, TranslateSelection

public interface StatefulCommand<T> extends SemiStatefulCommand
A command that can be in one of two states: running or not running. When a stateful command is running, it takes over the input stream and waits for a specific event to occur. This event can be either the 'Enter' key being pressed, which confirms the command and executes its 'onEnter' method, or the 'Escape' key being pressed, which cancels the command and executes its 'onEsc' method.
Author:
Lehlogonolo Poole
See Also:
  • Method Details

    • onStart

      void onStart(T object, SafeJLabel label)
      Called when the command is first started.
      Parameters:
      object - The object that the command operates on.
      label - The SafeJLabel instance.
    • onEnter

      default void onEnter(T object, SafeJLabel label)
      Called when the 'Enter' key is pressed.
      Parameters:
      object - The object that the command operates on.
      label - The SafeJLabel instance.
    • onEsc

      default void onEsc(T object, SafeJLabel label)
      Called when the 'Escape' key is pressed.
      Parameters:
      object - The object that the command operates on.
      label - The SafeJLabel instance.
    • run

      default void run(StatefulCommand<?> t, String name, T object, SafeJLabel label)
    • run

      default void run(StatefulCommand<?> t, String name, T object, SafeJLabel label, String s)
      Runs the stateful command.
      Parameters:
      t - The stateful command that is running.
      name - The name of the command.
      object - The object that the command should operates on.