Class AnonymousCommand

  • All Implemented Interfaces:
    Command

    public class AnonymousCommand
    extends CommandImpl
    An anonymous class that permits to create a command without defining a specific ActionImpl class. A runnable, corresponding to the body of the command has to be provided to the cmd.
    Author:
    Arnaud Blouin
    • Field Detail

      • cmdBody

        protected Runnable cmdBody
        The runnable executed when the command is executed.
    • Constructor Detail

      • AnonymousCommand

        public AnonymousCommand()
        Create the command.
    • Method Detail

      • doCmdBody

        protected void doCmdBody()
        Description copied from class: CommandImpl
        This method contains the statements to execute the command. This method is automatically called by DoIt and must not be called explicitly.
        Specified by:
        doCmdBody in class CommandImpl
      • canDo

        public boolean canDo()
        Description copied from interface: Command
        Checks whether the command can be executed.
        Specified by:
        canDo in interface Command
        Overrides:
        canDo in class CommandImpl
        Returns:
        True if the command can be executed.
      • setCmdBody

        public void setCmdBody​(Runnable body)
        Sets the runnable of the command.
        Parameters:
        body - The runnable executed when the command is executed.
      • getCmdBody

        public Runnable getCmdBody()
        Returns:
        The runnable of the command.