com.yworks.yfiles.bpmn.layout
Class BpmnLayouter

java.lang.Object
  extended bycom.yworks.yfiles.bpmn.layout.BpmnLayouter
All Implemented Interfaces:
Layouter

public class BpmnLayouter
extends Object
implements Layouter

An automatic layout algorithm for BPMN collaboration diagrams. The different type of elements have to be marked with the DataProvider keys BPMN_EDGE_TYPE_DPKEY and BPMN_NODE_TYPE_DPKEY. The algorithm supports both, full layout as well as routing of edges only (see setLayoutMode(byte)).

 

Field Summary
static String BPMN_EDGE_TYPE_DPKEY
          DataProvider key used to store the BPMN specific type for each edge.
static String BPMN_NODE_TYPE_DPKEY
          DataProvider key used to store the BPMN specific type for each node.
static byte LAYOUT_ALL_ELEMENTS
          Sphere of action specifier.
static byte LAYOUT_SELECTED_ELEMENTS
          Sphere of action specifier.
static byte MODE_FULL_LAYOUT
          Specifies the layout mode.
static byte MODE_ROUTE_EDGES
          Specifies the layout mode.
static byte ORIENTATION_LEFT_TO_RIGHT
          Specifies the orientation of the drawing.
static byte ORIENTATION_TOP_TO_BOTTOM
          Specifies the orientation of the drawing.
static Object SPHERE_OF_ACTION_EDGES_DPKEY
          DataProvider key used to mark edges for layout when using using sphere of action LAYOUT_SELECTED_ELEMENTS.
static Object SPHERE_OF_ACTION_NODES_DPKEY
          DataProvider key used to mark nodes for layout when using using sphere of action LAYOUT_SELECTED_ELEMENTS.
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
BpmnLayouter()
           
 
Method Summary
 boolean canLayout(LayoutGraph graph)
          Returns true.
 void doLayout(LayoutGraph graph)
          Lays out the specified graph.
 double getLaneInsets()
          Returns the insets used for swimlanes.
 byte getLayoutMode()
          Returns the used layout mode.
 byte getLayoutOrientation()
          Returns the layout orientation.
 double getMinimumEdgeLength()
          Returns the minimum length of edges.
 double getMinimumNodeDistance()
          Returns the minimum distance between two node elements.
 double getPoolDistance()
          Returns the used minimum distance between two pool elements.
 byte getSphereOfAction()
          Returns the sphere of action.
 void setLaneInsets(double laneInsets)
          Sets the insets for swimlanes, that is the distance between a graph element and the border of its enclosing swimlane.
 void setLayoutMode(byte layoutMode)
          Sets the layout mode.
 void setLayoutOrientation(byte layoutOrientation)
          Specifies the layout orientation.
 void setMinimumEdgeLength(double minimumEdgeLength)
          Sets the minimum length of edges.
 void setMinimumNodeDistance(double minimumNodeDistance)
          Sets the minimum distance between two node elements.
 void setPoolDistance(double distance)
          Sets the minimum distance between two pool elements.
 void setSphereOfAction(byte sphereOfAction)
          Sets the sphere of action.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SPHERE_OF_ACTION_NODES_DPKEY

public static final Object SPHERE_OF_ACTION_NODES_DPKEY
DataProvider key used to mark nodes for layout when using using sphere of action LAYOUT_SELECTED_ELEMENTS.

See Also:
getSphereOfAction(), setSphereOfAction(byte)

SPHERE_OF_ACTION_EDGES_DPKEY

public static final Object SPHERE_OF_ACTION_EDGES_DPKEY
DataProvider key used to mark edges for layout when using using sphere of action LAYOUT_SELECTED_ELEMENTS.

See Also:
getSphereOfAction(), setSphereOfAction(byte)

BPMN_NODE_TYPE_DPKEY

public static final String BPMN_NODE_TYPE_DPKEY
DataProvider key used to store the BPMN specific type for each node. Valid are all node type constants specified by class BpmnElementTypes.

See Also:
Constant Field Values

BPMN_EDGE_TYPE_DPKEY

public static final String BPMN_EDGE_TYPE_DPKEY
DataProvider key used to store the BPMN specific type for each edge. Valid are all edge type constants specified by class BpmnElementTypes.

See Also:
Constant Field Values

ORIENTATION_TOP_TO_BOTTOM

public static final byte ORIENTATION_TOP_TO_BOTTOM
Specifies the orientation of the drawing. Layout will be oriented from top to bottom.

See Also:
setLayoutOrientation(byte), Constant Field Values

ORIENTATION_LEFT_TO_RIGHT

public static final byte ORIENTATION_LEFT_TO_RIGHT
Specifies the orientation of the drawing. Layout will be oriented from left to right.

See Also:
setLayoutOrientation(byte), Constant Field Values

MODE_ROUTE_EDGES

public static final byte MODE_ROUTE_EDGES
Specifies the layout mode. In this mode only edges are routed. The node positions are fixed.

See Also:
setLayoutMode(byte), Constant Field Values

MODE_FULL_LAYOUT

public static final byte MODE_FULL_LAYOUT
Specifies the layout mode. In this mode all elements are laid out.

See Also:
setLayoutMode(byte), Constant Field Values

LAYOUT_ALL_ELEMENTS

public static final byte LAYOUT_ALL_ELEMENTS
Sphere of action specifier. Consider all elements during the layout.

See Also:
setSphereOfAction(byte), Constant Field Values

LAYOUT_SELECTED_ELEMENTS

public static final byte LAYOUT_SELECTED_ELEMENTS
Sphere of action specifier. Consider selected elements only. The selection state of an edge is determined by a boolean value returned by the data provider associated with the data provider key SPHERE_OF_ACTION_EDGES_DPKEY and the selection state of a node is determined by a boolean value returned by the data provider associated with the data provider key SPHERE_OF_ACTION_NODES_DPKEY.

Note, if the layout mode is set to MODE_FULL_LAYOUT non-selected elements may also be moved to produce valid drawings. However the layout algorithm uses the initial position of such elements as sketch.

See Also:
setSphereOfAction(byte), Constant Field Values
Constructor Detail

BpmnLayouter

public BpmnLayouter()
Method Detail

getLayoutMode

public byte getLayoutMode()
Returns the used layout mode.

Defaults to MODE_FULL_LAYOUT.

See Also:
setLayoutMode(byte)

setLayoutMode

public void setLayoutMode(byte layoutMode)
Sets the layout mode. Possible values are MODE_FULL_LAYOUT and MODE_ROUTE_EDGES.

Defaults to MODE_FULL_LAYOUT.

Parameters:
layoutMode - one of
Throws:
IllegalArgumentException - if the specified layout mode does not match any of the layout mode constants defined in this class.
See Also:
getLayoutMode()

getSphereOfAction

public byte getSphereOfAction()
Returns the sphere of action.

Defaults to LAYOUT_ALL_ELEMENTS.

See Also:
setSphereOfAction(byte)

setSphereOfAction

public void setSphereOfAction(byte sphereOfAction)
Sets the sphere of action. Possible values are LAYOUT_ALL_ELEMENTS and LAYOUT_SELECTED_ELEMENTS.

Defaults to LAYOUT_ALL_ELEMENTS.

Note, if the sphere of action is set to LAYOUT_SELECTED_ELEMENTS and the layout mode to MODE_FULL_LAYOUT non-selected elements may also be moved. However the layout algorithm uses the initial position of such elements as sketch.

Parameters:
sphereOfAction - one of
Throws:
IllegalArgumentException - if the specified sphere of action does not match any of the sphere of action constants defined in this class.
See Also:
getSphereOfAction(), setLayoutMode(byte)

getLaneInsets

public double getLaneInsets()
Returns the insets used for swimlanes.

Defaults to 10.0.

See Also:
setLaneInsets(double)

setLaneInsets

public void setLaneInsets(double laneInsets)
Sets the insets for swimlanes, that is the distance between a graph element and the border of its enclosing swimlane.

Defaults to 10.0.

Parameters:
laneInsets - the distance between graph elements and the border of their enclosing swimlanes.
See Also:
getLaneInsets()

getMinimumNodeDistance

public double getMinimumNodeDistance()
Returns the minimum distance between two node elements.

Defaults to 30.0

See Also:
setMinimumNodeDistance(double)

setMinimumNodeDistance

public void setMinimumNodeDistance(double minimumNodeDistance)
Sets the minimum distance between two node elements.

Defaults to 30.0

See Also:
getMinimumNodeDistance()

getMinimumEdgeLength

public double getMinimumEdgeLength()
Returns the minimum length of edges.

Defaults to 20.0.

See Also:
setMinimumEdgeLength(double)

setMinimumEdgeLength

public void setMinimumEdgeLength(double minimumEdgeLength)
Sets the minimum length of edges.

Defaults to 20.0.

See Also:
getMinimumEdgeLength()

getPoolDistance

public double getPoolDistance()
Returns the used minimum distance between two pool elements.

Defaults to 50.0.

See Also:
setPoolDistance(double)

setPoolDistance

public void setPoolDistance(double distance)
Sets the minimum distance between two pool elements.

Defaults to 50.0.

See Also:
getPoolDistance()

getLayoutOrientation

public byte getLayoutOrientation()
Returns the layout orientation.

Defaults to ORIENTATION_LEFT_TO_RIGHT.

See Also:
setLayoutOrientation(byte)

setLayoutOrientation

public void setLayoutOrientation(byte layoutOrientation)
Specifies the layout orientation.

Defaults to ORIENTATION_LEFT_TO_RIGHT.

Parameters:
layoutOrientation - one of
Throws:
IllegalArgumentException - if the specified orientation does not match any of the layout orientation constants defined in this class.
See Also:
getLayoutOrientation()

canLayout

public boolean canLayout(LayoutGraph graph)
Returns true. This method does not check whether the specified graph can be laid out by this algorithm at all.

Specified by:
canLayout in interface Layouter

doLayout

public void doLayout(LayoutGraph graph)
Lays out the specified graph.

Specified by:
doLayout in interface Layouter


© Copyright 2010-2014,
yWorks GmbH.
All rights reserved.