From 963f6fc5b5483f2e090fa2b1edc17b4636c824c3 Mon Sep 17 00:00:00 2001 From: Philip Alldredge Date: Fri, 19 Aug 2022 10:08:24 -0500 Subject: [PATCH] Fix minor graphical editor issues. Fix case where connections appear behind shapes. Minor addition to transient view API. Fix event data port label in prototype bindings dialog. --- .../transientviews/TransientViewTreeNode.java | 17 ++++++++++++++--- .../org/osate/ge/gef/BaseConnectionNode.java | 3 +++ ...ssObjectSelectionPrototypeBindingsModel.java | 3 ++- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/ge/org.osate.ge.gef.ui/src/org/osate/ge/gef/ui/transientviews/TransientViewTreeNode.java b/ge/org.osate.ge.gef.ui/src/org/osate/ge/gef/ui/transientviews/TransientViewTreeNode.java index 34d6cf088e3..4da74a83981 100644 --- a/ge/org.osate.ge.gef.ui/src/org/osate/ge/gef/ui/transientviews/TransientViewTreeNode.java +++ b/ge/org.osate.ge.gef.ui/src/org/osate/ge/gef/ui/transientviews/TransientViewTreeNode.java @@ -37,6 +37,7 @@ * @since 1.1 */ public class TransientViewTreeNode { + private final TransientViewTreeNode parent; private final Object bo; private Object userData; private Style style = Style.EMPTY; @@ -44,11 +45,13 @@ public class TransientViewTreeNode { /** * Private constructor to prevent direct instantiation + * @param parent the parent node. May be null. * @param bo the business object to be included in the view. * @see #createChild(TransientViewTreeNode, Object) * @see #createRoot() */ - private TransientViewTreeNode(final Object bo) { + private TransientViewTreeNode(final TransientViewTreeNode parent, final Object bo) { + this.parent = parent; this.bo = bo; } @@ -58,7 +61,7 @@ private TransientViewTreeNode(final Object bo) { * @return the new root node */ public static TransientViewTreeNode createRoot() { - return new TransientViewTreeNode(null); + return new TransientViewTreeNode(null, null); } /** @@ -71,11 +74,19 @@ public static TransientViewTreeNode createChild(final TransientViewTreeNode pare Objects.requireNonNull(parent, "parent must not be null"); Objects.requireNonNull(bo, "bo must not be null"); - final TransientViewTreeNode child = new TransientViewTreeNode(bo); + final TransientViewTreeNode child = new TransientViewTreeNode(parent, bo); parent.children.add(child); return child; } + /** + * Returns the parent node + * @return the parent of this transient view node + */ + public final TransientViewTreeNode getParent() { + return parent; + } + /** * Returns the business object to include in the view * @return the business object. Will return null if and only if the node is a root node. diff --git a/ge/org.osate.ge.gef/src/org/osate/ge/gef/BaseConnectionNode.java b/ge/org.osate.ge.gef/src/org/osate/ge/gef/BaseConnectionNode.java index bf8ebfb31f5..7714b7501cb 100644 --- a/ge/org.osate.ge.gef/src/org/osate/ge/gef/BaseConnectionNode.java +++ b/ge/org.osate.ge.gef/src/org/osate/ge/gef/BaseConnectionNode.java @@ -130,6 +130,9 @@ protected BaseConnectionNode() { // Apply initial style apply(FxStyle.DEFAULT); + + // Set view order so that connections are drawn on top of siblings. + setViewOrder(-1.0); } /** diff --git a/ge/org.osate.ge/src/org/osate/ge/aadl2/ui/internal/viewmodels/BusinessObjectSelectionPrototypeBindingsModel.java b/ge/org.osate.ge/src/org/osate/ge/aadl2/ui/internal/viewmodels/BusinessObjectSelectionPrototypeBindingsModel.java index f5d621ac509..83121f64a6c 100644 --- a/ge/org.osate.ge/src/org/osate/ge/aadl2/ui/internal/viewmodels/BusinessObjectSelectionPrototypeBindingsModel.java +++ b/ge/org.osate.ge/src/org/osate/ge/aadl2/ui/internal/viewmodels/BusinessObjectSelectionPrototypeBindingsModel.java @@ -71,6 +71,7 @@ import org.osate.aadl2.Subcomponent; import org.osate.aadl2.SubcomponentType; import org.osate.ge.BusinessObjectSelection; +import org.osate.ge.StringUtil; import org.osate.ge.aadl2.AadlImportsUtil; import org.osate.ge.aadl2.internal.util.AadlPrototypeUtil; import org.osate.ge.aadl2.internal.util.AgeAadlUtil; @@ -943,7 +944,7 @@ public boolean equals(Object obj) { @Override public String getLabel() { - return this.category.toString() + " port"; + return StringUtil.camelCaseToUser(category.toString()).toLowerCase() + " port"; } public final PortCategory getCategory() {