Skip to content

Commit

Permalink
added ability to set background/border/font colors and font sizes to …
Browse files Browse the repository at this point in the history
…connecting objects
  • Loading branch information
Tihomir Surdilovic committed May 24, 2012
1 parent e578099 commit 650700d
Show file tree
Hide file tree
Showing 11 changed files with 232 additions and 156 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<properties>
<mvel.version>2.1.0.drools8</mvel.version>
<drools.version>5.4.0.Final</drools.version>
<jbpm.version>5.3.0.Final</jbpm.version>
<jbpm.version>5.4.0-SNAPSHOT</jbpm.version>
<batik.version>1.6-1</batik.version>
</properties>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ public class Bpmn2JsonMarshaller {
public static final String defaultBgColor_Events = "#f5deb3";
public static final String defaultBrColor = "#000000";
public static final String defaultFontColor = "#000000";
public static final String defaultSequenceflowColor = "#000000";

private Map<String, DiagramElement> _diagramElements = new HashMap<String, DiagramElement>();
private Map<String,Association> _diagramAssociations = new HashMap<String, Association>();
Expand Down Expand Up @@ -2090,7 +2091,11 @@ protected void marshallSequenceFlow(SequenceFlow sequenceFlow, BPMNPlane plane,
properties.put("conditionexpressionlanguage", cdStr);
}
}
// priority value

boolean foundBgColor = false;
boolean foundBrColor = false;
boolean foundFontColor = false;
boolean foundSelectable = false;
Iterator<FeatureMap.Entry> iter = sequenceFlow.getAnyAttribute().iterator();
while(iter.hasNext()) {
FeatureMap.Entry entry = iter.next();
Expand All @@ -2109,6 +2114,41 @@ protected void marshallSequenceFlow(SequenceFlow sequenceFlow, BPMNPlane plane,
}
}
}
if(entry.getEStructuralFeature().getName().equals("bgcolor")) {
properties.put("bgcolor", entry.getValue());
foundBgColor = true;
}
if(entry.getEStructuralFeature().getName().equals("bordercolor")) {
properties.put("bordercolor", entry.getValue());
foundBrColor = true;
}
if(entry.getEStructuralFeature().getName().equals("fontsize")) {
properties.put("fontsize", entry.getValue());
foundBrColor = true;
}
if(entry.getEStructuralFeature().getName().equals("fontcolor")) {
properties.put("fontcolor", entry.getValue());
foundFontColor = true;
}
if(entry.getEStructuralFeature().getName().equals("selectable")) {
properties.put("isselectable", entry.getValue());
foundSelectable = true;
}
}
if(!foundBgColor) {
properties.put("bgcolor", defaultSequenceflowColor);
}

if(!foundBrColor) {
properties.put("bordercolor", defaultSequenceflowColor);
}

if(!foundFontColor) {
properties.put("fontcolor", defaultSequenceflowColor);
}

if(!foundSelectable) {
properties.put("isselectable", "true");
}

marshallProperties(properties, generator);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ public class Bpmn2JsonUnmarshaller {
public static final String defaultBgColor = "#fafad2";
public static final String defaultBrColor = "#000000";
public static final String defaultFontColor = "#000000";
public static final String defaultSequenceflowColor = "#000000";
// a list of the objects created, kept in memory with their original id for
// fast lookup.
private Map<Object, String> _objMap = new HashMap<Object, String>();
Expand Down Expand Up @@ -3967,6 +3968,52 @@ protected void applySequenceFlowProperties(SequenceFlow sequenceFlow, Map<String
if(properties.get("name") != null && !"".equals(properties.get("name"))) {
sequenceFlow.setName(escapeXmlString(properties.get("name")));
}
if(properties.get("bgcolor") != null && properties.get("bgcolor").length() > 0) {
if(!properties.get("bgcolor").equals(defaultSequenceflowColor)) {
ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
EAttributeImpl extensionAttribute = (EAttributeImpl) metadata.demandFeature(
"http://www.jboss.org/drools", "bgcolor", false, false);
EStructuralFeatureImpl.SimpleFeatureMapEntry extensionEntry = new EStructuralFeatureImpl.SimpleFeatureMapEntry(extensionAttribute,
properties.get("bgcolor"));
sequenceFlow.getAnyAttribute().add(extensionEntry);
}
}
if(properties.get("bordercolor") != null && properties.get("bordercolor").length() > 0) {
if(!properties.get("bordercolor").equals(defaultSequenceflowColor)) {
ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
EAttributeImpl extensionAttribute = (EAttributeImpl) metadata.demandFeature(
"http://www.jboss.org/drools", "bordercolor", false, false);
EStructuralFeatureImpl.SimpleFeatureMapEntry extensionEntry = new EStructuralFeatureImpl.SimpleFeatureMapEntry(extensionAttribute,
properties.get("bordercolor"));
sequenceFlow.getAnyAttribute().add(extensionEntry);
}
}
if(properties.get("fontsize") != null && properties.get("fontsize").length() > 0) {
ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
EAttributeImpl extensionAttribute = (EAttributeImpl) metadata.demandFeature(
"http://www.jboss.org/drools", "fontsize", false, false);
EStructuralFeatureImpl.SimpleFeatureMapEntry extensionEntry = new EStructuralFeatureImpl.SimpleFeatureMapEntry(extensionAttribute,
properties.get("fontsize"));
sequenceFlow.getAnyAttribute().add(extensionEntry);
}
if(properties.get("fontcolor") != null && properties.get("fontcolor").length() > 0) {
if(!properties.get("fontcolor").equals(defaultSequenceflowColor)) {
ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
EAttributeImpl extensionAttribute = (EAttributeImpl) metadata.demandFeature(
"http://www.jboss.org/drools", "fontcolor", false, false);
EStructuralFeatureImpl.SimpleFeatureMapEntry extensionEntry = new EStructuralFeatureImpl.SimpleFeatureMapEntry(extensionAttribute,
properties.get("fontcolor"));
sequenceFlow.getAnyAttribute().add(extensionEntry);
}
}
if(properties.get("isselectable") != null && properties.get("isselectable").length() > 0) {
ExtendedMetaData metadata = ExtendedMetaData.INSTANCE;
EAttributeImpl extensionAttribute = (EAttributeImpl) metadata.demandFeature(
"http://www.jboss.org/drools", "selectable", false, false);
EStructuralFeatureImpl.SimpleFeatureMapEntry extensionEntry = new EStructuralFeatureImpl.SimpleFeatureMapEntry(extensionAttribute,
properties.get("isselectable"));
sequenceFlow.getAnyAttribute().add(extensionEntry);
}
if (properties.get("auditing") != null && !"".equals(properties.get("auditing"))) {
Auditing audit = Bpmn2Factory.eINSTANCE.createAuditing();
audit.getDocumentation().add(createDocumentation(properties.get("auditing")));
Expand Down
6 changes: 4 additions & 2 deletions src/main/webapp/defaults/themes.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"Service Tasks" : "#fafad2|#000000|#000000",
"Data Objects" : "#d3d3d3|#778899|#000000",
"Swimlanes" : "#ffffff|#000000|#000000",
"Artifacts" : "#ffffff|#000000|#000000"
"Artifacts" : "#ffffff|#000000|#000000",
"Connecting Objects" : "#000000|#000000|#000000"
},
"HighContrast":{
"Start Events" : "#d2b29f|#000000|#000000",
Expand All @@ -21,7 +22,8 @@
"Service Tasks" : "#f3df8c|#000000|#000000",
"Data Objects" : "#d3d3d3|#778899|#000000",
"Swimlanes" : "#ffffff|#000000|#000000",
"Artifacts" : "#ffffff|#000000|#000000"
"Artifacts" : "#ffffff|#000000|#000000",
"Connecting Objects" : "#000000|#000000|#000000"
}
}
}
4 changes: 2 additions & 2 deletions src/main/webapp/js/Plugins/locknode.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ ORYX.Plugins.LockNode = Clazz.extend({
if(shape) {
shape.setSelectable(true);
shape.setMovable(true);
if(shape instanceof ORYX.Core.Node) {
if(shape instanceof ORYX.Core.Node || shape instanceof ORYX.Core.Edge) {
shape.setProperty("oryx-bordercolor", shape.properties["oryx-origbordercolor"]);
shape.setProperty("oryx-bgcolor", shape.properties["oryx-origbgcolor"]);
}
Expand All @@ -100,7 +100,7 @@ ORYX.Plugins.LockNode = Clazz.extend({
if(shape) {
shape.setSelectable(false);
shape.setMovable(false);
if(shape instanceof ORYX.Core.Node) {
if(shape instanceof ORYX.Core.Node || shape instanceof ORYX.Core.Edge) {
shape.setProperty("oryx-bordercolor", "#888888");
shape.setProperty("oryx-bgcolor", "#CCEEFF");
}
Expand Down
Loading

0 comments on commit 650700d

Please sign in to comment.