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

ibm_ilog.diagram.Graph

Object » graphCreator » dojox.gfx.Group » ibm_ilog.diagram.Graph
dojo.require("ibm_ilog.diagram.Graph");

The Graph object acts as a container for Node and Link objects.

Property Summary

Method Summary

  • clear(dispose) removes all shapes from a group/surface
  • constructor()
  • createLink(template, context) Creates a new link in this Graph.
  • createNode(template, context) Creates a new node in this Graph.
  • createSubgraph(template, context) Creates a new subgraph in this Graph.
  • createSwimLane(template, context) Creates a new swim lane in this Graph.
  • fitToContents(margin, zoomOutOnly) Changes the transform of this Graph so that the whole graph is visible in its parent surface.
  • getFitToContentsTransform(margin, zoomOutOnly) Computes the transform to apply to this Graph so that the whole graph is visible in its parent surface.
  • getId()
  • getLinkLayout() Gets the link layout algorithm that will be executed on the contents of this graph when performGraphLayout is called.
  • getLinks() returns Array Returns the links (that is, instances of ibm_ilog.diagram.Link) contained in this Graph.
  • getMoveLimits() Gets the move limits for this Graph.
  • getNodeLayout() Gets the graph layout algorithm that will be executed on the contents of this graph when performGraphLayout is called.
  • getNodes() returns Array Returns the nodes (that is, instances of ibm_ilog.diagram.Node) contained in this Graph.
  • getOwningSubgraph() returns ibm_ilog.diagram.Subgraph Returns the Subgraph object that is displaying this Graph.
  • getSelection() Returns the selection object, if selection is enabled in the graph (isSelect == true).
  • getSubgraphs() returns Array Returns the subgraphs (that is, instances of ibm_ilog.diagram.Subgraph) contained in this Graph.
  • getTextDir() returns text direction of the graph
  • hitTest(p, tolerance)
  • isAnimatedLayout() Returns the flags that determines if an animation must be displayed after a graph layout has been performed.
  • isAutoFitOnLayout() Returne the boolean that determines if fitToContents is called after a graph layout is performed.
  • isAutomaticLinkLayout() Returns the flag specifying if the link layout must be executed automatically whenever the graph changes. returns Boolean: True if the link layout will be executed automatically whenever the graph changes. False if the link layout is executed only by calling performGraphLayout explicitly.
  • isAutomaticNodeLayout() Returns the flag specifying if the graph layout must be executed automatically whenever the graph changes.
  • isLinkLayoutActive() Returns true if the link layout is active, or false otherwise.
  • isMove() Returns true if move is enabled, or false if move is disabled.
  • isNodeLayoutActive() Returns true if the graph layout is active, or false otherwise.
  • isSelect() returns Boolean Returns true if selection is enabled, or false if selection is disabled.
  • performGraphLayout(recursive) Executes the graph layout and/or the link layout specified by the setNodeLayout() and setLinkLayout methods.
  • setAnimatedLayout(animated) Determines if an animation must be displayed after a graph layout has been performed.
  • setAutoFitOnLayout(autoFit) Determines if fitToContents is called after a graph layout is performed.
  • setAutomaticLinkLayout(automatic) Determines if the link layout must be executed automatically whenever the graph changes.
  • setAutomaticNodeLayout(automatic) Determines if the graph layout must be executed automatically whenever the graph changes.
  • setLinkLayout(layout) Sets the link layout algorithm that will be executed on the contents of this graph when performGraphLayout is called.
  • setLinkLayoutActive(active) Activates or deactivates the link layout specified by setLinkLayout().
  • setMove(move) Enables or disables interactive move on this Graph.
  • setMoveLimits(rect) Sets the move limits for this Graph.
  • setNodeLayout(layout) Sets the graph layout algorithm that will be executed on the contents of this graph when performGraphLayout is called.
  • setNodeLayoutActive(active) Activates or deactivates the graph layout specified by setNodeLayout().
  • setSelect(select) Enables or disables interactive selection on this Graph.
  • setTextDir(textdir) set text direction to graph, propagate a new text direction to children (subgraphs, nodes, links)
  • toString()

Event Summary

  • onChanged() This event is called to signal that the contents of the graph have changed.
  • onElementMoving(element, transform, delta) Called when an element is about to be moved by an interactor.
  • onLayoutAnimate(v) Called on each step of the graph layout animation, if isAnimatedGraphLayout() is true.
  • onLayoutAnimationEnd() Called when the graph layout animation ends, if isAnimatedGraphLayout() is true.
  • onLayoutAnimationStart() Called when the graph layout animation starts, if isAnimatedGraphLayout() is true.

Attached Objects

Properties

defaultShape

Methods

clear
removes all shapes from a group/surface
ParameterTypeDescription
disposeboolean: Indicates whether the graph contents should be disposed. The default value is true.
constructor
createLink
The new link.

The description defined in the template parameter must specify which shape in the template defines the link path by means of the dojoAttachPoint attribute set to 'path'. In addition, the optional start and end arrow shapes can be defined in the template object and in this case must be declared using the corresponding 'startArrow' and '_endArrow' dojoAttachPoint's.

ParameterTypeDescription
templateStringThe template of the new link. If not specified, the default link template is used.
context
createNode
The new node.
Creates a new node in this Graph.
ParameterTypeDescription
templateStringThe template of the new node. If not specified, the default node template is used. If null, then an empty node is created.
context
createSubgraph
The new subgraph.
Creates a new subgraph in this Graph.
ParameterTypeDescription
templateStringThe template of the new subgraph. If not specified or null, the default subgraph template is used.
context
createSwimLane
The new swim lane.
Creates a new swim lane in this Graph.
ParameterTypeDescription
templateStringThe template of the new swim lane. If not specified or null, the default swim lane template is used.
context
fitToContents
Changes the transform of this Graph so that the whole graph is visible in its parent surface.
ParameterTypeDescription
marginnumber:A margin (in pixels) to leave around the graph contents.
zoomOutOnlyboolean:If true, the graph will only be zoomed out, that is, if its contents are smaller than the surface, the graph will only be centered and not zoomed in. If false, the graph will be zoomed in or out to fit the size of the parent surface.
getFitToContentsTransform
dojox.gfx.matrix.Matrix2D: The transform to apply to the graph. If the parent of the graph is not a GFX Surface, the identity matrix is returned.
Computes the transform to apply to this Graph so that the whole graph is visible in its parent surface.
ParameterTypeDescription
marginnumber:A margin (in pixels) to leave around the graph contents.
zoomOutOnlyboolean:If true, the graph will only be zoomed out, that is, if its contents are smaller than the surface, the graph will only be centered and not zoomed in. If false, the graph will be zoomed in or out to fit the size of the parent surface.
getId
getLinkLayout
ibm_ilog.graphlayout.GraphLayout: The link layout algorithm that will be executed on the contents of this graph when performGraphLayout is called.
Gets the link layout algorithm that will be executed on the contents of this graph when performGraphLayout is called.
getLinks
Returns Array
Returns the links (that is, instances of ibm_ilog.diagram.Link) contained in this Graph.
getMoveLimits
Rectangle A rectangle (x/y/width/height) that specifies the region where nodes are allowed to be moved. If null, node moves are not limited. The default is null (no limit).

See setMoveLimits().

getNodeLayout
ibm_ilog.graphlayout.GraphLayout: The graph layout algorithm that will be executed on the contents of this graph when performGraphLayout is called.
Gets the graph layout algorithm that will be executed on the contents of this graph when performGraphLayout is called.
getNodes
Returns Array
Returns the nodes (that is, instances of ibm_ilog.diagram.Node) contained in this Graph.
getOwningSubgraph
Returns ibm_ilog.diagram.Subgraph: The Subgraph object that is displaying this Graph.

Returns the Subgraph object that is displaying this Graph. If this GraphSubgraph, returns null or undefined.

getSelection
Returns the selection object, if selection is enabled in the graph (isSelect == true).
getSubgraphs
Returns Array
Returns the subgraphs (that is, instances of ibm_ilog.diagram.Subgraph) contained in this Graph.
getTextDir
returns text direction of the graph
hitTest
ParameterTypeDescription
p
tolerance
isAnimatedLayout
boolean: True if graph layout is animated, false otherwise.
Returns the flags that determines if an animation must be displayed after a graph layout has been performed.
isAutoFitOnLayout
boolean: True if fitToContents() is automatically called to show all the graph after a graph layout is performed.
Returne the boolean that determines if fitToContents is called after a graph layout is performed.
isAutomaticLinkLayout
Returns the flag specifying if the link layout must be executed automatically whenever the graph changes. returns Boolean: True if the link layout will be executed automatically whenever the graph changes. False if the link layout is executed only by calling performGraphLayout explicitly.
isAutomaticNodeLayout
Boolean True if the graph layout will be executed automatically whenever the graph changes. False if the graph layout is executed only by calling performGraphLayout explicitly.
Returns the flag specifying if the graph layout must be executed automatically whenever the graph changes.
isLinkLayoutActive
boolean: True if the link layout is active, false otherwise.
Returns true if the link layout is active, or false otherwise.
isMove
Returns true if move is enabled, or false if move is disabled.
isNodeLayoutActive
boolean: True if the graph layout is active, false otherwise.
Returns true if the graph layout is active, or false otherwise.
isSelect
Returns Boolean
Returns true if selection is enabled, or false if selection is disabled.
performGraphLayout

If a non-null graph layout has been specified by calling setNodeLayout(), and if the graph layout is active (that is, unless setNodeLayoutActive(false) has been called), then the graph layout algorithm is performed on the contents of this graph. Then, if a non-null link layout has been specified by calling setLinkLayout(), and if the link layout is active (that is, unless setLinkLayoutActive(false) has been called), then the link layout algorithm is performed on the contents of this graph.

ParameterTypeDescription
recursivebooleanboolean: If true, the graph layout is executed recursively on all Subgraphs contained in this Graph. If false, the graph layout is executed only on this Graph.
setAnimatedLayout
Determines if an animation must be displayed after a graph layout has been performed.
ParameterTypeDescription
animatedboolean:If true, an animation moves the nodes and reshapes the links from their position/shape before the layout to their position/shape after the layout.
setAutoFitOnLayout
Determines if fitToContents is called after a graph layout is performed.
ParameterTypeDescription
autoFitboolean:If true, fitToContents() is automatically called to show all the graph after a graph layout is performed.
setAutomaticLinkLayout
Determines if the link layout must be executed automatically whenever the graph changes.
ParameterTypeDescription
automaticboolean:If true, the link layout will be executed automatically whenever the graph changes. If false, the link layout must be executed by calling performGraphLayout explicitly.
setAutomaticNodeLayout
Determines if the graph layout must be executed automatically whenever the graph changes.
ParameterTypeDescription
automaticboolean:If true, the graph layout will be executed automatically whenever the graph changes. If false, the graph layout must be executed by calling performGraphLayout explicitly.
setLinkLayout
Sets the link layout algorithm that will be executed on the contents of this graph when performGraphLayout is called.
ParameterTypeDescription
layoutibm_ilog.graphlayout.GraphLayoutibm_ilog.graphlayout.GraphLayout: The link layout algorithm that will be executed on the contents of this graph when performGraphLayout is called.
setLinkLayoutActive

If the link layout is active, it will be performed when performGraphLayout() is called. For example, you can call setLinkLayoutActive(false) if you want to perform only a graph layout.

ParameterTypeDescription
activeboolean:True to activate the link layout, false to deactivate it.
setMove

Enables or disables interactive move on this Graph. Note that enabling move also enables select automatically. select: Boolean If true, the user will be able to move nodes by dragging them. If false, move will be disabled.

ParameterTypeDescription
move
setMoveLimits

This method lets you limit interactive node moves to a given rectangle in the Graph.

ParameterTypeDescription
rectRectangleA rectangle (x/y/width/height) that specifies the region where nodes are allowed to be moved. If null, node moves are not limited.
setNodeLayout
Sets the graph layout algorithm that will be executed on the contents of this graph when performGraphLayout is called.
ParameterTypeDescription
layoutibm_ilog.graphlayout.GraphLayoutibm_ilog.graphlayout.GraphLayout: The graph layout algorithm that will be executed on the contents of this graph when performGraphLayout is called.
setNodeLayoutActive

If the graph layout is active, it will be performed when performGraphLayout() is called. For example, you can call setNodeLayoutActive(false) if you want to perform only a link layout.

ParameterTypeDescription
activeboolean:True to activate the graph layout, false to deactivate it.
setSelect
Enables or disables interactive selection on this Graph.
ParameterTypeDescription
selectBooleanIf true, the user will be able to select nodes by clicking on them. If false, selection will be disabled.
setTextDir
set text direction to graph, propagate a new text direction to children (subgraphs, nodes, links)
ParameterTypeDescription
textdirStringString, text direction
toString

Events

onChanged
This event is called to signal that the contents of the graph have changed.
onElementMoving

This event lets a Graph forbid or limit node moves. The event handler can modify the delta argument: if delta.x or delta.y are modified, the move is limited to the new delta (and other objects moved together with the specified element will also be limited accordingly). The default implementation checks the limits set by setMoveLimits(rect) (null by default -> no limit).

ParameterTypeDescription
elementibm_ilog.diagram.GraphElementThe element being moved
transformdojox.gfx.matrix.Matrix2DThe original transform of the element.
deltaPointAn object with x and y properties specifying the move delta. This argument can be modified by event handlers to forbid of limit the move.
onLayoutAnimate
Called on each step of the graph layout animation, if isAnimatedGraphLayout() is true.
ParameterTypeDescription
vnumber:A value between 0 and 100 specifying the progress of the animation.
onLayoutAnimationEnd
Called when the graph layout animation ends, if isAnimatedGraphLayout() is true.
onLayoutAnimationStart
Called when the graph layout animation starts, if isAnimatedGraphLayout() is true.