public class IlvCompositeRenderer extends IlvInteractorRenderer
IlvCompositeRenderer
manages IlvSDMCompositeNode
and IlvSDMCompositeLink
.
In particular this renderer allows to :
LinkConnectionRectangle
This property is defined on the objects of type node.
IlvCompositeGraphic.getChildren(int)
The links will be connected to the nearest edge of the bounding box of the child
at the position defined by this property.
FromCompositePin
: Connects the origin of a link to a decoration.
ToCompositePin
: Connects the destination of a link to a decoration
FromCompositePinPosition
: Connects the origin to this position of the decoration
ToCompositePinPosition
: Connects the destination to this position of the decoration
Here is an example of using the rendering property LinkConnectionRectangle
SDM { Composite : true; } node { class : "ilog.views.graphic.composite.IlvCompositeGraphic" ; children[0]:@+base; children[1]:@+label; constraints[1]:@=attachmentLabel; LinkConnectionRectangle:0; } Subobject#base { class : ilog.views.sdm.graphic.IlvGraphicFactories$Rectangle; IlvRect : 0,0,40,40; } Subobject#attachmentLabel { class : "ilog.views.graphic.composite.layout.IlvAttachmentConstraint" ; hotSpot:TopCenter; anchor:BottomCenter; offset:0,3; } Subobject#label { class : ilog.views.sdm.graphic.IlvGraphicFactories$ZoomableLabel; IlvRect : 0,0,100,100; label:@label; foreground:black; name:"label"; }
This example shows how to build the following composite graphics
using the rendering properties From/ToCompositePin
, and From/ToCompositePinPosition
:
>
SDM { Composite: "true"; } node { class:"ilog.views.sdm.graphic.IlvSDMCompositeNode"; children[0]:@+rect; children[1]:@+decoration; constraints[1]:@=attachmentDecoration; } Subobject#rect { class : ilog.views.sdm.graphic.IlvGraphicFactories$Rectangle; IlvRect : 0,0,40,40; background:red; fillOn:true; } Subobject#decoration { class : ilog.views.sdm.graphic.IlvGraphicFactories$Rectangle; IlvRect : 0,0,5,5; background:yellow; fillOn:true; name:"decoration"; // We give a name to the graphic and use this name below } Subobject#attachmentDecoration { class : "ilog.views.graphic.composite.layout.IlvAttachmentConstraint" ; hotSpot:Center; anchor:RightCenter; offset : "20,20"; } link { class : ilog.views.sdm.graphic.IlvGeneralLink; arrowColor : '153,0,51'; arrowRatio : 4; lineStyle : 0; lineWidth : 1; endCap : CAP_BUT ; foreground : '153,0,51'; lineJoin : JOIN_ROUND; mode : MODE_UNICOLOR; oriented : true; NodeSideForOrigin : Bottom; NodeSideForDestination : Top; } link { FromCompositePin:"decoration"; // use the name defined above FromCompositePinPosition:"Center"; ToCompositePin:"decoration"; // use the name defined above ToCompositePinPosition:"Center"; }
IlvInteractorRenderer
,
IlvCompositeGraphic
,
IlvMouseGesture
,
IlvCompositeGraphic.setEventMap(ilog.views.graphic.composite.IlvEventMap)
,
IlvCompositeGraphic.getEventMap()
,
IlvStyleSheetRenderer.setLinkConnectorEnabled(boolean)
,
IlvStyleSheetRenderer.isLinkConnectorEnabled()
,
IlvStyleSheetRenderer.setAddingLinkConnectors(boolean)
,
IlvStyleSheetRenderer.isAddingLinkConnectors()
,
Serialized Form_interactor
_renderer
PSEUDOCLASS_PREFIX
Constructor and Description |
---|
IlvCompositeRenderer()
Creates a new
IlvCompositeRenderer renderer
with a null filtered renderer. |
IlvCompositeRenderer(IlvSDMRenderer renderer)
Creates a new
IlvCompositeRenderer renderer for a specified
filtered renderer. |
Modifier and Type | Method and Description |
---|---|
protected boolean |
acceptInteractor(IlvSDMEngine engine,
Object object,
IlvGraphic graphic)
This method allows subclasses to filter the objects on which the
interactor will be set.
|
protected boolean |
acceptShortcut(IlvSDMEngine engine,
IlvManagerView view,
InputEvent event)
The intent of this method is to allow
the
IlvCompositeInteractor object interactor
to be activated even if a view interactor is installed on the manager view. |
void |
addNodeGraphic(IlvSDMEngine engine,
Object node,
IlvGraphic graphic,
boolean redraw)
This method simply calls the
addNodeGraphic method
of the filtered renderer. |
IlvGraphic |
createLinkGraphic(IlvSDMEngine engine,
Object link,
IlvGraphic from,
IlvGraphic to)
This method simply calls the
createLinkGraphic method
of the filtered renderer. |
IlvGraphic |
createNodeGraphic(IlvSDMEngine engine,
Object node)
This method simply calls the
createNodeGraphic method
of the filtered renderer. |
void |
customize(IlvSDMEngine engine,
Object object,
IlvGraphic g,
String[] pseudoClasses)
This method simply calls the
customize method
of the filtered renderer. |
IlvRect |
getLinkConnectionRectangle(IlvSDMEngine engine,
IlvGraphic graphic,
IlvTransformer t,
IlvLinkConnector lc)
Returns a rectangle on which the connection points
of the links to/from a node should be located.
|
void |
linkGraphicAdded(IlvSDMEngine engine,
Object object,
IlvGraphic graphic,
boolean redraw)
Simply calls the
linkGraphicAdded method
of the filtered renderer. |
protected void |
moveResizeNodeGraphic(IlvSDMEngine engine,
Object node,
IlvGraphic g,
IlvRect newBBox,
int anchor)
Move the graphic to its final position
|
void |
nodeGraphicBBoxChanged(IlvSDMEngine engine,
Object node,
IlvGraphic graphic,
IlvRect oldBBox,
IlvRect newBBox,
String[] pseudoClasses)
This method calls the filtered renderer's
nodeGraphicBBoxChanged
method. |
void |
propertiesChanged(IlvSDMEngine engine,
Object object,
Collection<String> propertyNames,
IlvGraphic graphic)
Resets the object interactor on the object once it has been
customized.
|
void |
removeAll(IlvSDMEngine engine)
Cleans up the internal state of the renderer.
|
void |
removeNodeGraphic(IlvSDMEngine engine,
Object node,
IlvGraphic graphic,
boolean redraw)
If the graphic object was contained in a composite graphic (that is to say,
if the
"ParentName" property was used), it is removed from it
parent composite. |
addViewListeners, getInteractor, getParameter, isProcessMouseMoveEvents, isShorcutEnabled, isShortcutEnabled, needsViewListeners, nodeGraphicAdded, removeViewListeners, setInteractor, setParameter, setProcessMouseMoveEvents, setShorcutEnabled, setShortcutEnabled
addLinkGraphic, computeBBox, getEncapsulatedGraphic, getFilteredRenderer, getGraphicProperty, prepareRendering, processServerAction, removeLinkGraphic, renderingDone, setFilteredRenderer, updateObjectProperties
callMoveResizeNodeGraphic, convert, convert, getAlias, getAuxiliaryBean, getAuxiliaryBeans, getEngine, getLinkConnectionRectangle, getLocation, propertyChanged, setAlias, setEngine, setLayerName
public IlvCompositeRenderer(IlvSDMRenderer renderer)
IlvCompositeRenderer
renderer for a specified
filtered renderer.renderer
- the next rendererpublic IlvCompositeRenderer()
IlvCompositeRenderer
renderer
with a null
filtered renderer.protected boolean acceptShortcut(IlvSDMEngine engine, IlvManagerView view, InputEvent event)
IlvCompositeInteractor
object interactor
to be activated even if a view interactor is installed on the manager view.
If a view interactor is installed on the reference view
of the SDM engine, this method is called every time a mouse
or keyboard event occurs in the reference view. If the method
returns true
, the event will be sent to the interactor
of the object where the event occurred. If the method returns
false
, the object interactor is not called.
This method returns true
if the input event is triggered
on an IlvCompositeGraphic
instance and is accepted by the
IlvCompositeInteractor
installed on it.
acceptShortcut
in class IlvInteractorRenderer
engine
- The SDM engine attached to the reference view
in which the event occurred.view
- The reference view.event
- The event received by the manager view while
a view interactor was active.IlvCompositeInteractor
,
IlvCompositeInteractor.acceptEvent(ilog.views.IlvGraphic, java.awt.AWTEvent, ilog.views.IlvObjectInteractorContext)
,
IlvComposite
protected boolean acceptInteractor(IlvSDMEngine engine, Object object, IlvGraphic graphic)
If the method returns true
, the interactor will be
installed on the graphic object representing the specified
data object. Otherwise, no interactor will installed on this
object.
The default implementation always returns true
,
which means that the interactor is installed on all objects.
acceptInteractor
in class IlvInteractorRenderer
engine
- The SDM engine.object
- The data object.graphic
- The graphic object.public IlvRect getLinkConnectionRectangle(IlvSDMEngine engine, IlvGraphic graphic, IlvTransformer t, IlvLinkConnector lc)
null
as
link connector argument.
This method is overridden to take the subelement of the composite graphic into account that represents the link connection rectangle.
getLinkConnectionRectangle
in class IlvFilterSDMRenderer
engine
- The SDM engine.graphic
- The graphic object returned by createNodeGraphic
.t
- The transformer of the view.lc
- The link connector from which this is called.
This can be null
.protected void moveResizeNodeGraphic(IlvSDMEngine engine, Object node, IlvGraphic g, IlvRect newBBox, int anchor)
moveResizeNodeGraphic
in class IlvFilterSDMRenderer
engine
- The SDM engine.node
- The data node that the graphic object represents.g
- The graphic object that to be moved and/or resized.newBBox
- An IlvRectangle
initialized with the "x"
, "y"
,
"width"
and "height"
graphic properties.
If the width or height of the rectangle are non-zero, the graphic object
is moved and resized, otherwise the graphic object is only moved.
The final position must be stored in this parameter.anchor
- see IlvDirection
for the possible valuespublic void nodeGraphicBBoxChanged(IlvSDMEngine engine, Object node, IlvGraphic graphic, IlvRect oldBBox, IlvRect newBBox, String[] pseudoClasses)
nodeGraphicBBoxChanged
method.nodeGraphicBBoxChanged
in class IlvFilterSDMRenderer
engine
- The SDM engine.node
- The data node that the graphic object represents.graphic
- The graphic object that has been moved and/or resized.oldBBox
- The bounding box of the graphic object before
the change.newBBox
- The bounding box of the graphic object after
the change.pseudoClasses
- The pseudo-classes of the object.
This parameter can be null
.public IlvGraphic createNodeGraphic(IlvSDMEngine engine, Object node)
createNodeGraphic
method
of the filtered renderer.createNodeGraphic
in class IlvFilterSDMRenderer
engine
- The SDM engine associated with the grapher in
which the graphic object will be added.node
- The data node to translate into an IlvGraphic
.public void addNodeGraphic(IlvSDMEngine engine, Object node, IlvGraphic graphic, boolean redraw)
addNodeGraphic
method
of the filtered renderer.addNodeGraphic
in class IlvFilterSDMRenderer
engine
- The SDM engine associated with the grapher in which
the graphic object will be added.node
- The node that is being translated into an IlvGraphic
.graphic
- The graphic object returned by createNodeGraphic
.redraw
- If true
, the region covered
by the new graphic object must be redrawn.public IlvGraphic createLinkGraphic(IlvSDMEngine engine, Object link, IlvGraphic from, IlvGraphic to)
createLinkGraphic
method
of the filtered renderer.createLinkGraphic
in class IlvFilterSDMRenderer
engine
- The SDM engine associated with the grapher in
which the graphic object will be added.link
- The data link to translate into an IlvGraphic
.from
- The graphic object associated with the source node of the link.to
- The graphic object associated with the destination node of the link.public void linkGraphicAdded(IlvSDMEngine engine, Object object, IlvGraphic graphic, boolean redraw)
linkGraphicAdded
method
of the filtered renderer.linkGraphicAdded
in class IlvInteractorRenderer
engine
- The SDM engine associated with the grapher in which
the graphic object has been added.object
- 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 IlvInteractorRenderer
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 customize(IlvSDMEngine engine, Object object, IlvGraphic g, String[] pseudoClasses)
customize
method
of the filtered renderer.customize
in class IlvFilterSDMRenderer
engine
- The SDM engine.object
- The data object that the graphic object represents.g
- The graphic object to customize.pseudoClasses
- The pseudo-classes of the object. This parameter
can be null
.public void removeNodeGraphic(IlvSDMEngine engine, Object node, IlvGraphic graphic, boolean redraw)
"ParentName"
property was used), it is removed from it
parent composite.removeNodeGraphic
in class IlvFilterSDMRenderer
engine
- The SDM engine.node
- The node whose graphic object is being removed.graphic
- The graphic object representing node
.redraw
- true
if the view needs to be refreshed.public void removeAll(IlvSDMEngine engine)
This method is called by the SDM engine before a data model is loaded (and before the SDM engine clears the grapher's contents). It is also called when the renderer is detached from the SDM engine.
Subclasses that override this method must always call their superclass.
removeAll
in class IlvFilterSDMRenderer
engine
- The SDM engine.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.