ilog.views.graphic.linkpolicy
Class IlvCrossingLinkShapePolicy

java.lang.Object
  extended by ilog.views.graphic.linkpolicy.IlvAbstractLinkShapePolicy
      extended by ilog.views.graphic.linkpolicy.IlvCrossingLinkShapePolicy
All Implemented Interfaces:
ManagerContentChangedListener, IlvLinkShapePolicy, EventListener

public class IlvCrossingLinkShapePolicy
extends IlvAbstractLinkShapePolicy
implements ManagerContentChangedListener

An IlvCrossingLinkShapePolicy tells the links where the crossings are. This link shape policy works only with links of class IlvCrossingAwareLinkImage. The policy can be shared between links of the same kind. The parameters of the policy can be set via setHorizontalPreferred(boolean) and setNestingTraversal(boolean). The parameter settings should be the same for all crossing link shape policies of all links, otherwise the crossings may appear aesthetically unpleasing.

If you work with nested graphs and intergraph links, and links of different subgraphers can cross each other, you should enable the nesting traversal. It updates the crossings between links even for links that belong to different graphers. However, if this option is enabled, the crossings are only correctly updated if in each grapher of the nesting hierarchy the following holds: all node that represent subgraphers are in different layers than the links. For instance, you should insert all nodes into layer 0 and all links into layer 1. If the condition is not satisfied, it gets ambiguous whether a link is drawn above or below a subgrapher node, and hence it is impossible to decide whether two links belonging to different subgraphers will visually cross each other.

Furthermore, the most crossing graphics that display crossings look visually more appealing if all transformations on subgraphers preserve the aspect ratio, and all gaps on links are nonzoomable (see IlvCrossingAwareLinkImage.setGapZoomable(boolean)).

Since:
JViews 6.0
See Also:
IlvCrossingAwareLinkImage

Constructor Summary
IlvCrossingLinkShapePolicy()
          Creates a crossing 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 afterAny(IlvLinkImage link)
          Allows the policy to react after any of onInstall, onUninstall, afterAdd, beforeRemove, afterSetIntermediateLinkPoints, afterInsertPoint, afterRemovePoint, afterMovePoint, afterApplyTransform, afterFromNodeMoved, and afterToNodeMoved.
 void afterApplyTransform(IlvLinkImage link, IlvTransformer t)
          Allows the policy to react after a transformation was applied.
 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 afterMovePoint(IlvLinkImage link, int index, IlvTransformer t)
          Allows the policy to react after a point was moved.
 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.
 void contentsChanged(ManagerContentChangedEvent evt)
          This method is called by the manager, to notify content modifications.
 boolean isHorizontalPreferred()
          Returns true if the crossings are registered at the horizontal links.
 boolean isNestingTraversal()
          Returns true if the update of crossings will consider all links of the entire nesting hierarchy of subgraphs.
 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 SetCrossingEnabled(IlvManager manager, boolean flag, boolean traverse, boolean redraw)
          Enables or disables the display of crossings of all crossing aware links of the input manager.
 void setHorizontalPreferred(boolean flag)
          Sets whether the crossings should be registered at the horizontal links or at the vertical links.
static void SetHorizontalPreferred(IlvManager manager, boolean flag, boolean traverse, boolean redraw)
          Sets for all links of the input manager whether the crossings should be registered at the horizontal links or at the vertical links.
 void setNestingTraversal(boolean flag)
          Sets whether the crossings should be calculated for the entire nesting hierarchy of subgraphs, or whether the crossings should only be calculated for a flat graph while ignoring links in parent or subgraphs.
static void SetNestingTraversal(IlvManager manager, boolean flag, boolean traverse, boolean redraw)
          Sets whether the crossings should be calculated for the entire nesting hierarchy of subgraphs, or whether the crossings should only be calculated for a flat graph while ignoring links in parent or subgraphs.
 
Methods inherited from class ilog.views.graphic.linkpolicy.IlvAbstractLinkShapePolicy
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
 

Constructor Detail

IlvCrossingLinkShapePolicy

public IlvCrossingLinkShapePolicy()
Creates a crossing link shape policy.

Method Detail

setHorizontalPreferred

public void setHorizontalPreferred(boolean flag)
Sets whether the crossings should be registered at the horizontal links or at the vertical links. If the crossings are registered at the horizontal links, depending on the crossing graphic of the link the horizontal links will contain a gap or tunnel shape at the crossing. If the crossings are registered at the vertical links, these will contain a gap or tunnel shape at the crossing.

You should call this method only before any link uses this policy yet.

The crossings look only nice if all crossing link shape policies of all links of a (potentially nested) managers have the same preference. You can call this method if you know that this is the only instance of a crossing link shape policy in the grapher. Otherwise, it is recommended to use the method SetHorizontalPreferred(IlvManager, boolean, boolean, boolean) which sets the preference of all links in a manager in the same way.

See Also:
IlvCrossingAwareLinkImage.setCrossingGraphic(ilog.views.IlvGraphic), SetHorizontalPreferred(IlvManager, boolean, boolean, boolean), isHorizontalPreferred()

isHorizontalPreferred

public final boolean isHorizontalPreferred()
Returns true if the crossings are registered at the horizontal links.

See Also:
setHorizontalPreferred(boolean)

SetHorizontalPreferred

public static void SetHorizontalPreferred(IlvManager manager,
                                          boolean flag,
                                          boolean traverse,
                                          boolean redraw)
Sets for all links of the input manager whether the crossings should be registered at the horizontal links or at the vertical links. If the crossings are registered at the horizontal links, depending on the crossing graphic of the link the horizontal links will contain a gap or tunnel shape at the crossing. If the crossings are registered at the vertical links, these will contain a gap or tunnel shape at the crossing.

The crossings look only nice if all crossing link shape policies of all links of a (potentially nested) managers have the same preference. This method can be used to set the preference of all links in a manager in the same way.

Parameters:
manager - The manager.
flag - true if horizontal is preferred, false otherwise.
traverse - Whether the submanagers should recursively be traversed as well to set the preference.
redraw - Whether a redraw of all links is required after setting the preference.
See Also:
IlvCrossingAwareLinkImage.setCrossingGraphic(ilog.views.IlvGraphic), setHorizontalPreferred(boolean), isHorizontalPreferred()

setNestingTraversal

public void setNestingTraversal(boolean flag)
Sets whether the crossings should be calculated for the entire nesting hierarchy of subgraphs, or whether the crossings should only be calculated for a flat graph while ignoring links in parent or subgraphs. If true is passed as argument, the update of crossings will consider all links of the entire nesting hierarchy of subgraphs. It will recursively traverse the entire nesting hierarchy to find links that cross each other. If false is passed as argument, the update of crossings will only consider links that belong to the same subgraph. It will only search in the local grapher for links that cross each other.

You should call this method only before any link uses this policy yet.

All crossing link shape policies of all links of a nested managers must behave the same: either they all have the nesting traversal enabled or they all have the nesting traversal disabled. You can call this method if you know that this is the only instance of a crossing link shape policy in the grapher. Otherwise, it is recommended to use the method SetNestingTraversal(IlvManager, boolean, boolean, boolean) which sets the nesting traversal of all links in a manager in the same way.

See Also:
IlvCrossingAwareLinkImage.setCrossingGraphic(ilog.views.IlvGraphic), SetNestingTraversal(IlvManager, boolean, boolean, boolean), isNestingTraversal()

isNestingTraversal

public final boolean isNestingTraversal()
Returns true if the update of crossings will consider all links of the entire nesting hierarchy of subgraphs. Returns false if the update of crossings will only consider links that belong to the same subgraph.

See Also:
setNestingTraversal(boolean)

SetNestingTraversal

public static void SetNestingTraversal(IlvManager manager,
                                       boolean flag,
                                       boolean traverse,
                                       boolean redraw)
Sets whether the crossings should be calculated for the entire nesting hierarchy of subgraphs, or whether the crossings should only be calculated for a flat graph while ignoring links in parent or subgraphs. If true is passed as argument, the update of crossings will consider all links of the entire nesting hierarchy of subgraphs. It will recursively traverse the entire nesting hierarchy to find links that cross each other. If false is passed as argument, the update of crossings will only consider links that belong to the same subgraph. It will only search in the local grapher for links that cross each other.

All crossing link shape policies of all links of a nested managers must behave the same: either they all have the nesting traversal enabled or they all have the nesting traversal disabled. This method can be used to set the nesting traversal of all links in a manager in the same way.

Parameters:
manager - The manager.
flag - true if the nesting traversal is enabled, false otherwise.
traverse - Whether the submanagers should recursively be traversed as well to set the nesting traversal.
redraw - Whether a redraw of all links is required after setting the nesting traversal.
See Also:
IlvCrossingAwareLinkImage.setCrossingGraphic(ilog.views.IlvGraphic), setNestingTraversal(boolean), isNestingTraversal()

SetCrossingEnabled

public static void SetCrossingEnabled(IlvManager manager,
                                      boolean flag,
                                      boolean traverse,
                                      boolean redraw)
Enables or disables the display of crossings of all crossing aware links of the input manager.

Parameters:
manager - The manager.
flag - true if the crossing display is enabled, false otherwise.
traverse - Whether the submanagers should recursively be traversed as well to enable or disable the crossing display.
redraw - Whether a redraw of all links is required after enabling or disabling the crossing display.
See Also:
IlvCrossingAwareLinkImage.setCrossingEnabled(boolean)

afterAdd

public void afterAdd(IlvLinkImage link)
Allows the policy to react after a link with installed policy is added to a grapher.

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.

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.

afterMovePoint

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

Specified by:
afterMovePoint in interface IlvLinkShapePolicy
Overrides:
afterMovePoint in class IlvAbstractLinkShapePolicy
Parameters:
link - The link.
index - The index of the point that was moved.
t - The transformer through which the link is drawn.

afterApplyTransform

public void afterApplyTransform(IlvLinkImage link,
                                IlvTransformer t)
Allows the policy to react after a transformation was applied.

Specified by:
afterApplyTransform in interface IlvLinkShapePolicy
Overrides:
afterApplyTransform in class IlvAbstractLinkShapePolicy
Parameters:
link - The link.
t - The applied transformer.

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.

afterAny

public void afterAny(IlvLinkImage link)
Allows the policy to react after any of onInstall, onUninstall, afterAdd, beforeRemove, afterSetIntermediateLinkPoints, afterInsertPoint, afterRemovePoint, afterMovePoint, afterApplyTransform, afterFromNodeMoved, and afterToNodeMoved.

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

contentsChanged

public void contentsChanged(ManagerContentChangedEvent evt)
This method is called by the manager, to notify content modifications.

Specified by:
contentsChanged in interface ManagerContentChangedListener
Parameters:
evt - the "content changed" event.
See Also:
IlvManager.addManagerContentChangedListener(ilog.views.event.ManagerContentChangedListener), IlvManager.addManagerTreeContentChangedListener(ilog.views.event.ManagerContentChangedListener), IlvManager.removeManagerTreeContentChangedListener(ilog.views.event.ManagerContentChangedListener)


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