Perforce JViews TGO Sample: Network Component - Basic
Description
This sample shows how to use the basic features of the Perforce JViews TGO network component.
How to Use the Sample
When the select interactor is enabled, you can expand nodes that contain objects. The sample includes such a node: SubNetwork
. To expand the node, click the icon at the top right of the node. To collapse the expanded node, click the icon at the top right of the expanded node frame.
How to Run the Sample as an Application
This sample can
be run as an application.
The installation directory contains
an executable JAR file,
network-basic.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
- Initializing a JTGO application using a deployment descriptor
- Creating a network component
- Reading project information from an XML file containing CSS configuration and data source configuration
Detailed Description
This sample shows how to create a network component and use its basic features. The code of this sample can be found in the doSample
method. To create a network component, the sample includes the following steps:
- Initialize the application using the method ilog.tgo.IltSystem.Init. You can pass a deployment descriptor file to this method. This file contains information about global settings for the application.
In this sample, the descriptor is called deploy and contains directories to be added to the search path. These directories are necessary to locate:- the background file of the network and other bitmaps in the resources directory,
- the data source file and the network configuration files in the data directory.
- Create a network component.
The network component is of class ilog.cpl.IlpNetwork. - Load a project configuration (project) from an XML file.
The project configuration defines the component configuration files (CSS files) and the data source information. When the project file is set, the following steps are performed:- The configuration files are applied to the component.
- A data source is created according to the class specified in the project configuration. In this case, it creates a standard data source of class ilog.tgo.datasource.IltDefaultDataSource
- The data file network is read containing predefined JTGO classes (business objects).
- And finally the data source is attached to the network component.
- Buttons to add to the toolbar
For a list of available buttons, see the ilog.cpl.network.renderer.IlpToolBarRenderer class. - Default interactor to use
This should be the name of one of the buttons of the toolbar. - Background file to load
For a list of available background file types, see the ilog.cpl.network.renderer.IlpBackgroundsRenderer class. - Object representation properties
- Add the network to your Swing application.
IlpNetwork
is a SwingJComponent
, which means that it can be added to your application like any other Swing component.
Installation Directory
The Network Component - Basic sample is installed here.
Classes Involved
-
ilog.tgo.IltSystem
The class that initializes a JViews TGO application.
-
ilog.tgo.datasource.IltDefaultDataSource
The default data source implementation.
-
ilog.cpl.IlpNetwork
The network component.
-
ilog.cpl.model.IlpObject
The business object definition.
-
ilog.cpl.project.IlpTGOProject
The project definition.
-
ilog.cpl.network.renderer.IlpToolBarRenderer
This class gives control over the toolbar of a network component.
-
ilog.cpl.network.renderer.IlpBackgroundsRenderer
This class gives control over the backgrounds of a network component.
Source Files
-
basic.Main
The entry point of the sample.
-
basic.AlarmPopupMenuFactory
The factory that creates the pop-up menu in the objects.
-
basic.ShowDetailsAction
The action that displays details about objects upon a double-click.