Perforce JViews TGO Sample: Network Component - Basic Editor
Description
This sample shows how to use the features of the Perforce JViews TGO to create a network component basic editor in a simple form with the basic editing functionality.
How to Use the Sample
Display
section provides functionality regarding the overall display of the network. It allows users:
Overview
of the network componentBookmarks
that may be part of the Map Theme that may have been imported with a given background. Such bookmarks are only available with background maps that are genereated from the JViews Maps Map BuilderSettings
section provides users with the ability to change the settings of some aspect of the network. It allows users to:
Properties
of the selected network object. These properties can be the name, the type, the ID, the function, the family... It also displays the business class that is used to represent the selected network objectBackground
configuration of the network component. It allows users to add, remove, order and view the absolute path of a given background. Additionally it allows users to save the backgorund configuration for later use.Coordinate Viewer
panel shows the coordinates of the where the mouse is at any given point. Its format changes based on the Coordinate Systems that is currently being used by the sample.
Important: The style sheets to be loaded should be targeted at styling the network objects. As opposed to a configurational style sheet for the network component itself. If you wish to change the configuration of the network component being edited, you need to directly edit the network configuration file located at configuration.network-configuration
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-editor.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
- Using JViews TGO projects files (*.itpr) to store JViews TGO configuration (data, configuration and styling)
- Adding and removing objects to a network component at runtime via point-and-click interactors
- Creating a Network Element Create toolbar button
- Editing and saving the background configuration of a network component
- Importing JViews Maps Map Builder generated backgrounds and the associated Map Theme to be used in the network component
- Grouping and Ungrouping functionality to create subnetworks on-the-fly
- Using JViews Maps beans (coordinate viewer, graphic scale, scale editor...) within JViews TGO
- Editing properties of network objects via a property editor
Detailed Description
This sample shows how to use the features of the Perforce JViews TGO to create a network component editor. The code of this sample can be found in the doSample
method. To initialize JViews TGO and create the User Interface, the following steps are taken:
- Initialize the JViews TGO (editor.Main.initTGO):
- Initialize the JViews TGO internal constructs using the method ilog.tgo.IltSystem.Init.
- Initialize the JViews TGO constructs need for this sample:
- Sets the network configuration to be used that contains the toobar and interactor settings for the network.
- Creates a JViews TGO project that is used when the sample first runs to allow users to start editing a network.
- Add a
NamedPropertyListener
to the underlyingIlvManager
, namely theMain.PositionConverterHandler
, which will ensure that we are using the properIlpGeographicPositionConverter
for when a given background is loaded. - Add a custom
IlvDataPathResolver
that knows how to find background files in a given directory. In the case of this sample thedata/backgrounds
directory, so that all backgrounds files located in this directory can be found by the sample. - Display the region of Europe as the startup view by using an
IlvAreaOfInterest
(view bookmark) that is part of the Map Theme in the ivl background file.
- Create an editor.action.ActionProvider which provides the actions for this sample (except group and ungroup which are part of the pop-up menu).
- Create the User Interface (editor.Main.initUI), which triggers the creation of all the panels that compose the User Interface.
The following are the main types in this sample:
editor.Main and the editor.Main.PositionConverterHandler which have been described above.
editor.action.ActionProvider which serves as a repository for the actions that are available in this sample. It has a set of predefined actions that are accessed by the sample's UI controls.
editor.action.MakeNetworkElementAction the AbstractAction
implementation that allows individuals to create Network Elements with the click of a button.
editor.action.MakeNetworkElementButton the IlpNetworkInteractorAction
implementation that allows AbstractActions
to be integrated as gestures in an IlpInteractor
.
editor.util.BaseDirectoryPathResolver an IlvDefaultDataPathResolver
customization that searches for all possible paths that can be built with a given file name, under a given base directory. It aids the JViews Maps in finding background files.
Installation Directory
The Network Component - Basic Editor sample is installed here.
Classes Involved
-
ilog.tgo.IltSystem
The class that initializes a JViews TGO application.
-
ilog.tgo.datasource.IltDefaultDataSource
The default datasource implementation.
-
ilog.cpl.IlpNetwork
The network component.
-
ilog.cpl.model.IlpObject
The business object definition.
-
ilog.cpl.project.IlpTGOProject
The project definition.
-
ilog.cpl.graph.background.beans.IlpBackgroundPanel
The background panel component.
-
ilog.cpl.datasource.structure.IlpContainer
The containment structural information.
-
ilog.cpl.interactor.IlpAbstractPopupMenuFactory
The factory to create pop-up menus.
-
ilog.cpl.network.IlpNetworkHandlerWithDataSource
The component to handle user interactions and foward them to the back-end objects.
-
ilog.cpl.util.selection.IlpObjectSelectionModel
The selection model interface.
-
ilog.cpl.interactor.IlpViewActionEvent
The view event.
-
ilog.cpl.graphic.views.IlpViewsViewInteractor
The view interactor for network component.
-
ilog.cpl.interactor.IlpGesture
The interactor gesture.
-
ilog.cpl.network.action.toolbar.IlpNetworkInteractorAction
The action for network view interactors.
-
ilog.views.maps.beans.IlvJAdvancedZoomControl
The view zoom control.
-
ilog.views.maps.beans.IlvJAreaOfInterestPanel
The panel to configure and view areas of interest.
-
ilog.views.maps.beans.IlvJAutomaticScaleBar
The scale bar component.
-
ilog.views.maps.beans.IlvJMapScaleControl
The map scale control.
-
ilog.views.maps.beans.IlvJMouseCoordinateViewer
The coordinate viewer.
-
ilog.views.maps.beans.IlvJOverview
The overview window.
-
ilog.views.swing.IlvThreadedActivityMonitor
The manager of threaded activities.
-
ilog.views.swing.IlvThreadedActivityMonitorPanel
The panel that displays progress of multiple threaded activities.
Source Files
-
editor.Main
The entry point of the sample.
-
editor.PopupMenuFactory
The factory that creates the pop-up menu in the objects.
-
editor.action.ActionProvider
The manager to actions that are added to the application menubar.
-
editor.action.MakeNetworkElementAction
The action that creates network element objects.
-
editor.action.MakeNetworkElementButton
The button that is added to the network component toolbar to create network element objects.
-
editor.util.BaseDirectoryPathResolver
The utility class to resolve paths that can be built with a given file, under a given base directory.