com.dlsc.flexgantt.command.layer
Class DefaultChangeCapacityCommand

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

public class DefaultChangeCapacityCommand
extends AbstractCommand

A command that is used to change the capacity used value of a capacity object. The command can only be used for situations where the model is an instance of DefaultGanttChartModel and the timeline object implements the ICapacityObject interface.

Since:
1.0
Author:
Dirk Lemmermann
See Also:
ICapacityObject.setCapacityUsed(double), IEditCapacityObjectPolicy.isCapacityChangeable(Object, Object, com.dlsc.flexgantt.model.gantt.IGanttChartModel), IEditCapacityObjectPolicy.getChangeCapacityCommand(Object, Object, com.dlsc.flexgantt.model.gantt.IGanttChartModel, double), Serialized Form

Constructor Summary
DefaultChangeCapacityCommand(ICapacityObject object, DefaultGanttChartModel model, double capacity)
          Constructs a new command.
 
Method Summary
 void executeCommand(IProgressMonitor monitor)
          Executes the command.
 ICapacityObject getCapacityObject()
          Returns the capacity object that was / will be modified by the command.
 DefaultGanttChartModel getModel()
          Returns the model to which the capacity object belongs.
 double getNewCapacity()
          Returns the new capacity that will be / was assigned to the capacity object.
 double getOldCapacity()
          Returns the old capacity that was assigned to the capacity object.
 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

DefaultChangeCapacityCommand

public DefaultChangeCapacityCommand(ICapacityObject object,
                                    DefaultGanttChartModel model,
                                    double capacity)
Constructs a new command.

Parameters:
object - the capacity object that will be modified
model - the model to which the object belongs
capacity - the capacity that will be assigned to the 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

getCapacityObject

public ICapacityObject getCapacityObject()
Returns the capacity object that was / will be modified by the command.

Returns:
the modified capacity object
Since:
1.0

getModel

public DefaultGanttChartModel getModel()
Returns the model to which the capacity object belongs.

Returns:
the data source that returned the capacity object
Since:
1.0

getNewCapacity

public double getNewCapacity()
Returns the new capacity that will be / was assigned to the capacity object.

Returns:
the new capacity value
Since:
1.0

getOldCapacity

public double getOldCapacity()
Returns the old capacity that was assigned to the capacity object. Calling this method makes only sense after the command has been executed.

Returns:
the old capacity value
Since:
1.0