Perforce JViews Gantt Sample: Custom Resource Chart Connection
Description
This sample shows how to create a custom data model implementation that effeciently connects a resource-oriented Schedule chart to a custom data source. The custom data model implements load-on-demand.
How to Use the Sample
-
This sample is based on the Schedule Chart XML Data sample in the
<installdir>/samples/xmlSchedule
directory. In this sample, when you open an SDXL data file using the File/Open menu item, scheduling data is read into a standardIlvDefaultGanttModel
instance that is then encapsulated inside anGanttModelDBROWrapper
in order to simulate read-only back-end scheduling data. An instance of theDBROGanttModel
custom data model connects the back-end data to the chart. -
The
DBROGanttModel
is read-only. Resizing or moving reservations in the chart is disabled. -
The File menu contains the following two check boxes that
allow you to view the load-on-demand and caching behavior of the
DBROGanttModel
custom data model and its accesses to the underlyingGanttDBRO
back-end data:-
Display Database Queries: Enable this item to log
all accesses that the
DBROGanttModel
data model makes to the underlying back-end data. The log entries will appear in the system console in the following format:
[DB]
Qry child keys of activity:
[20,"Phase II Development"]
^
^
^
the message indicates an access to the back-end data the log message shows that the back-end data is being queried for the lookup keys of a parent activity's children the parent activity being queried has a back-end data look-up index of 20 and is named "Phase II Development" -
Display Data Model: The custom data model
instantiates and caches activities, resources, constraints, and
reservations upon demand.
Enable this item to log the instantiation of the data model entities
to the system console in the following format:
[Model]
Creating Activity-19
^
^
the message comes from the custom data model the log message shows that an instance of IlvActivity
is being created from the back-end data look-up key of 19
-
Display Database Queries: Enable this item to log
all accesses that the
How to Run the Sample as an Application
This sample can
be run as an application.
The installation directory contains
an executable JAR file,
db-schedule.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
-
Design of an efficient custom
IlvGanttModel
implementation that queries back-end scheduling data as information is needed for display.
Detailed Description
This sample shows how to efficiently connect a resource-oriented Schedule
Chart to read-only back-end scheduling data that is stored in tabular format.
GanttDBRO
defines the read-only interface to the back-end data.
For the purposes of this sample, the GanttModelDBROWrapper
class simulates the back-end scheduling data by encapsulating an existing
Gantt data model that has been parsed from an SDXL data file.
DBROGanttModel
is the custom data model implementation that
connects to the back-end data via the GanttDBRO
interface.
Installation Directory
The Custom Resource Chart Connection sample is installed here.
Classes Involved
Source Files
-
database.GanttDBRO
An interface that defines read-only access to back-end scheduling information.
-
database.GanttModelDBROWrapper
An implementation of the
GanttDBRO
interface that simulates back-end scheduling data. The scheduling data is created by encapsulating a standardIlvDefaultGanttModel
that has been populated from an SDXL data file. -
database.DBROGanttModel
A custom read-only
IlvGanttModel
implementation that connects to back-end scheduling data via theGanttDBRO
interface. The data model queries back-end data as it is needed for display. -
database.DBScheduleExample
The main class of the sample.
-
database.DBGanttActions
Swing Actions used in the menus and toolbar.