ilog.views.graphlayout.bus
Class IlvBusLayout

java.lang.Object
  extended by ilog.views.graphlayout.IlvGraphLayout
      extended by ilog.views.graphlayout.bus.IlvBusLayout
All Implemented Interfaces:
GraphModelListener, Serializable, EventListener

public class IlvBusLayout
extends IlvGraphLayout

The main class for the Bus Layout algorithm.

The Bus Layout algorithm is designed to display bus network topologies, that is, a set of nodes connected to a bus node. The algorithm takes into account the size of the nodes (so that no nodes overlap) and provides several ordering and alignment options.

Here is a sample drawing produced with the Bus Layout algorithm:

To use this layout style, you must specify a node of the attached graph model as the "bus" using the method setBus(ilog.views.IlvPolyPointsInterface). The bus node must be an instance of a class that implements the interface IlvPolyPointsInterface, for instance, an IlvPolyline (or a subclass). The layout algorithm gives the bus polyline the appropriate shape by moving, adding, or removing points as needed. Therefore, the initial number of points and the position of those points are not significant. Note that for the bus object, you can use only implementations of the interface IlvPolyPointsInterface for which the methods IlvPolyPointsInterface.allowsPointInsertion() and IlvPolyPointsInterface.allowsPointRemoval() return true.

Only the nodes connected to the bus node by a link are laid out.

The following figure illustrates the dimensional parameters of the layout algorithm.

The algorithm not only computes the shape of the bus object and the position of the nodes connected to the bus but also the connection points of the links on the bus node. These points are computed in such a manner as to obtain vertical links.

If the attached graph model encapsulates an IlvGrapher, the computation of the connection points is provided by a special subclass of IlvLinkConnector called IlvBusLinkConnector. Otherwise, the method getConnectionPoint(java.lang.Object, ilog.views.IlvPolyPointsInterface) is provided to allow you to implement a different mechanism.

See the corresponding chapter of the User's Manual for details on the algorithm, the types of graphs for which this algorithm can be used, the features, code samples, parameters, and so on.

Note that the initial position of the nodes (at the moment you start the layout) does not affect the resulting layout. However, nodes specified as fixed are not moved if you call the method IlvGraphLayout.setPreserveFixedNodes(boolean) with a true argument. The other nodes are placed in such a way that overlaps with the fixed nodes are avoided.

See Also:
Serialized Form

Field Summary
static int ALTERNATE
          Alternate flow direction.
static Comparator ASCENDING_AREA
          Ordering by ascending area.
static Comparator ASCENDING_HEIGHT
          Ordering by ascending height.
static Comparator ASCENDING_INDEX
          Ordering by ascending index.
static Comparator ASCENDING_WIDTH
          Ordering by ascending width.
static int BOTTOM
          Bottom alignment option.
static int CENTER
          Center alignment option.
static Comparator DESCENDING_AREA
          Ordering by descending area.
static Comparator DESCENDING_HEIGHT
          Ordering by descending height.
static Comparator DESCENDING_INDEX
          Ordering by descending index.
static Comparator DESCENDING_WIDTH
          Ordering by descending width.
static int LEFT_TO_RIGHT
          Left-to-right flow direction.
static int MIXED
          Mixed alignment option.
static int NO_INDEX
          No index code.
static int NO_ORDERING
          Deprecated. Beginning with ILOG JViews 6.5, pass the value null to setNodeComparator(java.util.Comparator) instead.
static int NO_RESHAPE_STYLE
          No links reshape option.
static int NODES_ABOVE_BUS
          Above bus position of the nodes.
static int NODES_BELOW_BUS
          Below bus position of the nodes.
static int ORDER_BY_HEIGHT
          Deprecated. Beginning with ILOG JViews 6.5, pass the value DESCENDING_HEIGHT to the method setNodeComparator(java.util.Comparator) instead.
static int ORDER_BY_INDEX
          Deprecated. Beginning with ILOG JViews 6.5, pass the value ASCENDING_INDEX to the method setNodeComparator(java.util.Comparator) instead.
static int STRAIGHT_LINE_STYLE
          Straight-line links shape option.
static int TOP
          Top alignment option.
 
Fields inherited from class ilog.views.graphlayout.IlvGraphLayout
INVERSE_VIEW_COORDINATES, MANAGER_COORDINATES, VIEW_COORDINATES
 
Constructor Summary
IlvBusLayout()
          Creates a new instance of the Bus Layout algorithm.
IlvBusLayout(IlvBusLayout source)
          Creates a new layout instance by copying an existing one.
 
Method Summary
 int checkAppropriateLink(Object link)
          Checks whether the input link is appropriate for this layout.
 IlvGraphLayout copy()
          Copies the layout instance.
 void copyParameters(IlvGraphLayout source)
          Copies the parameters from a given layout instance.
protected  IlvGraphLayoutGrapherProperty createLayoutGrapherProperty(String name, boolean withDefaults)
          Returns a new instance of IlvBusLayoutGrapherProperty that stores the parameter settings of this layout class.
protected  IlvGraphLayoutNodeProperty createLayoutNodeProperty(String name, IlvGraphic node, boolean withDefaults)
          Returns a new instance of IlvBusLayoutNodeProperty that stores the parameter settings of this layout class for nodes.
 void detach()
          Overridden version of the method detach.
 IlvPolyPointsInterface getBus()
          Returns the current bus node.
 float getConnectionOnBusMargin()
          Returns the horizontal offset between the first/last node on a given level and the left/right margin of the level.
 IlvPoint getConnectionPoint(Object link, IlvPolyPointsInterface bus)
          Returns the connection point of link on the bus node.
 int getFlowDirection()
          Returns the option that specifies the flow direction of the nodes.
 int getGlobalVerticalAlignment()
          Returns the global vertical alignment style.
 float getHorizontalOffset()
          Returns the horizontal offset between nodes placed on the same level of the bus.
 int getIndex(Object node)
          Returns the index associated with a node.
 IlvBusLinkConnector getLinkConnector()
          Returns the link connector installed on the bus node, if the bus is already specified, or the link connector instance that will be installed on the bus when it is specified.
 int getLinkStyle()
          Returns the current option for the style of the shape of the links.
 float getMargin()
          Returns the horizontal offset between the left/right border of the bus level and the left/right border of the layout region.
 float getMarginOnBus()
          Returns the horizontal offset between the first/last node on a given level and the left/right margin of the level.
 int getMaxNumberOfNodesPerLevel()
          Returns the maximum number of nodes per level.
 IlvGraphicVector getMovingNodes()
          Returns the vector of nodes being moved by the graph layout algorithm.
 Comparator getNodeComparator()
          Returns the comparator used for sorting the nodes.
 int getNodePosition()
          Returns the node position option.
 int getOrdering()
          Deprecated. Beginning with ILOG JViews 6.5, use the method getNodeComparator() instead.
 int getVerticalAlignment(Object node)
          Returns the local vertical alignment style of the node.
 float getVerticalOffsetToLevel()
          Returns the vertical offset between the nodes and the horizontal level of the bus to which they are connected.
 float getVerticalOffsetToPreviousLevel()
          Returns the vertical offset between nodes and the horizontal level of the bus above the nodes.
protected  void init()
          Initializes instance variables.
 boolean isBusLineExtremityAdjustingEnabled()
          Returns true if the adjustment of the extremity points of the bus line is enabled.
 boolean isBusWidthAdjustingEnabled()
          Returns true if the adjustment of the bus width to the total width of the nodes is enabled.
 boolean isIncrementalMode()
          Returns true if the incremental mode is enabled.
protected  void layout(boolean redraw)
          Computes the layout using the Bus Layout algorithm.
protected  IlvBusLinkConnector makeLinkConnector()
          Creates a new instance of the link connector.
 void setBus(IlvPolyPointsInterface bus)
          Allows you to specify the bus node.
 void setBusLineExtremityAdjustingEnabled(boolean enable)
          Enables the adjustment of the extremity points of the bus line.
 void setBusWidthAdjustingEnabled(boolean enable)
          Enables the adjustment of the bus width to the total width of the nodes.
 void setConnectionOnBusMargin(float margin)
          Sets the horizontal offset between the first/last node on a given level and the left/right margin of the level.
 void setFlowDirection(int direction)
          Allows you to specify the flow direction of the nodes.
 void setGlobalVerticalAlignment(int alignment)
          Sets the global vertical alignment style.
 void setHorizontalOffset(float offset)
          Sets the horizontal offset between nodes placed on the same level of the bus.
 void setIncrementalMode(boolean enable)
          Enables or disables the incremental mode.
 void setIndex(Object node, int index)
          Allows you to specify the index of a node.
 void setLinkStyle(int style)
          Sets the style of the shape of the links.
 void setMargin(float margin)
          Sets the horizontal offset between the left/right border of the bus level and the left/right border of the layout region.
 void setMarginOnBus(float margin)
          Sets the horizontal offset between the first/last node on a given level and the left/right margin of the level.
 void setMaxNumberOfNodesPerLevel(int nNodes)
          Sets the maximum number of nodes per level.
 void setNodeComparator(Comparator comparator)
          Sets the comparator used for sorting the nodes.
 void setNodePosition(int position)
          Sets the position of the nodes in respect to the bus line.
 void setOrdering(int ordering)
          Deprecated. Beginning with ILOG JViews 6.5, use the method setNodeComparator(java.util.Comparator) instead.
 void setVerticalAlignment(Object node, int alignment)
          Sets the vertical alignment style of an individual node.
 void setVerticalOffsetToLevel(float offset)
          Sets the vertical offset between the nodes and the horizontal level of the bus to which they are connected.
 void setVerticalOffsetToPreviousLevel(float offset)
          Sets the vertical offset between the nodes and the horizontal level of the bus above the nodes.
 boolean supportsAllowedTime()
          Indicates that this layout class can stop the layout computation in a proper manner when the user-defined allowed time is exceeded.
 boolean supportsLayoutOfConnectedComponents()
          Indicates that this layout class can cut the attached graph into connected components, apply itself to each connected component separately, and use the layout instance returned by the method IlvGraphLayout.getLayoutOfConnectedComponents() to position the connected components.
 boolean supportsLayoutRegion()
          Indicates that this layout class can control the size of the graph drawing to fit a user-defined region (a rectangle) or a user-defined manager view.
 boolean supportsLinkClipping()
          Indicates that this layout class can use a link clip interface to clip the end points of a link.
 boolean supportsLinkConnectionBox()
          Indicates that this layout class can use a link connection box interface to calculate the end points of a link.
 boolean supportsPreserveFixedNodes()
          Indicates that this layout class allows the user to specify fixed nodes.
 boolean supportsSaveParametersToNamedProperties()
          Indicates that this layout class can transfer the layout parameters to named properties.
 boolean supportsStopImmediately()
          Indicates that this layout class can interrupt the current run of layout immediately in a controlled way.
 
Methods inherited from class ilog.views.graphlayout.IlvGraphLayout
addGraphLayoutEventListener, addGraphLayoutParameterEventListener, afterLayoutOfSubgraph, attach, attach, beforeLayout, beforeLayoutOfSubgraph, callLayoutStepPerformedIfNeeded, checkAppropriateLinks, cleanGraphModel, cleanLink, cleanNode, clipAllLinks, clipLink, contentsChanged, createLayoutLinkProperty, createLayoutReport, getAllowedTime, getAutoLayoutHandler, getBalanceSplineCurveThreshold, getCalcLayoutRegion, getCoordinatesMode, getGrapher, getGraphModel, getInstanceId, getLayout, getLayoutOfConnectedComponents, getLayoutOfConnectedComponentsReport, getLayoutRegion, getLayoutReport, getLayouts, getLinkClipInterface, getLinkConnectionBoxInterface, getMaxSplineCurveSize, getMinBusyTime, getMinSplineCurveSize, getParentLayout, getProperty, getProperty, getRecursiveLayout, getRemainingAllowedTime, getSeedValueForRandomGenerator, getSpecLayoutRegion, getSplineLinkFilter, increasePercentageComplete, isAnimate, isAutoLayout, isFitToView, isFixed, isGeometryUpToDate, isInputCheckEnabled, isLayoutNeeded, isLayoutOfConnectedComponentsEnabled, isLayoutOfConnectedComponentsEnabledByDefault, isLayoutRunning, isLayoutTimeElapsed, isMemorySavings, isParametersUpToDate, isPreserveFixedLinks, isPreserveFixedNodes, isSplineRoutingEnabled, isStoppedImmediately, isStructureUpToDate, isUseDefaultParameters, isUseSeedValueForRandomGenerator, layoutStepPerformed, onParameterChanged, onParameterChanged, performAutoLayout, performLayout, performLayout, performLayout, PerformLayout, performSublayout, removeGraphLayoutEventListener, removeGraphLayoutParameterEventListener, setAllowedTime, setAnimate, setAutoLayout, setAutoLayoutHandler, setBalanceSplineCurveThreshold, setCoordinatesMode, setFixed, setGeometryUpToDate, setGrapher, setGraphModel, setInputCheckEnabled, setLayoutOfConnectedComponents, setLayoutOfConnectedComponentsEnabled, setLayoutRegion, setLayoutRegion, setLayoutRegion, setLayoutReport, setLinkClipInterface, setLinkConnectionBoxInterface, setMaxSplineCurveSize, setMemorySavings, setMinBusyTime, setMinSplineCurveSize, setParametersUpToDate, setParentLayout, setPreserveFixedLinks, setPreserveFixedNodes, setProperty, setProperty, setSeedValueForRandomGenerator, setSplineLinkFilter, setSplineRoutingEnabled, setStructureUpToDate, setUseDefaultParameters, setUseSeedValueForRandomGenerator, stopImmediately, supportsAnimation, supportsMemorySavings, supportsPercentageComplete, supportsPreserveFixedLinks, supportsRandomGenerator, supportsSplineRouting, unfixAllLinks, unfixAllNodes, useAnimateRedraw
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_ORDERING

public static final int NO_ORDERING
Deprecated. Beginning with ILOG JViews 6.5, pass the value null to setNodeComparator(java.util.Comparator) instead.
No ordering option. When used as the argument of the method setOrdering(int), the nodes are arranged on the bus arbitrarily.

See Also:
Constant Field Values

ORDER_BY_HEIGHT

public static final int ORDER_BY_HEIGHT
Deprecated. Beginning with ILOG JViews 6.5, pass the value DESCENDING_HEIGHT to the method setNodeComparator(java.util.Comparator) instead.
Ordering by height option. When used as the argument of the method setOrdering(int), the nodes are arranged on the bus by height, starting at the upper-left margin of the bus with the tallest node. Ordering the nodes by height can save vertical space and produce a more compact layout.

See Also:
Constant Field Values

ORDER_BY_INDEX

public static final int ORDER_BY_INDEX
Deprecated. Beginning with ILOG JViews 6.5, pass the value ASCENDING_INDEX to the method setNodeComparator(java.util.Comparator) instead.
Ordering by index option. When used as the argument of the method setOrdering(int), the nodes are arranged on the bus in the order of their indexes, starting at the upper-left margin of the bus with the node with the smallest index. Nodes that do not have an index are placed after the nodes for which an index is specified. Ordering by index allows you to specify a particular order for the nodes.

See Also:
Constant Field Values

DESCENDING_HEIGHT

public static final Comparator DESCENDING_HEIGHT
Ordering by descending height. When used as the argument of the method setNodeComparator(java.util.Comparator), the nodes are arranged on the bus by height, starting at the upper-left margin of the bus with the tallest node. Ordering the nodes by height can save vertical space and produce a more compact layout.

Since:
JViews 6.5

ASCENDING_HEIGHT

public static final Comparator ASCENDING_HEIGHT
Ordering by ascending height. When used as the argument of the method setNodeComparator(java.util.Comparator), the nodes are arranged on the bus by ascending height, starting at the upper-left margin of the bus with the node of the smallest height. Ordering the nodes by height can save vertical space and produce a more compact layout.

Since:
JViews 6.5

ASCENDING_WIDTH

public static final Comparator ASCENDING_WIDTH
Ordering by ascending width. When used as the argument of the method setNodeComparator(java.util.Comparator), the nodes are arranged on the bus by ascending width, starting at the upper-left margin of the bus with the node of the smallest width.

Since:
JViews 6.5

DESCENDING_WIDTH

public static final Comparator DESCENDING_WIDTH
Ordering by descending width. When used as the argument of the method setNodeComparator(java.util.Comparator), the nodes are arranged on the bus by width, starting at the upper-left margin of the bus with the node of the highest width.

Since:
JViews 6.5

ASCENDING_AREA

public static final Comparator ASCENDING_AREA
Ordering by ascending area. When used as the argument of the method setNodeComparator(java.util.Comparator), the nodes are arranged on the bus by ascending area, starting at the upper-left margin of the bus with the node of the smallest area.

Since:
JViews 6.5

DESCENDING_AREA

public static final Comparator DESCENDING_AREA
Ordering by descending area. When used as the argument of the method setNodeComparator(java.util.Comparator), the nodes are arranged on the bus by area, starting at the upper-left margin of the bus with the node of the highest area.

Since:
JViews 6.5

ASCENDING_INDEX

public static final Comparator ASCENDING_INDEX
Ordering by ascending index. When used as the argument of the method setNodeComparator(java.util.Comparator), the nodes are arranged on the bus in the order of their indexes, starting at the upper-left margin of the bus with the node with the smallest index. Nodes that do not have an index are placed after the nodes for which an index is specified. Ordering by index allows you to specify a particular order for the nodes.

Since:
JViews 6.5

DESCENDING_INDEX

public static final Comparator DESCENDING_INDEX
Ordering by descending index. When used as the argument of the method setNodeComparator(java.util.Comparator), the nodes are arranged on the bus in the order of their indexes, starting at the upper-left margin of the bus with the node with the highest index. Nodes that do not have an index are placed after the nodes for which an index is specified. Ordering by index allows you to specify a particular order for the nodes.

Since:
JViews 6.5

NO_INDEX

public static final int NO_INDEX
No index code. This value is returned by the method getIndex(java.lang.Object) when a node has no index value.

See Also:
Constant Field Values

STRAIGHT_LINE_STYLE

public static final int STRAIGHT_LINE_STYLE
Straight-line links shape option. When used as the argument of the method setLinkStyle(int), the links are given a straight-line shape.

Since:
JViews 3.0
See Also:
Constant Field Values

NO_RESHAPE_STYLE

public static final int NO_RESHAPE_STYLE
No links reshape option. When used as the argument of the method setLinkStyle(int), the links are not reshaped.

Since:
JViews 3.0
See Also:
Constant Field Values

CENTER

public static final int CENTER
Center alignment option.

When used as the argument of the method setGlobalVerticalAlignment(int), all the nodes are vertically centered on their level. The alignment of an individual node can be set by setVerticalAlignment(Object, int).

Since:
JViews 3.5
See Also:
Constant Field Values

TOP

public static final int TOP
Top alignment option. When used as the argument of the method setGlobalVerticalAlignment(int), all the nodes are aligned to the top border of their level. The alignment of an individual node can be set by setVerticalAlignment(Object, int).

Since:
JViews 3.5
See Also:
Constant Field Values

BOTTOM

public static final int BOTTOM
Bottom alignment option. When used as the argument of the method setGlobalVerticalAlignment(int), all the nodes are aligned to the bottom border of their level. The alignment of an individual node can be set by setVerticalAlignment(Object, int).

Since:
JViews 3.5
See Also:
Constant Field Values

MIXED

public static final int MIXED
Mixed alignment option. When used as the argument of the method setGlobalVerticalAlignment(int), each node can have a different alignment. The alignment of an individual node can be set by setVerticalAlignment(Object, int).

Since:
JViews 3.5
See Also:
Constant Field Values

LEFT_TO_RIGHT

public static final int LEFT_TO_RIGHT
Left-to-right flow direction. When used as the argument of the method setFlowDirection(int), all the nodes "flow" from left to right on all levels of the bus.

Since:
JViews 3.5
See Also:
Constant Field Values

ALTERNATE

public static final int ALTERNATE
Alternate flow direction. When used as the argument of the method setFlowDirection(int), all the nodes "flow" from left to right on the odd bus levels (first, third, fifth, and so on) and from right to left on the even bus levels (second, fourth, sixth, and so on). The levels are numbered from the top.

Since:
JViews 3.5
See Also:
Constant Field Values

NODES_ABOVE_BUS

public static final int NODES_ABOVE_BUS
Above bus position of the nodes. When used as the argument of the method setNodePosition(int), the nodes are placed above the corresponding bus line.

Since:
JViews 7.5
See Also:
Constant Field Values

NODES_BELOW_BUS

public static final int NODES_BELOW_BUS
Below bus position of the nodes. When used as the argument of the method setNodePosition(int), the nodes are placed below the corresponding bus line.

Since:
JViews 7.5
See Also:
Constant Field Values
Constructor Detail

IlvBusLayout

public IlvBusLayout()
Creates a new instance of the Bus Layout algorithm.
To indicate the grapher you want to lay out, use the method IlvGraphLayout.attach(IlvGrapher).
To indicate the graph model you want to lay out, use the method IlvGraphLayout.attach(IlvGraphModel).
To indicate the bus node, use the method setBus(ilog.views.IlvPolyPointsInterface).
To perform the layout, use the method IlvGraphLayout.performLayout().
To modify the layout parameters, use the various methods provided in this class and its superclass.

See Also:
IlvGraphLayout.attach(ilog.views.IlvGrapher), IlvGraphLayout.attach(ilog.views.graphlayout.IlvGraphModel), IlvGraphLayout.performLayout()

IlvBusLayout

public IlvBusLayout(IlvBusLayout source)
Creates a new layout instance by copying an existing one. This constructor is used by the copy() method. Any subclass should provide a copy constructor.

The parameters of the source layout are copied using the method copyParameters(ilog.views.graphlayout.IlvGraphLayout).

Parameters:
source - The layout instance that is copied.
Since:
JViews 5.0
See Also:
copy(), copyParameters(ilog.views.graphlayout.IlvGraphLayout)
Method Detail

copy

public IlvGraphLayout copy()
Copies the layout instance.

This method copies the layout instance by calling the copy constructor.

When performing a recursive layout of a nested graph, this method is used by IlvLayoutProvider to "clone" the layout instance of a parent graph.

Note that the parameters which are specific to a node or a link are not copied. The other parameters, including the layout region specification and the customization interfaces, are also copied. A copy of the layout instance used for laying out the connected components is set on the new instance.

If a method of the type supportsXXX is associated with a parameter, the parameter is copied only if the corresponding method returns true.

Specified by:
copy in class IlvGraphLayout
Returns:
A copy of the layout instance.
Since:
JViews 5.0

copyParameters

public void copyParameters(IlvGraphLayout source)
Copies the parameters from a given layout instance.

Note that the parameters which are specific to a node or a link are not copied. The other parameters, including the layout region specification and the customization interfaces, are also copied. A copy of the layout instance used for laying out the connected components is set on this layout instance.

If a method of the type supportsXXX is associated with a parameter, the parameter is copied only if the corresponding method returns true.

Overrides:
copyParameters in class IlvGraphLayout
Parameters:
source - The layout instance from which the parameters are copied.
Since:
JViews 5.0
See Also:
copy()

init

protected void init()
Initializes instance variables.

You should not call this method directly. The method is called internally by the constructor without arguments and by the copy constructor. The method must be overridden by subclasses that need to initialize additional instance variables.

Overrides:
init in class IlvGraphLayout
Since:
JViews 5.0

detach

public void detach()
Overridden version of the method detach.

Overrides:
detach in class IlvGraphLayout
See Also:
detach()

layout

protected void layout(boolean redraw)
               throws IlvGraphLayoutException
Computes the layout using the Bus Layout algorithm. To start the layout, call the method IlvGraphLayout.performLayout().

Specified by:
layout in class IlvGraphLayout
Parameters:
redraw - If true, the attached graph model will be asked to redraw the graph after layout. When the layout algorithm moves the nodes and reshapes the links, it is required to pass the value of the redraw argument to the methods IlvGraphModel.moveNode(java.lang.Object, float, float, boolean) and IlvGraphModel.reshapeLink(java.lang.Object, ilog.views.IlvPoint, ilog.views.IlvPoint[], int, int, ilog.views.IlvPoint, boolean).
Throws:
IlvGraphLayoutException - in the following cases:
  • No bus found (see getBus()).
  • If the following relationship is not respected: getCalcLayoutRegion().width > 2*getMargin() + 2*getMarginOnBus()
IlvInappropriateLinkException - if the grapher contains links that cannot be reshaped to a straight line and the link style is STRAIGHT_LINE_STYLE. (For details, see IlvInappropriateLinkException).
See Also:
IlvGraphLayout.performLayout(), IlvGraphLayout.getCalcLayoutRegion(), getMargin(), getMarginOnBus()

supportsPreserveFixedNodes

public final boolean supportsPreserveFixedNodes()
Indicates that this layout class allows the user to specify fixed nodes. Fixed nodes are not moved during the layout if the method setPreserveFixedNodes(boolean) is called with a true argument.

Overrides:
supportsPreserveFixedNodes in class IlvGraphLayout
Returns:
Always true.
See Also:
IlvGraphLayout.setPreserveFixedNodes(boolean), IlvGraphLayout.isPreserveFixedNodes()

supportsLayoutRegion

public final boolean supportsLayoutRegion()
Indicates that this layout class can control the size of the graph drawing to fit a user-defined region (a rectangle) or a user-defined manager view.

This layout uses the layout region to determine the vertical positioning of the upper level of the bus and the horizontal dimension of the levels of the bus. The height of the layout region is not used because it may need to be larger or smaller depending on the amount of space required for the drawing.

Overrides:
supportsLayoutRegion in class IlvGraphLayout
Returns:
Always true.
See Also:
IlvGraphLayout.setLayoutRegion(ilog.views.IlvManagerView), IlvGraphLayout.setLayoutRegion(ilog.views.IlvManagerView, ilog.views.IlvRect), IlvGraphLayout.setLayoutRegion(ilog.views.IlvRect), IlvGraphLayout.getSpecLayoutRegion(), IlvGraphLayout.getCalcLayoutRegion()

supportsLayoutOfConnectedComponents

public final boolean supportsLayoutOfConnectedComponents()
Indicates that this layout class can cut the attached graph into connected components, apply itself to each connected component separately, and use the layout instance returned by the method IlvGraphLayout.getLayoutOfConnectedComponents() to position the connected components. By default, this layout is an instance of IlvGridLayout that can be customized as needed.

Overrides:
supportsLayoutOfConnectedComponents in class IlvGraphLayout
Returns:
Always true.
Since:
JViews 3.5
See Also:
IlvGraphLayout.getLayoutOfConnectedComponents(), IlvGraphLayout.isLayoutOfConnectedComponentsEnabled(), IlvGraphLayout.performLayout(boolean, boolean)

supportsAllowedTime

public final boolean supportsAllowedTime()
Indicates that this layout class can stop the layout computation in a proper manner when the user-defined allowed time is exceeded. If the allowed time elapses before termination of the layout algorithm, some nodes are not moved and remain at the same position as before the start of the algorithm. The result code in the layout report is IlvGraphLayoutReport.STOPPED_AND_INVALID in this case.

Overrides:
supportsAllowedTime in class IlvGraphLayout
Returns:
Always true.
See Also:
IlvGraphLayout.setAllowedTime(long), IlvGraphLayout.getAllowedTime(), IlvGraphLayoutReport.getCode()

supportsStopImmediately

public final boolean supportsStopImmediately()
Indicates that this layout class can interrupt the current run of layout immediately in a controlled way. If the algorithm is stopped before termination of the layout algorithm, some nodes are not moved and remain at the same position as before the start of the algorithm. The result code in the layout report is IlvGraphLayoutReport.STOPPED_AND_INVALID in this case.

Overrides:
supportsStopImmediately in class IlvGraphLayout
Returns:
Always true.
Since:
JViews 3.5
See Also:
IlvGraphLayout.stopImmediately(), IlvGraphLayout.isStoppedImmediately()

supportsLinkConnectionBox

public final boolean supportsLinkConnectionBox()
Indicates that this layout class can use a link connection box interface to calculate the end points of a link. The link connection box interface is an object that provides the rectangle to which the links are connected for each node and the tangential shift offset at each side for the connection points.

The connection box interface is used only if link clipping is enabled by setting a link clip interface and the link style is straight line. In this case, the layout algorithm calculates the virtual center of the end nodes of each link by the link connection box interface and obtains the final connection points by clipping with the link clip interface. The virtual center is defined as the center of the connection box shifted by the average of the tangential "top" and "bottom" offset in the horizontal direction and the average of the tangential "left" and "right" offset in the vertical direction. For instance, if the tangential offset is 20 at the top side and 10 at all other sides, the average shift offset is (20 + 10)/2 = 15 in the horizontal direction and (10 + 10)/2 = 10 in the vertical direction; hence the virtual center is at connectionBox.center() + (15, 10).

The bus node is never treated by the link clipping, because the bus node usually has a special bus link connector (see IlvBusLinkConnector). Therefore, the link connection box does not affect the bus node.

If no link clipping is performed, the layout algorithm does not actively place the end points of links. It relies on the link connectors that are attached to the nodes to find appropriate connection points for the links.

Overrides:
supportsLinkConnectionBox in class IlvGraphLayout
Returns:
Always true.
Since:
JViews 5.0
See Also:
IlvGraphLayout.setLinkConnectionBoxInterface(ilog.views.graphlayout.IlvLinkConnectionBoxInterface), IlvGraphLayout.setLinkClipInterface(ilog.views.graphlayout.IlvLinkClipInterface), IlvLinkConnector, setLinkStyle(int), setBus(ilog.views.IlvPolyPointsInterface), supportsLinkClipping()

supportsLinkClipping

public final boolean supportsLinkClipping()
Indicates that this layout class can use a link clip interface to clip the end points of a link. The link clip interface is an object that provides the connection for a link clipped at the border of the shape of the end node. This is useful if the nodes have a non-rectangular shape such as a triangle, rhombus, or circle.

The bus node is never treated by the link clipping because the bus node usually has a special bus link connector (see IlvBusLinkConnector).

Link clipping is performed only if the link style is straight line. If no link clip interface is given, the layout algorithm does not actively place the end points of links. It relies on the link connectors that are attached to the nodes to find appropriate connection points for the links.

Overrides:
supportsLinkClipping in class IlvGraphLayout
Returns:
Always true.
Since:
JViews 5.0
See Also:
IlvGraphLayout.setLinkClipInterface(ilog.views.graphlayout.IlvLinkClipInterface), IlvLinkConnector, setLinkStyle(int), setBus(ilog.views.IlvPolyPointsInterface), supportsLinkConnectionBox()

supportsSaveParametersToNamedProperties

public final boolean supportsSaveParametersToNamedProperties()
Indicates that this layout class can transfer the layout parameters to named properties. This mechanism can be used if layout parameters must be stored persistently in an .ivl file.

Overrides:
supportsSaveParametersToNamedProperties in class IlvGraphLayout
Returns:
Always true.
Since:
JViews 3.5
See Also:
IlvGrapherAdapter.saveParametersToNamedProperties(IlvGraphLayout, boolean), IlvGrapherAdapter.loadParametersFromNamedProperties(IlvGraphLayout), IlvGrapherAdapter.removeParametersFromNamedProperties()

setBus

public void setBus(IlvPolyPointsInterface bus)
Allows you to specify the bus node. The bus node must be a node contained in the attached graph.

The number of points on the "polypoints" is not significant. The methods IlvPolyPointsInterface.allowsPointInsertion() and IlvPolyPointsInterface.allowsPointRemoval(), defined in the class IlvPolyPointsInterface, must return true.

Note that if the attached graph is an IlvGrapher (or IlvGrapherAdapter), this method automatically installs on the bus node the instance of the link connector returned by the method makeLinkConnector().

Remark: It may be useful to restrict users from modifying the bus node. If the bus node is an IlvPolyline contained in an IlvGrapher, you can call the method IlvManager.setEditable(ilog.views.IlvGraphic, boolean) on the grapher instance with a false parameter.

Throws:
IllegalArgumentException - If bus is not a node in the attached graph (the method IlvGraphModel.isNode(java.lang.Object) is called), or the bus object does not allow point insertion and removal (the methods IlvPolyPointsInterface.allowsPointInsertion() and IlvPolyPointsInterface.allowsPointRemoval() are called on the bus object).
Since:
JViews 3.0. This method replaces the method setBus(IlvPolyline).
See Also:
getBus()

getBus

public IlvPolyPointsInterface getBus()
Returns the current bus node. If no bus is specified or the specified bus object is no longer a valid node of the attached graph (the method IlvGraphModel.isNode(java.lang.Object) is called), the method automatically searches for a node that is an instance of IlvPolyPointsInterface. If none is found, the method returns null.

The method also returns null if the previously specified bus object is null or is no longer a node in the attached graph, or if no graph is attached.

Since:
JViews 3.0. This method replaces the method IlvPolyline getBus().
See Also:
setBus(ilog.views.IlvPolyPointsInterface)

setIndex

public void setIndex(Object node,
                     int index)
Allows you to specify the index of a node. When the layout is performed, the nodes for which indexes have been specified are arranged on the bus in the order corresponding to their index (starting in the upper-left corner with the smallest index). The nodes for which indexes have not been specified are arranged after them. You can specify the class variable NO_INDEX as an index value if you want to reset an index you previously specified.

Note that index must not be negative. The values of the indexes for consecutive nodes are not necessarily consecutive. Only the order of the values is important.

Since:
JViews 3.0. This method replaces the method setIndex(IlvGraphic, int).
See Also:
getIndex(java.lang.Object)

getIndex

public int getIndex(Object node)
Returns the index associated with a node. It returns NO_INDEX if node has no index.

Since:
JViews 3.0. This method replaces the method getIndex(IlvGraphic).
See Also:
setIndex(java.lang.Object, int)

getLinkConnector

public IlvBusLinkConnector getLinkConnector()
Returns the link connector installed on the bus node, if the bus is already specified, or the link connector instance that will be installed on the bus when it is specified.

Returns null if the attached graph is not an IlvGrapherAdapter or IlvGrapher.

See Also:
makeLinkConnector()

makeLinkConnector

protected IlvBusLinkConnector makeLinkConnector()
Creates a new instance of the link connector.

The default implementation returns a new instance of IlvBusLinkConnector. This method can be overridden to create subclasses of IlvBusLinkConnector. If the overridden method returns null, no link connector is installed on the bus node. Note that the method is called only when the attached graph is an IlvGrapherAdapter or an IlvGrapher.

See Also:
getLinkConnector()

getConnectionPoint

public IlvPoint getConnectionPoint(Object link,
                                   IlvPolyPointsInterface bus)
Returns the connection point of link on the bus node.

This method is provided to obtain the connection points of the links on the bus node in case the attached graph model does not encapsulate an IlvGrapher. If the attached graph model encapsulates an IlvGrapher, the layout of the connection points of the links are computed by the class IlvBusLinkConnector and this method is not used.

This method should be used only after having performed the layout, that is, after the bus node has been reshaped. Also, the method should be called only for links that have the bus object as the origin or destination node and are not self-links (same origin and destination nodes).

Since:
JViews 3.0
See Also:
IlvBusLinkConnector, setConnectionOnBusMargin(float), getConnectionOnBusMargin()

setFlowDirection

public final void setFlowDirection(int direction)
Allows you to specify the flow direction of the nodes.

The default is LEFT_TO_RIGHT.

Since:
JViews 3.5
See Also:
getFlowDirection()

getFlowDirection

public int getFlowDirection()
Returns the option that specifies the flow direction of the nodes.

Since:
JViews 3.5
See Also:
setFlowDirection(int)

setOrdering

public final void setOrdering(int ordering)
Deprecated. Beginning with ILOG JViews 6.5, use the method setNodeComparator(java.util.Comparator) instead.

Allows you to specify the way in which the nodes are arranged on the bus. The default is NO_ORDERING.

Note that in incremental mode (see setIncrementalMode(boolean)) and with fixed nodes (see IlvGraphLayout.setFixed(java.lang.Object, boolean)), the order of the nodes is not completely preserved.

See Also:
getOrdering(), setNodeComparator(java.util.Comparator)

getOrdering

public int getOrdering()
Deprecated. Beginning with ILOG JViews 6.5, use the method getNodeComparator() instead.

Returns the option that specifies the ordering of the nodes.

See Also:
setOrdering(int)

setNodeComparator

public final void setNodeComparator(Comparator comparator)
Sets the comparator used for sorting the nodes. The default is null.

The ordering of the nodes starts at the upper-left corner of the bus.

Note that in incremental mode (see setIncrementalMode(boolean)) or when nodes are fixed (see IlvGraphLayout.setFixed(java.lang.Object, boolean)) the order of the nodes is not guaranteed to obey the comparator, since this specification competes with the other constraints.

Since:
JViews 6.5
See Also:
getNodeComparator()

getNodeComparator

public Comparator getNodeComparator()
Returns the comparator used for sorting the nodes.

Since:
JViews 6.5
See Also:
setNodeComparator(java.util.Comparator)

setGlobalVerticalAlignment

public final void setGlobalVerticalAlignment(int alignment)
Sets the global vertical alignment style. It controls the vertical alignment of nodes inside the level where they are placed.

Valid values are:

The default value is TOP.

Since:
JViews 3.5
See Also:
getGlobalVerticalAlignment(), setVerticalAlignment(java.lang.Object, int)

getGlobalVerticalAlignment

public final int getGlobalVerticalAlignment()
Returns the global vertical alignment style.

Since:
JViews 3.5
See Also:
setGlobalVerticalAlignment(int)

setVerticalAlignment

public final void setVerticalAlignment(Object node,
                                       int alignment)
Sets the vertical alignment style of an individual node. This alignment style is used only if the global vertical alignment is set to MIXED. Otherwise, all nodes have the alignment style that is specified as the global alignment style.

The parameter controls the vertical alignment of nodes inside their level.

Valid values are:

The default value is TOP.

Since:
JViews 3.5
See Also:
getVerticalAlignment(java.lang.Object), setGlobalVerticalAlignment(int)

getVerticalAlignment

public final int getVerticalAlignment(Object node)
Returns the local vertical alignment style of the node.

Since:
JViews 3.5
See Also:
setVerticalAlignment(java.lang.Object, int), setGlobalVerticalAlignment(int)

setHorizontalOffset

public void setHorizontalOffset(float offset)
Sets the horizontal offset between nodes placed on the same level of the bus.

See Also:
getHorizontalOffset()

getHorizontalOffset

public float getHorizontalOffset()
Returns the horizontal offset between nodes placed on the same level of the bus.

See Also:
setHorizontalOffset(float)

setVerticalOffsetToLevel

public void setVerticalOffsetToLevel(float offset)
Sets the vertical offset between the nodes and the horizontal level of the bus to which they are connected.

See Also:
getVerticalOffsetToLevel()

getVerticalOffsetToLevel

public float getVerticalOffsetToLevel()
Returns the vertical offset between the nodes and the horizontal level of the bus to which they are connected.

See Also:
setVerticalOffsetToLevel(float)

setVerticalOffsetToPreviousLevel

public void setVerticalOffsetToPreviousLevel(float offset)
Sets the vertical offset between the nodes and the horizontal level of the bus above the nodes.

See Also:
getVerticalOffsetToPreviousLevel()

getVerticalOffsetToPreviousLevel

public float getVerticalOffsetToPreviousLevel()
Returns the vertical offset between nodes and the horizontal level of the bus above the nodes.

See Also:
setVerticalOffsetToPreviousLevel(float)

setMargin

public void setMargin(float margin)
Sets the horizontal offset between the left/right border of the bus level and the left/right border of the layout region.

Note that the following relationship must be respected: getCalcLayoutRegion().width > 2*getMargin() + 2*getMarginOnBus()

See Also:
getMargin()

getMargin

public float getMargin()
Returns the horizontal offset between the left/right border of the bus level and the left/right border of the layout region.

See Also:
setMargin(float)

setMarginOnBus

public void setMarginOnBus(float margin)
Sets the horizontal offset between the first/last node on a given level and the left/right margin of the level.

See Also:
getMarginOnBus()

getMarginOnBus

public float getMarginOnBus()
Returns the horizontal offset between the first/last node on a given level and the left/right margin of the level.

Note that the following relationship must be respected: getCalcLayoutRegion().width > 2*getMargin() + 2*getMarginOnBus()

See Also:
setMarginOnBus(float)

setConnectionOnBusMargin

public void setConnectionOnBusMargin(float margin)
Sets the horizontal offset between the first/last node on a given level and the left/right margin of the level. Note that when the attached graph model is an IlvGrapherAdapter, an IlvBusLinkConnector is used to compute the connection points of the links on the bus. IlvBusLinkConnector provides its own margin parameter. Therefore, the margin parameter for the connection of the links on the bus node is automatically updated according to the current margin specified in the instance of IlvBusLinkConnector. The method setConnectionOnBusMargin is provided only for the case where the attached graph does not encapsulate an IlvGrapher.

See Also:
getConnectionOnBusMargin(), getConnectionPoint(java.lang.Object, ilog.views.IlvPolyPointsInterface), IlvBusLinkConnector.setMargin(float)

getConnectionOnBusMargin

public float getConnectionOnBusMargin()
Returns the horizontal offset between the first/last node on a given level and the left/right margin of the level.

Note that the following relationship must be respected: getCalcLayoutRegion().width > 2*getMargin() + 2*getMarginOnBus()

See Also:
setConnectionOnBusMargin(float), getConnectionPoint(java.lang.Object, ilog.views.IlvPolyPointsInterface), IlvBusLinkConnector.getMargin()

setMaxNumberOfNodesPerLevel

public void setMaxNumberOfNodesPerLevel(int nNodes)
Sets the maximum number of nodes per level. The layout places as many nodes on each level as possible given the size of the nodes, the dimensional parameters (layout region and margins) and the specified maximum number of nodes per level.

The minimum value is 1. The default value is Integer.MAX_VALUE, that is, the number of nodes placed in each level is bounded only by the size of the nodes and the dimensional parameters.

Since:
JViews 5.5
See Also:
IlvGraphLayout.setLayoutRegion(ilog.views.IlvManagerView), IlvGraphLayout.setLayoutRegion(ilog.views.IlvManagerView, ilog.views.IlvRect), IlvGraphLayout.setLayoutRegion(ilog.views.IlvRect), IlvGraphLayout.getSpecLayoutRegion(), IlvGraphLayout.getCalcLayoutRegion(), setMargin(float), setMarginOnBus(float), setHorizontalOffset(float)

getMaxNumberOfNodesPerLevel

public int getMaxNumberOfNodesPerLevel()
Returns the maximum number of nodes per level.

Since:
JViews 5.5
See Also:
setMaxNumberOfNodesPerLevel(int)

setBusWidthAdjustingEnabled

public void setBusWidthAdjustingEnabled(boolean enable)
Enables the adjustment of the bus width to the total width of the nodes.

If the adjustment is disabled, the width of the bus object, that is, the difference between the maximum and minimum x-coordinates, depends on the current width of the layout region. If the adjustment is enabled, the width of the bus object is automatically adjusted to the total width of the nodes, plus the margins.

The parameter has no effect if getFlowDirection() returns ALTERNATE.

The bus width adjusting is disabled by default.

Since:
JViews 5.5
See Also:
isBusWidthAdjustingEnabled(), setFlowDirection(int)

isBusWidthAdjustingEnabled

public boolean isBusWidthAdjustingEnabled()
Returns true if the adjustment of the bus width to the total width of the nodes is enabled.

Since:
JViews 5.5
See Also:
setBusWidthAdjustingEnabled(boolean)

setBusLineExtremityAdjustingEnabled

public void setBusLineExtremityAdjustingEnabled(boolean enable)
Enables the adjustment of the extremity points of the bus line.

If the adjustment is enabled, the extremity points of the bus line are adjusted, if necessary, to the total width of the nodes, plus the margins. This can make a difference when there is only one horizontal bus line, or when the flow direction is ALTERNATE.

If the adjustment is disabled, the horizontal lines of the bus have equal length.

The default value is false.

Since:
JViews 7.5
See Also:
isBusLineExtremityAdjustingEnabled(), setFlowDirection(int)

isBusLineExtremityAdjustingEnabled

public boolean isBusLineExtremityAdjustingEnabled()
Returns true if the adjustment of the extremity points of the bus line is enabled.

Since:
JViews 7.5
See Also:
setBusLineExtremityAdjustingEnabled(boolean)

setLinkStyle

public void setLinkStyle(int style)
Sets the style of the shape of the links. Valid values are STRAIGHT_LINE_STYLE (the links are given a straight-line shape) and NO_RESHAPE_STYLE (no reshape is performed on the links).

This feature can be useful when the graph contains links that have intermediate points and are not straight-line links (for instance, IlvPolylineLinkImage links with intermediate points).

The default value is STRAIGHT_LINE_STYLE.

Note that when the graph attached to the layout is of type IlvGrapher, the effect of the link reshaping depends on the type of the links and the connectors installed at the node. For STRAIGHT_LINE_STYLE, we recommend using links of type IlvPolylineLinkImage and attaching a link connector of type IlvBusLinkConnector on the bus node (if no link connector is attached, the layout automatically attaches it). Other link or connector types may cause an IlvInappropriateLinkException during layout. You can use the method IlvGraphLayoutUtil.EnsureAppropriateLinks(ilog.views.graphlayout.IlvGraphModel, ilog.views.graphlayout.IlvLayoutProvider) before layout or when the exception is caught to convert all links and link connectors to an appropriate type.

Since:
JViews 3.0
See Also:
getLinkStyle()

getLinkStyle

public int getLinkStyle()
Returns the current option for the style of the shape of the links.

Since:
JViews 3.0
See Also:
setLinkStyle(int)

setIncrementalMode

public void setIncrementalMode(boolean enable)
Enables or disables the incremental mode.

If the incremental mode is enabled, the stability of the layout is preserved as much as possible when new nodes are added, existing ones removed, or node sizes modified. This means that the nodes are placed at the same location or in the same order as in the previous layout whenever it is possible. In this mode, the layout algorithm processes the changes incrementally rather than redoing the entire layout for every change.

To preserve the stability, the incremental mode can keep some regions free. Therefore, the total area of the layout can be larger than in nonincremental mode.

Note that the layout is redone from scratch after a change of one of the following parameters:

The default value is false (disabled).

Since:
JViews 3.5

isIncrementalMode

public boolean isIncrementalMode()
Returns true if the incremental mode is enabled. It returns false otherwise.

Since:
JViews 3.5
See Also:
setIncrementalMode(boolean)

setNodePosition

public final void setNodePosition(int position)
Sets the position of the nodes in respect to the bus line.

Valid values are:

The default value is NODES_ABOVE_BUS.

Since:
JViews 7.5
See Also:
getNodePosition()

getNodePosition

public final int getNodePosition()
Returns the node position option.

Since:
JViews 7.5
See Also:
setNodePosition(int)

checkAppropriateLink

public int checkAppropriateLink(Object link)
Checks whether the input link is appropriate for this layout. You should not call this method directly. It is called by IlvGraphLayout.checkAppropriateLinks().

Overrides:
checkAppropriateLink in class IlvGraphLayout
Parameters:
link - The link to be checked.
Returns:
The exception type for the link.
Since:
JViews 5.0
See Also:
IlvGraphLayout.checkAppropriateLinks()

getMovingNodes

public IlvGraphicVector getMovingNodes()
Returns the vector of nodes being moved by the graph layout algorithm. You should not call this method. It is only used when the graph model is an IlvGrapherAdaper in order to optimize for speed.

Overrides:
getMovingNodes in class IlvGraphLayout
Since:
JViews 5.5

createLayoutGrapherProperty

protected IlvGraphLayoutGrapherProperty createLayoutGrapherProperty(String name,
                                                                    boolean withDefaults)
Returns a new instance of IlvBusLayoutGrapherProperty that stores the parameter settings of this layout class.

The method is used by IlvGrapherAdapter.saveParametersToNamedProperties(IlvGraphLayout, boolean) to create a named property that contains parameter settings of this layout instance.

Overrides:
createLayoutGrapherProperty in class IlvGraphLayout
Since:
JViews 3.5
See Also:
IlvGraphLayoutGrapherProperty, IlvGrapherAdapter.saveParametersToNamedProperties(IlvGraphLayout, boolean), IlvGrapherAdapter.loadParametersFromNamedProperties(IlvGraphLayout), IlvGrapherAdapter.removeParametersFromNamedProperties()

createLayoutNodeProperty

protected IlvGraphLayoutNodeProperty createLayoutNodeProperty(String name,
                                                              IlvGraphic node,
                                                              boolean withDefaults)
Returns a new instance of IlvBusLayoutNodeProperty that stores the parameter settings of this layout class for nodes.

The method is used by IlvGrapherAdapter.saveParametersToNamedProperties(IlvGraphLayout, boolean) to create a named property for a node that contains parameter settings of this layout instance for the input node.

Overrides:
createLayoutNodeProperty in class IlvGraphLayout
Since:
JViews 3.5
See Also:
IlvGraphLayoutNodeProperty, IlvGrapherAdapter.saveParametersToNamedProperties(IlvGraphLayout, boolean), IlvGrapherAdapter.loadParametersFromNamedProperties(IlvGraphLayout), IlvGrapherAdapter.removeParametersFromNamedProperties()


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