X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.diagram%2Fsrc%2Forg%2Fsimantics%2Fdiagram%2Fflag%2FIFlagType.java;h=0c5974a8f54f968030f4ebbc695cc032f6c7363e;hb=e3f46ffc9d4a6930adc83ebb8e6730f19708cc94;hp=8ee0ff93dcc6712a5ebde1f5b9baa1fa5208d93d;hpb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/flag/IFlagType.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/flag/IFlagType.java index 8ee0ff93d..0c5974a8f 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/flag/IFlagType.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/flag/IFlagType.java @@ -11,11 +11,13 @@ *******************************************************************************/ package org.simantics.diagram.flag; +import java.awt.Font; import java.awt.Shape; 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; @@ -35,6 +37,7 @@ public interface IFlagType { FlagClass.Type getType(); Alignment getHorizontalAlignment(); Alignment getVerticalAlignment(); + Font getFont(); } /** @@ -44,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); + } }