com.dlsc.flexgantt.command.layer
Class DefaultCreateTimelineObjectCommand

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

public class DefaultCreateTimelineObjectCommand
extends AbstractCommand

A command that creates a new timeline object.

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

Constructor Summary
DefaultCreateTimelineObjectCommand(DefaultGanttChartNode node, DefaultGanttChartModel model, ILayer layer, ITimeSpan timeSpan, int lineIndex)
          Constructs a new command.
 
Method Summary
protected  DefaultTimelineObject createTimelineObject()
          Creates the actual timeline object instance, which is of type DefaultTimelineObject.
 void executeCommand(IProgressMonitor monitor)
          Executes the command.
 ILayer getLayer()
          Returns the layer on which the timeline object will be displayed.
 int getLineIndex()
          Returns the line index used for placing the timeline object on an inner line.
 DefaultGanttChartModel getModel()
          Returns the model that will be modified by the command.
 DefaultTimelineObject getNewTimelineObject()
          Returns the newly created timeline object.
 DefaultGanttChartNode getNode()
          Returns the node for which the timeline object gets created.
 ITimeSpan getTimeSpan()
          Returns the time span where the newly created timeline object will be placed.
 void setLayer(ILayer layer)
          Sets the layer on which the timeline object will be displayed.
 void setModel(DefaultGanttChartModel model)
          Sets the model that gets modified by the command.
 void setNode(DefaultGanttChartNode node)
          Sets the node for which the timeline object gets created.
 void setTimeSpan(ITimeSpan span)
          Sets the time span where the newly created timeline object will be placed.
 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

DefaultCreateTimelineObjectCommand

public DefaultCreateTimelineObjectCommand(DefaultGanttChartNode node,
                                          DefaultGanttChartModel model,
                                          ILayer layer,
                                          ITimeSpan timeSpan,
                                          int lineIndex)
Constructs a new command.

Parameters:
node - the node to which the new timeline object will be added
model - the model that gets modified by the command
layer - the layer on which the new timeline object will be placed
timeSpan - the time span where the new timeline object will be located
lineIndex - the index of the inner line where the timeline object will be located
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

createTimelineObject

protected DefaultTimelineObject createTimelineObject()
Creates the actual timeline object instance, which is of type DefaultTimelineObject. Subclasses can override this method to create a timeline object of a different type. This method should only be called once during the executeCommand(IProgressMonitor) method invocation. After that only the created instance should be used.

Returns:
the new timeline object
Since:
1.0

getLayer

public ILayer getLayer()
Returns the layer on which the timeline object will be displayed.

Returns:
the layer on which the timeline object will be displayed
Since:
1.0

setLayer

public void setLayer(ILayer layer)
Sets the layer on which the timeline object will be displayed.

Parameters:
layer - the layer on which the timeline object will be displayed
Since:
1.0

getTimeSpan

public ITimeSpan getTimeSpan()
Returns the time span where the newly created timeline object will be placed.

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

setTimeSpan

public void setTimeSpan(ITimeSpan span)
Sets the time span where the newly created timeline object will be placed.

Parameters:
span - the time span of the new timeline object
Since:
1.0

getNode

public DefaultGanttChartNode getNode()
Returns the node for which the timeline object gets created.

Returns:
the node for which the timeline object gets created.
Since:
1.0

setNode

public void setNode(DefaultGanttChartNode node)
Sets the node for which the timeline object gets created.

Parameters:
node - the node for which the timeline object gets created
Since:
1.0

getModel

public DefaultGanttChartModel getModel()
Returns the model that will be modified by the command.

Returns:
the model that gets modified by the command
Since:
1.0

setModel

public void setModel(DefaultGanttChartModel model)
Sets the model that gets modified by the command.

Parameters:
model - the model that gets modified by the command
Since:
1.0

getNewTimelineObject

public DefaultTimelineObject getNewTimelineObject()
Returns the newly created timeline object. This method can only be invoked after the command has been executed.

Returns:
the new timeline object
Since:
1.0

getLineIndex

public int getLineIndex()
Returns the line index used for placing the timeline object on an inner line.

Returns:
the line index
Since:
1.0