public class IlvLabelLayoutRenderer extends IlvFilterSDMRenderer
IlvLabelLayoutRenderer
is a
filtering renderer that applies an "annealing" label layout algorithm
to: IlvGeneralNode
instances
IlvGeneralLink
instances
IlvSDMCompositeNode
instances which are direct children of the root IlvSDMCompositeNode
IlvSDMCompositeLink
instances which are direct children of the root IlvSDMCompositeLink
IlvComposite
instance, its IlvAnnealingLabelDescriptor
instance can be customized in the style sheet.
The pseudo-classes of IlvLabelLayoutRenderer
are "labelLayout" and "labelLayout_n"
where n
is an index of a child of a IlvSDMCompositeNode
.
Here is an example:
node { class : "ilog.views.sdm.graphic.IlvSDMCompositeNode"; children[0] : @+base; LinkConnectionRectangle : "0"; // Connect links to the base. } node[label] { children[1] : @+label; constraints[1] : @=attachmentLabel; } node:labelLayout { preferredDirection : Bottom; } node:labelLayout_1 { preferredDistFromPath : 20; preferredDirection : Top; maxDistFromPath : 30; } Subobject#base:init { class : "ilog.views.graphic.IlvRectangle(definitionRect)"; definitionRect : '@|rect(0,0,@width,@height)'; fillOn : true; background : #BABABA; } Subobject#base { foreground : black; } Subobject#base:selected { foreground : red; } 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"; }
The following rendering property is handled directly by the renderer:
LabelLayoutIgnored
- If this property is set to true
,
the object will be completely ignored by the label layout.
IlvLabelLayout
,
IlvAnnealingLabelLayout
,
IlvAnnealingLabelDescriptor
,
IlvGeneralNode
,
IlvGeneralLink
,
IlvSDMCompositeNode
,
IlvSDMCompositeLink
,
Serialized Form_renderer
PSEUDOCLASS_PREFIX
Constructor and Description |
---|
IlvLabelLayoutRenderer()
Creates a new label layout renderer with a
null
filtered renderer. |
IlvLabelLayoutRenderer(IlvSDMRenderer renderer)
Creates a new label layout renderer for a specified
filtered renderer.
|
Modifier and Type | Method and Description |
---|---|
Object[] |
getAuxiliaryBeans()
Returns a single-element array containing the
IlvLabelLayout
object returned by getReferenceLabelLayout() . |
IlvRecursiveMultipleLayout |
getRecursiveMultipleLayout()
Returns the instance of
IlvRecursiveMultipleLayout
used internally by this renderer. |
IlvLabelLayout |
getReferenceLabelLayout()
Returns the reference label layout used by the internal
IlvRecursiveMultipleLayout object. |
boolean |
isDebug()
Returns
true if in debug mode. |
boolean |
isEnabled()
Returns a
boolean specifying whether the label layout algorithm
is enabled or disabled. |
boolean |
isLayoutOfGeneralLinkLabelsEnabled()
Deprecated.
Since JViews 6.0, use
isLayoutOfLinkLabelsEnabled() . |
boolean |
isLayoutOfGeneralNodeLabelsEnabled()
Deprecated.
Since JViews 6.0, use
isLayoutOfNodeLabelsEnabled() . |
boolean |
isLayoutOfLinkLabelsEnabled()
Returns a
boolean specifying whether the layout of labels
attached to the IlvGeneralLink objects
or the IlvSDMCompositeLink objects of the graph is enabled. |
boolean |
isLayoutOfNodeLabelsEnabled()
Returns a
boolean specifying whether the layout of labels
attached to the IlvGeneralNode objects
or the IlvSDMCompositeNode objects of the graph is enabled. |
boolean |
isLayoutOfNonTextLabelsEnabled()
Returns a
boolean specifying whether the layout considers
the children of
IlvSDMCompositeNode objects and
IlvSDMCompositeLink objects
as labels even though they are not of type
IlvText ,
IlvLabel , or
IlvZoomableLabel . |
boolean |
isPerformingLayoutOnZoom()
Returns a
boolean specifying whether the layout algorithm should be
applied every time the transformer of the reference view
changes, or only when the data is initially rendered. |
void |
nodeGraphicBBoxChanged(IlvSDMEngine engine,
Object node,
IlvGraphic graphic,
IlvRect oldBBox,
IlvRect newBBox,
String[] pseudoClasses)
Performs the label layout algorithm whenever a node
is moved.
|
void |
performLayout(IlvSDMEngine engine)
Performs the label layout algorithm.
|
void |
renderingDone(IlvSDMEngine engine)
This is where the label layout algorithm is performed.
|
void |
setDebug(boolean debug)
Enables tracing when the label layout renderer runs.
|
void |
setEnabled(boolean enabled)
Enable or disables the label layout algorithm.
|
void |
setLayoutOfGeneralLinkLabelsEnabled(boolean enabled)
Deprecated.
Since JViews 6.0, use
setLayoutOfLinkLabelsEnabled(boolean) . |
void |
setLayoutOfGeneralNodeLabelsEnabled(boolean enabled)
Deprecated.
Since JViews 6.0, use
setLayoutOfNodeLabelsEnabled(boolean) |
void |
setLayoutOfLinkLabelsEnabled(boolean enabled)
Enables or disables the layout of labels attached to the
IlvGeneralLink objects
or to the IlvSDMCompositeLink objects of the graph. |
void |
setLayoutOfNodeLabelsEnabled(boolean enabled)
Enables or disables the layout of labels attached to the
IlvGeneralNode objects
or to IlvSDMCompositeNode objects of the graph. |
void |
setLayoutOfNonTextLabelsEnabled(boolean enabled)
Enables or disables whether the layout considers the non-textual
children of
IlvSDMCompositeNode and
IlvSDMCompositeLink objects
as labels. |
void |
setPerformingLayoutOnZoom(boolean b)
Specifies whether the layout algorithm should be
applied every time the transformer of the reference view
changes, or only when the data is initially rendered.
|
addLinkGraphic, addNodeGraphic, computeBBox, createLinkGraphic, createNodeGraphic, customize, getEncapsulatedGraphic, getFilteredRenderer, getGraphicProperty, getLinkConnectionRectangle, linkGraphicAdded, moveResizeNodeGraphic, nodeGraphicAdded, prepareRendering, processServerAction, propertiesChanged, removeAll, removeLinkGraphic, removeNodeGraphic, setFilteredRenderer, updateObjectProperties
addViewListeners, callMoveResizeNodeGraphic, convert, convert, getAlias, getAuxiliaryBean, getEngine, getLinkConnectionRectangle, getLocation, getParameter, needsViewListeners, propertyChanged, removeViewListeners, setAlias, setEngine, setLayerName, setParameter
public IlvLabelLayoutRenderer(IlvSDMRenderer renderer)
renderer
- The filtered renderer.public IlvLabelLayoutRenderer()
null
filtered renderer.public void setPerformingLayoutOnZoom(boolean b)
b
- If true
, the link layout
will be performed every time the zoom factor of the view
changes. Otherwise, the link layout is performed only when
the data model is loaded or when new objects are added.public boolean isPerformingLayoutOnZoom()
boolean
specifying whether the layout algorithm should be
applied every time the transformer of the reference view
changes, or only when the data is initially rendered.public IlvRecursiveMultipleLayout getRecursiveMultipleLayout()
IlvRecursiveMultipleLayout
used internally by this renderer.getAuxiliaryBeans()
,
getReferenceLabelLayout()
public Object[] getAuxiliaryBeans()
IlvLabelLayout
object returned by getReferenceLabelLayout()
.getAuxiliaryBeans
in class IlvSDMRenderer
IlvLabelLayout
object returned by getReferenceLabelLayout()
.public IlvLabelLayout getReferenceLabelLayout()
IlvRecursiveMultipleLayout
object.IlvRecursiveMultipleLayout
object.IlvRecursiveMultipleLayout.getReferenceLabelLayout()
,
getRecursiveMultipleLayout()
,
getAuxiliaryBeans()
public void setEnabled(boolean enabled)
enabled
- If true
,
this renderer will perform the label layout algorithm
every time a data model is loaded or a node is added to
the model. If false
,
the label layout is disabled, and the renderer does
nothing.public boolean isEnabled()
boolean
specifying whether the label layout algorithm
is enabled or disabled.@Deprecated public void setLayoutOfGeneralNodeLabelsEnabled(boolean enabled)
setLayoutOfNodeLabelsEnabled(boolean)
IlvGeneralNode
objects
of the graph.
By default, the layout of general node labels is enabled.
enabled
- If true
, the label layout will be performed
on the labels attached to the IlvGeneralNode
objects of the graph. If false
,
the IlvGeneralNode
objects will be left unchanged.public void setLayoutOfNodeLabelsEnabled(boolean enabled)
IlvGeneralNode
objects
or to IlvSDMCompositeNode
objects of the graph.@Deprecated public boolean isLayoutOfGeneralNodeLabelsEnabled()
isLayoutOfNodeLabelsEnabled()
.boolean
specifying whether the layout of labels
attached to the IlvGeneralNode
objects
of the graph is enabled.setLayoutOfGeneralNodeLabelsEnabled(boolean)
public boolean isLayoutOfNodeLabelsEnabled()
boolean
specifying whether the layout of labels
attached to the IlvGeneralNode
objects
or the IlvSDMCompositeNode
objects of the graph is enabled.setLayoutOfNodeLabelsEnabled(boolean)
@Deprecated public void setLayoutOfGeneralLinkLabelsEnabled(boolean enabled)
setLayoutOfLinkLabelsEnabled(boolean)
.IlvGeneralLink
objects
of the graph.
By default, the layout of general link labels is enabled.
enabled
- If true
, the label layout will be performed
on the labels attached to the IlvGeneralLink
objects of the graph. If false
,
the IlvGeneralLink
objects will be left unchanged.public void setLayoutOfLinkLabelsEnabled(boolean enabled)
IlvGeneralLink
objects
or to the IlvSDMCompositeLink
objects of the graph.
By default, the layout of general link labels is enabled.
enabled
- If true
, the label layout will be performed
on the labels attached to the IlvGeneralLink
objects
or to the IlvSDMCompositeLink
objects of the graph. If false
,
these objects will be left unchanged.@Deprecated public boolean isLayoutOfGeneralLinkLabelsEnabled()
isLayoutOfLinkLabelsEnabled()
.boolean
specifying whether the layout of labels
attached to the IlvGeneralLink
objects
of the graph is enabled.setLayoutOfGeneralLinkLabelsEnabled(boolean)
public boolean isLayoutOfLinkLabelsEnabled()
boolean
specifying whether the layout of labels
attached to the IlvGeneralLink
objects
or the IlvSDMCompositeLink
objects of the graph is enabled.setLayoutOfLinkLabelsEnabled(boolean)
public void setLayoutOfNonTextLabelsEnabled(boolean enabled)
IlvSDMCompositeNode
and
IlvSDMCompositeLink
objects
as labels.
Textual children are children of one of the following types:
By default, the label layout considers only children of those types
as labels, and considers all other children as obstacles for the layout.
If this option is enabled, you can specify via CSS for each individual child (except for the base child) whether it should be considered as a label or an obstacle. If the option is enabled, this works for textual and for non-textual children. If the option is disabled, all non-textual children are considered obstacles. You can only choose for the textual children of the types mentioned above whether they are considered as labels or obstacles.
In the following example of CSS specification, the child with index
1
is treated as a label even though it is not a textual
child. The child with index 2
is treated as obstacle even
though it is a textual child:
LabelLayout { enabled : "true" ; layoutOfNonTextLabelsEnabled: "true"; } node:labelLayout_1 { preferredDirection: "Top"; treatAs: "LABEL"; } node:labelLayout_2 { treatAs: "OBSTACLE"; }
setLayoutOfLinkLabelsEnabled(boolean)
public boolean isLayoutOfNonTextLabelsEnabled()
boolean
specifying whether the layout considers
the children of
IlvSDMCompositeNode
objects and
IlvSDMCompositeLink
objects
as labels even though they are not of type
IlvText
,
IlvLabel
, or
IlvZoomableLabel
.
By default, the label layout considers only children of those types
as labels.setLayoutOfLinkLabelsEnabled(boolean)
public void setDebug(boolean debug)
public boolean isDebug()
true
if in debug mode.public void renderingDone(IlvSDMEngine engine)
renderingDone
in class IlvFilterSDMRenderer
engine
- The SDM engine.public void performLayout(IlvSDMEngine engine)
renderingDone(ilog.views.sdm.IlvSDMEngine)
.engine
- The SDM engine.public void nodeGraphicBBoxChanged(IlvSDMEngine engine, Object node, IlvGraphic graphic, IlvRect oldBBox, IlvRect newBBox, String[] pseudoClasses)
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.
This parameter can be null
.pseudoClasses
- the current pseudo classes© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.