com.dlsc.flexgantt.policy.layer
Class DefaultEditTimelineObjectPolicy

java.lang.Object
  extended by com.dlsc.flexgantt.policy.AbstractPolicy
      extended by com.dlsc.flexgantt.policy.layer.DefaultEditTimelineObjectPolicy
All Implemented Interfaces:
IPolicy, IEditTimelineObjectPolicy

public class DefaultEditTimelineObjectPolicy
extends AbstractPolicy
implements IEditTimelineObjectPolicy

The default implmementation of the edit policy for timeline objects. For a general description of this policy please refer to the policy interface IEditTimelineObjectPolicy.

Since:
1.0
Author:
Dirk Lemmermann

Constructor Summary
DefaultEditTimelineObjectPolicy()
           
 
Method Summary
 ICommand getChangeTimeSpanCommand(java.lang.Object node, java.lang.Object timelineObject, IGanttChartModel model, ILayer layer, ITimeSpan span, int dropAction)
          Returns a command object that will perform the actual change of the timeline object's time span.
 ICommand getCreateCommand(java.lang.Object node, IGanttChartModel model, ILayer layer, ITimeSpan span, int lineIndex)
          Returns a command object that will perform the creation of a new timeline object.
 ICommand getDeleteCommand(java.lang.Object node, ILayer layer, java.lang.Object timelineObject, IGanttChartModel model)
          Returns a command object that will perform the deletion of the timeline object.
 boolean isCreatable(java.lang.Object node, IGanttChartModel model, ITimeSpan span)
          Decides whether the timeline object may be deleted.
 boolean isDeletable(java.lang.Object node, java.lang.Object timelineObject, IGanttChartModel model)
          Decides whether the timeline object may be deleted.
 boolean isDurationChangeable(java.lang.Object node, java.lang.Object timelineObject, IGanttChartModel model)
          Decides whether the duration of a timeline object may be edited / changed.
 boolean isInPlaceEditable(java.lang.Object node, java.lang.Object timelineObject, IGanttChartModel model)
          Decides whether a timeline object can be edited with an editor where the editor is usually an instance of ITimelineObjectEditor.
 boolean isStartTimeChangeable(java.lang.Object node, java.lang.Object timelineObject, IGanttChartModel model)
          Decides whether the start time of a timeline object may be edited / changed.
 
Methods inherited from class com.dlsc.flexgantt.policy.AbstractPolicy
assertClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultEditTimelineObjectPolicy

public DefaultEditTimelineObjectPolicy()
Method Detail

isInPlaceEditable

public boolean isInPlaceEditable(java.lang.Object node,
                                 java.lang.Object timelineObject,
                                 IGanttChartModel model)
Description copied from interface: IEditTimelineObjectPolicy
Decides whether a timeline object can be edited with an editor where the editor is usually an instance of ITimelineObjectEditor.

Specified by:
isInPlaceEditable in interface IEditTimelineObjectPolicy
Parameters:
node - the tree node that owns the timeline object
timelineObject - the timeline object that gets checked for its editing ability
model - the data source of the tree node and the timeline object
Returns:
TRUE if the timeline object may be edited by the user

isStartTimeChangeable

public boolean isStartTimeChangeable(java.lang.Object node,
                                     java.lang.Object timelineObject,
                                     IGanttChartModel model)
Description copied from interface: IEditTimelineObjectPolicy
Decides whether the start time of a timeline object may be edited / changed.

Specified by:
isStartTimeChangeable in interface IEditTimelineObjectPolicy
Parameters:
node - the tree node that owns the timeline object
timelineObject - the timeline object that gets checked for its time span editing ability
model - the data source of the tree node and the timeline object
Returns:
TRUE if the start time of the timeline object may be edited

isDurationChangeable

public boolean isDurationChangeable(java.lang.Object node,
                                    java.lang.Object timelineObject,
                                    IGanttChartModel model)
Description copied from interface: IEditTimelineObjectPolicy
Decides whether the duration of a timeline object may be edited / changed.

Specified by:
isDurationChangeable in interface IEditTimelineObjectPolicy
Parameters:
node - the tree node that owns the timeline object
timelineObject - the timeline object that gets checked for its time span editing ability
model - the data source of the tree node and the timeline object
Returns:
TRUE if the duration of the timeline object may be edited

isCreatable

public boolean isCreatable(java.lang.Object node,
                           IGanttChartModel model,
                           ITimeSpan span)
Description copied from interface: IEditTimelineObjectPolicy
Decides whether the timeline object may be deleted.

Specified by:
isCreatable in interface IEditTimelineObjectPolicy
Parameters:
node - the tree node that will own the new timeline object
model - the data source of the timeline object
span - the time span where the new timeline object shall be created
Returns:
TRUE if the eventline object may be deleted

isDeletable

public boolean isDeletable(java.lang.Object node,
                           java.lang.Object timelineObject,
                           IGanttChartModel model)
Description copied from interface: IEditTimelineObjectPolicy
Decides whether the timeline object may be deleted.

Specified by:
isDeletable in interface IEditTimelineObjectPolicy
Parameters:
node - the tree node that owns the timeline object
timelineObject - the eventline object that gets checked
model - the data source of the timeline object
Returns:
TRUE if the eventline object may be deleted

getChangeTimeSpanCommand

public ICommand getChangeTimeSpanCommand(java.lang.Object node,
                                         java.lang.Object timelineObject,
                                         IGanttChartModel model,
                                         ILayer layer,
                                         ITimeSpan span,
                                         int dropAction)
Description copied from interface: IEditTimelineObjectPolicy
Returns a command object that will perform the actual change of the timeline object's time span.

Specified by:
getChangeTimeSpanCommand in interface IEditTimelineObjectPolicy
Parameters:
node - the tree node that owns the timeline object
timelineObject - the timeline object that receives a new time span
model - the data source of the tree node and the timeline object
layer - the layer on which the timeline object is located
span - the new time span for the timeline object
dropAction - the type of drag that was executed by the user (COPY or MOVE, the possible values are listed in DnDConstants).
Returns:
a command that will modify the timeline object's time span

getCreateCommand

public ICommand getCreateCommand(java.lang.Object node,
                                 IGanttChartModel model,
                                 ILayer layer,
                                 ITimeSpan span,
                                 int lineIndex)
Description copied from interface: IEditTimelineObjectPolicy
Returns a command object that will perform the creation of a new timeline object.

Specified by:
getCreateCommand in interface IEditTimelineObjectPolicy
Parameters:
node - the tree node that will own the new timeline object
model - the data source of the tree node
layer - the layer to which the newly created timeline object will be added
span - the time span where the new timeline object will be placed
lineIndex - the index of the line (see ILinePolicy) where the new timeline object gets created (-1 if no specific inner line is used)
Returns:
a command that will modify the timeline object's time span

getDeleteCommand

public ICommand getDeleteCommand(java.lang.Object node,
                                 ILayer layer,
                                 java.lang.Object timelineObject,
                                 IGanttChartModel model)
Description copied from interface: IEditTimelineObjectPolicy
Returns a command object that will perform the deletion of the timeline object.

Specified by:
getDeleteCommand in interface IEditTimelineObjectPolicy
Parameters:
node - the tree node that owns the timeline object
layer - the layer on which the timeline object is displayed
timelineObject - the timeline object that gets deleted
model - the data source of the tree node and the timeline object
Returns:
a command that will modify the timeline object's time span