X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.scenegraph%2Fsrc%2Forg%2Fsimantics%2Fscenegraph%2Fg2d%2FG2DRenderingHints.java;h=0f1803e2d64ee6d27d74695cab015a62fa658b54;hb=c684e246101adc478671274a9aae1979bfc02820;hp=00c7a6d0c8c516ead3e619f6edc8b8bb0070c9db;hpb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/G2DRenderingHints.java b/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/G2DRenderingHints.java index 00c7a6d0c..0f1803e2d 100644 --- a/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/G2DRenderingHints.java +++ b/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/G2DRenderingHints.java @@ -12,8 +12,8 @@ package org.simantics.scenegraph.g2d; import java.awt.Component; -import java.awt.RenderingHints.Key; import java.awt.geom.Rectangle2D; +import java.util.Map; /** * @author Tuukka Lehtonen @@ -21,6 +21,32 @@ import java.awt.geom.Rectangle2D; */ public final class G2DRenderingHints { + public static final Key KEY_BEGIN_ELEMENT = new G2DRenderingHints.Key(0); + public static final Key KEY_END_ELEMENT = new G2DRenderingHints.Key(1); + public static final Key KEY_ELEMENT_ID = new G2DRenderingHints.Key(2); + + public static class Key extends java.awt.RenderingHints.Key { + + public Key(int privateKey) { + super(privateKey); + } + + @Override + public boolean isCompatibleValue(Object val) { + switch (intKey()) { + case 0: + return val == null || val instanceof String + || val instanceof Map; + case 1: + return val == null || val instanceof Object; + case 2: + return val == null || val instanceof Object; + default: + throw new RuntimeException("Not possible!"); + } + } + } + /** * A rendering hint for storing the boundaries of the control area within a * Graphics2D instance.