ilog.views.graphic.linkpolicy
Class IlvBundleLinkShapePolicy

java.lang.Object
  extended by ilog.views.graphic.linkpolicy.IlvAbstractLinkShapePolicy
      extended by ilog.views.graphic.linkpolicy.IlvBundleLinkShapePolicy
All Implemented Interfaces:
IlvLinkShapePolicy

public class IlvBundleLinkShapePolicy
extends IlvAbstractLinkShapePolicy

A link shape policy that organizes multi links and self link in bundles. Multi links are links between the same pair of end nodes. Self links are links that have the same node as source and destination node. It is designed for graphs where all nodes have link connectors of type IlvClippingLinkConnector. It bundles only those links that are straight, because these links would otherwise overlap. It bundles only self links that have less than 4 bends, because these self links would otherwise be hidden by the nodes. The same policy can be shared among all links. The parameters of the policy can be set via setMultiLinkSpacing(float), setSelfLinkBaseSpacing(float), setSelfLinkSideSpacing(float), getSelfLinkDirection(), and setSelfLinkTriangular(boolean). You should set the spacing parameters before installing the policy. If you change spacing parameters of this policy, you must uninstall the policy first from all links and reinstall it afterwards.

On links of the type IlvEnhancedPolylineLinkImage and subclasses, this policy can be activated using IlvEnhancedPolylineLinkImage.setMultiLinkBundled(boolean).

For a complementary bundling mechanism, see IlvLinkBundle.

Since:
JViews 6.0
See Also:
IlvPolicyAwareLinkImage, IlvEnhancedPolylineLinkImage.setMultiLinkBundled(boolean)

Field Summary
static int ALWAYS_HORIZONTAL
          Option for the multilink orientation.
static int ALWAYS_VERTICAL
          Option for the multilink orientation.
static int VARIABLE
          Option for the multilink orientation.
 
Constructor Summary
IlvBundleLinkShapePolicy()
          Creates an empty link shape policy.
 
Method Summary
 void afterAdd(IlvLinkImage link)
          Allows the policy to react after a link with installed policy is added to a grapher.
 void afterFromNodeMoved(IlvLinkImage link)
          Allows the policy to react after the source node of the link was moved.
 void afterInsertPoint(IlvLinkImage link, int index, IlvTransformer t)
          Allows the policy to react after a point was inserted.
 void afterRemovePoint(IlvLinkImage link, int index, IlvTransformer t)
          Allows the policy to react after a point was removed.
 void afterSetIntermediateLinkPoints(IlvLinkImage link)
          Allows the policy to react after the intermediate points were set.
 void afterToNodeMoved(IlvLinkImage link)
          Allows the policy to react after the target node of the link was moved.
 void beforeRemove(IlvLinkImage link)
          Allows the policy to react before a link with installed policy is removed from a grapher.
 boolean canBundle(IlvLinkImage link)
          This method decides whether a link can be bundled.
 int getMultiLinkOrientation()
          Returns the preferred orientation of the links bundled as multilinks.
 float getMultiLinkSpacing()
          Returns the offset between links that are bundled as multilinks.
 float getSelfLinkBaseSpacing()
          Returns the smallest length of the base line segment of selflinks that are automatically routed.
 int getSelfLinkDirection()
          Returns the direction where the automatically routed self links are attached to the node.
 float getSelfLinkSideSpacing()
          Returns the smallest length of the two side line segments of selflinks that are automatically routed.
 boolean isSelfLinkTriangular()
          Returns true if the automatic rerouted selflinks have a triangular shape.
 void onInstall(IlvLinkImage link)
          Allows the policy to react immediately when it is installed at a link.
 void onUninstall(IlvLinkImage link)
          Allows the policy to react immediately when it is removed from a link.
static void SetMultiLinkOrientation(IlvManager manager, int orientation, boolean traverse, boolean redraw)
          Sets the preferred orientation of the links bundled as multilinks for all links of the input manager.
 void setMultiLinkOrientation(int orientation)
          Sets the preferred orientation of the links bundled as multilinks.
 void setMultiLinkSpacing(float offset)
          Sets the offset between links that are bundled as multilinks.
static void SetMultiLinkSpacing(IlvManager manager, float offset, boolean traverse, boolean redraw)
          Sets the offset between links that are bundled as multilinks for all links of the input manager.
 void setSelfLinkBaseSpacing(float offset)
          Sets the smallest length of the base line segment of selflinks that are automatically routed.
static void SetSelfLinkBaseSpacing(IlvManager manager, float offset, boolean traverse, boolean redraw)
          Sets the smallest length of the base line segment of selflinks that are automatically routed for all links of the input manager.
static void SetSelfLinkDirection(IlvManager manager, int direction, boolean traverse, boolean redraw)
          Sets the direction where the automatically routed self links are attached to the node for all links of the input manager.
 void setSelfLinkDirection(int direction)
          Sets the direction where the automatically routed self links are attached to the node.
 void setSelfLinkSideSpacing(float offset)
          Sets the smallest length of the two side line segments of selflinks that are automatically routed.
static void SetSelfLinkSideSpacing(IlvManager manager, float offset, boolean traverse, boolean redraw)
          Sets the smallest length of the two side line segments of selflinks that are automatically routed for all links of the input manager.
 void setSelfLinkTriangular(boolean enable)
          Sets whether the automatic rerouted selflinks have a triangular shape or a rectangular shape.
static void SetSelfLinkTriangular(IlvManager manager, boolean enable, boolean traverse, boolean redraw)
          Sets whether the automatic rerouted selflinks have a triangular shape or a rectangular shape for all links of the input manager.
 
Methods inherited from class ilog.views.graphic.linkpolicy.IlvAbstractLinkShapePolicy
afterAny, afterApplyTransform, afterMovePoint, allowApplyTransform, allowInsertPoint, allowMovePoint, allowRemovePoint, allowSetIntermediateLinkPoints, getChildPolicy, getLinkPoints, getPointAt, setChildPolicy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VARIABLE

public static final int VARIABLE
Option for the multilink orientation. The orientation is variable and always calculated from the positions of the end nodes.

Since:
JViews 8.0
See Also:
setMultiLinkOrientation(int), Constant Field Values

ALWAYS_HORIZONTAL

public static final int ALWAYS_HORIZONTAL
Option for the multilink orientation. The offset between the bundled links is always an x offset, independent from the actual positions of the nodes.

Since:
JViews 8.0
See Also:
setMultiLinkOrientation(int), Constant Field Values

ALWAYS_VERTICAL

public static final int ALWAYS_VERTICAL
Option for the multilink orientation. The offset between the bundled links is always an y offset, independent from the actual positions of the nodes.

Since:
JViews 8.0
See Also:
setMultiLinkOrientation(int), Constant Field Values
Constructor Detail

IlvBundleLinkShapePolicy

public IlvBundleLinkShapePolicy()
Creates an empty link shape policy.

Method Detail

setMultiLinkSpacing

public void setMultiLinkSpacing(float offset)
Sets the offset between links that are bundled as multilinks. The offset is relative to the local coordinate system of the link. The default offset is 5.

Note that changing the spacing may influence bounding rectangles of links. For this reason, you should set the spacing before you install this policy at any link. If you want to change the spacing later, you should deinstall the policy at all links before the change and reinstall it afterwards. As alternative, you can use the method SetMultiLinkSpacing(IlvManager, float, boolean, boolean) which sets the spacing at all policies of links in the manager in the same way.

See Also:
getMultiLinkSpacing()

getMultiLinkSpacing

public float getMultiLinkSpacing()
Returns the offset between links that are bundled as multilinks.

See Also:
setMultiLinkSpacing(float)

SetMultiLinkSpacing

public static void SetMultiLinkSpacing(IlvManager manager,
                                       float offset,
                                       boolean traverse,
                                       boolean redraw)
Sets the offset between links that are bundled as multilinks for all links of the input manager. See setMultiLinkSpacing(float) for details.

The bundling looks only nice if the same spacing is used for all links the belong to the same bundle (i.e., that have the same pair of end nodes). This method can be used to set the spacing of all links in a manager in the same way. It traverses all links, detects the link policy, and changes the parameter of the link policy in a safe way. Therefore, you can use this method while the bundle link shape policies are installed at the links.

Parameters:
manager - The manager.
offset - The multi link spacing.
traverse - Whether the submanagers should recursively be traversed as well to set the spacing.
redraw - Whether a redraw of all links is required after setting the spacing.
See Also:
setMultiLinkSpacing(float), getMultiLinkSpacing()

setMultiLinkOrientation

public void setMultiLinkOrientation(int orientation)
Sets the preferred orientation of the links bundled as multilinks. The allowed values are:

Since:
JViews 8.0
See Also:
getMultiLinkOrientation()

getMultiLinkOrientation

public int getMultiLinkOrientation()
Returns the preferred orientation of the links bundled as multilinks.

Since:
JViews 8.0
See Also:
setMultiLinkOrientation(int)

SetMultiLinkOrientation

public static void SetMultiLinkOrientation(IlvManager manager,
                                           int orientation,
                                           boolean traverse,
                                           boolean redraw)
Sets the preferred orientation of the links bundled as multilinks for all links of the input manager. See setMultiLinkOrientation(int) for details.

The bundling looks only nice if the same orientation is used for all links that belong to the same bundle (that is, that have the same pair of end nodes). This method can be used to set the orientation of all links in a manager in the same way. It traverses all links, detects the link policy, and changes the parameter of the link policy in a safe way. Therefore, you can use this method while the bundle link shape policies are installed on the links.

Parameters:
manager - The manager.
orientation - The multilink orientation.
traverse - Whether the submanagers should recursively be traversed as well to set the spacing.
redraw - Whether a redraw of all links is required after setting the spacing.
Since:
JViews 8.0
See Also:
setMultiLinkOrientation(int), getMultiLinkOrientation()

setSelfLinkBaseSpacing

public void setSelfLinkBaseSpacing(float offset)
Sets the smallest length of the base line segment of selflinks that are automatically routed. Self links that were added as straight links are routed over two bend points. The base spacing is the distance between these bend points. The spacing is relative to the local coordinate system of the link. The default base spacing is 15.

Note that changing the spacing may influence bounding rectangles of links. For this reason, you should set the spacing before you install this policy at any link. If you want to change the spacing later, you should deinstall the policy at all links before the change and reinstall it afterwards. As alternative, you can use the method SetSelfLinkBaseSpacing(IlvManager, float, boolean, boolean) which sets the spacing at all policies of links in the manager in the same way.

See Also:
getSelfLinkBaseSpacing()

getSelfLinkBaseSpacing

public float getSelfLinkBaseSpacing()
Returns the smallest length of the base line segment of selflinks that are automatically routed.

See Also:
setSelfLinkBaseSpacing(float)

SetSelfLinkBaseSpacing

public static void SetSelfLinkBaseSpacing(IlvManager manager,
                                          float offset,
                                          boolean traverse,
                                          boolean redraw)
Sets the smallest length of the base line segment of selflinks that are automatically routed for all links of the input manager. See setSelfLinkBaseSpacing(float) for details.

The bundling looks only nice if the same spacing is used for all links the belong to the same bundle (i.e., that have the same pair of end nodes). This method can be used to set the spacing of all links in a manager in the same way. It traverses all links, detects the link policy, and changes the parameter of the link policy in a safe way. Therefore, you can use this method while the bundle link shape policies are installed at the links.

Parameters:
manager - The manager.
offset - The self link spacing.
traverse - Whether the submanagers should recursively be traversed as well to set the spacing.
redraw - Whether a redraw of all links is required after setting the spacing.
See Also:
setSelfLinkBaseSpacing(float), getSelfLinkBaseSpacing()

setSelfLinkSideSpacing

public void setSelfLinkSideSpacing(float offset)
Sets the smallest length of the two side line segments of selflinks that are automatically routed. Self links that were added as straight links are routed over two bend points. The side spacing is the distance from each of both bend points to the border of the bounding box of the node. The spacing is relative to the local coordinate system of the link. The default side spacing is 10.

Note that changing the spacing may influence bounding rectangles of links. For this reason, you should set the spacing before you install this policy at any link. If you want to change the spacing later, you should deinstall the policy at all links before the change and reinstall it afterwards. As alternative, you can use the method SetSelfLinkSideSpacing(IlvManager, float, boolean, boolean) which sets the spacing at all policies of links in the manager in the same way.

See Also:
getSelfLinkSideSpacing()

getSelfLinkSideSpacing

public float getSelfLinkSideSpacing()
Returns the smallest length of the two side line segments of selflinks that are automatically routed.

See Also:
setSelfLinkSideSpacing(float)

SetSelfLinkSideSpacing

public static void SetSelfLinkSideSpacing(IlvManager manager,
                                          float offset,
                                          boolean traverse,
                                          boolean redraw)
Sets the smallest length of the two side line segments of selflinks that are automatically routed for all links of the input manager. See setSelfLinkSideSpacing(float) for details.

The bundling looks only nice if the same spacing is used for all links the belong to the same bundle (i.e., that have the same pair of end nodes). This method can be used to set the spacing of all links in a manager in the same way. It traverses all links, detects the link policy, and changes the parameter of the link policy in a safe way. Therefore, you can use this method while the bundle link shape policies are installed at the links.

Parameters:
manager - The manager.
offset - The self link spacing.
traverse - Whether the submanagers should recursively be traversed as well to set the spacing.
redraw - Whether a redraw of all links is required after setting the spacing.
See Also:
setSelfLinkSideSpacing(float), getSelfLinkSideSpacing()

setSelfLinkDirection

public void setSelfLinkDirection(int direction)
Sets the direction where the automatically routed self links are attached to the node. Self links that were added as straight links are routed over two bend points. The choices for the selflink direction are: Note that changing this option may influence bounding rectangles of links. For this reason, you should set the option before you install this policy at any link. If you want to change the option later, you should deinstall the policy at all links before the change and reinstall it afterwards. It is also recommended to make all self links straight while changing the option, so that the change has effect when reinstalling the policy. As alternative, you can use the method SetSelfLinkDirection(IlvManager, int, boolean, boolean) which sets the direction at all policies of links in the manager in the same way.

See Also:
getSelfLinkDirection(), IlvDirection

getSelfLinkDirection

public int getSelfLinkDirection()
Returns the direction where the automatically routed self links are attached to the node. The return value is one of the choices of IlvDirection.

See Also:
setSelfLinkDirection(int), IlvDirection

SetSelfLinkDirection

public static void SetSelfLinkDirection(IlvManager manager,
                                        int direction,
                                        boolean traverse,
                                        boolean redraw)
Sets the direction where the automatically routed self links are attached to the node for all links of the input manager. See setSelfLinkDirection(int) for details.

The bundling looks only nice if the same direction is used for all links the belong to the same bundle (i.e., that have the same pair of end nodes). This method can be used to set the direction of all links in a manager in the same way. It traverses all links, detects the link policy, and changes the parameter of the link policy in a safe way. Therefore, you can use this method while the bundle link shape policies are installed at the links.

Parameters:
manager - The manager.
direction - The self link direction.
traverse - Whether the submanagers should recursively be traversed as well to set the direction.
redraw - Whether a redraw of all links is required after setting the direction.
See Also:
setSelfLinkDirection(int), getSelfLinkDirection()

setSelfLinkTriangular

public void setSelfLinkTriangular(boolean enable)
Sets whether the automatic rerouted selflinks have a triangular shape or a rectangular shape. By default, they have a rectangular shape. Self links that were added as straight links are routed over two bend points. If the mode is triangular, the shape of the self links resembles a triangle, otherwise it resembles a rectangle.

Note that changing this option may influence bounding rectangles of links. For this reason, you should set the option before you install this policy at any link. If you want to change the option later, you should deinstall the policy at all links before the change and reinstall it afterwards. It is also recommended to make all self links straight while changing the option, so that the change has effect when reinstalling the policy. As alternative, you can use the method SetSelfLinkTriangular(IlvManager, boolean, boolean, boolean) which sets the shape preference at all policies of links in the manager in the same way.

See Also:
isSelfLinkTriangular()

isSelfLinkTriangular

public boolean isSelfLinkTriangular()
Returns true if the automatic rerouted selflinks have a triangular shape. Returns false if the automatic rerouted selflinks have a rectangular shape.

See Also:
setSelfLinkTriangular(boolean)

SetSelfLinkTriangular

public static void SetSelfLinkTriangular(IlvManager manager,
                                         boolean enable,
                                         boolean traverse,
                                         boolean redraw)
Sets whether the automatic rerouted selflinks have a triangular shape or a rectangular shape for all links of the input manager. See setSelfLinkTriangular(boolean) for details.

The bundling looks only nice if the same shape is used for all self links the belong to the same bundle (i.e., that have the same pair of end nodes). This method can be used to set the shape of all self links in a manager in the same way. It traverses all links, detects the link policy, and changes the parameter of the link policy in a safe way. Therefore, you can use this method while the bundle link shape policies are installed at the links.

Parameters:
manager - The manager.
enable - Whether triangular shapes are enabled.
traverse - Whether the submanagers should recursively be traversed as well to set the shape preference.
redraw - Whether a redraw of all links is required after setting the shape preference.
See Also:
setSelfLinkTriangular(boolean), isSelfLinkTriangular()

canBundle

public boolean canBundle(IlvLinkImage link)
This method decides whether a link can be bundled. The default implementation bundles only links that are straight, because links with bends are distinguishable through the bends anyway. Self links are bundled if they have two bends, since straight self links make no sense as they would be invisible.


afterAdd

public void afterAdd(IlvLinkImage link)
Allows the policy to react after a link with installed policy is added to a grapher. Notice that if this method changes the shape of the link, it has to call applyToObject on the link.

Specified by:
afterAdd in interface IlvLinkShapePolicy
Overrides:
afterAdd in class IlvAbstractLinkShapePolicy
Parameters:
link - The link.

beforeRemove

public void beforeRemove(IlvLinkImage link)
Allows the policy to react before a link with installed policy is removed from a grapher. Notice that if this method changes the shape of the link, it has to call applyToObject on the link.

Specified by:
beforeRemove in interface IlvLinkShapePolicy
Overrides:
beforeRemove in class IlvAbstractLinkShapePolicy
Parameters:
link - The link.

onInstall

public void onInstall(IlvLinkImage link)
Allows the policy to react immediately when it is installed at a link.

Specified by:
onInstall in interface IlvLinkShapePolicy
Overrides:
onInstall in class IlvAbstractLinkShapePolicy
Parameters:
link - The link.

onUninstall

public void onUninstall(IlvLinkImage link)
Allows the policy to react immediately when it is removed from a link.

Specified by:
onUninstall in interface IlvLinkShapePolicy
Overrides:
onUninstall in class IlvAbstractLinkShapePolicy
Parameters:
link - The link.

afterSetIntermediateLinkPoints

public void afterSetIntermediateLinkPoints(IlvLinkImage link)
Allows the policy to react after the intermediate points were set.

Specified by:
afterSetIntermediateLinkPoints in interface IlvLinkShapePolicy
Overrides:
afterSetIntermediateLinkPoints in class IlvAbstractLinkShapePolicy
Parameters:
link - The link.

afterInsertPoint

public void afterInsertPoint(IlvLinkImage link,
                             int index,
                             IlvTransformer t)
Allows the policy to react after a point was inserted.

Specified by:
afterInsertPoint in interface IlvLinkShapePolicy
Overrides:
afterInsertPoint in class IlvAbstractLinkShapePolicy
Parameters:
link - The link.
index - The index at which the new point was inserted.
t - The transformer through which the link is drawn.

afterRemovePoint

public void afterRemovePoint(IlvLinkImage link,
                             int index,
                             IlvTransformer t)
Allows the policy to react after a point was removed.

Specified by:
afterRemovePoint in interface IlvLinkShapePolicy
Overrides:
afterRemovePoint in class IlvAbstractLinkShapePolicy
Parameters:
link - The link.
index - The index at which a point was removed.
t - The transformer through which the link is drawn.

afterFromNodeMoved

public void afterFromNodeMoved(IlvLinkImage link)
Allows the policy to react after the source node of the link was moved.

Specified by:
afterFromNodeMoved in interface IlvLinkShapePolicy
Overrides:
afterFromNodeMoved in class IlvAbstractLinkShapePolicy
Parameters:
link - The link.

afterToNodeMoved

public void afterToNodeMoved(IlvLinkImage link)
Allows the policy to react after the target node of the link was moved.

Specified by:
afterToNodeMoved in interface IlvLinkShapePolicy
Overrides:
afterToNodeMoved in class IlvAbstractLinkShapePolicy
Parameters:
link - The link.


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.