-/*******************************************************************************\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.element.handler.impl;\r
-\r
-import java.awt.Shape;\r
-import java.awt.geom.AffineTransform;\r
-\r
-import org.simantics.g2d.diagram.handler.Topology.Terminal;\r
-import org.simantics.g2d.utils.geom.DirectionSet;\r
-import org.simantics.utils.Container;\r
-import org.simantics.utils.DataContainer;\r
-\r
-/**\r
- * An arbitrary object based implementation of the g2d {@link Terminal}\r
- * interface.\r
- * \r
- * <p>\r
- * Elements that intend to contain terminal and use\r
- * <code>DiagramGraphSynchronizer</code> must use this implementation to\r
- * represent the terminals of the element.\r
- * </p>\r
- * \r
- * <p>\r
- * Also contains a relative transformation with respect to its parent, a set of\r
- * allowed drawing directions and a graphical shape to depict the terminal.\r
- * </p>\r
- * \r
- * @author Tuukka Lehtonen\r
- */\r
-public abstract class ObjectTerminal implements Terminal {\r
-\r
- private static final Container<Shape> NO_SHAPE = new DataContainer<Shape>(null);\r
-\r
- private final Object data;\r
- private final AffineTransform transform;\r
- private final DirectionSet ds;\r
- private final Container<Shape> shape;\r
-\r
- public ObjectTerminal(Object data, AffineTransform transform, DirectionSet ds, Container<Shape> shape) {\r
- assert data != null;\r
- this.data = data;\r
- this.transform = transform;\r
- this.ds = ds;\r
- this.shape = shape != null ? shape : NO_SHAPE;\r
- }\r
-\r
- public ObjectTerminal(Object data, AffineTransform transform, DirectionSet ds, Shape shape) {\r
- this(data, transform, ds, new DataContainer<Shape>(shape));\r
- }\r
-\r
- public ObjectTerminal(Object data, AffineTransform transform, DirectionSet ds) {\r
- this(data, transform, ds, NO_SHAPE);\r
- }\r
-\r
- public ObjectTerminal(Object data, AffineTransform transform) {\r
- this(data, transform, DirectionSet.ANY, NO_SHAPE);\r
- }\r
-\r
- public ObjectTerminal(Object data) {\r
- this(data, new AffineTransform(), DirectionSet.ANY, NO_SHAPE);\r
- }\r
-\r
- @Override\r
- public String toString() {\r
- return getClass().getSimpleName() + "[" + data + ", " + transform + ", " + shape + "]";\r
- }\r
-\r
- @Override\r
- public int hashCode() {\r
- return data.hashCode();\r
- }\r
-\r
- @Override\r
- public boolean equals(Object obj) {\r
- if (this == obj)\r
- return true;\r
- if (obj == null || getClass() != obj.getClass())\r
- return false;\r
- ObjectTerminal other = (ObjectTerminal) obj;\r
- return data.equals(other.data);\r
- }\r
-\r
- public Object getData() {\r
- return data;\r
- }\r
-\r
- public AffineTransform getTransform() {\r
- return transform;\r
- }\r
-\r
- public DirectionSet getDirections() {\r
- return ds;\r
- }\r
-\r
- public Shape getShape() {\r
- return shape.get();\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.element.handler.impl;
+
+import java.awt.Shape;
+import java.awt.geom.AffineTransform;
+
+import org.simantics.g2d.diagram.handler.Topology.Terminal;
+import org.simantics.g2d.utils.geom.DirectionSet;
+import org.simantics.utils.Container;
+import org.simantics.utils.DataContainer;
+
+/**
+ * An arbitrary object based implementation of the g2d {@link Terminal}
+ * interface.
+ *
+ * <p>
+ * Elements that intend to contain terminal and use
+ * <code>DiagramGraphSynchronizer</code> must use this implementation to
+ * represent the terminals of the element.
+ * </p>
+ *
+ * <p>
+ * Also contains a relative transformation with respect to its parent, a set of
+ * allowed drawing directions and a graphical shape to depict the terminal.
+ * </p>
+ *
+ * @author Tuukka Lehtonen
+ */
+public abstract class ObjectTerminal implements Terminal {
+
+ private static final Container<Shape> NO_SHAPE = new DataContainer<Shape>(null);
+
+ private final Object data;
+ private final AffineTransform transform;
+ private final DirectionSet ds;
+ private final Container<Shape> shape;
+
+ public ObjectTerminal(Object data, AffineTransform transform, DirectionSet ds, Container<Shape> shape) {
+ assert data != null;
+ this.data = data;
+ this.transform = transform;
+ this.ds = ds;
+ this.shape = shape != null ? shape : NO_SHAPE;
+ }
+
+ public ObjectTerminal(Object data, AffineTransform transform, DirectionSet ds, Shape shape) {
+ this(data, transform, ds, new DataContainer<Shape>(shape));
+ }
+
+ public ObjectTerminal(Object data, AffineTransform transform, DirectionSet ds) {
+ this(data, transform, ds, NO_SHAPE);
+ }
+
+ public ObjectTerminal(Object data, AffineTransform transform) {
+ this(data, transform, DirectionSet.ANY, NO_SHAPE);
+ }
+
+ public ObjectTerminal(Object data) {
+ this(data, new AffineTransform(), DirectionSet.ANY, NO_SHAPE);
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[" + data + ", " + transform + ", " + shape + "]";
+ }
+
+ @Override
+ public int hashCode() {
+ return data.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null || getClass() != obj.getClass())
+ return false;
+ ObjectTerminal other = (ObjectTerminal) obj;
+ return data.equals(other.data);
+ }
+
+ public Object getData() {
+ return data;
+ }
+
+ public AffineTransform getTransform() {
+ return transform;
+ }
+
+ public DirectionSet getDirections() {
+ return ds;
+ }
+
+ public Shape getShape() {
+ return shape.get();
+ }
+
}
\ No newline at end of file