com.dlsc.flexgantt.command.layer

## Class DefaultChangeCapacityCommand

- java.lang.Object
- - com.dlsc.flexgantt.command.AbstractCommand
  - - com.dlsc.flexgantt.command.layer.DefaultChangeCapacityCommand

- All Implemented Interfaces:
    ICommand, 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
  Version:
    $Revision: 1.6 $
  Author:
    Dirk Lemmermann
  See Also:
    `ICapacityObject.setCapacityUsed(double)`, `IEditCapacityObjectPolicy.isCapacityChangeable(com.dlsc.flexgantt.model.gantt.TimelineObjectPath, com.dlsc.flexgantt.model.gantt.IGanttChartModel)`, `IEditCapacityObjectPolicy.getChangeCapacityCommand(com.dlsc.flexgantt.model.gantt.TimelineObjectPath, com.dlsc.flexgantt.model.gantt.IGanttChartModel, double)`, Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultChangeCapacityCommand(ICapacityObject object, DefaultGanttChartModel model, double capacity)` Constructs a new command.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `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, setName`

    - ### 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)
                              throws CommandException

      Description copied from interface: `ICommand`
      Executes the command.
      Parameters:
        `monitor` - a progress monitor
      Throws:
        `CommandException` - if anything during the execution of the command has gone wrong

    - #### undoCommand

          public void undoCommand(IProgressMonitor monitor)
                           throws CommandException

      Description copied from interface: `ICommand`
      Undos the command.
      Parameters:
        `monitor` - a progress monitor
      Throws:
        `CommandException` - if anything during the execution of the command has gone wrong

    - #### 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

Copyright © 2006–2020 Dirk Lemmermann Software & Consulting. All rights reserved.