skip to main content
Programmer's documentation > Developing with the JViews Gantt SDK > Critical path analysis > Example
 
Example
A basic sample Java™ application, CriticalPathExample.java, illustrates the critical path capabilities of the Rogue Wave® JViews Gantt. Open the sample index file found at:
<installdir>/jviews-gantt/samples/criticalPath.
The instructions in index.html explain how to run the Critical Path example. The source code of this example can be found in:
<installdir>/jviews-gantt/samples/criticalPath/src/criticalPath.
To analyze the critical path:
1. Create an IlvGanttModelScheduler that will automatically analyze the critical path of a Gantt data model as its activities change:
IlvGanttModel model = ...
IlvGanttModelScheduler scheduler = new IlvGanttModelScheduler(ganttModel);
scheduler.setAutoScheduling(true);
2. Use an IlvGanttModelSchedule to manually analyze the critical path of a Gantt data model in the following way:
IlvGanttModel model = ...
IlvGanttModelScheduler scheduler = new IlvGanttModelScheduler(ganttModel);
scheduler.schedule();
3. It is also possible to use an IlvCriticalPathCalculator instance to manually analyze the critical path:
IlvGanttModel model = ...
IlvCriticalPathCalculator calc = new IlvCriticalPathCalculator(ganttModel);
try {
  calc.computeSchedule();
} catch (IlvConstraintCycleException ex)
}

Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.