com.dlsc.flexgantt.command.eventline
Class DefaultChangeEventlineObjectTimeSpanCommand

java.lang.Object
  extended by com.dlsc.flexgantt.command.AbstractCommand
      extended by com.dlsc.flexgantt.command.eventline.DefaultChangeEventlineObjectTimeSpanCommand
All Implemented Interfaces:
ICommand, java.io.Serializable

public class DefaultChangeEventlineObjectTimeSpanCommand
extends AbstractCommand

A command that is used to change the time span of an eventline object. The command will perform the change via the eventline model and not directly on the eventline object. This way it ensures that the appropriate events will be thrown and the UI will be updated accordingly. This command can only be used in situations where the model is an instance of DefaultEventlineModel and the eventline object implements the IEventlineObject interface.

Since:
1.0
Author:
Dirk Lemmermann
See Also:
DefaultEventlineModel.setTimeSpan(IEventlineObject, ITimeSpan), IEventlineObject, IEditEventlineObjectPolicy.getChangeTimeSpanCommand(Object, com.dlsc.flexgantt.model.eventline.IEventlineModel, ITimeSpan), Serialized Form

Constructor Summary
DefaultChangeEventlineObjectTimeSpanCommand(IEventlineObject object, DefaultEventlineModel model, ITimeSpan span)
          Constructs a new command.
 
Method Summary
 void executeCommand(IProgressMonitor monitor)
          Executes the command.
 ITimelineObject getEventlineObject()
          Returns the eventline object that received a new time span.
 DefaultEventlineModel getModel()
          Returns the eventline model to which the eventline object belongs.
 ITimeSpan getNewTimeSpan()
          Returns the new time span that was assigned to the eventline object through the command.
 ITimeSpan getOldTimeSpan()
          Returns the old time span that was assigned to the eventline object before the command was executed.
 void undoCommand(IProgressMonitor monitor)
          Undos the command.
 
Methods inherited from class com.dlsc.flexgantt.command.AbstractCommand
getName, isRedoable, isRelevant, isUndoable, redoCommand
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultChangeEventlineObjectTimeSpanCommand

public DefaultChangeEventlineObjectTimeSpanCommand(IEventlineObject object,
                                                   DefaultEventlineModel model,
                                                   ITimeSpan span)
Constructs a new command.

Parameters:
object - the eventline object that will be modified
model - the model to which the eventline object belongs
span - the new time span that will be assigned to the eventline object
Since:
1.0
Method Detail

executeCommand

public void executeCommand(IProgressMonitor monitor)
Description copied from interface: ICommand
Executes the command.

Parameters:
monitor - a progress monitor

undoCommand

public void undoCommand(IProgressMonitor monitor)
Description copied from interface: ICommand
Undos the command.

Parameters:
monitor - a progress monitor

getModel

public DefaultEventlineModel getModel()
Returns the eventline model to which the eventline object belongs. Changes to the eventline object will be done via this model.

Returns:
the eventline model to which the eventline object belongs
Since:
1.0

getNewTimeSpan

public ITimeSpan getNewTimeSpan()
Returns the new time span that was assigned to the eventline object through the command.

Returns:
the eventline object's new time span
Since:
1.0

getOldTimeSpan

public ITimeSpan getOldTimeSpan()
Returns the old time span that was assigned to the eventline object before the command was executed. Calling this method makes only sense after the command has been executed.

Returns:
the eventline object's old time span
Since:
1.0

getEventlineObject

public ITimelineObject getEventlineObject()
Returns the eventline object that received a new time span.

Returns:
the eventline object that was the target of the command
Since:
1.0