Class SimpleCommand<T>

java.lang.Object
javafx.scene.input.CommandBase<T>
javafx.scene.input.SimpleCommand<T>
All Implemented Interfaces:
Command<T>

public class SimpleCommand<T>
extends CommandBase<T>
A command implementation that synchronously invokes a user-specified method.
  • Constructor Details

    • SimpleCommand

      public SimpleCommand​(Runnable executeMethod)
      Initializes a new instance of the SimpleCommand class.
      Parameters:
      executeMethod - a parameterless operation
    • SimpleCommand

      public SimpleCommand​(Consumer<T> executeMethod)
      Initializes a new instance of the SimpleCommand class.
      Parameters:
      executeMethod - a parameterized operation
    • SimpleCommand

      public SimpleCommand​(Runnable executeMethod, Consumer<Throwable> exceptionHandler)
      Initializes a new instance of the SimpleCommand class.
      Parameters:
      executeMethod - a parameterless operation
      exceptionHandler - handler for exceptions thrown by the operation; if none is provided, exceptions will be thrown on the calling thread
    • SimpleCommand

      public SimpleCommand​(Consumer<T> executeMethod, Consumer<Throwable> exceptionHandler)
      Initializes a new instance of the SimpleCommand class.
      Parameters:
      executeMethod - a parameterized operation
      exceptionHandler - handler for exceptions thrown by the operation; if none is provided, exceptions will be thrown on the calling thread
    • SimpleCommand

      public SimpleCommand​(Runnable executeMethod, ObservableValue<Boolean> condition)
      Initializes a new instance of the SimpleCommand class.
      Parameters:
      executeMethod - a parameterless operation
      condition - a value that controls the executability of the command
    • SimpleCommand

      public SimpleCommand​(Consumer<T> executeMethod, ObservableValue<Boolean> condition)
      Initializes a new instance of the SimpleCommand class.
      Parameters:
      executeMethod - a Runnable that represents a parameterized operation
      condition - a value that controls the executability of the command
    • SimpleCommand

      public SimpleCommand​(Runnable executeMethod, ObservableValue<Boolean> condition, Consumer<Throwable> exceptionHandler)
      Initializes a new instance of the SimpleCommand class.
      Parameters:
      executeMethod - a parameterless operation
      condition - a value that controls the executability of the command
      exceptionHandler - handler for exceptions thrown by the operation; if none is provided, exceptions will be thrown on the calling thread
    • SimpleCommand

      public SimpleCommand​(Consumer<T> executeMethod, ObservableValue<Boolean> condition, Consumer<Throwable> exceptionHandler)
      Initializes a new instance of the SimpleCommand class.
      Parameters:
      executeMethod - a parameterized operation
      condition - a value that controls the executability of the command
      exceptionHandler - handler for exceptions thrown by the operation; if none is provided, exceptions will be thrown on the calling thread
  • Method Details

    • execute

      public void execute​(T parameter)
      Description copied from interface: Command
      Executes the command.
      Parameters:
      parameter - the parameter that is passed to the command implementation