com.dlsc.flexgantt.policy.layer
Class DefaultRelationshipPolicy

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

public class DefaultRelationshipPolicy
extends AbstractPolicy
implements IRelationshipPolicy

The default implementation of the IRelationshipPolicy allows all timeline objects to be linked with each other and returns a DefaultCreateRelationshipCommand command object for performing the actual linking.

Since:
1.0
Author:
Dirk Lemmermann

Constructor Summary
DefaultRelationshipPolicy()
           
 
Method Summary
 ICommand getCreateRelationshipCommand(TimelineObjectPath sourcePath, TimelineObjectPath targetPath, IGanttChartModel model)
          Returns a command object that will perform the actual linking of the source and target timeline objects by making the appropriate changes in the model.
 boolean isRelationshipSource(TimelineObjectPath path, IGanttChartModel model)
          Determines whether the given timeline object can be used for creating a relationship to another object.
 boolean isRelationshipTarget(TimelineObjectPath sourcePath, TimelineObjectPath targetPath, IGanttChartModel model)
          Determines whether the given source timeline object can be linked to the given target timeline object.
 
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

DefaultRelationshipPolicy

public DefaultRelationshipPolicy()
Method Detail

getCreateRelationshipCommand

public ICommand getCreateRelationshipCommand(TimelineObjectPath sourcePath,
                                             TimelineObjectPath targetPath,
                                             IGanttChartModel model)
Description copied from interface: IRelationshipPolicy
Returns a command object that will perform the actual linking of the source and target timeline objects by making the appropriate changes in the model.

Specified by:
getCreateRelationshipCommand in interface IRelationshipPolicy
Parameters:
sourcePath - the path to the source timeline object
targetPath - the path to the target timeline object
model - the source model of the node and timeline object
Returns:
a command that will create a relationship between the timeline objects
See Also:
IRelationship, DefaultCreateRelationshipCommand

isRelationshipSource

public boolean isRelationshipSource(TimelineObjectPath path,
                                    IGanttChartModel model)
Description copied from interface: IRelationshipPolicy
Determines whether the given timeline object can be used for creating a relationship to another object.

Specified by:
isRelationshipSource in interface IRelationshipPolicy
Parameters:
path - the source timeline object path
model - the model of the node and timeline object
Returns:
TRUE if the given timeline object can be used for a relationship object
See Also:
IRelationshipPolicy.isRelationshipTarget(TimelineObjectPath, TimelineObjectPath, IGanttChartModel)

isRelationshipTarget

public boolean isRelationshipTarget(TimelineObjectPath sourcePath,
                                    TimelineObjectPath targetPath,
                                    IGanttChartModel model)
Description copied from interface: IRelationshipPolicy
Determines whether the given source timeline object can be linked to the given target timeline object.

Specified by:
isRelationshipTarget in interface IRelationshipPolicy
Parameters:
sourcePath - the source tree node
targetPath - the target tree node
model - the model of the nodes and timeline objects
Returns:
TRUE if the given source timeline object can be linked with the given target timeline object
See Also:
IRelationshipPolicy.isRelationshipSource(TimelineObjectPath, IGanttChartModel)