From 8d3efa34a6e809b222e5d6f4319a2ac310b9cf5d Mon Sep 17 00:00:00 2001 From: Ralph Soika Date: Thu, 3 Oct 2024 09:39:52 +0200 Subject: [PATCH] improvements Issue #157 --- .../elements/LinkEventDefinitionExtension.java | 13 +++++++++++-- .../elements/SignalEventDefinitionExtension.java | 12 +++++++++++- .../elements/TimerEventDefinitionExtension.java | 12 +++++++++++- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/open-bpmn.glsp-server/src/main/java/org/openbpmn/extensions/elements/LinkEventDefinitionExtension.java b/open-bpmn.glsp-server/src/main/java/org/openbpmn/extensions/elements/LinkEventDefinitionExtension.java index 53df66ec..b5bcc2e2 100644 --- a/open-bpmn.glsp-server/src/main/java/org/openbpmn/extensions/elements/LinkEventDefinitionExtension.java +++ b/open-bpmn.glsp-server/src/main/java/org/openbpmn/extensions/elements/LinkEventDefinitionExtension.java @@ -130,15 +130,20 @@ public void buildPropertiesForm(final BPMNElement bpmnElement, final DataBuilder public boolean updatePropertiesData(final JsonObject json, final String category, final BPMNElement bpmnElement, final GModelElement gNodeElement) { + boolean updateClient = false; // we are only interested in category link if ("Link".equals(category)) { Event bpmnEvent = (Event) bpmnElement; + Set oldDefinitionList = bpmnEvent.getEventDefinitionsByType("linkEventDefinition"); + JsonArray dataList = json.getJsonArray("links"); // synchronize the definition list of the event element Set linkEventDefinitions = synchronizeEventDefinitions("linkEventDefinition", bpmnEvent, dataList); - + if (oldDefinitionList.size() != linkEventDefinitions.size()) { + updateClient = true; + } // just update the values one by one by referring to the signalRef id by // comparing the name Iterator iter = linkEventDefinitions.iterator(); @@ -155,7 +160,11 @@ public boolean updatePropertiesData(final JsonObject json, final String category } } - return false; + if (updateClient) { + // modelState.reset(); + modelState.refreshGModelState(); + } + return updateClient; } } diff --git a/open-bpmn.glsp-server/src/main/java/org/openbpmn/extensions/elements/SignalEventDefinitionExtension.java b/open-bpmn.glsp-server/src/main/java/org/openbpmn/extensions/elements/SignalEventDefinitionExtension.java index d0ff00ea..fb1db1a7 100644 --- a/open-bpmn.glsp-server/src/main/java/org/openbpmn/extensions/elements/SignalEventDefinitionExtension.java +++ b/open-bpmn.glsp-server/src/main/java/org/openbpmn/extensions/elements/SignalEventDefinitionExtension.java @@ -164,14 +164,20 @@ public void buildPropertiesForm(final BPMNElement bpmnElement, final DataBuilder public boolean updatePropertiesData(final JsonObject json, final String category, final BPMNElement bpmnElement, final GModelElement gNodeElement) { + boolean updateClient = false; // we are only interested in category signals if ("Signals".equals(category)) { Event bpmnEvent = (Event) bpmnElement; + Set oldDefinitionList = bpmnEvent.getEventDefinitionsByType("signalEventDefinition"); + JsonArray dataList = json.getJsonArray("signals"); // synchronize the definition list of the event element Set signalEventDefinitions = synchronizeEventDefinitions("signalEventDefinition", bpmnEvent, dataList); + if (oldDefinitionList.size() != signalEventDefinitions.size()) { + updateClient = true; + } // now we can update the values Iterator iter = signalEventDefinitions.iterator(); int i = 0; @@ -185,7 +191,11 @@ public boolean updatePropertiesData(final JsonObject json, final String category // update completed } } - return false; + if (updateClient) { + // modelState.reset(); + modelState.refreshGModelState(); + } + return updateClient; } } diff --git a/open-bpmn.glsp-server/src/main/java/org/openbpmn/extensions/elements/TimerEventDefinitionExtension.java b/open-bpmn.glsp-server/src/main/java/org/openbpmn/extensions/elements/TimerEventDefinitionExtension.java index 8242eebb..3b00dbed 100644 --- a/open-bpmn.glsp-server/src/main/java/org/openbpmn/extensions/elements/TimerEventDefinitionExtension.java +++ b/open-bpmn.glsp-server/src/main/java/org/openbpmn/extensions/elements/TimerEventDefinitionExtension.java @@ -188,15 +188,21 @@ public void buildPropertiesForm(final BPMNElement bpmnElement, final DataBuilder public boolean updatePropertiesData(final JsonObject json, final String category, final BPMNElement bpmnElement, final GModelElement gNodeElement) { + boolean updateClient = false; // we are only interested in category 'Timer Definitions' if ("Timer Definitions".equals(category)) { Event bpmnEvent = (Event) bpmnElement; + Set oldDefinitionList = bpmnEvent.getEventDefinitionsByType("timerEventDefinition"); + JsonArray dataList = json.getJsonArray("timers"); // synchronize the definition list of the event element Set timerEventDefinitions = synchronizeEventDefinitions("timerEventDefinition", bpmnEvent, dataList); + if (oldDefinitionList.size() != timerEventDefinitions.size()) { + updateClient = true; + } // now we can update the values one by one // NOTE: the id can change within the definitionList if an element was deleted @@ -239,6 +245,10 @@ public boolean updatePropertiesData(final JsonObject json, final String category // update completed } } - return false; + if (updateClient) { + // modelState.reset(); + modelState.refreshGModelState(); + } + return updateClient; } }