Skip to content

Commit

Permalink
fixed name feature for edges
Browse files Browse the repository at this point in the history
Issue imixs#176
  • Loading branch information
rsoika committed Feb 19, 2023
1 parent 2a21c0d commit ac91e76
Showing 1 changed file with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.eclipse.glsp.graph.GLabel;
import org.eclipse.glsp.graph.GModelElement;
import org.eclipse.glsp.graph.GNode;
import org.openbpmn.bpmn.BPMNNS;
Expand Down Expand Up @@ -95,6 +96,10 @@ public int getPriority() {
* This method updates the name attribute of a BPMNElement and also the
* corresponding GNode Element in the diagram plane.
*
* <p>
* The method distinguish between LabelGNode elements (multiline) and simple
* GLabel elements
*
* @param json
* @param bpmnElement
* @param gNodeElement
Expand All @@ -107,12 +112,21 @@ public void updateNameProperty(final JsonObject json, BPMNElement bpmnElement, f
// Update Label...
Optional<GModelElement> label = modelState.getIndex().get(gNodeElement.getId() + "_bpmnlabel");
if (!label.isEmpty()) {
LabelGNode lgn = (LabelGNode) label.get();
// update the bpmn-text-node of the GNodeElement
GNode gnode = BPMNGraphUtil.findMultiLineTextNode(lgn);
if (gnode != null) {
gnode.getArgs().put("text", name);
GModelElement gModelElement = label.get();
// do we have a BPMN LabelGNode
if (gModelElement instanceof LabelGNode) {
LabelGNode lgn = (LabelGNode) gModelElement;
// update the bpmn-text-node of the GNodeElement
GNode gnode = BPMNGraphUtil.findMultiLineTextNode(lgn);
if (gnode != null) {
gnode.getArgs().put("text", name);
}
} else {
// we expect a GLabel
GLabel gLabel = (GLabel) gModelElement;
gLabel.setText(name);
}

}
}
}
Expand Down

0 comments on commit ac91e76

Please sign in to comment.