-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.g2d.elementclass;\r
-\r
-import java.awt.Color;\r
-import java.awt.geom.Rectangle2D;\r
-\r
-import org.simantics.g2d.element.ElementClass;\r
-import org.simantics.g2d.element.ElementUtils;\r
-import org.simantics.g2d.element.IElement;\r
-import org.simantics.g2d.element.handler.SceneGraph;\r
-import org.simantics.g2d.element.handler.impl.DefaultTransform;\r
-import org.simantics.g2d.element.handler.impl.FillColorImpl;\r
-import org.simantics.g2d.element.handler.impl.Resizeable;\r
-import org.simantics.scenegraph.g2d.G2DParentNode;\r
-import org.simantics.scenegraph.g2d.nodes.ShapeNode;\r
-\r
-/**\r
- * Transparent film\r
- * \r
- * @author Toni Kalajainen\r
- */\r
-public class FilmClass {\r
-\r
- public static final Color FILM_COLOR =\r
- new Color(0.f, 0.f, 0.f, 0.5f);\r
- \r
- public static final ElementClass FILM_CLASS =\r
- ElementClass.compile(\r
- DefaultTransform.INSTANCE,\r
- Resizeable.UNCONSTRICTED,\r
- //HandleMouseEvent.EVENT_CONSUMER,\r
- FillColorImpl.handlerOf(FILM_COLOR), \r
- new FilmSGNode()\r
- );\r
- \r
- static class FilmSGNode implements SceneGraph {\r
- /**\r
- * \r
- */\r
- private static final long serialVersionUID = -7763377402727204557L;\r
- private ShapeNode node = null;\r
- \r
- @Override\r
- public void cleanup(IElement e) {\r
- if(node != null) {\r
- node.remove();\r
- }\r
- node = null;\r
- }\r
-\r
- @Override\r
- public void init(IElement e, G2DParentNode parent) {\r
- if(node == null) {\r
- node = parent.addNode(ShapeNode.class);\r
- }\r
- Color fillColor = ElementUtils.getFillColor(e); \r
- Rectangle2D rect = ElementUtils.getElementBounds(e); \r
- \r
- node.setColor(fillColor);\r
- node.setFill(true);\r
- node.setShape(rect);\r
- } \r
- }\r
- \r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.g2d.elementclass;
+
+import java.awt.Color;
+import java.awt.geom.Rectangle2D;
+
+import org.simantics.g2d.element.ElementClass;
+import org.simantics.g2d.element.ElementUtils;
+import org.simantics.g2d.element.IElement;
+import org.simantics.g2d.element.handler.SceneGraph;
+import org.simantics.g2d.element.handler.impl.DefaultTransform;
+import org.simantics.g2d.element.handler.impl.FillColorImpl;
+import org.simantics.g2d.element.handler.impl.Resizeable;
+import org.simantics.scenegraph.g2d.G2DParentNode;
+import org.simantics.scenegraph.g2d.nodes.ShapeNode;
+
+/**
+ * Transparent film
+ *
+ * @author Toni Kalajainen
+ */
+public class FilmClass {
+
+ public static final Color FILM_COLOR =
+ new Color(0.f, 0.f, 0.f, 0.5f);
+
+ public static final ElementClass FILM_CLASS =
+ ElementClass.compile(
+ DefaultTransform.INSTANCE,
+ Resizeable.UNCONSTRICTED,
+ //HandleMouseEvent.EVENT_CONSUMER,
+ FillColorImpl.handlerOf(FILM_COLOR),
+ new FilmSGNode()
+ );
+
+ static class FilmSGNode implements SceneGraph {
+ /**
+ *
+ */
+ private static final long serialVersionUID = -7763377402727204557L;
+ private ShapeNode node = null;
+
+ @Override
+ public void cleanup(IElement e) {
+ if(node != null) {
+ node.remove();
+ }
+ node = null;
+ }
+
+ @Override
+ public void init(IElement e, G2DParentNode parent) {
+ if(node == null) {
+ node = parent.addNode(ShapeNode.class);
+ }
+ Color fillColor = ElementUtils.getFillColor(e);
+ Rectangle2D rect = ElementUtils.getElementBounds(e);
+
+ node.setColor(fillColor);
+ node.setFill(true);
+ node.setShape(rect);
+ }
+ }
+
+}