Perforce JViews Framework Code Example: Show-hide Grapher Branches
Description
This simple sample shows
how to show or hide a grapher branch.
A grapher (an instance of IlvGrapher
) is
a data structure used to display any type of network.
How to Use the Code Example
-
The GUI elements at the top left of the application are used for the following:
- Create a polyline link.
-
Start level:
Specify the number of levels away from the starting node at which
the nodes of the branch can be affected by the show and hide settings.
This effect is visible the next time you click the show or hide icons of the nodes. -
End level:
Specify the number of levels away from the starting node at which the
nodes of the branch are not affected by the show or hide settings.
A value of -1 causes the end level to be ignored, and the entire branch can be made visible or invisible. Otherwise, the nodes affected by the show-and-hide branch operation are the nodes with levels between the start and end levels (exclusive of the end level). The effect is visible the next time you click on the show or hide icons of the nodes. - Nested graph: a check box to show a nested graph when selected or a flat graph when cleared.
-
The combination box specifies how the branch is calculated for the
nested graph:
- Normal links: From the starting node, only normal links, but no intergraph links, are traversed to calculate the branch to be shown or hidden. The branch always ends at the border of the subgrapher that contains the starting node.
- Explicit intergraph links: From the starting node, normal links and intergraph links are traversed to calculate the branch to be shown or hidden. When traversing a subgrapher, only the links directly connected to the subgrapher are considered, but not the tree external intergraph links that are connected to an inner node of the subgrapher.
- Implicit intergraph links: From the starting node, normal links and intergraph links are traversed to calculate the branch to be shown or hidden. When traversing a subgrapher, the tree external intergraph links that are connected to an inner node of the subgrapher are also considered.
- Implicit subgraphs: From the starting node, normal links and intergraph links are traversed to calculate the branch to be shown or hidden. When traversing an inner node of a subgrapher, the entire subgrapher is considered.
The effect is visible the next time you click on the show or hide icons of the nodes.
-
You can perform the following operations using the
IlvGrapher.setVisibleBranch
utility:- Hide the branch starting from the node by clicking the "o-" icon of a node.
- Show the branch starting from the node by clicking the "o+" icon of a node.
- Hide the branch arriving at the node by clicking the "d-" icon of a node.
- Show the branch arriving at the node by clicking the "d+" icon of a node.
How to Run the Code Example as an Application
This code example can
be run as an application.
The installation directory contains
an executable JAR file,
show-hide-grapher-branch.jar
,
that allows you to execute the code example 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 code example 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 code example and type:
ant run
Topics Covered
-
Using the
IlvGrapher.setVisibleBranch
utility.
Installation Directory
The Show-hide Grapher Branches code example is installed here.
Classes Involved
- ilog.views.IlvGrapher
- ilog.views.graphic.composite.IlvCompositeGraphic
- ilog.views.graphic.composite.IlvEventMap
- ilog.views.graphic.composite.objectinteractor.IlvCompositeInteractor
- ilog.views.accelerator.IlvIdentityAccelerator
- ilog.views.accelerator.IlvZoomOutAccelerator
- ilog.views.accelerator.IlvZoomInAccelerator
- ilog.views.accelerator.IlvFitToSizeAccelerator
- ilog.views.accelerator.IlvRotateAccelerator
- ilog.views.accelerator.IlvSelectAllAccelerator
- ilog.views.accelerator.IlvScrollUpAccelerator
- ilog.views.accelerator.IlvScrollDownAccelerator
- ilog.views.accelerator.IlvScrollRightAccelerator
- ilog.views.accelerator.IlvScrollLeftAccelerator
- ilog.views.accelerator.IlvDeleteSelectionAccelerator
- ilog.views.util.swing.IlvDecimalNumberField
- ilog.views.util.swing.IlvJComboBox