1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
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
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.g2d.dnd;
14 import java.awt.geom.Rectangle2D;
16 import org.simantics.g2d.element.ElementClass;
17 import org.simantics.g2d.element.handler.StaticSymbol;
18 import org.simantics.g2d.image.Image;
19 import org.simantics.scenegraph.g2d.G2DParentNode;
20 import org.simantics.utils.datastructures.hints.HintContext;
21 import org.simantics.utils.datastructures.hints.IHintContext;
24 * @author Tuukka Lehtonen
26 public class ElementClassDragItem implements IDragItem {
28 private final ElementClass ec;
29 private final HintContext ctx = new HintContext();
31 public ElementClassDragItem(ElementClass ec) {
33 throw new NullPointerException("null element class");
37 public ElementClass getElementClass() {
42 public Rectangle2D getBounds() {
43 Image i = ec.getSingleItem(StaticSymbol.class).getImage();
48 public void paint(G2DParentNode parent) {
49 Image i = ec.getSingleItem(StaticSymbol.class).getImage();
54 public IHintContext getHintContext() {