IBM ILOG Dojo Diagrammer 1.1 API Documentation
Legend: Array Boolean Constructor Date DomNode Error Function Namespace Number Object RegExp Singleton String

ibm_ilog.graphlayout.grid.GridLayout (version 1.1-SNAPSHOT)

Object » ibm_ilog.graphlayout.GraphLayout » ibm_ilog.graphlayout.grid.GridLayout
dojo.require("ibm_ilog.graphlayout.grid.GridLayout");

The main class for the Grid Layout algorithm.

The Grid Layout algorithm has two major modes: grid and row/column. (For details, see the method GridLayout.setLayoutMode().) In grid mode, the layout arranges the nodes of a graph in the cells of a grid (matrix). If a node is too large to fit into one grid cell (with a margin), it occupies multiple cells. The size of the grid cells can be specified using the methods GridLayout.setHorizontalGridOffset() and GridLayout.setVerticalGridOffset(). The margins can be specified using the methods GridLayout.setTopMargin(), GridLayout.setBottomMargin(), GridLayout.setLeftMargin(), and GridLayout.setRightMargin().

The following sample drawing shows a layout in the grid mode where the grid size has been specified so that each node fits into one grid cell. (Usually such layouts are more esthetic and appear to be more regular, but a larger area is left empty around the smallest nodes. This is generally the best option when all the nodes have the same size.)

Sample drawing produced with the Grid Layout

The following sample drawing shows a layout in the grid mode where the grid size has been specified so that some nodes fit into one grid cell and other nodes occupy multiple cells. (Usually such layouts take less space if the nodes have a heterogeneous size.)

Sample drawing produced with the Grid Layout

The following diagram shows the dimensional parameters of the layout in grid mode.

Sample drawing produced with the Grid Layout

In row/column mode, the layout arranges the nodes of a graph either by rows or by columns (according to the specified option). The width of the rows is controlled by the width of the layout region parameter. The height of the columns is controlled by the height of the layout region parameter. The margins can be specified using the methods GridLayout.setTopMargin(), GridLayout.setBottomMargin(), GridLayout.setLeftMargin(), and GridLayout.setRightMargin(). The minimum horizontal distance between nodes is equal to the sum of the left and right margins. The minimum vertical distance between nodes is equal to the sum of the top and bottom margins.

For graphs with nodes of heterogeneous size, the row/column mode often allows a more compact layout than the grid mode.

The following sample drawing shows a layout in the row mode.

Sample drawing produced with the Grid Layout

The following sample drawing shows a layout in the column mode.

Sample drawing produced with the Grid Layout

The following diagram shows the dimensional parameters of the layout in row mode (the parameters for the column mode are analogous).

Sample drawing produced with the Grid Layout

The algorithm is primarily designed for graphs without (visible) links between the nodes. If links exist, they are ignored by the Grid layout.

Several alignment options are provided (see GridLayout.setGlobalHorizontalAlignment() and GridLayout.setGlobalVerticalAlignment()). The alignment can be specified individually for each node (see GridLayout.setHorizontalAlignment() and GridLayout.setVerticalAlignment()).

An incremental mode is provided (see GridLayout.setIncrementalMode()). 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 possible. In this mode, the layout algorithm processes the changes incrementally rather than redoing the entire layout for every change.

Nodes that the layout algorithm is not allowed to move can be specified using the method ibm_ilog.graphlayout.GraphLayout.setFixed(). (See also ibm_ilog.graphlayout.GraphLayout.setPreserveFixedNodes().) In grid mode, nonfixed nodes are placed in such a way that they do not overlap the grid cells occupied by other fixed or nonfixed nodes. In row/column mode, nonfixed nodes are placed in such a way that they do not overlap fixed or nonfixed nodes. Of course, fixed nodes can overlap other fixed nodes.

The layout algorithm can take into account a different node size than the size corresponding to the bounding box of the node. Using GridLayout.setNodeBoxInterface(), you can specify an object that provides the box that has to be taken into account for each node. The following diagram shows the dimensional parameters of the layout in grid mode (the row/column case mode is analogous) when a node box that is different from the bounding box of the node is used:

Sample drawing produced with the Grid Layout

Property Summary

  • ASCENDING_AREA Ordering by ascending area option. When this value is used as the argument of the method ' GridLayout.setNodeComparator()', the nodes are arranged by ascending area, starting at the upper-left corner with the node that has the smallest area.
  • ASCENDING_HEIGHT Ordering by ascending height option. When this value is used as the argument of the method ' GridLayout.setNodeComparator()', the nodes are arranged by ascending height, starting at the upper-left corner with the shortest node. Ordering the nodes by ascending height can save vertical space and produce a more compact layout.
  • ASCENDING_INDEX Ordering by ascending index option. When this value is used as the argument of the method ' GridLayout.setNodeComparator()', the nodes are arranged in the order of their indexes, starting at the upper-left corner with the node that has the smallest index. Nodes that do not have an index are placed after nodes for which an index is specified. Ordering by index allows you to specify a particular order for the nodes.
  • ASCENDING_WIDTH Ordering by ascending width option. When this value is used as the argument of the method ' GridLayout.setNodeComparator()', the nodes are arranged by ascending width, starting at the upper-left corner with the narrowest node.
  • AUTOMATIC_ORDERING Automatic ordering option. When this value is used as the argument of the method ' GridLayout.setNodeComparator()', the algorithm is free to choose an order aimed at reducing the total area occupied by the layout.
  • BOTTOM Bottom alignment option. When used as the argument of the method ' GridLayout.setGlobalVerticalAlignment()', all the nodes are aligned to the bottom border of their grid cell or row. The alignment of an individual node can be set by ' GridLayout.setVerticalAlignment()'.
  • CENTER Center alignment option. When used as the argument of the method ' GridLayout.setGlobalHorizontalAlignment()', all the nodes are horizontally centered in their grid cell or column. The alignment of an individual node can be set by ' GridLayout.setHorizontalAlignment()'. When used as the argument of the method ' GridLayout.setGlobalVerticalAlignment()', all the nodes are vertically centered in their grid cell or row. The alignment of an individual node can be set by ' GridLayout.setVerticalAlignment()'.
  • DESCENDING_AREA Ordering by descending area option. When this value is used as the argument of the method ' GridLayout.setNodeComparator()', the nodes are arranged by area, starting at the upper-left corner with the node that has the largest area.
  • DESCENDING_HEIGHT Ordering by height option. When this value is used as the argument of the method ' GridLayout.setNodeComparator()', the nodes are arranged by height, starting at the upper-left corner with the tallest node. Ordering the nodes by height can save vertical space and produce a more compact layout.
  • DESCENDING_INDEX Ordering by descending index option. When this value is used as the argument of the method ' GridLayout.setNodeComparator()', the nodes are arranged in the order of their indexes, starting at the upper-left corner with the node that has the largest index. Nodes that do not have an index are placed after nodes for which an index is specified. Ordering by index allows you to specify a particular order for the nodes.
  • DESCENDING_WIDTH Ordering by descending width option. When this value is used as the argument of the method ' GridLayout.setNodeComparator()', the nodes are arranged by width, starting at the upper-left corner with the widest node.
  • LEFT Left alignment option. When used as the argument of the method ' GridLayout.setGlobalHorizontalAlignment()', all the nodes are aligned to the left border of their grid cell or column. The alignment of an individual node can be set by ' GridLayout.setHorizontalAlignment()'.
  • MIXED Mixed alignment option. When used as the argument of the methods ' GridLayout.setGlobalHorizontalAlignment()' or ' GridLayout.setGlobalVerticalAlignment()', each node can have a different alignment. The alignment of an individual node can be set by ' GridLayout.setHorizontalAlignment()' and ' GridLayout.setVerticalAlignment()'.
  • NO_INDEX No index code. This value is returned by the method ' GridLayout.getIndex()' when a node has no index value.
  • NO_ORDERING No ordering option. When his value is used as the argument of the method ' GridLayout.setNodeComparator()', the nodes are arranged in an arbitrary order.
  • RIGHT Right alignment option. When used as the argument of the method ' GridLayout.setGlobalHorizontalAlignment()', all the nodes are aligned to the right border of their grid cell or column. The alignment of an individual node can be set by ' GridLayout.setHorizontalAlignment()'.
  • TILE_TO_COLUMNS Tile-to-columns layout mode. When used as the argument of the method ' GridLayout.setLayoutMode()', all the nodes are organized in columns and are horizontally aligned with respect to the row border according to the horizontal alignment option. In this mode, the grid offset parameters are not used and the width of the layout region controls the maximum total width of the layout.
  • TILE_TO_GRID_FIXED_HEIGHT Tile-to-grid layout mode with fixed height of the grid. When used as the argument of the method ' GridLayout.setLayoutMode()', the nodes are placed in the cells of a grid and the height of the layout region controls the maximum height of the grid.
  • TILE_TO_GRID_FIXED_WIDTH Tile-to-grid layout mode with fixed width of the grid. When used as the argument of the method ' GridLayout.setLayoutMode()', the nodes are placed in the cells of a grid and the width of the layout region controls the maximum width of the grid.
  • TILE_TO_ROWS Tile-to-rows layout mode. When used as the argument of the method ' GridLayout.setLayoutMode()', all the nodes are organized in rows and are vertically aligned with respect to the row border according to the vertical alignment option. In this mode, the grid offset parameters are not used and the height of the layout region controls the maximum total height of the layout.
  • TOP Top alignment option. When used as the argument of the method ' GridLayout.setGlobalVerticalAlignment()', all the nodes are aligned to the top border of their grid cell or row. The alignment of an individual node can be set by ' GridLayout.setVerticalAlignment()'.

Method Summary

  • afterLayoutOfSubgraph(subgraph) Performs postprocessing operations after the layout of each subgraph or connected component.
  • attach(graphModel) Sets the graph model to be laid out.
  • beforeLayout() Performs preprocessing operations before the layout of the entire graph.
  • beforeLayoutOfSubgraph(subgraph) Performs preprocessing operations before the layout of each subgraph or connected component.
  • callLayoutStepPerformedIfNeeded() Calls 'onLayoutStepPerformed' when necessary.
  • cleanGraphModel(graphModel) Cleans a graph model.
  • cleanLink(graphModel, link) Cleans a link.
  • cleanNode(graphModel, node) Cleans a node.
  • connectAllLinksToCenter() Connects all links to the enter of their end nodes.
  • connectLinkToCenter(link, atFromSide, atToSide) Connects the link to the node center at both end nodes by using the link connection box interface.
  • constructor(source)
  • contentsChanged(event) Called when the structure or the geometry of the graph changes.
  • copy() returns ibm_ilog.graphlayout.GraphLayout Copies the layout instance.
  • copyParameters(source) Copies the parameters from a given layout instance.
  • createLayoutReport() returns ibm_ilog.graphlayout.GraphLayoutReport Returns a new instance of the layout report.
  • detach() Detaches the graph model from the layout instance.
  • getAllowedTime() returns Number Returns the currently allowed time for the layout algorithm in milliseconds.
  • getBalanceSplineCurveThreshold() returns Number Returns the threshold for spline curves at bends which the optimized spline control point routing uses to balance the curve.
  • getBottomMargin() returns Number Returns the bottom margin.
  • getCalcLayoutRegion() returns Rectangle Returns a copy of the rectangle that defines the layout region parameter.
  • getGlobalHorizontalAlignment() returns int Returns the global horizontal alignment style.
  • getGlobalVerticalAlignment() returns int Returns the global vertical alignment style.
  • getGraphModel() returns ibm_ilog.graphlayout.AbstractGraphLayoutModel Returns the graph model to lay out if a graph model is attached.
  • getHorizontalAlignment(node) Returns the local horizontal alignment style of the node.
  • getHorizontalGridOffset() returns Number Returns the horizontal grid offset.
  • getIndex(node) returns int Returns the index value associated with a node.
  • getInstanceId() returns int A utility method that returns a unique integer value for each layout instance.
  • getLayout(subgraph) returns ibm_ilog.graphlayout.GraphLayout Returns the layout instance for a subgraph of the nested graph encapsulated by the graph model of this layout instance.
  • getLayoutMode() returns int Returns the current layout mode.
  • getLayoutOfConnectedComponents() returns ibm_ilog.graphlayout.GraphLayout Returns the layout instance that lays out the connected components of the graph.
  • getLayoutOfConnectedComponentsReport() returns ibm_ilog.graphlayout.GraphLayoutReport Returns the layout report containing information about the behavior of the connected components layout.
  • getLayoutRegion() Returns a copy of the rectangle that defines the layout region, as specified using the method ' ibm_ilog.graphlayout.GraphLayout.layoutRegion', or 'null' if no rectangle has been specified, or the specified rectangle was 'null'.
  • getLayoutRegionMode() Gets the layout region mode.
  • getLayoutReport() returns ibm_ilog.graphlayout.GraphLayoutReport Returns the layout report, that is, the object that contains information about the behavior of the layout algorithm.
  • getLayouts(preOrder) returns ibm_ilog.graphlayout.IIterator Returns the instances of 'GraphLayout' for the nested graph encapsulated by the graph model of this layout instance.
  • getLeftMargin() returns Number Returns the left margin.
  • getLinkConnectionBoxInterface() returns ibm_ilog.graphlayout.ILinkConnectionBoxProvider Returns the link connection box interface used to calculate the connection points of links during layout.
  • getMaxNumberOfNodesPerRowOrColumn() returns int Returns the maximum number of nodes per row in ' GridLayout.TILE_TO_ROWS' mode or the maximum number of nodes per column in ' GridLayout.TILE_TO_COLUMNS' mode.
  • getMaxSplineCurveSize() returns Number Returns the maximum curve size used when spline control point optimization routing is enabled.
  • getMinBusyTime() returns Number Returns the minimal time that the layout algorithm can be busy between two calls of ' ibm_ilog.graphlayout.GraphLayout.onLayoutStepPerformed()' when the method ' ibm_ilog.graphlayout.GraphLayout.callLayoutStepPerformedIfNeeded()' is used.
  • getMinSplineCurveSize() returns Number Returns the minimum curve size used when optimized spline control points routing is enabled.
  • getNodeBoxInterface() returns ibm_ilog.graphlayout.INodeBoxProvider Returns the object that provides the rectangle defining the location and size of each node, if one is specified.
  • getNodeComparator() returns Function Returns the comparator used for sorting the nodes.
  • getObjectParameter(graphModel, nodeOrLink, key) returns Object Returns the value of a parameter of the layout instance.
  • getParameter(key) returns Object Returns the value of a parameter of the layout instance.
  • getParentLayout() returns ibm_ilog.graphlayout.GraphLayout Returns the parent layout.
  • getRecursiveLayout() returns ibm_ilog.graphlayout.RecursiveLayout Returns the instance of Recursive Layout that is used to perform this layout recursively when you call ' ibm_ilog.graphlayout.GraphLayout.performLayout()' with the traverse flag set to 'true'.
  • getRemainingAllowedTime() returns Number Returns the remaining allowed time.
  • getRightMargin() returns Number Returns the right margin.
  • getSeedValueForRandomGenerator() returns Number Returns the user-defined seed value for the random generator.
  • getSpecLayoutRegion() returns Rectangle Returns a copy of the rectangle that defines the layout region, as specified using the method ' ibm_ilog.graphlayout.GraphLayout.layoutRegion'.
  • getSplineLinkFilter() returns ibm_ilog.graphlayout.SplineLinkFilter Returns the filter that detects which links are suitable for optimized spline routing.
  • getTopMargin() returns Number Returns the top margin.
  • getVerticalAlignment(node) Returns the local vertical alignment style of the node.
  • getVerticalGridOffset() returns Number Returns the vertical grid offset.
  • getViewMatrix() Returns the matrix that is applied to the first view attached to this layout.
  • increasePercentageComplete(newPercentage) Increases the percentage of completion that is stored in the layout report to the input value.
  • init() Initializes instance variables.
  • isCriticalParametersUpToDate(layoutRegion) returns Boolean
  • isFitToViewEnabled() returns Boolean Returns 'true' if the graph drawing must fit (exactly or approximately) an area of a specific view.
  • isFixed(nodeOrLink) returns Boolean Returns whether the node or link is specified as fixed.
  • isGeometryUpToDate() returns Boolean Returns whether the geometry of the graph is up to date.
  • isIncrementalMode() returns Boolean Returns 'true' if the incremental mode is enabled, and 'false' otherwise.
  • isInputCheckEnabled() returns Boolean Returns 'true' if the checks for the nodes and/or links are enabled.
  • isLayoutNeeded() returns Boolean Verifies that it is necessary to perform the layout.
  • isLayoutOfConnectedComponentsEnabled() returns Boolean Indicates whether the connected component layout mechanism is enabled.
  • isLayoutOfConnectedComponentsEnabledByDefault() returns Boolean Returns 'true' if the connected components layout mechanism is enabled by default.
  • isLayoutRunning(checkParents) returns Boolean Indicates whether this layout algorithm is running or not.
  • isLayoutTimeElapsed() returns Boolean Returns 'true' if, at the moment the method is called, the allowed layout time is exceeded; returns 'false' otherwise.
  • isLinkClipping() Gets whether links should be clipped at the shape of the end nodes.
  • isLocalRecursiveLayoutNeeded(layoutProvider, recLayout, rootModel, traverse) returns Boolean Checks whether layout is needed when layout is performed recursively on a hierarchy of nested subgraphs.
  • isParametersUpToDate() returns Boolean Returns whether the layout parameters are up to date.
  • isPreserveFixedLinks() returns Boolean Returns 'true' if the layout is not allowed to reshape the links indicated as fixed by the user.
  • isPreserveFixedNodes() returns Boolean Returns 'true' if the layout is not allowed to move the nodes indicated as fixed by the user.
  • isSameLayoutRegion(layoutRegion)
  • isSplineRoutingEnabled() returns Boolean Tests whether the calculation of optimized spline control points is enabled.
  • isStoppedImmediately() returns Boolean Returns 'true' if the method ' ibm_ilog.graphlayout.GraphLayout.stopImmediately()' was called.
  • isStructureUpToDate() returns Boolean Returns whether the structure of the graph is up to date.
  • isUseSeedValueForRandomGenerator() returns Boolean Returns 'true' if the user-defined seed value is used for the random generator and 'false' otherwise.
  • layout() Computes the layout using the Grid Layout algorithm.
  • performLayout(force, traverse) returns int Starts the layout algorithm using the currently attached graph model and the current settings for the layout parameters.
  • performSublayout(subgraph, layout, force) Starts the input layout algorithm.
  • setAllowedTime(time) Sets the upper limit for the duration of the layout algorithm.
  • setBalanceSplineCurveThreshold(threshold) Sets the threshold for spline curves at bends which the optimized spline control point routing uses to balance the curve.
  • setBottomMargin(margin) Sets the bottom margin parameter.
  • setCriticalParametersMatrixUpToDate(parameterName, option)
  • setCriticalParametersUpToDate(parameterName, uptodate)
  • setFixed(nodeOrLink, fixed) Sets the specified node or link as fixed.
  • setGeometryUpToDate(uptodate) Sets whether the geometry of the graph is up to date.
  • setGlobalHorizontalAlignment(alignment) Sets the global horizontal alignment style.
  • setGlobalVerticalAlignment(alignment) Sets the global vertical alignment style.
  • setGraphModel(graphModel) Sets the graph model to be laid out.
  • setHorizontalAlignment(node, alignment) Sets the horizontal alignment style of an individual node.
  • setHorizontalGridOffset(offset) Sets the spacing of the grid lines on the horizontal axis.
  • setIncrementalMode(enable) Sets the incremental mode.
  • setIndex(node, index) Sets the index of a node.
  • setInputCheckEnabled(enable) Sets whether the checks for the nodes and/or links provided as arguments for the different methods of the layout algorithms are enabled.
  • setLayoutMode(mode) Sets the layout mode.
  • setLayoutOfConnectedComponents(layout) Sets the layout instance that lays out the connected components of the graph.
  • setLayoutOfConnectedComponentsEnabled(enable) Sets whether the generic connected component layout mechanism is enabled.
  • setLayoutRegion(rect) Sets the layout region as a rectangle 'rect'), with the dimensions of the rectangle being given in container (graph model) coordinates.
  • setLayoutRegionMode(value) Sets the layout region mode.
  • setLayoutReport(report) Sets the layout report, that is, the object that contains information about the behavior of the layout algorithm.
  • setLayoutRunning(running, fromParents) Sets whether layout is running.
  • setLeftMargin(margin) Sets the left margin parameter.
  • setLinkClipping(value) Sets whether links should be clipped at the shape of the end nodes.
  • setLinkConnectionBoxInterface(linkConnectionBoxInterface) Sets the link connection box interface for the connection points of links.
  • setMaxNumberOfNodesPerRowOrColumn(nNodes) Sets the maximum number of nodes per row or per column.
  • setMaxSplineCurveSize(size) Sets the maximum curve size used when optimized spline control point routing is enabled.
  • setMinBusyTime(time) Sets the minimal time that the layout algorithm can be busy.
  • setMinSplineCurveSize(size) Sets the minimum curve size used when optimized spline control point routing is enabled.
  • setNodeBoxInterface(nodeBoxInterface) Sets an object that provides the rectangle defining the location and size of each node.
  • setNodeComparator(comparator) Sets the comparator used for sorting the nodes.
  • setObjectParameter(graphModel, nodeOrLink, key, value) returns Object Sets the value of a parameter for a node or a link, using a given graph model.
  • setParameter(key, value) returns Object Sets the value of a property for the layout instance.
  • setParametersUpToDate(uptodate) Sets whether the parameters of the graph layout are up to date.
  • setParentLayout(parent) Sets the parent layout of this layout instance.
  • setPreserveFixedLinks(option) Sets whether the layout avoids movement of fixed links.
  • setPreserveFixedNodes(option) Sets whether the layout avoids movement of fixed nodes.
  • setRightMargin(margin) Sets the right margin parameter.
  • setSeedValueForRandomGenerator(seed) Sets the seed value for the random generator.
  • setSplineLinkFilter(filter) Sets the filter that detects which links are suitable for optimized spline routing.
  • setSplineRoutingEnabled(flag) Sets whether the calculation of optimized spline control points is enabled.
  • setStructureUpToDate(uptodate) Sets whether the structure of the graph is up to date.
  • setTopMargin(margin) Sets the top margin parameter.
  • setUseSeedValueForRandomGenerator(option) Sets whether the user-defined seed value should be used for the random generator.
  • setVerticalAlignment(node, alignment) Sets the vertical alignment style of an individual node.
  • setVerticalGridOffset(offset) Sets the spacing of the grid lines on the vertical axis.
  • stopImmediately() returns Boolean Stops the running layout algorithm as soon as possible.
  • supportsAllowedTime() returns Boolean Indicates that this layout class can stop the layout computation in a proper manner when the user-defined allowed time is exceeded.
  • supportsLayoutOfConnectedComponents() returns Boolean Indicates whether the layout class can cut the attached graph into connected components, apply itself on each connected component separately, and then use the layout instance returned by the method ' ibm_ilog.graphlayout.GraphLayout.getLayoutOfConnectedComponents()' to position the connected components.
  • supportsLayoutRegion() returns Boolean 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.
  • supportsLinkConnectionBox() returns Boolean Indicates whether the layout class can use a link connection box interface to calculate the end points of a link.
  • supportsPercentageComplete() returns Boolean Indicates whether the layout class can estimate the percentage of completion during the run of layout.
  • supportsPreserveFixedLinks() returns Boolean Indicates whether the layout class allows the user to specify fixed links.
  • supportsPreserveFixedNodes() returns Boolean Indicates that this layout class allows the user to specify fixed nodes.
  • supportsRandomGenerator() returns Boolean Indicates whether the layout class uses randomly generated numbers (or randomly chosen parameters) for which it can accept a user-defined seed value.
  • supportsSplineRouting() returns Boolean Indicates whether the layout class supports the generic optimization of spline control points.
  • supportsStopImmediately() returns Boolean Indicates that this layout class can control the current run by interrupting the run of the layout immediately.
  • toString() returns String Returns a printable string representing this layout instance.
  • unfixAllLinks() Removes the fixed attribute from all links in the graph model.
  • unfixAllNodes() Removes the fixed attribute from all nodes in the graph model.

Event Summary

Attached Objects

Properties

ASCENDING_AREA
Ordering by ascending area option. When this value is used as the argument of the method ' GridLayout.setNodeComparator()', the nodes are arranged by ascending area, starting at the upper-left corner with the node that has the smallest area.
ASCENDING_HEIGHT
Ordering by ascending height option. When this value is used as the argument of the method ' GridLayout.setNodeComparator()', the nodes are arranged by ascending height, starting at the upper-left corner with the shortest node. Ordering the nodes by ascending height can save vertical space and produce a more compact layout.
ASCENDING_INDEX
Ordering by ascending index option. When this value is used as the argument of the method ' GridLayout.setNodeComparator()', the nodes are arranged in the order of their indexes, starting at the upper-left corner with the node that has the smallest index. Nodes that do not have an index are placed after nodes for which an index is specified. Ordering by index allows you to specify a particular order for the nodes.
ASCENDING_WIDTH
Ordering by ascending width option. When this value is used as the argument of the method ' GridLayout.setNodeComparator()', the nodes are arranged by ascending width, starting at the upper-left corner with the narrowest node.
AUTOMATIC_ORDERING
Automatic ordering option. When this value is used as the argument of the method ' GridLayout.setNodeComparator()', the algorithm is free to choose an order aimed at reducing the total area occupied by the layout.
BOTTOM
Bottom alignment option. When used as the argument of the method ' GridLayout.setGlobalVerticalAlignment()', all the nodes are aligned to the bottom border of their grid cell or row. The alignment of an individual node can be set by ' GridLayout.setVerticalAlignment()'.
CENTER
Center alignment option. When used as the argument of the method ' GridLayout.setGlobalHorizontalAlignment()', all the nodes are horizontally centered in their grid cell or column. The alignment of an individual node can be set by ' GridLayout.setHorizontalAlignment()'. When used as the argument of the method ' GridLayout.setGlobalVerticalAlignment()', all the nodes are vertically centered in their grid cell or row. The alignment of an individual node can be set by ' GridLayout.setVerticalAlignment()'.
DESCENDING_AREA
Ordering by descending area option. When this value is used as the argument of the method ' GridLayout.setNodeComparator()', the nodes are arranged by area, starting at the upper-left corner with the node that has the largest area.
DESCENDING_HEIGHT
Ordering by height option. When this value is used as the argument of the method ' GridLayout.setNodeComparator()', the nodes are arranged by height, starting at the upper-left corner with the tallest node. Ordering the nodes by height can save vertical space and produce a more compact layout.
DESCENDING_INDEX
Ordering by descending index option. When this value is used as the argument of the method ' GridLayout.setNodeComparator()', the nodes are arranged in the order of their indexes, starting at the upper-left corner with the node that has the largest index. Nodes that do not have an index are placed after nodes for which an index is specified. Ordering by index allows you to specify a particular order for the nodes.
DESCENDING_WIDTH
Ordering by descending width option. When this value is used as the argument of the method ' GridLayout.setNodeComparator()', the nodes are arranged by width, starting at the upper-left corner with the widest node.
LEFT
Left alignment option. When used as the argument of the method ' GridLayout.setGlobalHorizontalAlignment()', all the nodes are aligned to the left border of their grid cell or column. The alignment of an individual node can be set by ' GridLayout.setHorizontalAlignment()'.
MIXED
Mixed alignment option. When used as the argument of the methods ' GridLayout.setGlobalHorizontalAlignment()' or ' GridLayout.setGlobalVerticalAlignment()', each node can have a different alignment. The alignment of an individual node can be set by ' GridLayout.setHorizontalAlignment()' and ' GridLayout.setVerticalAlignment()'.
NO_INDEX
No index code. This value is returned by the method ' GridLayout.getIndex()' when a node has no index value.
NO_ORDERING
No ordering option. When his value is used as the argument of the method ' GridLayout.setNodeComparator()', the nodes are arranged in an arbitrary order.
RIGHT
Right alignment option. When used as the argument of the method ' GridLayout.setGlobalHorizontalAlignment()', all the nodes are aligned to the right border of their grid cell or column. The alignment of an individual node can be set by ' GridLayout.setHorizontalAlignment()'.
TILE_TO_COLUMNS
Tile-to-columns layout mode. When used as the argument of the method ' GridLayout.setLayoutMode()', all the nodes are organized in columns and are horizontally aligned with respect to the row border according to the horizontal alignment option. In this mode, the grid offset parameters are not used and the width of the layout region controls the maximum total width of the layout.
TILE_TO_GRID_FIXED_HEIGHT
Tile-to-grid layout mode with fixed height of the grid. When used as the argument of the method ' GridLayout.setLayoutMode()', the nodes are placed in the cells of a grid and the height of the layout region controls the maximum height of the grid.
TILE_TO_GRID_FIXED_WIDTH
Tile-to-grid layout mode with fixed width of the grid. When used as the argument of the method ' GridLayout.setLayoutMode()', the nodes are placed in the cells of a grid and the width of the layout region controls the maximum width of the grid.
TILE_TO_ROWS
Tile-to-rows layout mode. When used as the argument of the method ' GridLayout.setLayoutMode()', all the nodes are organized in rows and are vertically aligned with respect to the row border according to the vertical alignment option. In this mode, the grid offset parameters are not used and the height of the layout region controls the maximum total height of the layout.
TOP
Top alignment option. When used as the argument of the method ' GridLayout.setGlobalVerticalAlignment()', all the nodes are aligned to the top border of their grid cell or row. The alignment of an individual node can be set by ' GridLayout.setVerticalAlignment()'.

Methods

afterLayoutOfSubgraph

Performs postprocessing operations after the layout of each subgraph or connected component.

The default implementation does nothing. Subclasses can override this method to perform some cleanup operations when appropriate.

ParameterTypeDescription
subgraphibm_ilog.graphlayout.AbstractGraphLayoutModelSubgraph or connected component where layout has just been performed.
attach

Sets the graph model to be laid out.

You must attach the graph model before performing the layout, that is, before calling the method ibm_ilog.graphlayout.GraphLayout.performLayout(), and before specifying layout parameters for specific nodes or links.

This method first calls ibm_ilog.graphlayout.GraphLayout.detach() if a graph model is already attached. After attaching the model, the method onAttached is called, passing this layout instance as argument. The method does nothing if the graph model is already attached.

ParameterTypeDescription
graphModelibm_ilog.graphlayout.AbstractGraphLayoutModelThe graph model to lay out.
beforeLayout

Performs preprocessing operations before the layout of the entire graph. This is called in each layout run once per graph.

The default implementation calls IGraphLayoutModel.beforeLayout(GraphLayout). Subclasses can override this method to perform some initialization operations when appropriate.

beforeLayoutOfSubgraph

Performs preprocessing operations before the layout of each subgraph or connected component. This method is called in each layout run once for each connected component.

The default implementation does nothing. Subclasses can override this method to perform some initialization operations when appropriate.

ParameterTypeDescription
subgraphibm_ilog.graphlayout.AbstractGraphLayoutModelSubgraph where layout is about to be performed.
callLayoutStepPerformedIfNeeded

Calls onLayoutStepPerformed when necessary.

This method is provided for convenience in the implementation of layout algorithms. It calls ibm_ilog.graphlayout.GraphLayout.onLayoutStepPerformed() when the last call finished earlier than the minimal busy time before this call. It avoids calling ibm_ilog.graphlayout.GraphLayout.onLayoutStepPerformed() when the layout time has elapsed or when the layout is notified to stop immediately, if the algorithm supports these features.

This mechanism is used by some algorithms to avoid the overhead of ibm_ilog.graphlayout.GraphLayout.onLayoutStepPerformed() becoming too high if it is called too often. Internal routines of layout algorithms can use this method often without worrying that too many layout events are raised.

Layout algorithms call ibm_ilog.graphlayout.GraphLayout.onLayoutStepPerformed() directly instead of using this method when it is necessary to report a specific state (for example, when the layout report sets the code GraphLayoutReport.LAYOUT_STARTED or GraphLayoutReport.LAYOUT_FINISHED).

cleanGraphModel

Cleans a graph model. This method removes any data that has been stored by the layout algorithm on a graph model.

Subclasses can override this method to remove additional information stored in the graph model.

ParameterTypeDescription
graphModelibm_ilog.graphlayout.AbstractGraphLayoutModelThe graph model to be cleaned.
cleanLink

Cleans a link. This method removes any data that has been stored by the layout algorithm on a regular link or on an intergraph link.

The method is automatically called by ibm_ilog.graphlayout.GraphLayout.contentsChanged() whenever a GraphLayoutModelEvent of type GraphLayoutModelEvent.LINK_REMOVED is received.

Subclasses can override this method to remove additional information stored in the links.

Notice that the method may be called multiple times for the same link. At the time this method is called, the link may already be removed; therefore, overridden versions of this method should be implemented so that they work even if the object is no longer a link of graphModel.

ParameterTypeDescription
graphModelibm_ilog.graphlayout.AbstractGraphLayoutModelThe graph model to which the 'link' belongs.
linkObjectThe link to be cleaned.
cleanNode

Cleans a node. This method removes any data that has been stored by the layout algorithm on a node.

The method is automatically called by ibm_ilog.graphlayout.GraphLayout.contentsChanged() whenever a GraphLayoutModelEvent of type GraphLayoutModelEvent.NODE_REMOVED is received.

Subclasses can override this method to remove additional information stored in the nodes.

Notice that the method may be called multiple times for the same node. At the time this method is called, the node may already be removed; therefore, overridden versions of this method should be implemented so that they work even if the object is no longer a node of graphModel.

ParameterTypeDescription
graphModelibm_ilog.graphlayout.AbstractGraphLayoutModelThe graph model to which the 'node' belongs.
nodeObjectThe node to be cleaned.
connectAllLinksToCenter

Connects all links to the enter of their end nodes. This method is provided for convenience in the implementation of layout algorithms. The method can be called by a layout algorithm to connect links to node centers after the end nodes are placed at their final positions and the link has its final shape.

If a link connection box is set, it uses the virtual center of the connection box instead of the center of the bounding boxes of the end nodes. 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 by 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).

redraw: Boolean Whether the links need to be redrawn.

connectLinkToCenter

Connects the link to the node center at both end nodes by using the link connection box interface. This method is provided for convenience in the implementation of layout algorithms. The method can be called by a layout algorithm to connect links to node centers after the end nodes are placed at their final positions and the link has its final shape.

If a link connection box is set, it uses the virtual center of the connection box instead of the center of the bounding boxes of the end nodes. 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 by 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).

ParameterTypeDescription
linkObjectThe link to be connected.
atFromSideBoolean'true' if the link should be connected at its source node.
atToSideBoolean'true' if the link should be connected at its target node. redraw: Boolean Whether the link needs to be redrawn.
constructor
ParameterTypeDescription
source
contentsChanged

Called when the structure or the geometry of the graph changes.

If the type of the event is GraphLayoutModelEvent.STRUCTURE_CHANGED, the method ibm_ilog.graphlayout.GraphLayout.setStructureUpToDate() is called with a false argument. Or, if the type of the event is GraphLayoutModelEvent.GEOMETRY_CHANGED, the method ibm_ilog.graphlayout.GraphLayout.setGeometryUpToDate() is called with a false argument.

The method then calls ibm_ilog.graphlayout.GraphLayout.cleanNode() if the type of the event is GraphLayoutModelEvent.NODE_REMOVED or ibm_ilog.graphlayout.GraphLayout.cleanLink() if the type of the event is GraphLayoutModelEvent.LINK_REMOVED. The node or link that is passed to the method called is obtained using GraphLayoutModelEvent.getNodeOrLink().

ParameterTypeDescription
eventibm_ilog.graphlayout.GraphLayoutModelEventThe event indicating the change that has occurred in the graph model.
copy
Returns ibm_ilog.graphlayout.GraphLayout: A copy of the layout instance.

Copies the layout instance.

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

When performing a recursive layout on a nested graph, this method is used by ibm_ilog.graphlayout.ILayoutProvider 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 node box interface, are also copied.

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

copyParameters

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 node box interface, are also copied.

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

ParameterTypeDescription
sourceibm_ilog.graphlayout.GraphLayoutThe layout instance from which the parameters are copied.
createLayoutReport
Returns ibm_ilog.graphlayout.GraphLayoutReport: A new instance of the layout report.

Returns a new instance of the layout report. The default implementation returns a new instance of GraphLayoutReport.

You can overwrite this method in order to create subclasses of GraphLayoutReport.

This method is called by ibm_ilog.graphlayout.GraphLayout.performLayout(). The returned object is stored internally in the layout instance and will be returned by the method ibm_ilog.graphlayout.GraphLayout.performLayout().

Use this method to obtain information about the behavior of the layout algorithm if the information is added to the layout report in the implementation of the ibm_ilog.graphlayout.GraphLayout.layout() method, where it can be obtained using ibm_ilog.graphlayout.GraphLayout.getLayoutReport().

While the ibm_ilog.graphlayout.GraphLayout.layout() method is running, you can also obtain the layout report outside this method using the layout event listener mechanism .

detach

Detaches the graph model from the layout instance. When you attach a new graph model to the layout instance, you do not need to detach the old graph model because this is done automatically when you call ibm_ilog.graphlayout.GraphLayout.attach().

The method performs cleaning operations on the graph model. In addition to the cleaning operations in the base class, the Grid Layout algorithm removes the alignment specifications of individual nodes.

Note that you must call this method when you no longer need the layout instance. Otherwise, some objects may not be garbage collected.

getAllowedTime
Returns Number

Returns the currently allowed time for the layout algorithm in milliseconds.

Note that the method performLayout does NOT automatically stop the layout when the allowed time is exceeded. It is entirely the responsibility of the implementation of the method ibm_ilog.graphlayout.GraphLayout.layout() to do this.

getBalanceSplineCurveThreshold
Returns Number: The threshold for spline curves at bends which the optimized spline control point routing uses to balance the curve.
Returns the threshold for spline curves at bends which the optimized spline control point routing uses to balance the curve.
getBottomMargin
Returns Number
Returns the bottom margin.
getCalcLayoutRegion
Returns Rectangle: A copy of the rectangle that defines the layout region parameter.

Returns a copy of the rectangle that defines the layout region parameter.

This method first tries to use the layout region specification by calling ibm_ilog.graphlayout.GraphLayout.getSpecLayoutRegion(). If this method returns a non-null rectangle, the rectangle is returned. Otherwise, the method tries to estimate an appropriate layout region according to the number and size of the nodes in the attached graph. If no graph is attached or the attached graph is empty, this method returns a default rectangle (0, 0, 1000, 1000).

getGlobalHorizontalAlignment
Returns int
Returns the global horizontal alignment style.
getGlobalVerticalAlignment
Returns int
Returns the global vertical alignment style.
getGraphModel
Returns ibm_ilog.graphlayout.AbstractGraphLayoutModel: The graph model to lay out if one is attached.

Returns the graph model to lay out if a graph model is attached. Otherwise, the method returns null.

During the layout of a disconnected graph by a layout class that supports the connected components layout mechanism (see ibm_ilog.graphlayout.GraphLayout.supportsLayoutOfConnectedComponents()) and for which this mechanism is enabled (see ibm_ilog.graphlayout.GraphLayout.isLayoutOfConnectedComponentsEnabled()), the method ibm_ilog.graphlayout.GraphLayout.getGraphModel() may return a different graph model from the one originally attached using the method ibm_ilog.graphlayout.GraphLayout.attach(). For details, see the method ibm_ilog.graphlayout.GraphLayout.performLayout().

getHorizontalAlignment
The horizontal alignment style of an individual node. Valid values are: ' GridLayout.CENTER', ' GridLayout.LEFT' or ' GridLayout.RIGHT'.
Returns the local horizontal alignment style of the node.
ParameterTypeDescription
nodeObjectThe node instance.
getHorizontalGridOffset
Returns Number
Returns the horizontal grid offset.
getIndex
Returns int: The specified index value of the node, or ' GridLayout.NO_INDEX' if no value is specified.

Returns the index value associated with a node. It returns GridLayout.NO_INDEX if node has no index value.

ParameterTypeDescription
nodeObjectThe node instance.
getInstanceId
Returns int: A unique integer value for each layout instance.

A utility method that returns a unique integer value for each layout instance. Use this method to obtain names for properties that are unique for each layout instance.

getLayout
Returns ibm_ilog.graphlayout.GraphLayout: The layout instance.

Returns the layout instance for a subgraph of the nested graph encapsulated by the graph model of this layout instance. The returned layout instance is a clone of this layout instance.

This method is equivalent to getRecursiveLayout().getLayout(subgraph). This is an expert feature, available when the graph layout is laying out a model that is not displayed in a Graph or Diagram.

ParameterTypeDescription
subgraphObjectThe subgraph object. This must not be the root graph.
getLayoutMode
Returns int
Returns the current layout mode.
getLayoutOfConnectedComponents
Returns ibm_ilog.graphlayout.GraphLayout

Returns the layout instance that lays out the connected components of the graph.

The method returns null if the layout instance does not support the layout of connected components. that is, if the method ibm_ilog.graphlayout.GraphLayout.supportsLayoutOfConnectedComponents() returns false.

Otherwise, if a layout instance has been specified using the method ibm_ilog.graphlayout.GraphLayout.setLayoutOfConnectedComponents(), this instance is returned. If no layout instance has been specified using the method ibm_ilog.graphlayout.GraphLayout.setLayoutOfConnectedComponents(), the method returns an instance of ibm_ilog.graphlayout.grid.GridLayout. Its layout region parameter is set by default to the rectangle (0, 0, 800, 800). The layout mode parameter is set to ibm_ilog.graphlayout.grid.GridLayout.TILE_TO_ROWS. Note that the layout instance returned by this method cannot be used independently as long as it is set as a connected component layout.

getLayoutOfConnectedComponentsReport
Returns ibm_ilog.graphlayout.GraphLayoutReport: The layout report containing information about the behavior of the connected components layout.

Returns the layout report containing information about the behavior of the connected components layout.

This method returns the instance of the layout report created by the connected components layout instance.

If the last run of the layout did not use the connected components layout (because either the graph was connected, or the layout does not support this feature, or this feature was disabled, or an exception occurred during the layout process), the method returns null.

getLayoutRegion

Returns a copy of the rectangle that defines the layout region, as specified using the method ibm_ilog.graphlayout.GraphLayout.layoutRegion, or null if no rectangle has been specified, or the specified rectangle was null.

getLayoutRegionMode
Gets the layout region mode.
getLayoutReport
Returns ibm_ilog.graphlayout.GraphLayoutReport: The layout report that contains information about the behavior of the layout algorithm.

Returns the layout report, that is, the object that contains information about the behavior of the layout algorithm.

If this method is called after the method ibm_ilog.graphlayout.GraphLayout.performLayout() was called for the first time on this layout instance, it returns the instance of the layout report created by ibm_ilog.graphlayout.GraphLayout.createLayoutReport(). Otherwise, it returns null.

getLayouts
Returns ibm_ilog.graphlayout.IIterator: This layout instance and recursively the layout instances for all subgraphs that are clones of this layout instance.

Returns the instances of GraphLayout for the nested graph encapsulated by the graph model of this layout instance.

This method returns this layout instance and recursively the layout instances for all subgraphs that are clones of this layout instance. The order of the enumeration can be preorder (that is, the layout of the parent graph comes before the layout of the subgraphs) or postorder (that is, the layout of the subgraphs comes before the layout of the parent graph).

This method is equivalent to getRecursiveLayout().getLayouts(preOrder). This is an expert feature, available when the graph layout is laying out a model that is not displayed in a Graph or Diagram.

ParameterTypeDescription
preOrderBooleanIf 'true', the layout instances are returned in preorder, otherwise in postorder.
getLeftMargin
Returns Number
Returns the left margin.
getLinkConnectionBoxInterface
Returns ibm_ilog.graphlayout.ILinkConnectionBoxProvider

Returns the link connection box interface used to calculate the connection points of links during layout.

Returns null if none is specified.

getMaxNumberOfNodesPerRowOrColumn
Returns int
Returns the maximum number of nodes per row in ' GridLayout.TILE_TO_ROWS' mode or the maximum number of nodes per column in ' GridLayout.TILE_TO_COLUMNS' mode.
getMaxSplineCurveSize
Returns Number: The maximum curve size used when spline control point optimization routing is enabled.
Returns the maximum curve size used when spline control point optimization routing is enabled.
getMinBusyTime
Returns Number
Returns the minimal time that the layout algorithm can be busy between two calls of ' ibm_ilog.graphlayout.GraphLayout.onLayoutStepPerformed()' when the method ' ibm_ilog.graphlayout.GraphLayout.callLayoutStepPerformedIfNeeded()' is used.
getMinSplineCurveSize
Returns Number: The minimum curve size used when optimized spline control points routing is enabled.
Returns the minimum curve size used when optimized spline control points routing is enabled.
getNodeBoxInterface
Returns ibm_ilog.graphlayout.INodeBoxProvider

Returns the object that provides the rectangle defining the location and size of each node, if one is specified. Otherwise, it returns null.

getNodeComparator
Returns Function
Returns the comparator used for sorting the nodes.
getObjectParameter
Returns Object: The value of the parameter.

Returns the value of a parameter of the layout instance. This method returns null if the does not exist.

The method does not check that the specified node or link belongs to the specified graphModel. Also, the specified graph model does not need to be the graph model currently attached to this layout instance.

ParameterTypeDescription
graphModelibm_ilog.graphlayout.AbstractGraphLayoutModelThe graph model used for storing the parameter.
nodeOrLinkObjectThe node or link for which the parameter is to be retrieved.
keyStringThe key string for the parameter.
getParameter
Returns Object: The value stored for 'key'.

Returns the value of a parameter of the layout instance. The method returns null if the parameter does not exist.

ParameterTypeDescription
keyStringThe key string for the parameter.
getParentLayout
Returns ibm_ilog.graphlayout.GraphLayout

Returns the parent layout. If a layout instance A creates or uses another layout instance B to accomplish a part of or the total layout work, the layout instance A is called the "parent" of the layout instance B. The parent layout instance is responsible for declaring itself as a parent of B by calling the method ibm_ilog.graphlayout.GraphLayout.setParentLayout() on it. The layout instance B is called a sublayout of A.

Sublayouts never have their own local layout listeners. Layout events have parent layouts as the source.

The method returns null if the layout instance has no parent.

getRecursiveLayout
Returns ibm_ilog.graphlayout.RecursiveLayout: The recursive layout instance responsible for performing the layout when traversing the graph hierarchy.

Returns the instance of Recursive Layout that is used to perform this layout recursively when you call ibm_ilog.graphlayout.GraphLayout.performLayout() with the traverse flag set to true. The returned instance of Recursive Layout uses this layout as a reference layout, and it is attached to the same graph model as this graph model. You should call this method only when a graph model is attached. You should not detach the returned layout nor attach it to any other graph model.

The returned instance always uses the reference layout mode (see ibm_ilog.graphlayout.RecursiveLayout.getLayoutMode()). This is an expert feature, available when the graph layout is laying out a model that is not displayed in a Graph or Diagram.

getRemainingAllowedTime
Returns Number: A negative number is returned if one of the following conditions is met:
  • The allowed time has elapsed.
  • The layout does not support the allowed time.
  • This method is called when the layout report is not yet available.
  • This method is called when the layout report is no longer available.

Returns the remaining allowed time. The remaining allowed time is the difference between the allowed time given by ibm_ilog.graphlayout.GraphLayout.getAllowedTime(), and the time elapsed since the beginning of layout execution.

getRightMargin
Returns Number
Returns the right margin.
getSeedValueForRandomGenerator
Returns Number

Returns the user-defined seed value for the random generator.

An Error is thrown if the layout does not support this mechanism.

getSpecLayoutRegion
Returns Rectangle: Returns a copy of the rectangle that defines the layout region.

Returns a copy of the rectangle that defines the layout region, as specified using the method ibm_ilog.graphlayout.GraphLayout.layoutRegion.

The implementation of the method ibm_ilog.graphlayout.GraphLayout.layout() in subclasses of GraphLayout is solely responsible for whether the rectangle returned by this method is taken into account when calculating the layout, and in which manner. The method returns null in the following cases:

  • The layout region mechanism is not supported (that is, ibm_ilog.graphlayout.GraphLayout.supportsLayoutRegion() returns false).
  • You do not call setLayoutRegion and no graph model is attached to the layout

Note that, except when specified using ibm_ilog.graphlayout.GraphLayout.layoutRegion, the layout region can change with time (for example, because the size of the view passed as the argument to ibm_ilog.graphlayout.GraphLayout.setLayoutRegion() changes, or its transformer is changed).

getSplineLinkFilter
Returns ibm_ilog.graphlayout.SplineLinkFilter: The filter that detects which links are suitable for optimized spline routing.
Returns the filter that detects which links are suitable for optimized spline routing.
getTopMargin
Returns Number
Returns the top margin.
getVerticalAlignment
The vertical alignment style of an individual node. Possible values are: ' GridLayout.CENTER', ' GridLayout.TOP', ' GridLayout.BOTTOM'.
Returns the local vertical alignment style of the node.
ParameterTypeDescription
nodeObjectThe node instance
getVerticalGridOffset
Returns Number
Returns the vertical grid offset.
getViewMatrix
Returns the matrix that is applied to the first view attached to this layout.
increasePercentageComplete

Increases the percentage of completion that is stored in the layout report to the input value. Layout algorithms that support the percentage complete feature should call this method during the running of the layout. This method does not set the percentage to a lower value than the previous value. It also does not set the value to more than 100%. It silently ignores wrong input values.

ParameterTypeDescription
newPercentageintNew percentage of completion
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.

isCriticalParametersUpToDate
Returns Boolean
ParameterTypeDescription
layoutRegion
isFitToViewEnabled
Returns Boolean: 'true' if the graph drawing must fit (exactly or approximately) an area of the diagram view.

Returns true if the graph drawing must fit (exactly or approximately) an area of a specific view. Otherwise, the method returns false.

isFixed
Returns Boolean: 'true' if the node or link is specified as fixed.
Returns whether the node or link is specified as fixed.
ParameterTypeDescription
nodeOrLinkObjectNode or link instance present in the graph model attached to this layout.
isGeometryUpToDate
Returns Boolean

Returns whether the geometry of the graph is up to date.

Returns false if at least one node or link was moved or reshaped since the last time the layout was successfully performed on the same graph model or if the layout has never been performed successfully on the same graph model.

Returns true if no changes occurred.

This method is automatically called by ibm_ilog.graphlayout.GraphLayout.isLayoutNeeded().

Note that when the layout is performed successfully (that is, GraphLayoutReport.getCode() called on the layout report returns GraphLayoutReport.LAYOUT_DONE), the layout instance is automatically notified that the geometry of the graph is now up-to-date.

isIncrementalMode
Returns Boolean
Returns 'true' if the incremental mode is enabled, and 'false' otherwise.
isInputCheckEnabled
Returns Boolean

Returns true if the checks for the nodes and/or links are enabled. Returns false otherwise.

isLayoutNeeded
Returns Boolean: 'true' if it is necessary to perform the layout, 'false' otherwise.

Verifies that it is necessary to perform the layout.

Basically, the method returns false if no changes occurred on the graph model (no nodes or links were inserted, removed, reshaped, or moved) and no parameters changed since the last time the layout was successfully performed using this layout instance. Otherwise, the method returns true.

isLayoutOfConnectedComponentsEnabled
Returns Boolean

Indicates whether the connected component layout mechanism is enabled.

The default value is the value returned by the method ibm_ilog.graphlayout.GraphLayout.isLayoutOfConnectedComponentsEnabledByDefault().

isLayoutOfConnectedComponentsEnabledByDefault
Returns Boolean: 'true' if the connected components layout mechanism is enabled by default.

Returns true if the connected components layout mechanism is enabled by default. Otherwise, the method returns false.

The default implementation always returns false.

Subclasses can override this method in order to return true, that is, to indicate that the connected components layout is enabled by default.

isLayoutRunning
Returns Boolean: 'true' if this layout is currently running or (if 'checkParents' is enabled) if any parent layout is currently running.

Indicates whether this layout algorithm is running or not.

If the parameter checkParents is false, this method returns true if this layout has been started and is not yet completed. If the parameter checkParents is true, this method additionally checks whether any controlling parent layout is currently running.

ParameterTypeDescription
checkParentsBooleanIndicates that this method should also check whether any controlling parent layout is currently running.
isLayoutTimeElapsed
Returns Boolean: 'false' if the layout does not support this mechanism.

Returns true if, at the moment the method is called, the allowed layout time is exceeded; returns false otherwise.

You can call this method inside the implementation of the method ibm_ilog.graphlayout.GraphLayout.layout().

isLinkClipping
Gets whether links should be clipped at the shape of the end nodes.
isLocalRecursiveLayoutNeeded
Returns Boolean: 'true' if it is necessary to perform the layout, 'false' otherwise.

Checks whether layout is needed when layout is performed recursively on a hierarchy of nested subgraphs.

This method is called on the layout of the parent graph before the layout of the subgraphs is started. This allows the parent layout to negotiate with the subgraph layouts whether the parent layout treats the subgraphs as well, or whether the layouts of the subgraphs must run individually. If this method returns false, this layout is not performed, because some parent layout can handle the subgraph already.

The method is only called during a recursive layout (started by ibm_ilog.graphlayout.RecursiveLayout ). The default implementation returns always true. This is an expert feature, available when the graph layout is laying out a model that is not displayed in a Graph or Diagram.

ParameterTypeDescription
layoutProvideribm_ilog.graphlayout.ILayoutProviderThe object that provides a layout instance to be used for laying out each subgraph.
recLayoutibm_ilog.graphlayout.GraphLayoutThe recursive layout that started the recursive application of layouts. This can be 'null'.
rootModelibm_ilog.graphlayout.AbstractGraphLayoutModelThe graph model that is the root of the nesting hierarchy of graph models.
traverseBooleanIf 'false', this layout is intended to be only applied to its own graph model. If 'true', this layout is intended to be applied to its graph model and the layout instances provided by the 'layoutProvider' are intended to be applied recursively to all nested subgraph models. The traverse flag is basically passed through from the call of ' ibm_ilog.graphlayout.GraphLayout.performLayout()'.
isParametersUpToDate
Returns Boolean

Returns whether the layout parameters are up to date.

Returns false if at least one parameter was modified since the last time the layout was successfully performed on the same graph or if the layout has never been performed successfully on the same graph.

Returns true if no parameters changed since the last time the layout was successfully performed on the same graph model.

If a layout class supports the layout of the connected components (that is, ibm_ilog.graphlayout.GraphLayout.supportsLayoutOfConnectedComponents() returns true) and if this mechanism is enabled (that is, ibm_ilog.graphlayout.GraphLayout.isLayoutOfConnectedComponentsEnabled() returns true), an additional test is performed to check that the layout of the connected components is up-to-date. Therefore, the method returns false if the graph is disconnected and the method ibm_ilog.graphlayout.GraphLayout.isParametersUpToDate() called on the layout instance returned by ibm_ilog.graphlayout.GraphLayout.getLayoutOfConnectedComponents() returns false.

If a layout class supports the layout region mechanism (that is, ibm_ilog.graphlayout.GraphLayout.supportsLayoutRegion() returns true) and if a view must be taken into account for the computation of the layout region in container coordinates (see ibm_ilog.graphlayout.GraphLayout.getCalcLayoutRegion()), an additional test is performed to verify that the size of the view has changed. The method returns false if a change occurred.

This method is automatically called by ibm_ilog.graphlayout.GraphLayout.isLayoutNeeded().

Note that when the layout is performed successfully (that is, GraphLayoutReport.getCode() called on the layout report returns GraphLayoutReport.LAYOUT_DONE), the layout instance is automatically notified that the parameters are now up-to-date.

isPreserveFixedLinks
Returns Boolean

Returns true if the layout is not allowed to reshape the links indicated as fixed by the user. Returns false if the layout is free to reshape all the links.

Always returns false if the layout does not support this option.

isPreserveFixedNodes
Returns Boolean

Returns true if the layout is not allowed to move the nodes indicated as fixed by the user. Returns false if the layout is free to move all the nodes.

Always returns false if the layout does not support this option.

Note that fixed nodes can be handled differently by different layout algorithms. Some layout algorithms can adapt the layout of the nonfixed nodes to take into account the current positions of the fixed nodes. For details, refer to the documentation of the layout algorithm.

isSameLayoutRegion
ParameterTypeDescription
layoutRegion
isSplineRoutingEnabled
Returns Boolean: If the calculation of optimized spline control points is enabled, 'true' is returned.
Tests whether the calculation of optimized spline control points is enabled.
isStoppedImmediately
Returns Boolean: 'true' if the method 'stopImmediately' was called.

Returns true if the method ibm_ilog.graphlayout.GraphLayout.stopImmediately() was called. Layout algorithm classes can use this method to recognize that it was requested to stop the current layout run.

isStructureUpToDate
Returns Boolean

Returns whether the structure of the graph is up to date.

Returns false if at least one modification occurred in the structure of the graph model (a node or link was added or removed) since the last time the layout was successfully performed on the same graph model using this layout instance or if the layout has never been performed successfully on the same graph model. The following are considered to be modifications of the structure: adding or removing a node or link .

Returns true if no changes occurred.

This method is automatically called by ibm_ilog.graphlayout.GraphLayout.isLayoutNeeded().

Note that when the layout is performed successfully (that is, GraphLayoutReport.getCode() called on the layout report returns GraphLayoutReport.LAYOUT_DONE), the layout instance is automatically notified that the structure is now up-to-date. It is also automatically notified of the topological modifications of the graph model using a manager-contents-changed listener.

isUseSeedValueForRandomGenerator
Returns Boolean

Returns true if the user-defined seed value is used for the random generator and false otherwise.

An error is thrown An Error is thrown if the layout does not support this mechanism.

layout

Computes the layout using the Grid Layout algorithm. To start the layout, call the method ibm_ilog.graphlayout.GraphLayout.performLayout().

performLayout
Returns int: The layout code (see ibm_ilog.graphlayout.GraphLayoutReport.getCode()).
Starts the layout algorithm using the currently attached graph model and the current settings for the layout parameters.
ParameterTypeDescription
forceBooleanIf 'true', the method isLayoutNeeded is not called. No check is made to determine if it is necessary to perform the layout.
traverseBooleanIf 'true', the layout is applied to the attached graph model and recursively to all subgraph models of the attached graph model. Otherwise, it is only applied on the attached graph model.
performSublayout

This is used when this layout controls the input layout as sublayout. Layout classes can override this method if changes are needed with respect to the way how the input layout is started.

You should not call this method directly.

ParameterTypeDescription
subgraph
layout
force
setAllowedTime

Sets the upper limit for the duration of the layout algorithm.

When an iterative layout algorithm is used, the iterations can be stopped when this time is exceeded. Noniterative algorithms can also use this parameter as an upper limit for the computation time. The default value is normally 32000 (32 seconds). Subclasses that support this feature can use a different default value depending on their particular behavior. Layout algorithms that are stopped in this way set the result code of the layout report either to GraphLayoutReport.STOPPED_AND_VALID or to GraphLayoutReport.STOPPED_AND_INVALID.

When the connected components of disconnected graphs are laid out separately (see ibm_ilog.graphlayout.GraphLayout.supportsLayoutOfConnectedComponents()), the specified allowed time is considered as the total time for the layout of all the connected components plus the time for the connected components layout.

Note that the layout algorithm may not obey exactly the allowed time specification.

Note for implementers of layout algorithms: the method ibm_ilog.graphlayout.GraphLayout.performLayout() does NOT automatically stop the layout when the allowed time is exceeded. It is the sole responsibility of the implementation of the method ibm_ilog.graphlayout.GraphLayout.layout() to do this.

An Error is thrown if the layout does not support this mechanism.

ParameterTypeDescription
timeNumberThe allowed time in milliseconds.
setBalanceSplineCurveThreshold

Sets the threshold for spline curves at bends which the optimized spline control point routing uses to balance the curve.

The parameter works only if the layout supports generic spline optimization routing, and if it is enabled.

Bends in a spline have a size that is described roughly by the triangle the surrounds the curve part of a bend.

If the side length of the triangle is larger than the threshold, the algorithm tries to create a isosceles triangle. This results in more balanced bend curves.

If the side length of the triangle is smaller than the threshold, it uses non-isosceles triangles. Using isosceles triangles, the bend curve looks too sharp.

The default value is 10.

ParameterTypeDescription
thresholdNumberThe balance spline curve threshold.
setBottomMargin

Sets the bottom margin parameter.

If the layout mode is GridLayout.TILE_TO_GRID_FIXED_WIDTH or GridLayout.TILE_TO_GRID_FIXED_HEIGHT, the bottom margin is the minimum distance between the bottom border of a node (or its user-specified box - see GridLayout.setNodeBoxInterface()) and the bottom border of the grid cell.

If the layout mode is GridLayout.TILE_TO_ROWS or GridLayout.TILE_TO_COLUMNS, the minimum vertical distance between two nodes (or their user-specified boxes) is the sum of the top and bottom margins.

The default value is 5.

ParameterTypeDescription
margin
setCriticalParametersMatrixUpToDate
ParameterTypeDescription
parameterName
option
setCriticalParametersUpToDate
ParameterTypeDescription
parameterName
uptodate
setFixed

Sets the specified node or link as fixed.

Fixed nodes are not moved during the layout only if the method isPreserveFixedNodes() returns true. By default, no node is fixed.

Fixed links are not reshaped during the layout only if the method isPreserveFixedLinks() returns true. By default, no link is fixed.

ParameterTypeDescription
nodeOrLinkObjectNode or link instance which is part of the graph model.
fixedBooleanIndicates whether the object should remain fixed or not.
setGeometryUpToDate

Sets whether the geometry of the graph is up to date.

If the argument is false, notifies the layout instance that the geometry of the graph was changed since the last time the layout was successfully performed.

Usually you do not need to call this method. The method is automatically called with a true argument each time the layout is successfully performed.

ParameterTypeDescription
uptodate
setGlobalHorizontalAlignment

Sets the global horizontal alignment style. This method controls the horizontal alignment of nodes either inside their grid cell if the layout mode (see GridLayout.setLayoutMode()) is GridLayout.TILE_TO_GRID_FIXED_WIDTH or GridLayout.TILE_TO_GRID_FIXED_HEIGHT, or inside the columns if the layout mode is GridLayout.TILE_TO_COLUMNS. This parameter is not used if the layout mode (see GridLayout.setLayoutMode()) is GridLayout.TILE_TO_ROWS.

Valid values are:

  • GridLayout.CENTER - the node is centered in its grid cell or column.
  • GridLayout.LEFT - the node is aligned to the left border of the cell or column.
  • GridLayout.RIGHT - the node is aligned to the left border of the cell or column.
  • GridLayout.MIXED - each node can have a different alignment option. In this case, the horizontal alignment of each individual node can be set by the method GridLayout.setHorizontalAlignment() so that different alignments can occur in the same layout.

The default value is GridLayout.CENTER.

ParameterTypeDescription
alignment
setGlobalVerticalAlignment

Sets the global vertical alignment style. This method controls the vertical alignment of nodes either inside their grid cell if the layout mode (see GridLayout.setLayoutMode()) is GridLayout.TILE_TO_GRID_FIXED_WIDTH or GridLayout.TILE_TO_GRID_FIXED_HEIGHT, or inside the rows if the layout mode is GridLayout.TILE_TO_ROWS. This parameter is not used if the layout mode (see GridLayout.setLayoutMode()) is GridLayout.TILE_TO_COLUMNS.

Valid values are:

  • GridLayout.CENTER - the node is centered in its grid cell or column.
  • GridLayout.TOP - the node is aligned to the top border of the cell or column.
  • GridLayout.BOTTOM - the node is aligned to the bottom border of the cell or column.
  • GridLayout.MIXED - each node can have a different alignment option. In this case, the vertical alignment of each individual node can be set by the method GridLayout.setVerticalAlignment() so that different alignments can occur in the same layout.

The default value is GridLayout.CENTER.

ParameterTypeDescription
alignment
setGraphModel

Sets the graph model to be laid out. You should not call this method. Instead, use the method ibm_ilog.graphlayout.GraphLayout.attach().

ParameterTypeDescription
graphModel
setHorizontalAlignment

Sets the horizontal alignment style of an individual node. This alignment style is used only if the global horizontal alignment is set to GridLayout.MIXED. Otherwise, all nodes have the alignment style that is specified as the global alignment style.

This parameter controls the horizontal alignment of nodes either inside their grid cells if the layout mode (see GridLayout.setLayoutMode()) is GridLayout.TILE_TO_GRID_FIXED_WIDTH or GridLayout.TILE_TO_GRID_FIXED_HEIGHT, or within the columns if the layout mode is GridLayout.TILE_TO_COLUMNS.

This parameter is not used if the layout mode (see GridLayout.setLayoutMode()) is GridLayout.TILE_TO_ROWS.

Valid values are:

  • GridLayout.CENTER - the node is centered in its grid cell or column.
  • GridLayout.LEFT - the node is aligned to the left border of the cell or column.
  • GridLayout.RIGHT - the node is aligned to the right border of the cell or column.

The default value is GridLayout.CENTER.

ParameterTypeDescription
nodeObjectThe node instance.
alignmentintThe horizontal alignment style of an individual node. Valid values are: ' GridLayout.CENTER', ' GridLayout.LEFT' or ' GridLayout.RIGHT'.
setHorizontalGridOffset

Sets the spacing of the grid lines on the horizontal axis.

The default value is 40.

This parameter is not used if the layout mode (see GridLayout.setLayoutMode()) is GridLayout.TILE_TO_ROWS or GridLayout.TILE_TO_COLUMNS.

ParameterTypeDescription
offset
setIncrementalMode

Sets 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 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 when nonincremental mode is used.

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

  • layout region
  • grid offset
  • layout mode
  • margins

The default value is false (disabled).

ParameterTypeDescription
enable
setIndex

Sets the index of a node. When the layout is performed, the nodes for which indexes have been specified are arranged in the order corresponding to their index values (starting in the upper-left corner with the smallest index value); the nodes for which indexes have not been specified are arranged after them. You can specify the class field GridLayout.NO_INDEX as an index value if you want to clear an index value that 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.

ParameterTypeDescription
nodeObjectThe node instance.
indexintThe index of the specified node. When the layout is performed, the nodes for which indexes have been specified are arranged in the order corresponding to their index values (starting in the upper-left corner with the smallest index value).
setInputCheckEnabled

Sets whether the checks for the nodes and/or links provided as arguments for the different methods of the layout algorithms are enabled.

If enabled, methods that require a node or a link as an argument check whether the object they receive is really a node or a link in the attached graph (using the methods AbstractGraphLayoutModel.isNode() and AbstractGraphLayoutModel.isLink()).

The checks can be disabled to avoid their overhead cost. The default value is true.

ParameterTypeDescription
enable
setLayoutMode

Sets the layout mode. Valid values are:

  • GridLayout.TILE_TO_GRID_FIXED_WIDTH - The nodes are placed in the cells of a grid (matrix) that has a fixed maximum number of columns. This number is equal to the width of the layout region parameter divided by the horizontal grid offset (see GridLayout.setHorizontalGridOffset()).
  • GridLayout.TILE_TO_GRID_FIXED_HEIGHT - The nodes are placed in the cells of a grid (matrix) that has a fixed maximum number of rows. This number is equal to the height of the layout region parameter divided by the vertical grid offset (see GridLayout.setVerticalGridOffset()).
  • GridLayout.TILE_TO_ROWS - The nodes are placed in rows. The maximum width of the rows is equal to the width of the layout region parameter. The height of each row is the maximum height of the nodes contained in the row (plus margins).
  • GridLayout.TILE_TO_COLUMNS - The nodes are placed in columns. The maximum height of the columns is equal to the height of the layout region parameter. The width of each column is the maximum width of the nodes contained in the column (plus margins).

The default value is GridLayout.TILE_TO_GRID_FIXED_WIDTH.

ParameterTypeDescription
mode
setLayoutOfConnectedComponents

Sets the layout instance that lays out the connected components of the graph. When this method is not called, a default layout instance (see ibm_ilog.graphlayout.GraphLayout.getLayoutOfConnectedComponents() is used. You can call this method with a null argument to return to the default connected components layout instance.

Note the following points:

  • The layout instance passed as the argument cannot be used independently as long as it is set as a connected component layout.
  • The connected component layout is not used if the graph is connected.

ParameterTypeDescription
layoutibm_ilog.graphlayout.GraphLayoutThe layout instance to set, or 'null' to return to the default layout instance.
setLayoutOfConnectedComponentsEnabled

Sets whether the generic connected component layout mechanism is enabled. If enabled on a layout class that supports this mechanism (see ibm_ilog.graphlayout.GraphLayout.supportsLayoutOfConnectedComponents()), the method ibm_ilog.graphlayout.GraphLayout.performLayout() cuts the attached graph model into connected components and lays out each connected component separately. Then the connected components are placed using the layout instance returned by the method ibm_ilog.graphlayout.GraphLayout.getLayoutOfConnectedComponents().

Notice that the connected component layout is not used if the graph is connected.

The default value is the value returned by the method ibm_ilog.graphlayout.GraphLayout.isLayoutOfConnectedComponentsEnabledByDefault().

ParameterTypeDescription
enableBooleanSet to 'true' to enable the connected component layout mechanism, or 'false' to disable.
setLayoutRegion

Sets the layout region as a rectangle rect), with the dimensions of the rectangle being given in container (graph model) coordinates. The region's new position is specified by rect.x and rect.y, and its new size is specified by rect.width and rect.height.

For subclasses that support this parameter, the layout region is usually the rectangle that the graph must fit (exactly or approximately) after the layout is performed, or the rectangle which influences the position and/or size of the resulting layout. The way the layout region parameter is taken into account is the sole responsibility of the subclasses.

You should use this method if you want to perform the layout with no manager view attached to the graph model or if you want to define the region to fit in the manager coordinates. If you want the layout to fit a region of a manager view, with its dimensions in manager view coordinates, use the method ibm_ilog.graphlayout.GraphLayout.setLayoutRegion(). If you want to revert to the default layout region, that is the layout region which is computed by default if no layout region has been previously specified, you can call this method with a null argument.

An Error is thrown if the layout does not support this mechanism, or if the width or height of rect is 0.

ParameterTypeDescription
rectRectangleThe rectangle for the layout region, or 'null'.
setLayoutRegionMode
Sets the layout region mode.
ParameterTypeDescription
value
setLayoutReport

Sets the layout report, that is, the object that contains information about the behavior of the layout algorithm.

This method is called automatically by ibm_ilog.graphlayout.GraphLayout.performLayout() with the layout report created using the method ibm_ilog.graphlayout.GraphLayout.createLayoutReport(). Subclasses can override this method to perform additional actions.

ParameterTypeDescription
reportibm_ilog.graphlayout.GraphLayoutReportNew layout report.
setLayoutRunning

Sets whether layout is running. The method is part of IBM ILOG Dojo Diagrammer internals. You should not use it.

ParameterTypeDescription
runningBooleanWhether layout is running or not.
fromParentsBooleanWhether this is a notification from a parent layout or from this layout instance.
setLeftMargin

Sets the left margin parameter.

If the layout mode is GridLayout.TILE_TO_GRID_FIXED_WIDTH or GridLayout.TILE_TO_GRID_FIXED_HEIGHT, the left margin is the minimum distance between the left border of a node (or its user-specified box - see GridLayout.setNodeBoxInterface()) and the left border of the grid cell.

If the layout mode is GridLayout.TILE_TO_ROWS or GridLayout.TILE_TO_COLUMNS, the minimum horizontal distance between two nodes (or their user-specified boxes) is the sum of the left and right margins.

The default value is 5.

ParameterTypeDescription
margin
setLinkClipping
Sets whether links should be clipped at the shape of the end nodes.
ParameterTypeDescription
value
setLinkConnectionBoxInterface

Sets the link connection box interface for the connection points of links. 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.

By default, the layout algorithm places the connection points of the links relative to the bounding box of the nodes (see ).

By setting a link connection box interface, the links can be connected relative to a different box (see ILinkConnectionBoxProvider.getBox()). It is furthermore possible to "shift" the links tangentially by using the method ILinkConnectionBoxProvider.getTangentialOffset() from the interface ILinkConnectionBoxProvider:

  • On the "top" and "bottom" sides of a node, the connection points are moved to the right if the offset is positive and to the left if the offset is negative.
  • On the "left" and "right" sides of a node, the connection points are moved to the bottom if the offset is positive and to the top if the offset is negative.
The details of how the link connection box is used depend on the specific layout algorithm.

You can call this method with a null argument to restore the default behavior.

An Error is thrown if the layout does not support this mechanism.

ParameterTypeDescription
linkConnectionBoxInterface
setMaxNumberOfNodesPerRowOrColumn

Sets the maximum number of nodes per row or per column.

In GridLayout.TILE_TO_ROWS mode, the number is the maximum number of nodes per row. In GridLayout.TILE_TO_COLUMNS mode, the number is the maximum number of nodes per column.

The layout places as many nodes on each row or column as possible given the size of the nodes, the dimensional parameters (layout region and margins) and the specified maximum number of nodes per row or column.

The minimum value is 1. The default value is Number.MAX_VALUE , that is, the number of nodes placed in each row or column is bounded only by the size of the nodes and the dimensional parameters. The parameter has no effect if the layout mode is GridLayout.TILE_TO_GRID_FIXED_WIDTH or GridLayout.TILE_TO_GRID_FIXED_HEIGHT.

ParameterTypeDescription
nNodes
setMaxSplineCurveSize

Sets the maximum curve size used when optimized spline control point routing is enabled.

The parameter works only if the layout supports the generic spline optimization routing, and if it is enabled.

Bends in a spline have a size that is described roughly by the triangle the surrounds the curve part of a bend. Spline routing tries to set the side length of this triangle at each bend between the minimum curve size and the maximum curve size.

The default value is 30.

ParameterTypeDescription
sizeNumberThe maximum spline curve size
setMinBusyTime

Sets the minimal time that the layout algorithm can be busy. This is the time between two calls of ibm_ilog.graphlayout.GraphLayout.onLayoutStepPerformed() when the method ibm_ilog.graphlayout.GraphLayout.callLayoutStepPerformedIfNeeded() is used.

The objective is to avoid the overhead of ibm_ilog.graphlayout.GraphLayout.onLayoutStepPerformed() becoming too high if the method is called too often. Internal routines of layout algorithms usually call ibm_ilog.graphlayout.GraphLayout.callLayoutStepPerformedIfNeeded(), which calls ibm_ilog.graphlayout.GraphLayout.onLayoutStepPerformed() if the time since the last call was at least the minimal busy time.

The default value is 50 (milliseconds).

ParameterTypeDescription
time
setMinSplineCurveSize

Sets the minimum curve size used when optimized spline control point routing is enabled.

The parameter works only if the layout supports the generic spline optimization routing, and if it is enabled.

Bends in a spline have a size that is described roughly by the triangle the surrounds the curve part of a bend. Spline routing tries to set the side length of this triangle at each bend between the minimum curve size and the maximum curve size.

The default value is 5.

ParameterTypeDescription
sizeNumberThe minimum spline curve size
setNodeBoxInterface

Sets an object that provides the rectangle defining the location and size of each node.

This method allows a node size other than the bounding box to be taken into account by the layout algorithm.

If you do not call this method, the layout algorithm uses the bounding box of the node (see IGraphLayoutModel.getObjectBounds()).

The default value is null. You can call this method with a null argument to restore the default behavior.

ParameterTypeDescription
nodeBoxInterface
setNodeComparator

Sets the comparator used for sorting the nodes. The valid values are the following:

  • GridLayout.AUTOMATIC_ORDERING - The algorithm is free to choose an order aimed at reducing the total area occupied by the layout.
  • GridLayout.NO_ORDERING - No ordering is performed.
  • GridLayout.DESCENDING_HEIGHT - The nodes are ordered in descending order of height.
  • GridLayout.ASCENDING_HEIGHT - The nodes are ordered in ascending order of height.
  • GridLayout.DESCENDING_WIDTH - The nodes are ordered in descending order of width.
  • GridLayout.ASCENDING_WIDTH - The nodes are ordered in ascending order of width.
  • GridLayout.DESCENDING_AREA - The nodes are ordered in descending order of area.
  • GridLayout.ASCENDING_AREA - The nodes are ordered in ascending order of area.
  • GridLayout.ASCENDING_INDEX - The nodes are ordered in ascending order of index value (see GridLayout.setIndex()).
  • GridLayout.DESCENDING_INDEX - The nodes are ordered in descending order of index value (see GridLayout.setIndex()).
  • null - The nodes are ordered in an arbitrary way.
  • Any other implementation of the java.util.Comparator interface - the nodes are ordered according to this custom comparator .
The default value is GridLayout.AUTOMATIC_ORDERING.

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

In incremental mode (see GridLayout.setIncrementalMode()) or when nodes are fixed (see ibm_ilog.graphlayout.GraphLayout.setFixed()) the order of the nodes is not guaranteed to obey the comparator, since this specification competes with the other constraints.

If the layout mode is GridLayout.TILE_TO_GRID_FIXED_WIDTH or GridLayout.TILE_TO_GRID_FIXED_HEIGHT, the order options are applied only for nodes whose size (including margins) is smaller than the grid cell size (see GridLayout.setHorizontalGridOffset() and GridLayout.setVerticalGridOffset()).

ParameterTypeDescription
comparator
setObjectParameter
Returns Object: The value that was previously stored for 'key', or 'null' if none.

Sets the value of a parameter for a node or a link, using a given graph model.

If value is null, the parameter is removed. Otherwise, the parameter value is set to value.

Notice that the method does not check whether the node or link actually belongs to graphModel. The input graph model does not need to be the graph model currently attached to this layout instance.

ParameterTypeDescription
graphModelibm_ilog.graphlayout.AbstractGraphLayoutModelThe graph model used for storing the parameter.
nodeOrLinkObjectThe node or link for which the parameter is to be set.
keyStringThe key string for the parameter.
valueObjectThe new value of the parameter.
setParameter
Returns Object: The value that was previously stored for 'key', or 'null' if none.

Sets the value of a property for the layout instance. If value is null, the parameter is removed. Otherwise, the parameter value is set to value.

ParameterTypeDescription
keyStringThe key string for the parameter.
valueObjectThe new value of the parameter.
setParametersUpToDate

Sets whether the parameters of the graph layout are up to date.

If the argument is false, notifies the layout instance that a parameter value was changed.

This method is automatically called with a false argument each time the value of a parameter is changed using the methods provided in this class or in its subclasses provided in IBM ILOG Dojo Diagrammer.

The method is automatically called with a true argument each time the layout is successfully performed.

ParameterTypeDescription
uptodate
setParentLayout

Sets the parent layout of this layout instance. You should not call this method directly.

ParameterTypeDescription
parent
setPreserveFixedLinks

Sets whether the layout avoids movement of fixed links. If the argument is true, specifies that the layout is not allowed to reshape the links indicated as fixed by the user. If the argument is false, the layout is free to reshape all the links of the graph. (This does not change the setting for the fixed links, which can still be used at any time in the future.)
The default value is false.

An Error is thrown if the layout class does not support this option.

ParameterTypeDescription
option
setPreserveFixedNodes

Sets whether the layout avoids movement of fixed nodes. If the argument is true, specifies that the layout is not allowed to move the nodes indicated as fixed by the user. If the argument is false, the layout is free to move all the nodes of the graph. (This does not change the setting for the fixed nodes, which can still be used at any time in the future.)

The default value is false.

Note that fixed nodes can be handled differently by different layout algorithms. Some layout algorithms can adapt the layout of the nonfixed nodes to take into account the current positions of the fixed nodes. For details, refer to the documentation of the layout algorithm.

ParameterTypeDescription
option
setRightMargin

Sets the right margin parameter.

If the layout mode is GridLayout.TILE_TO_GRID_FIXED_WIDTH or GridLayout.TILE_TO_GRID_FIXED_HEIGHT, the right margin is the minimum distance between the right border of a node (or its user-specified box - see GridLayout.setNodeBoxInterface()) and the right border of the grid cell.

If the layout mode is GridLayout.TILE_TO_ROWS or GridLayout.TILE_TO_COLUMNS, the minimum horizontal distance between two nodes (or their user-specified boxes) is the sum of the left and right margins.

The default value is 5.

ParameterTypeDescription
margin
setSeedValueForRandomGenerator

Sets the seed value for the random generator. The default value is 0. The user-defined seed value is used only if you call setUseSeedValueForRandomGenerator(boolean) with a true argument.

An Error is thrown if the layout does not support this mechanism.

ParameterTypeDescription
seed
setSplineLinkFilter

Sets the filter that detects which links are suitable for optimized spline routing.

The parameter works only if the layout supports the generic spline optimization routing, and if it is enabled.

The filter detects which objects are splines, so that the optimized spline routing is only applied to splines, not to normal polyline links.

ParameterTypeDescription
filter
setSplineRoutingEnabled

Sets whether the calculation of optimized spline control points is enabled.

If the layout algorithm supports generic spline optimization, this option enables the optimization of spline control points. Such optimization improves the result only if the splines use a smoothness between 0.1 and 0.9. It does not affect links that are not reshaped by the layout algorithm or that are routed as straight lines.

This is an expert option. It is disabled by default.

ParameterTypeDescription
flagBooleanSet to 'true' to enable the optimization of spline control points.
setStructureUpToDate

Sets whether the structure of the graph is up to date.

If the argument is false, notifies the layout instance that the structure of the graph was changed since the last time the layout was successfully performed.

Usually you do not need to call this method. The method is automatically called with a true argument each time the layout is successfully performed.

ParameterTypeDescription
uptodate
setTopMargin

Sets the top margin parameter.

If the layout mode is GridLayout.TILE_TO_GRID_FIXED_WIDTH or GridLayout.TILE_TO_GRID_FIXED_HEIGHT, the top margin is the minimum distance between the top border of a node (or its user-specified box - see GridLayout.setNodeBoxInterface()) and the top border of the grid cell.

If the layout mode is GridLayout.TILE_TO_ROWS or GridLayout.TILE_TO_COLUMNS, the minimum vertical distance between two nodes (or their user-specified boxes) is the sum of the top and bottom margins.

The default value is 5.

ParameterTypeDescription
margin
setUseSeedValueForRandomGenerator

Sets whether the user-defined seed value should be used for the random generator.

An Error is thrown if the layout does not support this mechanism.

ParameterTypeDescription
option
setVerticalAlignment

Sets the vertical alignment style of an individual node. This alignment style is used only if the global vertical alignment is set to GridLayout.MIXED. Otherwise, all nodes have the alignment style that is specified as the global alignment style.

This parameter controls the vertical alignment of nodes either inside their grid cell if the layout mode (see GridLayout.setLayoutMode()) is GridLayout.TILE_TO_GRID_FIXED_WIDTH or GridLayout.TILE_TO_GRID_FIXED_HEIGHT, or within the rows if the layout mode is GridLayout.TILE_TO_ROWS.

This parameter is not used if the layout mode (see GridLayout.setLayoutMode()) is GridLayout.TILE_TO_COLUMNS.

Valid values are:

  • GridLayout.CENTER - the node is centered in its grid cell or column.
  • GridLayout.TOP - the node is aligned to the top border of the cell or column.
  • GridLayout.BOTTOM - the node is aligned to the bottom border of the cell or column.

The default value is GridLayout.CENTER.

ParameterTypeDescription
nodeObjectThe node instance.
alignmentintThe vertical alignment style of an individual node. Possible values are: ' GridLayout.CENTER', ' GridLayout.TOP', ' GridLayout.BOTTOM'.
setVerticalGridOffset

Sets the spacing of the grid lines on the vertical axis.

The default value is 40.

This parameter is not used if the layout mode (see GridLayout.setLayoutMode()) is GridLayout.TILE_TO_ROWS or GridLayout.TILE_TO_COLUMNS.

ParameterTypeDescription
offset
stopImmediately
Returns Boolean: 'true' if it was possible to indicate to this layout to stop its execution, 'false' if this layout does not support this feature or if it cannot be stopped.

Stops the running layout algorithm as soon as possible.

This method only sets the flag ibm_ilog.graphlayout.GraphLayout.isStoppedImmediately() to true; it is the responsibility of the implementation of the method ibm_ilog.graphlayout.GraphLayout.layout() to react in an appropriate way. Layout algorithms that support the immediate stop feature should check the flag ibm_ilog.graphlayout.GraphLayout.isStoppedImmediately() from time to time and react when this flag changes to true.

Layout algorithms that are stopped in this way set the result code of the layout report to GraphLayoutReport.STOPPED_AND_VALID or GraphLayoutReport.STOPPED_AND_INVALID.

supportsAllowedTime
Returns Boolean

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 Grid Layout algorithm, the result code in the layout report is ibm_ilog.graphlayout.GraphLayoutReport.STOPPED_AND_INVALID.

supportsLayoutOfConnectedComponents
Returns Boolean

Indicates whether the layout class can cut the attached graph into connected components, apply itself on each connected component separately, and then use the layout instance returned by the method ibm_ilog.graphlayout.GraphLayout.getLayoutOfConnectedComponents() to position the connected components.

The default implementation always returns false. Subclasses can override this method in order to return true, that is, to indicate that this option is supported.

supportsLayoutRegion
Returns Boolean

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.

If the layout mode (see GridLayout.setLayoutMode()) is GridLayout.TILE_TO_GRID_FIXED_WIDTH, the width of the layout region determines the maximum width of the layout (the maximum number of columns).

If the layout mode is GridLayout.TILE_TO_GRID_FIXED_HEIGHT, the height of the layout region determines the maximum height of the layout (the maximum number of rows).

If the layout mode is GridLayout.TILE_TO_ROWS, the width of the layout region determines the maximum width of the rows.

If the layout mode is GridLayout.TILE_TO_COLUMNS, the height of the layout region determines the maximum height of the columns.

However, if the width of a node is larger than the maximum width of the layout or the height of the node is larger than the maximum height of the layout, the bounding box of the node will be placed partially out of the specified layout region.

In all layout modes, the coordinates of the top-left corner of the layout region determines the coordinates of the top-left border of the layout.

supportsLinkConnectionBox
Returns Boolean

Indicates whether the 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.

If the layout class supports this feature and a connection box interface object is set using the method ibm_ilog.graphlayout.GraphLayout.setLinkConnectionBoxInterface(), the layout algorithm uses this object to calculate the connection points for links.

The default implementation always returns false. Subclasses can override this method in order to return true, that is, to indicate that this option is supported.

supportsPercentageComplete
Returns Boolean

Indicates whether the layout class can estimate the percentage of completion during the run of layout. If supported, the percentage is stored in the layout report and can be retrieved by any layout event listener.

The default implementation always returns false. Subclasses can override this method in order to return true; that is, to indicate that this option is supported.

supportsPreserveFixedLinks
Returns Boolean

Indicates whether the layout class allows the user to specify fixed links. Fixed links are not reshaped during the layout.

The default implementation always returns false. Subclasses can override this method in order to return true; that is, to indicate that this option is supported.

supportsPreserveFixedNodes
Returns Boolean

Indicates that this layout class allows the user to specify fixed nodes.

Fixed nodes are not moved during the layout if the method ibm_ilog.graphlayout.GraphLayout.setPreserveFixedNodes() is called with a true argument . Nonfixed nodes are placed in such a manner that overlaps with fixed nodes are avoided.

supportsRandomGenerator
Returns Boolean

Indicates whether the layout class uses randomly generated numbers (or randomly chosen parameters) for which it can accept a user-defined seed value. When you perform the same layout on the same graph several times and use the same user-defined seed value (or some other constant value), the same random numbers are generated and, if the algorithm is deterministic, you obtain the same drawing of the graph model. If you want different drawings each time you perform the layout, you can modify the seed value and call the method ibm_ilog.graphlayout.GraphLayout.setUseSeedValueForRandomGenerator() with a true argument.

The default implementation always returns false.

Subclasses can override this method in order to return true, that is, to indicate that this option is supported.

supportsSplineRouting
Returns Boolean

Indicates whether the layout class supports the generic optimization of spline control points.

Subclasses can override this method in order to return true, that is, to indicate that this option is supported. Subclasses that do not route the links and always use straight links cannot benefit from the generic mechanism.

supportsStopImmediately
Returns Boolean

Indicates that this layout class can control the current run by interrupting the run of the layout immediately.

If the algorithm is stopped before termination, the result code in the layout report is ibm_ilog.graphlayout.GraphLayoutReport.STOPPED_AND_INVALID.

toString
Returns String: A printable string representing this layout instance.

Returns a printable string containing the fully qualified class name and the identifier returned by the method getInstanceId().

unfixAllLinks

Removes the fixed attribute from all links in the graph model.

An Error is thrown if the layout class does not support this option or if there is no attached graph model.

unfixAllNodes

Removes the fixed attribute from all nodes in the graph model. An Error is thrown if the layout class does not support this option or if there is no attached graph model.

Events

onLayoutStepPerformed

This method can be called by the layout classes when a step (or iteration) of the layout algorithm has been performed.

ParameterTypeDescription
layoutStarted
layoutFinished
onObjectParameterChanged

Called when a layout parameter for a specific node or link has changed.

It calls ibm_ilog.graphlayout.GraphLayout.setParametersUpToDate() with a false argument to notify the layout instance that the layout is not up-to-date. It also fires a graph layout parameter event.

If you add new parameters for specific nodes and links to your own subclass of GraphLayout, you should call this method each time they are modified.

ParameterTypeDescription
nodeOrLinkObjectNode or link instance for which a parameter has been changed.
parameterNameStringName of the parameter whose value has been changed.
onParameterChanged

Called when a global layout parameter has changed.

Global layout parameters affect all or many nodes and links. It calls ibm_ilog.graphlayout.GraphLayout.setParametersUpToDate() with a false argument to notify the layout instance that the layout is not anymore up to date. It also fires a graph layout parameter event.

If you add new global parameters in your own subclass of GraphLayout, you should call this method each time they are modified.

ParameterTypeDescription
parameterNameStringName of the parameter whose value has been changed.
onParameterChangedImpl
ParameterTypeDescription
nodeOrLink
parameterName