ilog.views.graphic.linkpolicy
Class IlvAbstractLinkShapePolicy

java.lang.Object
  extended by ilog.views.graphic.linkpolicy.IlvAbstractLinkShapePolicy
All Implemented Interfaces:
IlvLinkShapePolicy
Direct Known Subclasses:
IlvBundleLinkShapePolicy, IlvCrossingLinkShapePolicy, IlvOrthogonalLinkShapePolicy

public abstract class IlvAbstractLinkShapePolicy
extends Object
implements IlvLinkShapePolicy

An IlvAbstractLinkShapePolicy can serve as base class for all advanced link shape policies. It implements a delegation facility to a child policy. This allows to combine link shape policies easily, via setChildPolicy(ilog.views.graphic.linkpolicy.IlvLinkShapePolicy).

Since:
JViews 6.0

Constructor Summary
protected IlvAbstractLinkShapePolicy()
          Creates a new instance of IlvAbstractLinkShapePolicy.
 
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.
 boolean allowApplyTransform(IlvLinkImage link, IlvTransformer t)
          Returns true if the policy allows to apply a transformation.
 boolean allowInsertPoint(IlvLinkImage link, int index, float x, float y, IlvTransformer t)
          Returns true if the policy allows to insert the point.
 boolean allowMovePoint(IlvLinkImage link, int index, float x, float y, IlvTransformer t)
          Returns true if the policy allows to move the point.
 boolean allowRemovePoint(IlvLinkImage link, int index, IlvTransformer t)
          Returns true if the policy allows to remove the point.
 boolean allowSetIntermediateLinkPoints(IlvLinkImage link, IlvPoint[] points, int index, int length)
          Returns true if the policy allows to set the intermediate points.
 void beforeRemove(IlvLinkImage link)
          Allows the policy to react before a link with installed policy is removed from a grapher.
 IlvLinkShapePolicy getChildPolicy()
          Returns the child policy.
 IlvPoint[] getLinkPoints(IlvLinkImage link, IlvTransformer t)
          Returns the points that define the link.
 IlvPoint getPointAt(IlvLinkImage link, int index, IlvTransformer t)
          Returns the point at a given index.
 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.
 void setChildPolicy(IlvLinkShapePolicy policy)
          Sets the child policy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlvAbstractLinkShapePolicy

protected IlvAbstractLinkShapePolicy()
Creates a new instance of IlvAbstractLinkShapePolicy.

Method Detail

setChildPolicy

public void setChildPolicy(IlvLinkShapePolicy policy)
Sets the child policy. If you set a child link shape policy, this policy delegates to the child policy. You should only change the child policy while this link shape policy is not installed.


getChildPolicy

public final IlvLinkShapePolicy getChildPolicy()
Returns the child policy.


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
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
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
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
Parameters:
link - The link.

allowSetIntermediateLinkPoints

public boolean allowSetIntermediateLinkPoints(IlvLinkImage link,
                                              IlvPoint[] points,
                                              int index,
                                              int length)
Returns true if the policy allows to set the intermediate points. Returns false otherwise.

Specified by:
allowSetIntermediateLinkPoints in interface IlvLinkShapePolicy
Parameters:
link - The link.
points - An array of points.
index - The index of the point that will be the first intermediate point.
length - The number of intermediate points taken in the points array.

afterSetIntermediateLinkPoints

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

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

allowInsertPoint

public boolean allowInsertPoint(IlvLinkImage link,
                                int index,
                                float x,
                                float y,
                                IlvTransformer t)
Returns true if the policy allows to insert the point. Returns false otherwise.

Specified by:
allowInsertPoint in interface IlvLinkShapePolicy
Parameters:
link - The link.
index - The index at which the new point will be inserted.
x - The x coordinate of the new point (in manager coordinates).
y - The y coordinate of the new point (in manager coordinates).
t - The transformer through which the link is drawn.

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
Parameters:
link - The link.
index - The index at which the new point was inserted.
t - The transformer through which the link is drawn.

allowRemovePoint

public boolean allowRemovePoint(IlvLinkImage link,
                                int index,
                                IlvTransformer t)
Returns true if the policy allows to remove the point. Returns false otherwise.

Specified by:
allowRemovePoint in interface IlvLinkShapePolicy
Parameters:
link - The link.
index - The index of the point to be removed.
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
Parameters:
link - The link.
index - The index at which a point was removed.
t - The transformer through which the link is drawn.

allowMovePoint

public boolean allowMovePoint(IlvLinkImage link,
                              int index,
                              float x,
                              float y,
                              IlvTransformer t)
Returns true if the policy allows to move the point. Returns false otherwise.

Specified by:
allowMovePoint in interface IlvLinkShapePolicy
Parameters:
link - The link.
index - The index of the point to be moved.
x - The new x coordinate (in manager coordinates).
y - The new y coordinate (in manager coordinates).
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
Parameters:
link - The link.
index - The index of the point that was moved.
t - The transformer through which the link is drawn.

allowApplyTransform

public boolean allowApplyTransform(IlvLinkImage link,
                                   IlvTransformer t)
Returns true if the policy allows to apply a transformation. Returns false otherwise.

Specified by:
allowApplyTransform in interface IlvLinkShapePolicy
Parameters:
link - The link.
t - The transformer to be applied.

afterApplyTransform

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

Specified by:
afterApplyTransform in interface IlvLinkShapePolicy
Parameters:
link - The link.
t - The transformer to be applied.

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
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
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. While during the methods above, the policy is temporarily deactivated at the link to avoid that link shape changes done by the policy loops calls the policy again in an infinite loop, the method afterAny is called when the policy is again activated. Hence, the policy should not change the link shape inside this method, but rather can perform cleanup methods needed for the methods above.

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

getLinkPoints

public IlvPoint[] getLinkPoints(IlvLinkImage link,
                                IlvTransformer t)
Returns the points that define the link.

Specified by:
getLinkPoints in interface IlvLinkShapePolicy
Parameters:
link - The link.
t - The transformer to be applied.

getPointAt

public IlvPoint getPointAt(IlvLinkImage link,
                           int index,
                           IlvTransformer t)
Returns the point at a given index.

Specified by:
getPointAt in interface IlvLinkShapePolicy
Parameters:
link - The link.
index - The index of the point.
t - The transformer to be applied.


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