-/*******************************************************************************\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.scenegraph.g2d;\r
-\r
-import java.awt.Composite;\r
-import java.awt.Graphics2D;\r
-import java.awt.geom.AffineTransform;\r
-import java.awt.geom.Point2D;\r
-import java.awt.geom.Rectangle2D;\r
-\r
-import org.simantics.scenegraph.INode;\r
-import org.simantics.scenegraph.g2d.events.IEventHandler;\r
-\r
-/**\r
- * \r
- * \r
- * @author Tuukka Lehtonen\r
- */\r
-public interface IG2DNode extends INode, IEventHandler {\r
-\r
- /**\r
- * Set the z-index, i.e. the rendering order number for this 2D node.\r
- * 2D nodes are sorted in ascending z-order for rendering.\r
- * \r
- * @param z\r
- */\r
- @SyncField("z")\r
- public void setZIndex(int z);\r
-\r
- /**\r
- * @return the rendering order of this 2D node.\r
- */\r
- public int getZIndex();\r
-\r
- /**\r
- * @return <code>false</code> if this node will not render anything if\r
- * {@link #render(Graphics2D)} was invoked. Serves as a means to\r
- * optimize rendering. Should always return <code>true</code> by\r
- * default.\r
- */\r
- public boolean validate();\r
-\r
- /**\r
- * Perform the actual rendering. Node state changes should be avoided in\r
- * this method. This method should not change the transform of the g2d\r
- * instance. You should call g2d.create or copy the original transform and\r
- * put it back at the end of this method according to what is specified in\r
- * {@link Graphics2D#setTransform(AffineTransform)}.\r
- * \r
- * This method is always invoked so that the local transform of this\r
- * {@link IG2DNode} has not been applied to the Graphics2D rendering\r
- * context. It is this node's responsibility to apply its own transform\r
- * during rendering if necessary.\r
- * \r
- * The method must also make sure that it returns the {@link Composite} of\r
- * g2d to its original state using (see {@link Graphics2D#setComposite(Composite)).\r
- * \r
- * @param g2d\r
- * \r
- * @see #setTransform(AffineTransform)\r
- * @see #getTransform()\r
- */\r
- public void render(Graphics2D g2d);\r
-\r
- /**\r
- * Mark the scene graph to be repainted in its current rendering context (UI\r
- * component) as soon as is appropriate for the backend system.\r
- */\r
- public void repaint();\r
-\r
- // Bounds and transformation\r
-\r
- /**\r
- * @return affine transformation set for this node to transform it into its\r
- * parent's coordinate space\r
- */\r
- public AffineTransform getTransform();\r
-\r
- /**\r
- * Set an affine transformation for this node that transforms its local\r
- * coordinates into its parent's coordinate space\r
- * \r
- * @param transform local → parent transform\r
- */\r
- public void setTransform(AffineTransform transform);\r
-\r
- /**\r
- * Return bounds transformed with local transformation\r
- * \r
- * @return transformed bounds\r
- */\r
- public Rectangle2D getBounds();\r
-\r
- /**\r
- * Return bounds in local coordinates. May expose internal state of the\r
- * node. The client is not allowed to modify the returned value.\r
- * \r
- * @return bounds\r
- */\r
- public Rectangle2D getBoundsInLocal();\r
-\r
- public Rectangle2D getBoundsInLocal(boolean ignoreNulls);\r
-\r
- // Helper methods for bounds checking\r
-\r
- public boolean contains(Point2D point);\r
-\r
- public boolean intersects(Rectangle2D rect);\r
-\r
- public Point2D localToParent(Point2D point);\r
-\r
- public Rectangle2D localToParent(Rectangle2D rect);\r
-\r
- public Point2D parentToLocal(Point2D point);\r
-\r
- public Rectangle2D parentToLocal(Rectangle2D rect);\r
-\r
- public Point2D localToControl(Point2D point);\r
-\r
- public Rectangle2D localToControl(Rectangle2D rect);\r
-\r
- public Point2D controlToLocal(Point2D point);\r
-\r
- public Rectangle2D controlToLocal(Rectangle2D rect);\r
-\r
- /**\r
- * @return root node of the 2D scene graph or <code>null</code> if this node is\r
- * not part of a properly rooted scene graph hierarchy\r
- */\r
- public G2DSceneGraph getRootNode2D();\r
-\r
- /**\r
- * @return true if this node has focus in the owner scene graph\r
- */\r
- public boolean hasFocus();\r
-\r
- /**\r
- * @return the node that has focus in the owner scene graph\r
- */\r
- public IG2DNode getFocusNode();\r
-\r
- /**\r
- * @param node the node to have focus in the owner scene graph. The\r
- * specified node must be a part of the same scene graph.\r
- */\r
- public void setFocusNode(IG2DNode node);\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.scenegraph.g2d;
+
+import java.awt.Composite;
+import java.awt.Graphics2D;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+
+import org.simantics.scenegraph.INode;
+import org.simantics.scenegraph.g2d.events.IEventHandler;
+
+/**
+ *
+ *
+ * @author Tuukka Lehtonen
+ */
+public interface IG2DNode extends INode, IEventHandler {
+
+ /**
+ * Set the z-index, i.e. the rendering order number for this 2D node.
+ * 2D nodes are sorted in ascending z-order for rendering.
+ *
+ * @param z
+ */
+ @SyncField("z")
+ public void setZIndex(int z);
+
+ /**
+ * @return the rendering order of this 2D node.
+ */
+ public int getZIndex();
+
+ /**
+ * @return <code>false</code> if this node will not render anything if
+ * {@link #render(Graphics2D)} was invoked. Serves as a means to
+ * optimize rendering. Should always return <code>true</code> by
+ * default.
+ */
+ public boolean validate();
+
+ /**
+ * Perform the actual rendering. Node state changes must be avoided in
+ * this method. Implement node state changes to refresh method instead.
+ * This method should not change the transform of the g2d
+ * instance. You should call g2d.create or copy the original transform and
+ * put it back at the end of this method according to what is specified in
+ * {@link Graphics2D#setTransform(AffineTransform)}.
+ *
+ * This method is always invoked so that the local transform of this
+ * {@link IG2DNode} has not been applied to the Graphics2D rendering
+ * context. It is this node's responsibility to apply its own transform
+ * during rendering if necessary.
+ *
+ * The method must also make sure that it returns the {@link Composite} of
+ * g2d to its original state using (see {@link Graphics2D#setComposite(Composite)).
+ *
+ * @param g2d
+ *
+ * @see #setTransform(AffineTransform)
+ * @see #getTransform()
+ */
+ public void render(Graphics2D g2d);
+
+ /**
+ * Refresh the node state.
+ */
+ public void refresh();
+
+ /**
+ * Visit the IG2DNode substructure of this node using the provided visitor.
+ *
+ * @param visitor the visitor to use
+ * @since 1.29.0
+ */
+ public void accept(IG2DNodeVisitor visitor);
+
+ /**
+ * Mark the scene graph to be repainted in its current rendering context (UI
+ * component) as soon as is appropriate for the backend system.
+ */
+ public void repaint();
+
+ // Bounds and transformation
+
+ /**
+ * @return affine transformation set for this node to transform it into its
+ * parent's coordinate space
+ */
+ public AffineTransform getTransform();
+
+ /**
+ * Set an affine transformation for this node that transforms its local
+ * coordinates into its parent's coordinate space
+ *
+ * @param transform local → parent transform
+ */
+ public void setTransform(AffineTransform transform);
+
+ /**
+ * Return bounds transformed with local transformation
+ *
+ * @return transformed bounds
+ */
+ public Rectangle2D getBounds();
+
+ /**
+ * Return bounds in local coordinates. May expose internal state of the
+ * node. The client is not allowed to modify the returned value.
+ *
+ * @return bounds
+ */
+ public Rectangle2D getBoundsInLocal();
+
+ public Rectangle2D getBoundsInLocal(boolean ignoreNulls);
+
+ // Helper methods for bounds checking
+
+ public boolean contains(Point2D point);
+
+ public boolean intersects(Rectangle2D rect);
+
+ public Point2D localToParent(Point2D point);
+
+ public Rectangle2D localToParent(Rectangle2D rect);
+
+ public Point2D parentToLocal(Point2D point);
+
+ public Rectangle2D parentToLocal(Rectangle2D rect);
+
+ public Point2D localToControl(Point2D point);
+
+ public Rectangle2D localToControl(Rectangle2D rect);
+
+ public Point2D controlToLocal(Point2D point);
+
+ public Rectangle2D controlToLocal(Rectangle2D rect);
+
+ /**
+ * @return root node of the 2D scene graph or <code>null</code> if this node is
+ * not part of a properly rooted scene graph hierarchy
+ */
+ public G2DSceneGraph getRootNode2D();
+
+ /**
+ * @return true if this node has focus in the owner scene graph
+ */
+ public boolean hasFocus();
+
+ /**
+ * @return the node that has focus in the owner scene graph
+ */
+ public IG2DNode getFocusNode();
+
+ /**
+ * @param node the node to have focus in the owner scene graph. The
+ * specified node must be a part of the same scene graph.
+ */
+ public void setFocusNode(IG2DNode node);
+
+}