Interface ScheduleAware


  • public interface ScheduleAware

    Definition of an interface to be implemented by Command objects that are interested in the point of time they are passed to a CommandQueue .

    This interface is evaluated by implementations of the CommandQueue.execute(Command) method. If the Command object to be executed implements this interface, the onSchedule() method is invoked. Invocation of this method happens in the same thread that has called the execute() method. This is usually the event dispatch thread in typical GUI applications, when a user triggered an action, which causes the execution of a command.

    The idea behind this interface is that often some initialization has to be performed before the actual execution of a command in a background thread. An example of such an initialization is changing the status of UI controls affected by the current command. This has typically to be done in the event dispatch thread, immediately after the invocation of the action that caused the execution of this command. By implementing this interface this initialization logic can be placed in the Command implementation itself and need not to be implemented somewhere else.

    Version:
    $Id: ScheduleAware.java 205 2012-01-29 18:29:57Z oheger $
    Author:
    Oliver Heger
    • Method Detail

      • commandScheduled

        void commandScheduled​(CommandQueue queue)
        Notifies this object that it was passed to a CommandQueue for execution. This method is invoked by the CommandQueue.execute(Command) method (in the current thread).
        Parameters:
        queue - the CommandQueue to which this object was passed