Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package org.activiti.bpmn;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import com.mxgraph.layout.mxGraphLayout;
import com.mxgraph.model.mxCell;
import com.mxgraph.model.mxGeometry;
import com.mxgraph.model.mxIGraphModel;
import com.mxgraph.util.mxRectangle;
import com.mxgraph.view.mxGraph;
/**
* BPMNLayout
*
*/
public class BPMNLayout extends mxGraphLayout {
// NEW
protected BpmnAutoLayout bpmnAutoLayout;
public void setBpmnAutoLayout(BpmnAutoLayout bpmnAutoLayout) {
this.bpmnAutoLayout = bpmnAutoLayout;
}
// NEW
/**
* Specifies the orientation of the layout. Default is true.
*/
protected boolean horizontal;
/**
* Specifies if edge directions should be inverted. Default is false.
*/
protected boolean invert;
/**
* If the parent should be resized to match the width/height of the tree. Default is true.
*/
protected boolean resizeParent = true;
/**
* Specifies if the tree should be moved to the top, left corner if it is inside a top-level layer. Default is true.
*/
protected boolean moveTree = true;
/**
* Specifies if all edge points of traversed edges should be removed. Default is true.
*/
protected boolean resetEdges = true;
/**
* Holds the levelDistance. Default is 40.
*/
protected int levelDistance = 40;
/**
* Holds the nodeDistance. Default is 20.
*/
protected int nodeDistance = 20;
/**
*
* @param graph
*/
public BPMNLayout(mxGraph graph) {
this(graph, true);
}
/**
*
* @param graph
* @param horizontal
*/
public BPMNLayout(mxGraph graph, boolean horizontal) {
this(graph, horizontal, false);
}
/**
*
* @param graph
* @param horizontal
* @param invert
*/
public BPMNLayout(mxGraph graph, boolean horizontal, boolean invert) {
super(graph);
setUseBoundingBox(false);
this.horizontal = horizontal;
this.invert = invert;
}
public mxGraph getGraph() {
return (mxGraph) graph;
}
/**
* Returns a boolean indicating if the given mxCell should be ignored as a vertex. This returns true if the cell has no connections.
*
* @param vertex
* Object that represents the vertex to be tested.
* @return Returns true if the vertex should be ignored.
*/
public boolean isVertexIgnored(Object vertex) {
return super.isVertexIgnored(vertex) || graph.isSwimlane(vertex) || graph.getModel().getGeometry(vertex).isRelative() || graph.getConnections(vertex).length == 0;
}
/**
* @return the horizontal
*/
public boolean isHorizontal() {
return horizontal;
}
/**
* @param horizontal
* the horizontal to set
*/
public void setHorizontal(boolean horizontal) {
this.horizontal = horizontal;
}
/**
* @return the invert
*/
public boolean isInvert() {
return invert;
}
/**
* @param invert
* the invert to set
*/
public void setInvert(boolean invert) {
this.invert = invert;
}
/**
* @return the resizeParent
*/
public boolean isResizeParent() {
return resizeParent;
}
/**
* @param resizeParent
* the resizeParent to set
*/
public void setResizeParent(boolean resizeParent) {
this.resizeParent = resizeParent;
}
/**
* @return the moveTree
*/
public boolean isMoveTree() {
return moveTree;
}
/**
* @param moveTree
* the moveTree to set
*/
public void setMoveTree(boolean moveTree) {
this.moveTree = moveTree;
}
/**
* @return the resetEdges
*/
public boolean isResetEdges() {
return resetEdges;
}
/**
* @param resetEdges
* the resetEdges to set
*/
public void setResetEdges(boolean resetEdges) {
this.resetEdges = resetEdges;
}
/**
* @return the levelDistance
*/
public int getLevelDistance() {
return levelDistance;
}
/**
* @param levelDistance
* the levelDistance to set
*/
public void setLevelDistance(int levelDistance) {
this.levelDistance = levelDistance;
}
/**
* @return the nodeDistance
*/
public int getNodeDistance() {
return nodeDistance;
}
/**
* @param nodeDistance
* the nodeDistance to set
*/
public void setNodeDistance(int nodeDistance) {
this.nodeDistance = nodeDistance;
}
public void execute(Object parent) {
mxIGraphModel model = graph.getModel();
List