-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Working on new visualization of BPMN models
- Loading branch information
Showing
24 changed files
with
579 additions
and
231 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 30 additions & 28 deletions
58
libPlg/src/plg/generator/scriptexecuter/IntegerScriptExecutor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,30 @@ | ||
package plg.generator.scriptexecuter; | ||
|
||
import plg.exceptions.InvalidScript; | ||
|
||
/** | ||
* This class describes a script executor that will generate an integer value | ||
* | ||
* @author Andrea Burattin | ||
*/ | ||
public class IntegerScriptExecutor extends ScriptExecutor { | ||
|
||
/** | ||
* Script constructor | ||
* | ||
* @param script a Python script | ||
*/ | ||
public IntegerScriptExecutor(String script) { | ||
super(script); | ||
} | ||
|
||
@Override | ||
public Integer getValue() throws InvalidScript { | ||
if (result == null) { | ||
return null; | ||
} | ||
return (Integer) result.__tojava__(Integer.class); | ||
} | ||
} | ||
package plg.generator.scriptexecuter; | ||
|
||
import org.python.core.Py; | ||
|
||
import plg.exceptions.InvalidScript; | ||
|
||
/** | ||
* This class describes a script executor that will generate an integer value | ||
* | ||
* @author Andrea Burattin | ||
*/ | ||
public class IntegerScriptExecutor extends ScriptExecutor { | ||
|
||
/** | ||
* Script constructor | ||
* | ||
* @param script a Python script | ||
*/ | ||
public IntegerScriptExecutor(String script) { | ||
super(script); | ||
} | ||
|
||
@Override | ||
public Integer getValue() throws InvalidScript { | ||
if (result == null) { | ||
return null; | ||
} | ||
return Py.py2int(result); | ||
} | ||
} |
58 changes: 30 additions & 28 deletions
58
libPlg/src/plg/generator/scriptexecuter/StringScriptExecutor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,30 @@ | ||
package plg.generator.scriptexecuter; | ||
|
||
import plg.exceptions.InvalidScript; | ||
|
||
/** | ||
* This class describes a script executor that will generate a string value | ||
* | ||
* @author Andrea Burattin | ||
*/ | ||
public class StringScriptExecutor extends ScriptExecutor { | ||
|
||
/** | ||
* Script constructor | ||
* | ||
* @param script a Python script | ||
*/ | ||
public StringScriptExecutor(String script) { | ||
super(script); | ||
} | ||
|
||
@Override | ||
public String getValue() throws InvalidScript { | ||
if (result == null) { | ||
return null; | ||
} | ||
return (String) result.__tojava__(String.class); | ||
} | ||
} | ||
package plg.generator.scriptexecuter; | ||
|
||
import org.python.antlr.adapter.AstAdapters; | ||
|
||
import plg.exceptions.InvalidScript; | ||
|
||
/** | ||
* This class describes a script executor that will generate a string value | ||
* | ||
* @author Andrea Burattin | ||
*/ | ||
public class StringScriptExecutor extends ScriptExecutor { | ||
|
||
/** | ||
* Script constructor | ||
* | ||
* @param script a Python script | ||
*/ | ||
public StringScriptExecutor(String script) { | ||
super(script); | ||
} | ||
|
||
@Override | ||
public String getValue() throws InvalidScript { | ||
if (result == null) { | ||
return null; | ||
} | ||
return result.__tojava__(Object.class).toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/> | ||
<classpathentry combineaccessrules="false" kind="src" path="/libPlg"/> | ||
<classpathentry kind="lib" path="lib/jgraphx/jgraphx.jar"/> | ||
<classpathentry combineaccessrules="false" kind="src" path="/plgResources"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/> | ||
<classpathentry combineaccessrules="false" kind="src" path="/libPlg"/> | ||
<classpathentry kind="lib" path="lib/jgraphx/jgraphx.jar"/> | ||
<classpathentry kind="lib" path="lib/GraphViz-latest.jar"/> | ||
<classpathentry kind="lib" path="lib/KitFox.jar"/> | ||
<classpathentry kind="lib" path="lib/commons-lang3-3.8.1.jar"/> | ||
<classpathentry kind="lib" path="lib/commons-io-2.6.jar"/> | ||
<classpathentry combineaccessrules="false" kind="src" path="/plgResources"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package plg.visualizer; | ||
|
||
import java.awt.Color; | ||
|
||
import org.processmining.plugins.graphviz.visualisation.DotPanel; | ||
|
||
import plg.model.Process; | ||
import plg.visualizer.model.DotModel; | ||
|
||
/** | ||
* This widget is used to visualize a BPMN model. | ||
* | ||
* @author Andrea Burattin | ||
*/ | ||
public class BPMNVisualizer2 extends DotPanel { | ||
|
||
private static final long serialVersionUID = -8441909033110442685L; | ||
|
||
/** | ||
* Class constructor | ||
* | ||
* @param process the process graph to show | ||
*/ | ||
public BPMNVisualizer2(Process process) { | ||
super(new DotModel(process)); | ||
|
||
setOpaque(true); | ||
setBackground(Color.WHITE); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package plg.visualizer.model; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import org.processmining.plugins.graphviz.dot.Dot; | ||
import org.processmining.plugins.graphviz.dot.DotNode; | ||
|
||
import plg.model.Component; | ||
import plg.model.FlowObject; | ||
import plg.model.Process; | ||
import plg.model.data.DataObject; | ||
import plg.model.data.IDataObjectOwner.DATA_OBJECT_DIRECTION; | ||
import plg.model.sequence.Sequence; | ||
import plg.visualizer.model.edges.DotDataObjectConnection; | ||
import plg.visualizer.model.edges.DotSequence; | ||
import plg.visualizer.model.nodes.DotNodesFactory; | ||
|
||
/** | ||
* | ||
* @author Andrea Burattin | ||
*/ | ||
public class DotModel extends Dot { | ||
|
||
private Process model; | ||
|
||
public DotModel(Process model) { | ||
this.model = model; | ||
|
||
// setOption("splines", "ortho"); | ||
// setOption("nodesep", "0.5"); | ||
setOption("rankdir", "LR"); | ||
|
||
realize(); | ||
} | ||
|
||
private void realize() { | ||
Map<String, DotNode> idToNodes = new HashMap<String, DotNode>(); | ||
|
||
// adding all nodes | ||
for (Component node : model.getComponents()) { | ||
if (node instanceof FlowObject || node instanceof DataObject) { | ||
DotNode dotNode = DotNodesFactory.construct(node); | ||
idToNodes.put(node.getId(), dotNode); | ||
addNode(dotNode); | ||
} | ||
} | ||
|
||
// adding all edges | ||
for (Sequence sequence : model.getSequences()) { | ||
DotNode source = idToNodes.get(sequence.getSource().getId()); | ||
DotNode sink = idToNodes.get(sequence.getSink().getId()); | ||
addEdge(new DotSequence(source, sink)); | ||
} | ||
|
||
// connecting all data objects | ||
for (DataObject dobj : model.getDataObjects()) { | ||
if (dobj.getObjectOwner() != null) { | ||
DotNode source = null; | ||
DotNode sink = null; | ||
if (dobj.getDirectionOwner() == DATA_OBJECT_DIRECTION.GENERATED) { | ||
source = idToNodes.get(dobj.getObjectOwner().getId()); | ||
sink = idToNodes.get(dobj.getId()); | ||
} else { | ||
source = idToNodes.get(dobj.getId()); | ||
sink = idToNodes.get(dobj.getObjectOwner().getId()); | ||
} | ||
addEdge(new DotDataObjectConnection(source, sink)); | ||
} | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
libPlgVisualizer/src/plg/visualizer/model/edges/DotDataObjectConnection.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package plg.visualizer.model.edges; | ||
|
||
import org.processmining.plugins.graphviz.dot.DotEdge; | ||
import org.processmining.plugins.graphviz.dot.DotNode; | ||
|
||
/** | ||
* | ||
* @author Andrea Burattin | ||
*/ | ||
public class DotDataObjectConnection extends DotEdge { | ||
|
||
public DotDataObjectConnection(DotNode source, DotNode target) { | ||
super(source, target); | ||
|
||
setOption("color", "#666666"); | ||
setOption("style", "dashed"); | ||
setOption("arrowhead", "open"); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
libPlgVisualizer/src/plg/visualizer/model/edges/DotSequence.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package plg.visualizer.model.edges; | ||
|
||
import org.processmining.plugins.graphviz.dot.DotEdge; | ||
import org.processmining.plugins.graphviz.dot.DotNode; | ||
|
||
/** | ||
* | ||
* @author Andrea Burattin | ||
*/ | ||
public class DotSequence extends DotEdge { | ||
|
||
public DotSequence(DotNode source, DotNode target) { | ||
super(source, target); | ||
|
||
setOption("color", "#5a677b"); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
libPlgVisualizer/src/plg/visualizer/model/nodes/DotDataObject.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package plg.visualizer.model.nodes; | ||
|
||
import org.processmining.plugins.graphviz.dot.DotNode; | ||
|
||
import plg.model.data.DataObject; | ||
|
||
/** | ||
* | ||
* @author Andrea Burattin | ||
*/ | ||
public class DotDataObject extends DotNode { | ||
|
||
public DotDataObject(DataObject node) { | ||
super(node.getName(), null); | ||
|
||
setSelectable(true); | ||
|
||
setOption("shape", "note"); | ||
setOption("fontsize", "10"); | ||
setOption("width", "0.5"); | ||
setOption("height", "0.5"); | ||
setOption("style", "filled"); | ||
setOption("fillcolor", "#ffffff"); | ||
setOption("color", "#666666"); | ||
setOption("fontcolor", "#666666"); | ||
setOption("fontname", "sans-serif"); | ||
} | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
libPlgVisualizer/src/plg/visualizer/model/nodes/DotEndEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package plg.visualizer.model.nodes; | ||
|
||
import org.processmining.plugins.graphviz.dot.DotNode; | ||
|
||
/** | ||
* | ||
* @author Andrea Burattin | ||
*/ | ||
public class DotEndEvent extends DotNode { | ||
|
||
public DotEndEvent() { | ||
super("", null); | ||
|
||
setSelectable(true); | ||
|
||
setOption("shape", "circle"); | ||
setOption("style", "filled"); | ||
setOption("fillcolor", "#e46e60:#ffc5c1"); | ||
setOption("gradientangle", "270"); | ||
setOption("color", "#630000"); | ||
setOption("width", ".3"); | ||
setOption("fontcolor", "#630000"); | ||
setOption("fontname", "sans-serif"); | ||
setOption("fontsize", "12.0"); | ||
setOption("penwidth", "2"); | ||
} | ||
|
||
} |
Oops, something went wrong.