]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.diagram/src/org/simantics/diagram/flag/IFlagType.java
Added mechanism to diagram IFlagType to prevent graph modifications
[simantics/platform.git] / bundles / org.simantics.diagram / src / org / simantics / diagram / flag / IFlagType.java
index 8176d1e7931081fdc66665ff1cb1065b2d4731c0..0c5974a8f54f968030f4ebbc695cc032f6c7363e 100644 (file)
@@ -17,6 +17,7 @@ import java.awt.geom.Rectangle2D;
 
 import org.simantics.db.ReadGraph;
 import org.simantics.db.exception.DatabaseException;
+import org.simantics.g2d.canvas.ICanvasContext;
 import org.simantics.g2d.elementclass.FlagClass;
 import org.simantics.g2d.utils.Alignment;
 
@@ -46,7 +47,23 @@ public interface IFlagType {
      * @param graph database read access
      * @return all info gathered up about the flag
      * @throws DatabaseException
+     * @Deprecated implement {@link #getInfo(ReadGraph, ICanvasContext)} instead
      */
-    FlagInfo getInfo(ReadGraph graph) throws DatabaseException;
+    default FlagInfo getInfo(ReadGraph graph) throws DatabaseException {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * Reads and calculates information about this flags graphical
+     * representation.
+     * 
+     * @param graph database read access
+     * @param context the canvas context with which the info is loaded 
+     * @return all info gathered up about the flag
+     * @throws DatabaseException
+     */
+    default FlagInfo getInfo(ReadGraph graph, ICanvasContext context) throws DatabaseException {
+        return getInfo(graph);
+    }
 
 }