public class IlvSubGraphRenderer extends IlvFilterSDMRenderer
IlvSubGraphRenderer
is a
filtering renderer that displays subgraphs as special
nodes that can be expanded and collapsed.
This renderer is useful when the data model is hierarchical, that is, when some of its nodes contain subgraphs.
Each subgraph is initially displayed with a frame around it. The frame can be collapsed; it is then replaced with a single node (as defined in the style sheet), and the nodes and links of the subgraph become invisible. The collapsed node can be expanded to show the subgraph again.
To expand or collapse a subgraph node in a view, simply click the "expand" or "collapse" icon displayed in the upper-left corner of the subgraph node.
The subgraph renderer can be customized using the following rendering properties:
Expandable : "true"|"false";
InitiallyExpanded : "true"|"false";
FrameMargin : "<double>,<double>,<double>,<double>";
or
FrameMargin : "<double>";
FrameGraphic : "@#<graphic>"
IlvExpandedFrame
is used. You can also use an IlvDefaultManagerFrameGraphic
to get the default look of submanagers, with a title bar displayed at the top of
the submanager. For convenience, you can use the shortcut:
FrameGraphic : "default";which is equivalent to
FrameGraphic : "ilog.views.sdm.graphic.IlvDefaultManagerFrameGraphic";To get the effect of a
IlvConstantModeManagerFrame
you can use the shortcut:
FrameGraphic : "constantmode";which is equivalent to
node { FrameGraphic : "@+FrameGraphic"; DelegateToManagerFrame : "true"; } Subobject#FrameGraphic { class: "ilog.views.sdm.graphic.IlvDefaultManagerFrameGraphic"; managerFrame: "@+Frame"; } Subobject#Frame { class: "ilog.views.IlvConstantModeManagerFrame"; minimumMargin : "5"; }
PlusGraphic : "@#<graphic>"
MinusGraphic : "@#<graphic>"
PlusGraphicPosition : "<position>"
TopLeft
,
TopRight
,
BottomLeft
,
BottomRight
,
Top
,
Bottom
,
Left
,
Right
, and
Center
.
By default, the icon is in the top left corner.
MinusGraphicPosition : "<position>"
TopLeft
,
TopRight
,
BottomLeft
,
BottomRight
,
Top
,
Bottom
,
Left
,
Right
, and
Center
.
By default, the icon is in the top left corner.
PlusGraphicOffsetX : "<double>"
PlusGraphicOffsetY : "<double>"
MinusGraphicOffsetX : "<double>"
MinusGraphicOffsetY : "<double>"
DelegateToManagerFrame : "true"|"false";
IlvDefaultManagerFrameGraphic
encapsulating a manager frame. If the flag is true, it uses the
margin specification of the manager frame instead of the margin
specification specified by FrameMargin
. This is
in particular needed for IlvConstantModeManagerFrame
encapsulated inside IlvDefaultManagerFrameGraphic
.
Examples:
The following rule states that only those nodes whose type
property is equal to "compound"
are expandable.
node[type!="compound"] { Expandable : "false"; }
The following rules say the subgraphs should initially appear collapsed, and define a custom look for the expandable nodes: a different margin, a red rectangle for the frame, and icons instead of labels for the "expand" and "collapse" graphics.
node[type="compound"] { InitiallyExpanded : "false"; FrameMargin : "10"; FrameGraphic : "@#rectangle"; PlusGraphic : "@#plus"; MinusGraphic : "@#minus"; } Subobject#rectangle { class : "ilog.views.sdm.graphic.IlvGraphicFactories$Rectangle"; foreground : "green"; } Subobject#plus { class : "ilog.views.sdm.graphic.IlvGraphicFactories$Icon"; imageLocation : "plus.gif"; } Subobject#minus { class : "ilog.views.sdm.graphic.IlvGraphicFactories$Icon"; imageLocation : "minus.gif"; }
You can also customize the expandable nodes differently depending
on whether they are expanded or collapsed. To do this, you must use
the pseudoclasses "expanded"
and "collapsed"
.
For example, the following rules put different tooltips on the nodes depending on whether they are expanded or collapsed:
node:expanded { toolTipText : "Click on '-' to collapse"; } node:collapsed { toolTipText : "Click on '+' to expand"; }
Since JViews 5.5, the IlvSubGraphRenderer
class provides a new
"load on demand" mode, which lets you create the graphic objects inside a
subgraph only when the subgraph is first expanded. See the #setLoadOnDemand
method.
Note: The FrameGraphic, PlusGraphic, and MinusGraphic properties are not added in the manager.
Once created, each property change on a subgraph will customize the
grapher and the expanded frame (or collapsed node, according to the
subgraph expanded state).
This class is functionally equivalent to the
class IlvExpandCollapseRenderer
, but it uses the
subgraph functionalities available since Perforce JViews 5.0 to
implement the expandable nodes.
CSS example:
ilvSubGraphRenderer {
class : "ilog.views.sdm.renderer.IlvSubGraphRenderer";
alias : "<value>";
expandCollapseEnabled : "false";
frameZoomable : "false";
leafToContainerEnabled : "false";
loadOnDemand : "false";
parameter : "<value>";
savingExpandedState : "false";
subObjectsSelectionAllowed : "false";
updatingPositionsOnExpand : "false";
}
Modifier and Type | Property and Description |
---|---|
java.lang.String |
alias
Sets the alias of this renderer. |
java.lang.String |
class
Default constructor. |
boolean |
expandCollapseEnabled
Enables or disables the expand/collapse interaction on subgraphs. |
boolean |
frameZoomable
Specifies whether the frames and the expand/collapse icons drawn around subgraphs are zoomable or not. |
boolean |
leafToContainerEnabled
Controls whether leaves are automatically converted to container when a first new child is added. |
boolean |
loadOnDemand
Enables or disables load-on-demand. |
java.lang.String |
parameter
This method gives access to a privileged parameter of the renderer, and allows this parameter to be specified quickly in the main option rule of the style sheet. |
boolean |
savingExpandedState
Specifies whether or not the expanded state of a subgraph is saved to the data model. |
boolean |
subObjectsSelectionAllowed
Allows or forbids the selection of subobjects contained in an expanded node. |
boolean |
updatingPositionsOnExpand
Specifies whether or not the positions of subgraphs and their children must be updated when subgraphs are expanded or collapsed. |
public java.lang.String class
class : "ilog.views.sdm.renderer.IlvSubGraphRenderer";
public java.lang.String alias
SubGraph
or GraphLayout
.
alias : "<value>";
public boolean expandCollapseEnabled
expandCollapseEnabled : "false";
public boolean frameZoomable
frameZoomable : "false";
public boolean leafToContainerEnabled
leafToContainerEnabled : "false";
public boolean loadOnDemand
loadOnDemand : "false";
public java.lang.String parameter
For example, the main parameter of the
ilog.views.sdm.renderer.maps.IlvMapRenderer
is the name
of the map file. You can specify that you want to display a
map of the USA by the single declaration:
SDM { Map : "usa.ivl"; }
The default implementation does nothing. Subclasses should
override this method to give access to their main parameter.
CSS example:
parameter : "<value>";
public boolean savingExpandedState
"InitiallyExpanded"
.
So, for example, if the SDM style sheet contains a rule like the following:
node.process { Expandable : "true"; InitiallyExpanded : "@expanded"; }then, when a process node is expanded or collapsed, the
expanded
property of the node will be updated in the data model.
Note that if the InitiallyExpanded
property is set to a constant
value, for example:
InitiallyExpanded : "false";then the node will still be collapsed the next time the style sheet is applied, even though the data model has been updated.
savingExpandedState : "false";
public boolean subObjectsSelectionAllowed
subObjectsSelectionAllowed : "false";
public boolean updatingPositionsOnExpand
Normally, the position of a subgraph are consistent with the positions of its children. That is to say, the coordinates of the subgraph are such that the subgraph is initially centered with the bounding box of all its children. This ensures that the positions are always up to date when subgraphs are expanded or collapsed.
Normally, if you edit the data model using the built-in editing capabilities of the SDM engine (for example in the Workflow Modeler), this condition is always true.
If the data model is modified directly, though, this condition may not be true any more, and the positions of subgraphs and their children may be inconsistent. This may have unexpected side effects when the nodes are modified. A typical side effect is that subgraphs may be translated when you change one of their properties.
In that case, you can set this property to true
to have the
SDM engine update the positions on every expand or collapse operation.
The property is set to false
by default. Note that setting
the property to true
may slow down expand and collapse operations,
because of the additional update of the data model.
CSS example:
updatingPositionsOnExpand : "false";
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.