This is an automated email from the ASF dual-hosted git repository. rantunes pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/incubator-kie-tools-temporary-rnd-do-not-use.git
commit d8fef4b3135dc5964cbce22a76aef435a8ea5a0c Author: Handreyrc <[email protected]> AuthorDate: Tue Nov 28 13:12:03 2023 -0500 KOGITO-9952: SWF Editor - Add Icon to show there are subflows defined in States (#2063) --- .../sw/client/shapes/CallbackStateShape.java | 24 ++++++++----- .../sw/client/shapes/ForEachStateShape.java | 7 ++++ .../stunner/sw/client/shapes/HasActions.java | 21 +++++++++-- .../stunner/sw/client/shapes/HasBranches.java | 19 ++++++++-- .../sw/client/shapes/OperationStateShape.java | 11 ++++-- .../sw/client/shapes/ParallelStateShape.java | 14 ++++++-- .../{IconPosition.java => DataDepiction.java} | 31 +++++++++++----- .../stunner/sw/client/shapes/icons/IconPath.java | 8 +++-- .../sw/client/shapes/icons/IconPosition.java | 8 +++-- .../stunner/sw/client/shapes/HasActionsTest.java | 40 +++++++++++++++++++-- .../stunner/sw/client/shapes/HasBranchesTest.java | 42 ++++++++++++++++++++++ 11 files changed, 188 insertions(+), 37 deletions(-) diff --git a/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/CallbackStateShape.java b/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/CallbackStateShape.java index cc80172da4..3aca20882a 100644 --- a/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/CallbackStateShape.java +++ b/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/CallbackStateShape.java @@ -26,6 +26,8 @@ import org.kie.workbench.common.stunner.core.graph.Edge; import org.kie.workbench.common.stunner.core.graph.Node; import org.kie.workbench.common.stunner.core.graph.content.view.View; import org.kie.workbench.common.stunner.sw.client.shapes.icons.CornerIcon; +import org.kie.workbench.common.stunner.sw.client.shapes.icons.DataDepiction; +import org.kie.workbench.common.stunner.sw.definition.ActionNode; import org.kie.workbench.common.stunner.sw.definition.CallbackState; import org.kie.workbench.common.stunner.sw.definition.State; import org.kie.workbench.common.stunner.sw.definition.WorkflowTimeouts; @@ -34,9 +36,11 @@ import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPath.C import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPath.EVENT; import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPath.FILTER; import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPath.SERVICE; +import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPath.SUBFLOW; import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPosition.BOTTOM_FROM_RIGHT_TOP_CORNER; import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPosition.CENTER_TOP; import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPosition.LEFT_FROM_RIGHT_TOP_CORNER; +import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPosition.LEFT_TOP_CORNER; import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPosition.RIGHT_TOP_CORNER; import static org.kie.workbench.common.stunner.sw.resources.i18n.SWConstants.EVENT_REFERENCE; import static org.kie.workbench.common.stunner.sw.resources.i18n.SWConstants.TIMEOUT_ACTION; @@ -44,7 +48,7 @@ import static org.kie.workbench.common.stunner.sw.resources.i18n.SWConstants.TIM import static org.kie.workbench.common.stunner.sw.resources.i18n.SWConstants.TIMEOUT_STATE; public class CallbackStateShape extends StateShape implements HasActions, - HasEventAndDataFilter { + HasEventAndDataFilter { public static final String ICON_COLOR = "#EC7A08"; public static final String ICON_SVG = "M63.97,36.13c0-2.13-1.64-3.95-3.76-4.07-2.31-.13-4.23,1.7-4.23,3.99,0,6.61-5.37,11.98-11.98,11.98H24.03v-4.99c0-1.18-.7-2.25-1.78-2.74-1.08-.47-2.34-.28-3.23,.52l-9.98,8.98c-.63,.56-.99,1.37-.99,2.22s.36,1.66,.99,2.23l9.98,8.98c.56,.51,1.28,.77,2,.77,.41,0,.83-.09,1.22-.26,1.08-.48,1.78-1.55,1.78-2.74v-4.99h19.97c10.98,0,19.92-8.91,19.97-19.89ZM20,16.08h19.85l.11,4.99c0,1.18,.7,2.25,1.78,2.74,.4,.17,.81,.26,1.11,.26,.73,0,1.44-.27,2.01-.77l9.98- [...] @@ -60,9 +64,9 @@ public class CallbackStateShape extends StateShape implements HasActions, if (state.getTimeouts() != null && state.getTimeouts() instanceof WorkflowTimeouts) { getView().addChild(new CornerIcon(CLOCK, CENTER_TOP, - getTranslation(TIMEOUT_EVENT) + ": " + ((WorkflowTimeouts)state.getTimeouts()).getEventTimeout() + "\r\n" - + getTranslation(TIMEOUT_STATE) + ": " + ((WorkflowTimeouts)state.getTimeouts()).getStateExecTimeout() + "\r\n" - + getTranslation(TIMEOUT_ACTION) + ": " + ((WorkflowTimeouts)state.getTimeouts()).getActionExecTimeout())); + getTranslation(TIMEOUT_EVENT) + ": " + ((WorkflowTimeouts) state.getTimeouts()).getEventTimeout() + "\r\n" + + getTranslation(TIMEOUT_STATE) + ": " + ((WorkflowTimeouts) state.getTimeouts()).getStateExecTimeout() + "\r\n" + + getTranslation(TIMEOUT_ACTION) + ": " + ((WorkflowTimeouts) state.getTimeouts()).getActionExecTimeout())); } getView().addChild(new CornerIcon(EVENT, @@ -75,10 +79,14 @@ public class CallbackStateShape extends StateShape implements HasActions, if (state.getStateDataFilter() != null || state.getEventDataFilter() != null) { getView().addChild(new CornerIcon(FILTER, - BOTTOM_FROM_RIGHT_TOP_CORNER, - getStateDataFilter(state.getStateDataFilter()) - + "\r\n\r\n" - + getEventFilter(state.getEventDataFilter()))); + BOTTOM_FROM_RIGHT_TOP_CORNER, + getStateDataFilter(state.getStateDataFilter()) + + "\r\n\r\n" + + getEventFilter(state.getEventDataFilter()))); + } + + if (null != state.getAction() && hasSubflows(new ActionNode[]{state.getAction()})) { + getView().addChild(new DataDepiction(SUBFLOW, LEFT_TOP_CORNER)); } } diff --git a/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/ForEachStateShape.java b/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/ForEachStateShape.java index dae19a91d7..c47f7c89c2 100644 --- a/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/ForEachStateShape.java +++ b/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/ForEachStateShape.java @@ -27,6 +27,7 @@ import org.kie.workbench.common.stunner.core.graph.Node; import org.kie.workbench.common.stunner.core.graph.content.view.View; import org.kie.workbench.common.stunner.sw.client.shapes.icons.BottomDepiction; import org.kie.workbench.common.stunner.sw.client.shapes.icons.CornerIcon; +import org.kie.workbench.common.stunner.sw.client.shapes.icons.DataDepiction; import org.kie.workbench.common.stunner.sw.definition.ForEachState; import org.kie.workbench.common.stunner.sw.definition.State; import org.kie.workbench.common.stunner.sw.definition.WorkflowTimeouts; @@ -37,8 +38,10 @@ import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPath.F import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPath.PARALLEL; import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPath.SEQUENTIAL; import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPath.SERVICE; +import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPath.SUBFLOW; import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPosition.BOTTOM_FROM_RIGHT_TOP_CORNER; import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPosition.LEFT_FROM_RIGHT_TOP_CORNER; +import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPosition.LEFT_TOP_CORNER; import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPosition.RIGHT_BOTTOM; import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPosition.RIGHT_TOP_CORNER; import static org.kie.workbench.common.stunner.sw.resources.i18n.SWConstants.TIMEOUT_ACTION; @@ -80,6 +83,10 @@ public class ForEachStateShape extends StateShape implements HasActions, } getView().addChild(new BottomDepiction(isDefaultMode(state.getMode()) ? PARALLEL : SEQUENTIAL)); + + if (hasSubflows(state.getActions())) { + getView().addChild(new DataDepiction(SUBFLOW, LEFT_TOP_CORNER)); + } } @Override diff --git a/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/HasActions.java b/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/HasActions.java index ddc6911f6f..fe36700218 100644 --- a/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/HasActions.java +++ b/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/HasActions.java @@ -6,15 +6,15 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations - * under the License. + * under the License. */ package org.kie.workbench.common.stunner.sw.client.shapes; @@ -80,4 +80,19 @@ public interface HasActions extends HasTranslation { return getTranslation(ACTION_IS_NULL); } + + default boolean hasSubflows(ActionNode[] actions) { + if (actions == null || actions.length == 0) { + return false; + } + + for (ActionNode action : actions) { + if (action.getSubFlowRef() != null) { + return true; + } + } + + return false; + } + } diff --git a/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/HasBranches.java b/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/HasBranches.java index ac0069a0ce..b602de4eaa 100644 --- a/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/HasBranches.java +++ b/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/HasBranches.java @@ -6,15 +6,15 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations - * under the License. + * under the License. */ package org.kie.workbench.common.stunner.sw.client.shapes; @@ -44,4 +44,17 @@ public interface HasBranches extends HasActions { return result.toString(); } + + default boolean hasSubflows(ParallelStateBranch[] branches) { + if (branches == null || branches.length == 0) { + return false; + } + + for (ParallelStateBranch branch : branches) { + return hasSubflows(branch.getActions()); + } + + return false; + } + } \ No newline at end of file diff --git a/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/OperationStateShape.java b/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/OperationStateShape.java index 9f1bc31e31..ce9d69ccc6 100644 --- a/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/OperationStateShape.java +++ b/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/OperationStateShape.java @@ -27,6 +27,7 @@ import org.kie.workbench.common.stunner.core.graph.Node; import org.kie.workbench.common.stunner.core.graph.content.view.View; import org.kie.workbench.common.stunner.sw.client.shapes.icons.BottomDepiction; import org.kie.workbench.common.stunner.sw.client.shapes.icons.CornerIcon; +import org.kie.workbench.common.stunner.sw.client.shapes.icons.DataDepiction; import org.kie.workbench.common.stunner.sw.definition.OperationState; import org.kie.workbench.common.stunner.sw.definition.State; import org.kie.workbench.common.stunner.sw.definition.WorkflowTimeouts; @@ -36,8 +37,10 @@ import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPath.F import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPath.PARALLEL; import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPath.SEQUENTIAL; import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPath.SERVICE; +import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPath.SUBFLOW; import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPosition.BOTTOM_FROM_RIGHT_TOP_CORNER; import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPosition.LEFT_FROM_RIGHT_TOP_CORNER; +import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPosition.LEFT_TOP_CORNER; import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPosition.RIGHT_TOP_CORNER; import static org.kie.workbench.common.stunner.sw.resources.i18n.SWConstants.TIMEOUT_ACTION; import static org.kie.workbench.common.stunner.sw.resources.i18n.SWConstants.TIMEOUT_STATE; @@ -59,8 +62,8 @@ public class OperationStateShape extends StateShape implements HasActions, if (state.getTimeouts() != null && state.getTimeouts() instanceof WorkflowTimeouts) { getView().addChild(new CornerIcon(CLOCK, LEFT_FROM_RIGHT_TOP_CORNER, - getTranslation(TIMEOUT_STATE) + ": " + ((WorkflowTimeouts)state.getTimeouts()).getStateExecTimeout() + "\r\n" - + getTranslation(TIMEOUT_ACTION) + ": " + ((WorkflowTimeouts)state.getTimeouts()).getActionExecTimeout())); + getTranslation(TIMEOUT_STATE) + ": " + ((WorkflowTimeouts) state.getTimeouts()).getStateExecTimeout() + "\r\n" + + getTranslation(TIMEOUT_ACTION) + ": " + ((WorkflowTimeouts) state.getTimeouts()).getActionExecTimeout())); } getView().addChild(new CornerIcon(SERVICE, @@ -74,6 +77,10 @@ public class OperationStateShape extends StateShape implements HasActions, boolean isDefault = state.getActionMode() == null || !(state.getActionMode().equals("parallel")); getView().addChild(new BottomDepiction(isDefault ? SEQUENTIAL : PARALLEL)); + + if (hasSubflows(state.getActions())) { + getView().addChild(new DataDepiction(SUBFLOW, LEFT_TOP_CORNER)); + } } @Override diff --git a/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/ParallelStateShape.java b/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/ParallelStateShape.java index c117e5eb00..0e1fe45966 100644 --- a/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/ParallelStateShape.java +++ b/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/ParallelStateShape.java @@ -27,6 +27,7 @@ import org.kie.workbench.common.stunner.core.graph.Node; import org.kie.workbench.common.stunner.core.graph.content.view.View; import org.kie.workbench.common.stunner.sw.client.shapes.icons.BottomText; import org.kie.workbench.common.stunner.sw.client.shapes.icons.CornerIcon; +import org.kie.workbench.common.stunner.sw.client.shapes.icons.DataDepiction; import org.kie.workbench.common.stunner.sw.definition.ParallelState; import org.kie.workbench.common.stunner.sw.definition.State; import org.kie.workbench.common.stunner.sw.definition.WorkflowTimeouts; @@ -34,13 +35,16 @@ import org.kie.workbench.common.stunner.sw.definition.WorkflowTimeouts; import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPath.BRANCH; import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPath.CLOCK; import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPath.FILTER; +import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPath.SUBFLOW; import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPosition.BOTTOM_FROM_RIGHT_TOP_CORNER; import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPosition.LEFT_FROM_RIGHT_TOP_CORNER; +import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPosition.LEFT_TOP_CORNER; import static org.kie.workbench.common.stunner.sw.client.shapes.icons.IconPosition.RIGHT_TOP_CORNER; import static org.kie.workbench.common.stunner.sw.resources.i18n.SWConstants.TIMEOUT_BRANCH; import static org.kie.workbench.common.stunner.sw.resources.i18n.SWConstants.TIMEOUT_STATE; -public class ParallelStateShape extends StateShape implements HasDataFilter, HasBranches { +public class ParallelStateShape extends StateShape implements HasDataFilter, + HasBranches { public static final String ICON_COLOR = "#4CB140"; public static final String ICON_SVG = "M50.54,.01c2.34,.16,4.24,2.31,4.24,4.65V59.43c0,2.64-2.23,4.75-4.91,4.56-2.33-.17-4.23-2.31-4.23-4.65V4.57c0-2.63,2.22-4.75,4.9-4.56M13.46,63.99c-2.34-.16-4.24-2.31-4.24-4.65V4.57c0-2.52,2.04-4.57,4.57-4.57s4.57,2.05,4.57,4.57V59.43c0,2.64-2.22,4.75-4.9,4.56Z"; @@ -56,8 +60,8 @@ public class ParallelStateShape extends StateShape implements HasDataFilter, Has if (state.getTimeouts() != null && state.getTimeouts() instanceof WorkflowTimeouts) { getView().addChild(new CornerIcon(CLOCK, LEFT_FROM_RIGHT_TOP_CORNER, - getTranslation(TIMEOUT_BRANCH) + ": " + ((WorkflowTimeouts)state.getTimeouts()).getBranchExecTimeout() + "\r\n" - + getTranslation(TIMEOUT_STATE) + ": " + ((WorkflowTimeouts)state.getTimeouts()).getStateExecTimeout())); + getTranslation(TIMEOUT_BRANCH) + ": " + ((WorkflowTimeouts) state.getTimeouts()).getBranchExecTimeout() + "\r\n" + + getTranslation(TIMEOUT_STATE) + ": " + ((WorkflowTimeouts) state.getTimeouts()).getStateExecTimeout())); } getView().addChild(new CornerIcon(BRANCH, @@ -74,6 +78,10 @@ public class ParallelStateShape extends StateShape implements HasDataFilter, Has ? getTranslation("Enum.atleast") + ": " + state.getNumCompleted() : getTranslation("Enum.allof"); getView().addChild(new BottomText(completionType)); + + if (hasSubflows(state.getBranches())) { + getView().addChild(new DataDepiction(SUBFLOW, LEFT_TOP_CORNER)); + } } @Override diff --git a/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/icons/IconPosition.java b/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/icons/DataDepiction.java similarity index 61% copy from packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/icons/IconPosition.java copy to packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/icons/DataDepiction.java index 5a8ca140f2..764da6e9cb 100644 --- a/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/icons/IconPosition.java +++ b/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/icons/DataDepiction.java @@ -6,26 +6,39 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations - * under the License. + * under the License. */ + package org.kie.workbench.common.stunner.sw.client.shapes.icons; +import com.ait.lienzo.client.core.shape.Group; +import com.ait.lienzo.client.core.shape.MultiPath; import com.ait.lienzo.client.core.types.Point2D; -public interface IconPosition { +public class DataDepiction extends Group { + + public DataDepiction(final String icon, final Point2D location) { + setLocation(location); + setListening(true); + + MultiPath multiPath = new MultiPath(icon) + .setStrokeWidth(0) + .setFillColor("#4F5255") + .setListening(false); + add(multiPath); + } - Point2D RIGHT_TOP_CORNER = new Point2D(224, 6); - Point2D LEFT_FROM_RIGHT_TOP_CORNER = new Point2D(202, 6); - Point2D CENTER_TOP = new Point2D(180, 6); - Point2D RIGHT_BOTTOM = new Point2D(224, 50); - Point2D BOTTOM_FROM_RIGHT_TOP_CORNER = new Point2D(224, 28); + @Override + public void destroy() { + super.destroy(); + } } diff --git a/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/icons/IconPath.java b/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/icons/IconPath.java index 63945eb481..b606ac4f59 100644 --- a/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/icons/IconPath.java +++ b/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/icons/IconPath.java @@ -6,15 +6,15 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations - * under the License. + * under the License. */ package org.kie.workbench.common.stunner.sw.client.shapes.icons; @@ -30,4 +30,6 @@ public interface IconPath { String EVENT = "M 6.755 6.788 L 5.504 6.788 L 6.335 4.933 C 6.39 4.82 6.348 4.679 6.249 4.595 C 6.15 4.51 5.997 4.523 5.898 4.609 L 3.198 6.858 C 3.114 6.93 3.072 7.056 3.114 7.168 C 3.157 7.281 3.254 7.35 3.382 7.35 L 4.634 7.35 L 3.802 9.207 C 3.747 9.319 3.788 9.459 3.887 9.544 C 3.944 9.6 3.986 9.614 4.057 9.614 C 4.125 9.614 4.184 9.585 4.239 9.544 L 6.938 7.294 C 7.023 7.223 7.065 7.097 7.023 6.985 C 6.98 6.872 6.868 6.788 6.755 6.788 Z M 7.88 2.865 C 7.866 2.865 7.866 2.865 7. [...] String CONDITION = "M 7.382 2.142 L 9.781 4.542 C 9.921 4.683 10 4.876 10 5.076 C 10 5.274 9.921 5.467 9.781 5.608 L 7.382 8.008 C 7.256 8.132 7.088 8.2 6.912 8.2 C 6.547 8.2 6.25 7.903 6.25 7.538 L 6.25 6.326 L 3.75 6.326 C 3.405 6.326 3.126 6.046 3.126 5.7 L 3.126 4.45 C 3.126 4.105 3.405 3.826 3.75 3.826 L 6.25 3.826 L 6.25 2.612 C 6.25 2.247 6.547 1.95 6.912 1.95 C 7.088 1.95 7.256 2.02 7.382 2.142 Z M 3.126 1.95 L 1.876 1.95 C 1.53 1.95 1.25 2.23 1.25 2.576 L 1.25 7.576 C 1.25 7 [...] String COLLECTION = "M 4.541 0.126 C 4.832 -0.008 5.168 -0.008 5.459 0.126 L 9.728 2.098 C 9.894 2.175 10 2.341 10 2.524 C 10 2.708 9.894 2.874 9.728 2.95 L 5.459 4.923 C 5.168 5.058 4.832 5.058 4.541 4.923 L 0.272 2.95 C 0.106 2.873 0 2.706 0 2.524 C 0 2.343 0.106 2.175 0.272 2.098 L 4.541 0.126 Z M 8.689 4.118 L 9.728 4.598 C 9.894 4.675 10 4.841 10 5.024 C 10 5.208 9.894 5.374 9.728 5.45 L 5.459 7.423 C 5.168 7.558 4.832 7.558 4.541 7.423 L 0.272 5.45 C 0.106 5.373 0 5.206 0 5.024 [...] + String SUBFLOW = "m 14.865771,6.45624 c 0,1.6043697 -1.300599,2.904968 -2.904969,2.904968 -1.604369,0 -2.9049675,-1.3005983 -2.9049675,-2.904968 0,-1.6043693 1.3005985,-2.9049678 2.9049675,-2.9049678 1.60437,0 2.904969,1.3005985 2.904969,2.9049678 z M 14.575367,0.08598491 3.2529671,0.05163006 C 1.795948,0.12024785 0.21598954,1.4570527 0.18247097,3.106344 l -0.0209989,0.9842624 c 0.005208,1.3753457 1.10407263,2.7819001 3.04565883,2.8329148 l 2.0074903,0.05782 -1.7104976,1.692038 c -0. [...] + } diff --git a/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/icons/IconPosition.java b/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/icons/IconPosition.java index 5a8ca140f2..6cfba4f8e6 100644 --- a/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/icons/IconPosition.java +++ b/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/main/java/org/kie/workbench/common/stunner/sw/client/shapes/icons/IconPosition.java @@ -6,15 +6,15 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations - * under the License. + * under the License. */ package org.kie.workbench.common.stunner.sw.client.shapes.icons; @@ -28,4 +28,6 @@ public interface IconPosition { Point2D CENTER_TOP = new Point2D(180, 6); Point2D RIGHT_BOTTOM = new Point2D(224, 50); Point2D BOTTOM_FROM_RIGHT_TOP_CORNER = new Point2D(224, 28); + Point2D LEFT_TOP_CORNER = new Point2D(8, 6); + } diff --git a/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/test/java/org/kie/workbench/common/stunner/sw/client/shapes/HasActionsTest.java b/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/test/java/org/kie/workbench/common/stunner/sw/client/shapes/HasActionsTest.java index a65772337e..2b69f0f69c 100644 --- a/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/test/java/org/kie/workbench/common/stunner/sw/client/shapes/HasActionsTest.java +++ b/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/test/java/org/kie/workbench/common/stunner/sw/client/shapes/HasActionsTest.java @@ -6,15 +6,15 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations - * under the License. + * under the License. */ package org.kie.workbench.common.stunner.sw.client.shapes; @@ -25,6 +25,9 @@ import org.kie.workbench.common.stunner.sw.definition.ActionNode; import org.kie.workbench.common.stunner.sw.definition.FunctionRef; import org.kie.workbench.common.stunner.sw.definition.SubFlowRef; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + public class HasActionsTest extends HasTranslationGeneralTest { private final HasActions hasAction = HasActionsTest.super::getTranslation; @@ -183,4 +186,35 @@ public class HasActionsTest extends HasTranslationGeneralTest { "Action.subflow", "Action.function"); } + + @Test + public void hasSubflowsTrueTest() { + ActionNode[] actions = new ActionNode[2]; + + ActionNode action1 = new ActionNode(); + SubFlowRef subFlowRef = new SubFlowRef(); + String workflowId = "PROPER WORKFLOW ID"; + subFlowRef.setWorkflowId(workflowId); + action1.setSubFlowRef(subFlowRef); + actions[0] = action1; + + ActionNode action2 = new ActionNode(); + String funcRef = "FUNC REF NAME"; + action2.setFunctionRef(funcRef); + actions[1] = action2; + + assertTrue(hasAction.hasSubflows(actions)); + } + + @Test + public void hasSubflowsFalseTest() { + ActionNode[] actions = new ActionNode[1]; + ActionNode action = new ActionNode(); + String funcRef = "FUNC REF NAME"; + action.setFunctionRef(funcRef); + actions[0] = action; + + assertFalse(hasAction.hasSubflows(actions)); + } + } diff --git a/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/test/java/org/kie/workbench/common/stunner/sw/client/shapes/HasBranchesTest.java b/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/test/java/org/kie/workbench/common/stunner/sw/client/shapes/HasBranchesTest.java index 636025d79e..4353a82237 100644 --- a/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/test/java/org/kie/workbench/common/stunner/sw/client/shapes/HasBranchesTest.java +++ b/packages/serverless-workflow-diagram-editor/sw-editor/sw-editor-client/src/test/java/org/kie/workbench/common/stunner/sw/client/shapes/HasBranchesTest.java @@ -22,8 +22,11 @@ package org.kie.workbench.common.stunner.sw.client.shapes; import org.junit.Test; import org.kie.workbench.common.stunner.sw.definition.ActionNode; import org.kie.workbench.common.stunner.sw.definition.ParallelStateBranch; +import org.kie.workbench.common.stunner.sw.definition.SubFlowRef; import static org.assertj.core.util.Arrays.array; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; public class HasBranchesTest extends HasTranslationGeneralTest { @@ -82,4 +85,43 @@ public class HasBranchesTest extends HasTranslationGeneralTest { hasBranches.getBranchesString(array(branch, branch)), "Branch.title", "Actions.null", "Branch.title", "Actions.null"); } + + @Test + public void hasSubflowsTrueTest() { + ActionNode[] actions = new ActionNode[2]; + + ActionNode action1 = new ActionNode(); + SubFlowRef subFlowRef = new SubFlowRef(); + String workflowId = "PROPER WORKFLOW ID"; + subFlowRef.setWorkflowId(workflowId); + action1.setSubFlowRef(subFlowRef); + actions[0] = action1; + + ActionNode action2 = new ActionNode(); + String funcRef = "FUNC REF NAME"; + action2.setFunctionRef(funcRef); + actions[1] = action2; + + ParallelStateBranch branch = new ParallelStateBranch(); + branch.setName(NAME); + branch.setActions(actions); + + assertTrue(hasBranches.hasSubflows(array(branch))); + } + + @Test + public void hasSubflowsFalseTest() { + ActionNode[] actions = new ActionNode[1]; + ActionNode action = new ActionNode(); + String funcRef = "FUNC REF NAME"; + action.setFunctionRef(funcRef); + actions[0] = action; + + ParallelStateBranch branch = new ParallelStateBranch(); + branch.setName(NAME); + branch.setActions(actions); + + assertFalse(hasBranches.hasSubflows(array(branch))); + } + } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
