Creating a basic application from JViews Gantt beans
The basic steps for creating an application that will use a Gantt or Schedule chart are:
1. Create your GUI with various Swing components, such as a working area, a menu bar and a toolbar.
public class SimpleGantt extends JPanel
{
public IlvHierarchyChart chart;
public SimpleGantt(JFrame frame) {
super();
// Prepare the JPanel's appearance
setLayout(new BorderLayout());
2. Create an instance of a Gantt or Schedule chart in the Java® API.
IlvGanttChart chart = new IlvGanttChart();
3. Connect the instance to a data model or load a project file that has been created and saved in the Designer.
// Bind the Gantt Chart to the Data Model
IlvGanttModel model = new IlvDefaultGanttModel();
chart.setGanttModel(model);
or
// Apply the project file to the chart
chart.setProject(project);
<installdir>/jviews-gantt/bin/designer/data/examples
NOTE After creating a project using the Designer for
JViews Gantt with a JDBC data source, the test/preview mode does not allow editing of the activities. The same project is not editable in a running application either. This happens when you use
IlvGanttJDBCDataSource, which will result in a read-only model.
Instead of loading a project file, you can load a custom data model and then load a style sheet (.css file) defined in the Designer. See
Integrating a style sheet into an application. In this case, you use only the styling developed with the Designer and not the whole project.
Refer to the samples in
<installdir>/jviews-gantt/samples provided with Rogue Wave
JViews Gantt for examples of how to create applications that use Gantt or Schedule charts.
The example
<installdir>/jviews-gantt/codefragments/application/simpleGantt/src/SimpleGantt.java shows a Swing application with a basic Gantt chart. This Swing application extends
JPanel. It is located in:
<installdir>/jviews-gantt/codefragments/application/simpleGantt
See
Gantt charts in
Developing with the SDK for how to create a Gantt chart and customize it with the SDK instead of the Designer.
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.