For experts: additional features of Link Layout

Using a node-side filter

Some applications require that links are not connected to specific sides of certain nodes. With the Link Layout algorithm, you can restrict to which node side a link can connect by using a node-side filter.
A node-side filter is any class that implements the interface IlvNodeSideFilter. This interface defines the following method:.
public boolean accept(IlvGraphModel graphModel,
                      Object link,
                      boolean origin,
                      Object node,
                      int side);
This method lets the input link connect its origin or destination to the input side of the input node .
As an example, assume that the application requires that for end nodes of type IlvShadowRectangle, links can connect their origin only at the top and bottom side.
For end nodes of type IlvReliefRectangle, links can connect their destination only at the left and right side. You can obtain this result with the following node-side filter:
class MyFilter implements IlvNodeSideFilter
{
     public boolean accept(IlvGraphModel graphModel,
                           Object link,
                           boolean origin,
                           Object node,
                           int side)
    {
        if (node instanceof IlvShadowRectangle && origin)
            return(side == IlvDirection.Top || side == IlvDirection.Bottom);
        if (node instanceof IlvReliefRectangle && !origin)
            return(side == IlvDirection.Left || side == IlvDirection.Right);
        return true;
    }
}
Example of setting node-side filter (Link Layout algorithm)
To set this node-side filter:
In CSS
SDM allows you to specify the node-side constraints using the NodeSideForOrigin and NodeSideForDestination properties. For more information, see Per-object properties of the LinkLayout renderer in Developing with the JViews Diagrammer SDK .
In Java
Call:
layout.setNodeSideFilter(new MyFilter());  
To remove the node-side filter, call:
layout.setNodeSideFilter(null);  

Using a node box interface

Some applications require that the effective area of a node is not exactly its bounding box. For example, if the node has a shadow, the shadow is included in the bounding box. The shadow might not be considered as an obstacle for the links. In this case, the effective bounding box of a node is smaller than the bounding box returned by IlvGraphic.boundingBox .
Example of using a node box interface (Link Layout algorithm)
In CSS
It is not possible to set the node box interface.
In Java
You can modify the effective bounding box of a node by implementing a class that implements the IlvNodeBoxInterface.
This interface defines the following method:
public IlvRect getBox(IlvGraphModel graphModel, Object node);   
By using this method, you can obtain the effective bounding box. For example, to set a node box interface that returns a smaller bounding box for all nodes of type IlvShadowRectangle, call:
layout.setNodeBoxInterface(new IlvNodeBoxInterface() {
        public IlvRect getBox(IlvGraphModel graphModel, Object node) {
            IlvRect rect = graphModel.boundingBox(node);
            if (node instanceof IlvShadowRectangle) {
                // need a rect that is 4 units smaller
                rect.resize(rect.width-4.f, rect.height-4.f); 
            }
            return rect;
        }
    });

Using a link connection box interface

By default, the connection points of the links are distributed on the border of the bounding box of the nodes. Sometimes, it can be necessary to place the connection points on a rectangle that is smaller or larger than the bounding box. For instance, it can happen when labels are displayed below or above nodes.
Using a link connection box interface to modify the position of connection points (Link Layout algorithm)
In CSS
It is not possible to set the link connection box interface.
In Java
You can modify the position of the connection points of the links by implementing a class that implements the IlvLinkConnectionBoxInterface. It is a subinterface of IlvNodeBoxInterface (see Using a node box interface). It defines again the method:
public IlvRect getBox(IlvGraphModel graphModel, Object node);    
This method allows you to return the effective rectangle on which the connection points of the links are placed.
Additionally, the interface IlvLinkConnectionBoxInterface defines a second method:
public float getTangentialOffset(IlvGraphModel graphModel, Object node, int 
nodeSide);  
This method is used only in the short link mode. For details, see Using a link connection box interface. In Link Layout in long link mode, implement the method by returning the value 0.