com.dlsc.flexgantt.command.layer
Class DefaultChangeTimelineObjectTimeSpanCommand

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

public class DefaultChangeTimelineObjectTimeSpanCommand
extends AbstractCommand

A command that will change the time span of a timeline object. The command is only suitable in situations where the model is an instance of DefaultGanttChartModel and the object implements the ITimelineObject interface.

Since:
1.0
Author:
Dirk Lemmermann
See Also:
IEditTimelineObjectPolicy, IEditTimelineObjectPolicy.getChangeTimeSpanCommand(Object, Object, com.dlsc.flexgantt.model.gantt.IGanttChartModel, ILayer, ITimeSpan, int), ITimelineObject.setTimeSpan(ITimeSpan), DefaultGanttChartModel.setTimeSpan(ITimelineObject, ITimeSpan), Serialized Form

Constructor Summary
DefaultChangeTimelineObjectTimeSpanCommand(DefaultGanttChartNode node, ILayer layer, ITimelineObject object, DefaultGanttChartModel model, ITimeSpan span, int dropAction)
          Constructs a new command.
 
Method Summary
 void executeCommand(IProgressMonitor monitor)
          Executes the command.
 int getDropAction()
          Returns the type of drop that was used by the user to change the time span.
 ILayer getLayer()
          Returns the layer where the timeline object is located.
 DefaultGanttChartModel getModel()
          Returns the model to which the timeline object belongs.
 ITimeSpan getNewTimeSpan()
          Returns the time span that will be / was assigned to the timeline object by the command.
 DefaultGanttChartNode getNode()
          Returns the tree node to which the timeline object belongs.
 ITimeSpan getOldTimeSpan()
          Returns the time span that was assigned to the timeline object before the command was executed.
 ITimelineObject getTimelineObject()
          Returns the timeline object that was modified by the command.
 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

DefaultChangeTimelineObjectTimeSpanCommand

public DefaultChangeTimelineObjectTimeSpanCommand(DefaultGanttChartNode node,
                                                  ILayer layer,
                                                  ITimelineObject object,
                                                  DefaultGanttChartModel model,
                                                  ITimeSpan span,
                                                  int dropAction)
Constructs a new command.

Parameters:
node - the hierarchy / tree node on which the timeline object is located
layer - the layer where the timeline object gets displayed
object - the timeline object that will be modified by the command
model - the model from which the timeline object originated
span - the new time span that will be assgined to the timeline object
dropAction - the type of drop performed by the user (possible values are defined in DnDConstants)
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 DefaultGanttChartModel getModel()
Returns the model to which the timeline object belongs.

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

getNewTimeSpan

public ITimeSpan getNewTimeSpan()
Returns the time span that will be / was assigned to the timeline object by the command.

Returns:
the new time span of the timeline object
Since:
1.0

getOldTimeSpan

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

Returns:
the old time span of the timeline object
Since:
1.0

getTimelineObject

public ITimelineObject getTimelineObject()
Returns the timeline object that was modified by the command.

Returns:
the modified timeline object
Since:
1.0

getLayer

public ILayer getLayer()
Returns the layer where the timeline object is located.

Returns:
the layer of the timeline object
Since:
1.0

getNode

public DefaultGanttChartNode getNode()
Returns the tree node to which the timeline object belongs.

Returns:
the tree node to which the timeline object belongs
Since:
1.0

getDropAction

public int getDropAction()
Returns the type of drop that was used by the user to change the time span. Possible values are listed in DnDConstants.

Returns:
the drop action (see DnDConstants)
Since:
1.0