]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.g2d/src/org/simantics/g2d/diagram/participant/ElementPainter.java
Add customisation possibilities for SelectionNode
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / diagram / participant / ElementPainter.java
index 6e9ff85b1f62c9fb75f4552e346c956cad80113a..71b87c7141006cd5f114c7e779a047af93e785b9 100644 (file)
@@ -137,7 +137,7 @@ public class ElementPainter extends AbstractDiagramParticipant implements Compos
      * ElementPainter.
      */
     public static interface ISelectionProvider {
      * ElementPainter.
      */
     public static interface ISelectionProvider {
-        public void init(final IElement e, final G2DParentNode parentNode, final String nodeId,
+        public void init(int selectionId, final IElement e, final G2DParentNode parentNode, final String nodeId,
                 final AffineTransform transform, final Rectangle2D bounds, final Color color);
     }
 
                 final AffineTransform transform, final Rectangle2D bounds, final Color color);
     }
 
@@ -953,7 +953,7 @@ public class ElementPainter extends AbstractDiagramParticipant implements Compos
                     continue;
 
                 if (NodeUtil.needSelectionPaint(elementNode))
                     continue;
 
                 if (NodeUtil.needSelectionPaint(elementNode))
-                    paintSelectionFrame(elementNode, selectionNode, el, color);
+                    paintSelectionFrame(selectionId, elementNode, selectionNode, el, color);
 
                 nodesUpdated = true;
             }
 
                 nodesUpdated = true;
             }
@@ -999,7 +999,7 @@ public class ElementPainter extends AbstractDiagramParticipant implements Compos
                 createSelectionReference(selectionsNode, elementNode);
 
                 if (NodeUtil.needSelectionPaint(elementNode))
                 createSelectionReference(selectionsNode, elementNode);
 
                 if (NodeUtil.needSelectionPaint(elementNode))
-                    paintSelectionFrame(en, selectionNode, e, color);
+                    paintSelectionFrame(selectionId, en, selectionNode, e, color);
 
             } else {
                 if (elementNode != null) {
 
             } else {
                 if (elementNode != null) {
@@ -1027,7 +1027,7 @@ public class ElementPainter extends AbstractDiagramParticipant implements Compos
         return result;
     }
 
         return result;
     }
 
-    public void paintSelectionFrame(G2DParentNode elementNode, G2DParentNode selectionNode, final IElement e, Color color) {
+    public void paintSelectionFrame(int selectionId, G2DParentNode elementNode, G2DParentNode selectionNode, final IElement e, Color color) {
         // The element node already has the correct transform.
         AffineTransform selectionTransform = ElementUtils.getTransform(e);// no it doesnt ... new AffineTransform();
         Shape shape = ElementUtils.getElementShapeOrBounds(e);
         // The element node already has the correct transform.
         AffineTransform selectionTransform = ElementUtils.getTransform(e);// no it doesnt ... new AffineTransform();
         Shape shape = ElementUtils.getElementShapeOrBounds(e);
@@ -1104,10 +1104,10 @@ public class ElementPainter extends AbstractDiagramParticipant implements Compos
 
         ISelectionProvider provider = this.getContext().getDefaultHintContext().getHint(KEY_SELECTION_PROVIDER);
         if (provider != null) {
 
         ISelectionProvider provider = this.getContext().getDefaultHintContext().getHint(KEY_SELECTION_PROVIDER);
         if (provider != null) {
-            provider.init(e, selectionNode, getNodeId("shape", e), selectionTransform, bounds, color);
+            provider.init(selectionId, e, selectionNode, getNodeId("shape", e), selectionTransform, bounds, color);
         } else {
             SelectionNode s = selectionNode.getOrCreateNode(getNodeId("shape", e), SelectionNode.class);
         } else {
             SelectionNode s = selectionNode.getOrCreateNode(getNodeId("shape", e), SelectionNode.class);
-            s.init(selectionTransform, bounds, color);
+            s.init(selectionId, selectionTransform, bounds, color);
             Double paddingFactor = diagram.getHint(DiagramHints.SELECTION_PADDING_SCALE_FACTOR);
             if (paddingFactor != null)
                 s.setPaddingFactor(paddingFactor);
             Double paddingFactor = diagram.getHint(DiagramHints.SELECTION_PADDING_SCALE_FACTOR);
             if (paddingFactor != null)
                 s.setPaddingFactor(paddingFactor);