|| | |||Browse by category|
What is the best way to enforce the logic implied by Gantt Chart constraints?
When a constraint is in place, many users want to "enforce" the logic they imply. For example, if there is an end-to-start constraint between two activities and the user moves the end of the from-activity past the beginning of the to-activity, the to-activity should move to the right.
The best way to do this is in the constraint itself. The attached code defines an enforced end-to-start constraint and factory. You use the new constraint by calling
setConstraintFactory(new IlvEnd2StartFactory()) on the Gantt chart.
The constraint class implements
ActivityListener, so that it can react to changes in activities in the Gantt data model. The attached code is designed to be reused quite easily. It defines a generic abstract class called
IlvEnforcedConstraint. You can extend this to define types of constraint other than the one provided (end-to-start).
The complete source is provided in this file: enforcedconstraint.zip.
Download and extract the file. Then read the html file it contains,
Note: A basic form of Critical Path Analysis has been introduced starting from JViews Gantt 7.5. This reschedules all activities in the Gantt data model to occur as soon as possible after the project start time, while taking into account constraints between activities. This feature can either be performed manually upon request (see
IlvCriticalPathCalculator) or automatically as the activities in the schedule change (see
For more information about this feature, refer to the following section: Developing with the SDK > Critical Path Analysis
The associated sample can be found from the Samples section of the documentation and is located here: