]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.g2d/src/org/simantics/g2d/dnd/DragItem.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / dnd / DragItem.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.g2d.dnd;
13
14 import java.awt.geom.Rectangle2D;
15
16 import org.simantics.scenegraph.g2d.G2DParentNode;
17 import org.simantics.utils.datastructures.hints.HintContext;
18 import org.simantics.utils.datastructures.hints.IHintContext;
19
20 /**
21  * @author Tuukka Lehtonen
22  */
23 public class DragItem<T> implements IDragItem {
24
25     private final T           object;
26     private final HintContext ctx = new HintContext();
27
28     public DragItem(T obj) {
29         if (obj == null)
30             throw new NullPointerException("null object");
31         this.object = obj;
32     }
33
34     public T getObject() {
35         return object;
36     }
37
38     @Override
39     public Rectangle2D getBounds() {
40         return new Rectangle2D.Double(0, 0, 1, 1);
41     }
42
43     @Override
44     public void paint(G2DParentNode parent) {
45     }
46
47     @Override
48     public IHintContext getHintContext() {
49         return ctx;
50     }
51
52 }