]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
More type information for diagram elements 25/825/2
authorAntti Villberg <antti.villberg@semantum.fi>
Thu, 10 Aug 2017 07:32:41 +0000 (10:32 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Thu, 10 Aug 2017 13:26:59 +0000 (16:26 +0300)
refs #7420

Change-Id: Iab051ea3f367f6d421e2ae88d2290af35314a454

bundles/org.simantics.diagram/src/org/simantics/diagram/adapter/CompositeImage.java
bundles/org.simantics.g2d/src/org/simantics/g2d/diagram/participant/ElementPainter.java
bundles/org.simantics.g2d/src/org/simantics/g2d/element/ElementHints.java
bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/nodes/SingleElementNode.java

index 98f229b91324b75a913be0df238676f52813cbec..1c6e4df404c0403683b68a9ef18b35c96b6d5b3e 100644 (file)
@@ -142,6 +142,7 @@ public class CompositeImage implements Image {
             //SingleElementNode holder = parent.getOrCreateNode(ElementUtils.generateNodeId(e), SingleElementNode.class);
             holder.setZIndex(++zIndex);
             holder.setKey(e.getHint(ElementHints.KEY_OBJECT));
+            holder.setTypeClass(e.getHint(ElementHints.KEY_TYPE_CLASS));
 
             List<SceneGraph> nodeHandlers = ec.getItemsByClass(SceneGraph.class);
             for(SceneGraph n : nodeHandlers) {
index eb9e33607d5500197cc7c4fd8d0c061036d835c3..ec6e8cba0258cfc6c782ce732467c44eec1614d7 100644 (file)
@@ -558,6 +558,7 @@ public class ElementPainter extends AbstractDiagramParticipant implements Compos
             if (holder == null) {
                 holder = parentNode.addNode(ElementUtils.generateNodeId(e), ConnectionNode.class);
                 holder.setKey(e.getHint(ElementHints.KEY_OBJECT));
+                holder.setTypeClass(e.getHint(ElementHints.KEY_TYPE_CLASS));
                 holder.setTransferableProvider(new ElementTransferableProvider(getContext(), e));
                 e.setHint(sgKey, holder);
                 holder.setZIndex(parentNode.getNodeCount() + 1);
@@ -569,6 +570,7 @@ public class ElementPainter extends AbstractDiagramParticipant implements Compos
             if (holder == null) {
                 holder = parentNode.addNode(ElementUtils.generateNodeId(e), SingleElementNode.class);
                 holder.setKey(e.getHint(ElementHints.KEY_OBJECT));
+                holder.setTypeClass(e.getHint(ElementHints.KEY_TYPE_CLASS));
                 holder.setTransferableProvider(new ElementTransferableProvider(getContext(), e));
                 e.setHint(sgKey, holder);
                 holder.setZIndex(parentNode.getNodeCount() + 1);
index f272044f1952791e580a992ff383070081e0740d..9710fab683b6ea7ce48a5b03013a7189248bf220 100644 (file)
@@ -101,6 +101,7 @@ public class ElementHints {
 
     /** Source of data in external data model */
     public static final Key KEY_OBJECT = new KeyOf(Object.class, "OBJECT");
+    public static final Key KEY_TYPE_CLASS = new KeyOf(String.class, "TYPE_CLASS");
 
     /**
      * Used for identifying elements that should be ignored in all matters
index beee2538a534092c9f32c79577d9559b3851e3d9..61353557defe11fa5f99f05bad9dbd93aa4dc8a5 100644 (file)
@@ -34,15 +34,24 @@ public class SingleElementNode extends TransformNode implements InitValueSupport
     protected Boolean visible = Boolean.TRUE;
     protected Boolean hidden = Boolean.FALSE;
     private transient Object key;
+    private transient String typeClass;
 
     public void setKey(Object key) {
         this.key = key;
     }
 
+    public void setTypeClass(String typeClass) {
+        this.typeClass = typeClass;
+    }
+
     public Object getKey() {
         return key;
     }
 
+    public String getTypeClass() {
+        return typeClass;
+    }
+
     public void setTransferableProvider(TransferableProvider transferableProvider) {
         if (transferableProvider != this.transferableProvider) {
             if (this.transferableProvider != null)