public class IlvGrapherPinRenderer extends IlvFilterSDMRenderer
IlvGrapherPinRenderer
is a filtering renderer
that lets you define the positions of the connection points
between the links and the nodes of the graph.
To define connection points on a node, you must set a series of
indexed properties of the form GrapherPin[
index]
in the SDM style sheet; for example:
node.split { GrapherPin[0] : "Top"; GrapherPin[1] : "Left"; GrapherPin[2] : "Right"; }This example rule says that a node of tag
"split"
has three connection points: one at the top of the node's bounding rectangle,
one on the left, and another one on the right.
You can define as many connection points as you want for a node. The indices of the connection points must form a series without "gaps", for example: 0, 1, 2, but not 0, 1, 3. A connection point can be defined in two ways:
"Top"
, "Bottom"
,
"Left"
, "Right"
, "TopLeft"
, "TopRight"
,
"BottomLeft"
, "BottomRight"
) or "Center"
), or
"
xoffset,
yoffset"
, where
the offsets are floating point numbers between -1.0
and 1.0
.
-1.0
corresponds to the left or the top of the node's
bounding rectangle.
1.0
corresponds to the right or the bottom of the node's
bounding rectangle.
0.0
corresponds to the center of the node's
bounding rectangle.
"0,-1"
is the same as "Top"
.
"-1,0"
is the same as "Left"
.
"1,1"
is the same as "BottomRight"
,
"0,0"
is the same as "Center"
,
To specify which point a link must be connected to, you can set
the FromPin
or ToPin
properties.
For example, to connect all links of tag transition
from
the right of their source nodes to the top of their destination nodes, you would write:
link.transition { FromPin : "2"; ToPin : "0"; }The values
"0"
and "2"
refer to the indices
of the connection points defined for the node.
The GrapherPin renderer supports the interactive editing of link connections.
When you create a link using the IlvMakeSDMLinkInteractor
,
the grapher pins appear as small circles. The link will be connected automatically
to the grapher pin that is nearest to the point where you clicked or released the
mouse. Similarly, the connection points will be taken into account when you reconnect
an existing link using the IlvSDMLinkReconnector
.
Note, though, that to enable the interactive edition of link connections, and to have this
information saved to the data model and restored correctly, you must configure the
SDM style sheet so that the FromPin
and ToPin
are passed
through from the data model to the renderer. If you do not set any FromPin
or ToPin
property, this will be done automatically. If you set these
properties explicitly, though, as in the example above, your explicit settings will
override the values saved in the data model.
You can force the link connection information to be passed through by adding a rule like the following:
link.transition { FromPin : "@sdm:FromPin"; ToPin : "@sdm:ToPin"; }
IlvPinLinkConnector
,
IlvGrapherPin
,
Serialized FormModifier and Type | Class and Description |
---|---|
static class |
IlvGrapherPinRenderer.SDMGrapherPin
The class
SDMGrapherPin implements the
grapher pins used by the IlvGrapherPinRenderer . |
static class |
IlvGrapherPinRenderer.SDMPinLinkConnector
The class
SDMPinLinkConnector implements the
link connector used by the IlvGrapherPinRenderer . |
_renderer
PSEUDOCLASS_PREFIX
Constructor and Description |
---|
IlvGrapherPinRenderer()
Creates a new grapher pin renderer.
|
Modifier and Type | Method and Description |
---|---|
void |
linkGraphicAdded(IlvSDMEngine engine,
Object link,
IlvGraphic graphic,
boolean redraw)
Connects the new link to the grapher pins specified in the SDM style sheet.
|
void |
nodeGraphicAdded(IlvSDMEngine engine,
Object node,
IlvGraphic graphic,
boolean redraw)
Creates the grapher pins for the new node.
|
void |
propertiesChanged(IlvSDMEngine engine,
Object object,
Collection<String> propertyNames,
IlvGraphic graphic)
Updates the link connections when the grapher pins have been modified
in the data model.
|
void |
renderingDone(IlvSDMEngine engine)
Attaches the link connectors to the grapher nodes.
|
addLinkGraphic, addNodeGraphic, computeBBox, createLinkGraphic, createNodeGraphic, customize, getEncapsulatedGraphic, getFilteredRenderer, getGraphicProperty, getLinkConnectionRectangle, moveResizeNodeGraphic, nodeGraphicBBoxChanged, prepareRendering, processServerAction, removeAll, removeLinkGraphic, removeNodeGraphic, setFilteredRenderer, updateObjectProperties
addViewListeners, callMoveResizeNodeGraphic, convert, convert, getAlias, getAuxiliaryBean, getAuxiliaryBeans, getEngine, getLinkConnectionRectangle, getLocation, getParameter, needsViewListeners, propertyChanged, removeViewListeners, setAlias, setEngine, setLayerName, setParameter
public IlvGrapherPinRenderer()
public void nodeGraphicAdded(IlvSDMEngine engine, Object node, IlvGraphic graphic, boolean redraw)
nodeGraphicAdded
in class IlvFilterSDMRenderer
engine
- The SDM engine associated with the grapher in which
the graphic object has been added.node
- The object that is being translated into an IlvGraphic
.graphic
- The graphic object that has just been added to the grapher.redraw
- If true
, the region covered by the new
graphic object must be redrawn.IlvSDMRenderer.addNodeGraphic(ilog.views.sdm.IlvSDMEngine, java.lang.Object, ilog.views.IlvGraphic, boolean)
public void linkGraphicAdded(IlvSDMEngine engine, Object link, IlvGraphic graphic, boolean redraw)
linkGraphicAdded
in class IlvFilterSDMRenderer
engine
- The SDM engine associated with the grapher in which
the graphic object has been added.link
- The object that is being translated into an IlvGraphic
.graphic
- The graphic object that has just been added to the grapher.redraw
- If true
, the region covered by the new
graphic object must be redrawn.IlvSDMRenderer.addLinkGraphic(ilog.views.sdm.IlvSDMEngine, java.lang.Object, ilog.views.IlvGraphic, boolean)
public void propertiesChanged(IlvSDMEngine engine, Object object, Collection<String> propertyNames, IlvGraphic graphic)
propertiesChanged
in class IlvFilterSDMRenderer
engine
- The SDM engine associated with the grapher in
which the graphic object is displayed.object
- The data object whose property has changed.propertyNames
- The names of the properties that have been modified.graphic
- The graphic object associated with object
.public void renderingDone(IlvSDMEngine engine)
renderingDone
in class IlvFilterSDMRenderer
engine
- The SDM engine.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.