]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.g2d/src/org/simantics/g2d/dnd/DragItem.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / dnd / DragItem.java
diff --git a/bundles/org.simantics.g2d/src/org/simantics/g2d/dnd/DragItem.java b/bundles/org.simantics.g2d/src/org/simantics/g2d/dnd/DragItem.java
new file mode 100644 (file)
index 0000000..f357abf
--- /dev/null
@@ -0,0 +1,52 @@
+/*******************************************************************************\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.dnd;\r
+\r
+import java.awt.geom.Rectangle2D;\r
+\r
+import org.simantics.scenegraph.g2d.G2DParentNode;\r
+import org.simantics.utils.datastructures.hints.HintContext;\r
+import org.simantics.utils.datastructures.hints.IHintContext;\r
+\r
+/**\r
+ * @author Tuukka Lehtonen\r
+ */\r
+public class DragItem<T> implements IDragItem {\r
+\r
+    private final T           object;\r
+    private final HintContext ctx = new HintContext();\r
+\r
+    public DragItem(T obj) {\r
+        if (obj == null)\r
+            throw new NullPointerException("null object");\r
+        this.object = obj;\r
+    }\r
+\r
+    public T getObject() {\r
+        return object;\r
+    }\r
+\r
+    @Override\r
+    public Rectangle2D getBounds() {\r
+        return new Rectangle2D.Double(0, 0, 1, 1);\r
+    }\r
+\r
+    @Override\r
+    public void paint(G2DParentNode parent) {\r
+    }\r
+\r
+    @Override\r
+    public IHintContext getHintContext() {\r
+        return ctx;\r
+    }\r
+\r
+}
\ No newline at end of file