com.dlsc.flexgantt.policy.eventline
Class DefaultEditEventlineObjectPolicy

java.lang.Object
  extended by com.dlsc.flexgantt.policy.AbstractPolicy
      extended by com.dlsc.flexgantt.policy.eventline.DefaultEditEventlineObjectPolicy
All Implemented Interfaces:
IEditEventlineObjectPolicy, IPolicy

public class DefaultEditEventlineObjectPolicy
extends AbstractPolicy
implements IEditEventlineObjectPolicy

The default implementation of the IEditEventlineObjectPolicy works in combination with the DefaultEventlineModel and eventline objects that implement the IEventlineObject interface.

Since:
1.0
Author:
Dirk Lemmermann

Constructor Summary
DefaultEditEventlineObjectPolicy()
           
 
Method Summary
 ICommand getChangeTimeSpanCommand(java.lang.Object eventlineObject, IEventlineModel model, ITimeSpan span)
          Returns a command object that will perform the actual change of the eventline object's time span.
 ICommand getCreateCommand(IEventlineModel model, ITimeSpan span)
          Returns a command object that will perform the actual creating of a new eventline object.
 ICommand getDeleteCommand(java.lang.Object eventlineObject, IEventlineModel model)
          Returns a command object that will perform the actual deletion of the eventline object.
 boolean isCreatable(IEventlineModel model, ITimeSpan span)
          Decides whether an eventline object may be created for the given model and with the given time span.
 boolean isDeletable(java.lang.Object eventlineObject, IEventlineModel model)
          Decides whether the eventline object may be deleted.
 boolean isDurationChangeable(java.lang.Object eventlineObject, IEventlineModel model)
          Decides whether the duration of an eventline object may be edited / changed.
 boolean isStartTimeChangeable(java.lang.Object eventlineObject, IEventlineModel model)
          Decides whether the start time of an eventline 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

DefaultEditEventlineObjectPolicy

public DefaultEditEventlineObjectPolicy()
Method Detail

isStartTimeChangeable

public boolean isStartTimeChangeable(java.lang.Object eventlineObject,
                                     IEventlineModel model)
Description copied from interface: IEditEventlineObjectPolicy
Decides whether the start time of an eventline object may be edited / changed.

Specified by:
isStartTimeChangeable in interface IEditEventlineObjectPolicy
Parameters:
eventlineObject - the eventline object that gets checked for its time span editing ability
model - the data source of the eventline object
Returns:
TRUE if the start time of the eventline object may be edited

isDurationChangeable

public boolean isDurationChangeable(java.lang.Object eventlineObject,
                                    IEventlineModel model)
Description copied from interface: IEditEventlineObjectPolicy
Decides whether the duration of an eventline object may be edited / changed.

Specified by:
isDurationChangeable in interface IEditEventlineObjectPolicy
Parameters:
eventlineObject - the eventline object that gets checked for its time span editing ability
model - the data source of the eventline object
Returns:
TRUE if the duration of the eventline object may be edited

isDeletable

public boolean isDeletable(java.lang.Object eventlineObject,
                           IEventlineModel model)
Description copied from interface: IEditEventlineObjectPolicy
Decides whether the eventline object may be deleted.

Specified by:
isDeletable in interface IEditEventlineObjectPolicy
Parameters:
eventlineObject - the eventline object that gets checked
model - the data source of the eventline object
Returns:
TRUE if the eventline object may be deleted

isCreatable

public boolean isCreatable(IEventlineModel model,
                           ITimeSpan span)
Description copied from interface: IEditEventlineObjectPolicy
Decides whether an eventline object may be created for the given model and with the given time span.

Specified by:
isCreatable in interface IEditEventlineObjectPolicy
Parameters:
model - the model to which the newly created object will be added
span - the time span where the event object gets created
Returns:
TRUE if the eventline object may be deleted

getChangeTimeSpanCommand

public ICommand getChangeTimeSpanCommand(java.lang.Object eventlineObject,
                                         IEventlineModel model,
                                         ITimeSpan span)
Description copied from interface: IEditEventlineObjectPolicy
Returns a command object that will perform the actual change of the eventline object's time span.

Specified by:
getChangeTimeSpanCommand in interface IEditEventlineObjectPolicy
Parameters:
eventlineObject - the eventline object that gets checked for its editing ability
model - the data source of the eventline object
span - the new time span for the eventline object
Returns:
a command that will modify the eventline object's time span

getDeleteCommand

public ICommand getDeleteCommand(java.lang.Object eventlineObject,
                                 IEventlineModel model)
Description copied from interface: IEditEventlineObjectPolicy
Returns a command object that will perform the actual deletion of the eventline object.

Specified by:
getDeleteCommand in interface IEditEventlineObjectPolicy
Parameters:
eventlineObject - the eventline object that gets deleted
model - the data source of the eventline object
Returns:
a command that will delete the eventline object

getCreateCommand

public ICommand getCreateCommand(IEventlineModel model,
                                 ITimeSpan span)
Description copied from interface: IEditEventlineObjectPolicy
Returns a command object that will perform the actual creating of a new eventline object.

Specified by:
getCreateCommand in interface IEditEventlineObjectPolicy
Parameters:
model - the model to which the new object needs to be added
span - the time span for the new eventline object
Returns:
a command that will create a new eventline object