Package org.activiti.bpmn
Class BPMNLayout
- java.lang.Object
-
- com.mxgraph.layout.mxGraphLayout
-
- org.activiti.bpmn.BPMNLayout
-
- All Implemented Interfaces:
com.mxgraph.layout.mxIGraphLayout
public class BPMNLayout extends com.mxgraph.layout.mxGraphLayoutBPMNLayout
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classBPMNLayout.Polygonprotected static classBPMNLayout.Polylineprotected static classBPMNLayout.TreeNode
-
Field Summary
Fields Modifier and Type Field Description protected BpmnAutoLayoutbpmnAutoLayoutprotected booleanhorizontalSpecifies the orientation of the layout.protected booleaninvertSpecifies if edge directions should be inverted.protected intlevelDistanceHolds the levelDistance.protected booleanmoveTreeSpecifies if the tree should be moved to the top, left corner if it is inside a top-level layer.protected intnodeDistanceHolds the nodeDistance.protected booleanresetEdgesSpecifies if all edge points of traversed edges should be removed.protected booleanresizeParentIf the parent should be resized to match the width/height of the tree.
-
Constructor Summary
Constructors Constructor Description BPMNLayout(com.mxgraph.view.mxGraph graph)BPMNLayout(com.mxgraph.view.mxGraph graph, boolean horizontal)BPMNLayout(com.mxgraph.view.mxGraph graph, boolean horizontal, boolean invert)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected com.mxgraph.util.mxRectangleapply(BPMNLayout.TreeNode node, com.mxgraph.util.mxRectangle bounds)protected voidattachParent(BPMNLayout.TreeNode node, double height)protected BPMNLayout.Polylinebridge(BPMNLayout.Polyline line1, double x1, double y1, BPMNLayout.Polyline line2, double x2, double y2)protected BPMNLayout.PolylinecreateLine(double dx, double dy, BPMNLayout.Polyline next)protected BPMNLayout.TreeNodecreateNode(java.lang.Object cell)protected BPMNLayout.TreeNodedfs(java.lang.Object cell, java.lang.Object parent, java.util.Set<java.lang.Object> visited)Does a depth first search starting at the specified cell.voidexecute(java.lang.Object parent)com.mxgraph.view.mxGraphgetGraph()intgetLevelDistance()intgetNodeDistance()protected com.mxgraph.util.mxRectanglehorizontalLayout(BPMNLayout.TreeNode node, double x0, double y0, com.mxgraph.util.mxRectangle bounds)protected booleanisBoundaryEvent(java.lang.Object obj)booleanisHorizontal()booleanisInvert()booleanisMoveTree()booleanisResetEdges()booleanisResizeParent()booleanisVertexIgnored(java.lang.Object vertex)Returns a boolean indicating if the given mxCell should be ignored as a vertex.protected doublejoin(BPMNLayout.TreeNode node)protected voidlayout(BPMNLayout.TreeNode node)Starts the actual compact tree layout algorithm at the given node.protected voidlayoutLeaf(BPMNLayout.TreeNode node)protected doublemerge(BPMNLayout.Polygon p1, BPMNLayout.Polygon p2)protected voidmoveNode(BPMNLayout.TreeNode node, double dx, double dy)Moves the specified node and all of its children by the given amount.protected doubleoffset(double p1, double p2, double a1, double a2, double b1, double b2)voidsetBpmnAutoLayout(BpmnAutoLayout bpmnAutoLayout)voidsetHorizontal(boolean horizontal)voidsetInvert(boolean invert)voidsetLevelDistance(int levelDistance)voidsetMoveTree(boolean moveTree)voidsetNodeDistance(int nodeDistance)voidsetResetEdges(boolean resetEdges)voidsetResizeParent(boolean resizeParent)protected com.mxgraph.util.mxRectangleverticalLayout(BPMNLayout.TreeNode node, java.lang.Object parent, double x0, double y0, com.mxgraph.util.mxRectangle bounds)
-
-
-
Field Detail
-
bpmnAutoLayout
protected BpmnAutoLayout bpmnAutoLayout
-
horizontal
protected boolean horizontal
Specifies the orientation of the layout. Default is true.
-
invert
protected boolean invert
Specifies if edge directions should be inverted. Default is false.
-
resizeParent
protected boolean resizeParent
If the parent should be resized to match the width/height of the tree. Default is true.
-
moveTree
protected boolean moveTree
Specifies if the tree should be moved to the top, left corner if it is inside a top-level layer. Default is true.
-
resetEdges
protected boolean resetEdges
Specifies if all edge points of traversed edges should be removed. Default is true.
-
levelDistance
protected int levelDistance
Holds the levelDistance. Default is 40.
-
nodeDistance
protected int nodeDistance
Holds the nodeDistance. Default is 20.
-
-
Constructor Detail
-
BPMNLayout
public BPMNLayout(com.mxgraph.view.mxGraph graph)
- Parameters:
graph-
-
BPMNLayout
public BPMNLayout(com.mxgraph.view.mxGraph graph, boolean horizontal)- Parameters:
graph-horizontal-
-
BPMNLayout
public BPMNLayout(com.mxgraph.view.mxGraph graph, boolean horizontal, boolean invert)- Parameters:
graph-horizontal-invert-
-
-
Method Detail
-
setBpmnAutoLayout
public void setBpmnAutoLayout(BpmnAutoLayout bpmnAutoLayout)
-
getGraph
public com.mxgraph.view.mxGraph getGraph()
- Overrides:
getGraphin classcom.mxgraph.layout.mxGraphLayout
-
isVertexIgnored
public boolean isVertexIgnored(java.lang.Object vertex)
Returns a boolean indicating if the given mxCell should be ignored as a vertex. This returns true if the cell has no connections.- Overrides:
isVertexIgnoredin classcom.mxgraph.layout.mxGraphLayout- Parameters:
vertex- Object that represents the vertex to be tested.- Returns:
- Returns true if the vertex should be ignored.
-
isHorizontal
public boolean isHorizontal()
- Returns:
- the horizontal
-
setHorizontal
public void setHorizontal(boolean horizontal)
- Parameters:
horizontal- the horizontal to set
-
isInvert
public boolean isInvert()
- Returns:
- the invert
-
setInvert
public void setInvert(boolean invert)
- Parameters:
invert- the invert to set
-
isResizeParent
public boolean isResizeParent()
- Returns:
- the resizeParent
-
setResizeParent
public void setResizeParent(boolean resizeParent)
- Parameters:
resizeParent- the resizeParent to set
-
isMoveTree
public boolean isMoveTree()
- Returns:
- the moveTree
-
setMoveTree
public void setMoveTree(boolean moveTree)
- Parameters:
moveTree- the moveTree to set
-
isResetEdges
public boolean isResetEdges()
- Returns:
- the resetEdges
-
setResetEdges
public void setResetEdges(boolean resetEdges)
- Parameters:
resetEdges- the resetEdges to set
-
getLevelDistance
public int getLevelDistance()
- Returns:
- the levelDistance
-
setLevelDistance
public void setLevelDistance(int levelDistance)
- Parameters:
levelDistance- the levelDistance to set
-
getNodeDistance
public int getNodeDistance()
- Returns:
- the nodeDistance
-
setNodeDistance
public void setNodeDistance(int nodeDistance)
- Parameters:
nodeDistance- the nodeDistance to set
-
execute
public void execute(java.lang.Object parent)
- Specified by:
executein interfacecom.mxgraph.layout.mxIGraphLayout- Overrides:
executein classcom.mxgraph.layout.mxGraphLayout
-
isBoundaryEvent
protected boolean isBoundaryEvent(java.lang.Object obj)
-
moveNode
protected void moveNode(BPMNLayout.TreeNode node, double dx, double dy)
Moves the specified node and all of its children by the given amount.
-
dfs
protected BPMNLayout.TreeNode dfs(java.lang.Object cell, java.lang.Object parent, java.util.Set<java.lang.Object> visited)
Does a depth first search starting at the specified cell. Makes sure the specified swimlane is never left by the algorithm.
-
layout
protected void layout(BPMNLayout.TreeNode node)
Starts the actual compact tree layout algorithm at the given node.
-
horizontalLayout
protected com.mxgraph.util.mxRectangle horizontalLayout(BPMNLayout.TreeNode node, double x0, double y0, com.mxgraph.util.mxRectangle bounds)
-
verticalLayout
protected com.mxgraph.util.mxRectangle verticalLayout(BPMNLayout.TreeNode node, java.lang.Object parent, double x0, double y0, com.mxgraph.util.mxRectangle bounds)
-
attachParent
protected void attachParent(BPMNLayout.TreeNode node, double height)
-
layoutLeaf
protected void layoutLeaf(BPMNLayout.TreeNode node)
-
join
protected double join(BPMNLayout.TreeNode node)
-
merge
protected double merge(BPMNLayout.Polygon p1, BPMNLayout.Polygon p2)
-
offset
protected double offset(double p1, double p2, double a1, double a2, double b1, double b2)
-
bridge
protected BPMNLayout.Polyline bridge(BPMNLayout.Polyline line1, double x1, double y1, BPMNLayout.Polyline line2, double x2, double y2)
-
createNode
protected BPMNLayout.TreeNode createNode(java.lang.Object cell)
-
apply
protected com.mxgraph.util.mxRectangle apply(BPMNLayout.TreeNode node, com.mxgraph.util.mxRectangle bounds)
-
createLine
protected BPMNLayout.Polyline createLine(double dx, double dy, BPMNLayout.Polyline next)
-
-