When using the Tree layout, it is preferable to use link
connectors of type IlvFreeLinkConnector and links of type IlvPolylineLinkImage or IlvSplineLinkImage. The links can be
straight or have a specific shape with intermediate points. You
can specify that the links be reshaped into an “orthogonal” form.
You can set the link style globally, in which case all links have
the same shape, or locally on each link, in which case different
link shapes occur in the same drawing.
Link style and link shapes
Link styles work only when you use links that can be reshaped.
Subclasses of IlvPolylineLinkImage or of IlvSplineLinkImage, (such as
IlvGeneralLink
) can be reshaped. Furthermore, link styles work only if free
link connectors are installed. Free link connectors are
subclasses of IlvFreeLinkConnector. If you use a diagram
component, the free link connectors are automatically installed
when necessary unless specified differently. If you call layout
in Java™ on an
IlvGrapher
instance directly, the layout algorithm may raise an IlvInappropriateLinkException if links are
neither a subclass of IlvPolylineLinkImage nor of IlvSplineLinkImage, or if connectors are
not a subclass of
IlvFreeLinkConnector
. In this case, you can use the methods
EnsureAppropriateLinkTypes
,
EnsureAppropriateLinkConnectors
, or
EnsureAppropriateLinks
defined in IlvGraphLayoutUtil to replace inappropriate
links or link connectors automatically, either before layout or
when the IlvInappropriateLinkException is caught.
For details on these methods, see the Java
API Reference Manual. For details on the graph model, see Using
the graph model.
Global link style
To specify the global link style:
In CSS
Add this statement to the
GraphLayout
section:
globalLinkStyle: "STRAIGHT_LINE_STYLE";
In Java
Use the method:
void setGlobalLinkStyle(int style);
The valid values for
style
are:
IlvTreeLayout.NO_RESHAPE_STYLE
None of the links is reshaped in any manner.IlvTreeLayout.STRAIGHT_LINE_STYLE
All the intermediate points of the links (if any) are removed. It is the default value. See Tree layout in free layout mode with center alignment and flow direction to the right and Tree layout in radial layout mode with aspect ratio 1.5 as examples.IlvTreeLayout.ORTHOGONAL_STYLE
The links are reshaped in an orthogonal form (alternating horizontal and vertical segments). See Tree layout with flow direction to the bottom, orthogonal link style, and tip-over alignment at some leaf nodes and Tip-over alignments as examples.IlvTreeLayout.MIXED_STYLE
Each link can have a different link style. The style of each individual link can be set to have different link shapes occurring on the same graph.
In CSS, you omit the prefix
IlvTreeLayout
when specifying the value of the link style.
Individual link style
All links have the same style of shape unless the global link
style is
MIXED_STYLE
. Only when the global link style is set to
MIXED_STYLE
can each link have an individual link style.
![A sample
graph with different link styles in each subtree](../../../GraphLayout/_media/layout-Tree-mixedlinks39_default.gif)
Different link styles mixed in the
same drawing
To specify the style of an individual
link:
In CSS
First set the global link style to
MIXED_STYLE, then specify a rule that selects the link, for
instance:
GraphLayout { globalLinkStyle: "MIXED_STYLE"; } #link1{ LinkStyle: "ORTHOGONAL_STYLE"; }
The valid values for
style
are:
IlvTreeLayout.STRAIGHT_LINE_STYLE
(the default)IlvTreeLayout.NO_RESHAPE_STYLE
IlvTreeLayout.ORTHOGONAL_STYLE
Note
The link style of a Tree Layout graph requires links in an IlvGrapher that can be reshaped. Links
of type IlvLinkImage, IlvOneLinkImage, IlvDoubleLinkImage, IlvOneSplineLinkImage, and IlvDoubleSplineLinkImage cannot be
reshaped. You should use the class IlvPolylineLinkImage or IlvSplineLinkImage instead.