1 /*******************************************************************************
\r
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
\r
3 * in Industry THTH ry.
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.g2d.dnd;
\r
14 import java.awt.geom.Rectangle2D;
\r
16 import org.simantics.g2d.element.ElementClass;
\r
17 import org.simantics.g2d.element.handler.StaticSymbol;
\r
18 import org.simantics.g2d.image.Image;
\r
19 import org.simantics.scenegraph.g2d.G2DParentNode;
\r
20 import org.simantics.utils.datastructures.hints.HintContext;
\r
21 import org.simantics.utils.datastructures.hints.IHintContext;
\r
24 * @author Tuukka Lehtonen
\r
26 public class ElementClassDragItem implements IDragItem {
\r
28 private final ElementClass ec;
\r
29 private final HintContext ctx = new HintContext();
\r
31 public ElementClassDragItem(ElementClass ec) {
\r
33 throw new NullPointerException("null element class");
\r
37 public ElementClass getElementClass() {
\r
42 public Rectangle2D getBounds() {
\r
43 Image i = ec.getSingleItem(StaticSymbol.class).getImage();
\r
44 return i.getBounds();
\r
48 public void paint(G2DParentNode parent) {
\r
49 Image i = ec.getSingleItem(StaticSymbol.class).getImage();
\r
54 public IHintContext getHintContext() {
\r