Perforce JViews Gantt Sample: Resource Chart (SDK)
Description
This sample shows a simple project scheduling application displayed as a resource-oriented Schedule Chart.
How to Use the Sample
-
On the left, an
IlvJTable
object shows the resource properties. The first column of the table shows the hierarchy of the resources in the form of a tree. Click the expand/collapse icon to expand or collapse a resource with child nodes. The other columns in the table are used to show more properties of the resources. -
On the right, the Schedule chart uses an
IlvGanttSheet
to visualize the reservations. The rows in the Gantt sheet show the schedules of the resources displayed in the resource table. - At the top of the Gantt sheet, the time scale appears.
-
This sample has the following keyboard accelerators:
- Ctrl+Z : zoom
- Ctrl+U : unzoom
- Ctrl+F : fit to view
- Ctrl+Enter : toggle selected row expand/collapse
- Ctrl+2 : increase row height
- Ctrl+Shift+2 : decrease row height
- Arrow Keys : scroll
- Refer to the Detailed Description part for more information on the different actions you can perform.
How to Run the Sample as an Application
This sample can
be run as an application.
The installation directory contains
an executable JAR file,
schedule-chart.jar
,
that allows you to execute the sample with a double click from a
file browser. Note that if you are using Internet Explorer, you can
open the installation directory
and execute the JAR file from the browser. This
technique may not work in other Web browsers.
Alternatively, you
can run the sample application from the command line.
First check that the Ant utility is properly configured. If not, see the
instructions on how to configure Ant for Perforce JViews.
Then, go to the installation directory
of the sample and type:
ant run
Topics Covered
-
Creating an
IlvScheduleChart
object to display resources. - Creating a data model for the Schedule chart.
- Entering activities and resources in the data model, and attaching the data model to the Schedule chart.
- Interacting with the Schedule chart by using the installed menu, the toolbar, or the mouse.
Detailed Description
This sample shows a simple project scheduling application displayed as a resource-oriented Schedule Chart.
Selecting Resources and Reservations
Many operations on the Schedule Chart apply to resources and reservations selected by the user.
- To select a single reservation, click its graphic in the Gantt sheet.
- Select multiple reservations by either dragging a rectangle over the reservations or Shift-clicking the desired reservation.
- To select a resource, click its row in the resource table. You can change the selected resource using the arrow keys.
Editing Resource Properties with the Table
The resource table is fully editable. Change the properties of a resource by typing in the corresponding table cells.
Interacting with the Gantt Sheet
You can interact with the Gantt sheet in the following ways:
- You can select a reservation in the Gantt sheet simply by clicking on it.
- Select several reservations by either Shift-clicking multiple reservations or by dragging a selection rectangle over them.
- You can move the selected reservations by dragging them with the mouse.
- Change the begining or end date of a selected reservation by dragging the start or end of the reservation graphic.
- Once reservations are selected, you can duplicate them by pressing the Alt key and dragging the selected reservations.
Zooming and Scrolling in the Time Scale
You can zoom and scroll in the time scale:
- Drag the time scale to scroll to the left or to the right.
- Single-click and move the mouse to select a time span, then click to confirm the zoom or press the Esc key to cancel.
- Double-click to zoom on the time span where the mouse is located.
Scrolling in the Table
You can use the up and down arrow keys, or the page up and page down keys, to scroll up and down the table.
Editing Resources
Creating and Deleting Resources
To create a new resource:
- Select an existing resource to indicate where the resource should be created.
- Choose Insert resource from the Edit menu.
To delete an existing resource:
- Select the resource to be deleted.
- Choose Delete resource from the Edit menu.
Moving a Resource in the Table
To change the hierarchical position of a resource:
- Select the resource to be moved.
- ChooseIndent resource,Outdent resource, Move up, or Move down from the Edit menu.
Creating and Deleting Reservations
To create a reservation:
- Select Create reservation from the Edit menu.
- In the Gantt sheet, click on the row where the reservation should be created.
- Drag the mouse to create the reservation.
Changing the Property Displayed in the Reservation Graphics
In the Gantt sheet, reservation graphics show the positions of the reservations as time span rectangles. They can also show some properties of the displayed reservations.
The Field menu allows you to choose the property you want to display in the reservation graphics. To do so:
- Select a reservation.
- Choose the field you want displayed from the Field menu.
Changing the Row Height of the Schedule Chart
The Schedule chart consists of resource rows. The height of the rows can be changed. The Row menu lists a number of commands that allow you to increase or decrease the row height of the Schedule chart.
Changing the Activity Layout
A resource may have more than one reservation shown in the same row of the Gantt sheet. The relative vertical positions of the reservations are managed by the activity layout of the Schedule chart to avoid potential overlapping activities.
To choose from different activity layouts for the Schedule chart, use the commands in the Row menu.
Installation Directory
The Resource Chart (SDK) sample is installed here.
Classes Involved
- ilog.views.gantt.IlvScheduleChart
- ilog.views.gantt.IlvGanttModel
- ilog.views.gantt.graphic.interactor.IlvGanttSelectInteractor
- ilog.views.gantt.graphic.interactor.IlvMakeActivityInteractor
Source Files
-
scheduleChart.ScheduleExample
The Schedule chart sample.
-
shared.AbstractExample
The superclass of all Gantt chart samples.
-
shared.GanttCommand
Swing Actions used in the menus and toolbar.
-
shared.data.GeneralActivityFactory
The factory that creates numbered
IlvGeneralActivity
instances sequentially. -
shared.data.GeneralResourceFactory
The factory that creates numbered
IlvGeneralResource
instances sequentially. -
shared.data.SimpleActivityFactory
The superclass of
GeneralActivityFactory
that creates numberedIlvSimpleActivity
instances sequentially. -
shared.data.SimpleResourceFactory
The superclass of
GeneralResourceFactory
that creates numberedIlvSimpleResource
instances sequentially.