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.element;
14 import org.simantics.g2d.diagram.IDiagram;
15 import org.simantics.g2d.element.handler.LifeCycle;
16 import org.simantics.g2d.element.impl.Element;
17 import org.simantics.utils.datastructures.hints.IHintContext;
20 * Element is an object on a diagram. Element is part of one diagram.
22 * Element variables describe visual properties of the element.
24 * Variables (all of them) may be cloned, and serialized.
25 * Do not put non-visualization specific variables in element, e.g. Canvas Specific
28 * Use DiagramParticipant to write _canvas_specific_variables_ e.g.
29 * DiagramParticipant dp = ctx.getSingleItem(DiagramParticipant.class);
30 * dp.setElementHint(...);
31 * dp.setDiagramHint(...);
33 * Note! all values should be treated as if they are immutable.
37 * @author Toni Kalajainen
38 * @noimplement This interface is not intended to be implemented by clients.
40 public interface IElement extends IHintContext {
45 ElementClass getElementClass();
48 * Returns the diagram this element is directly a part of.
52 IDiagram getDiagram();
55 * Looks whether this element is a a direct part of a diagram.
57 * @return <code>null</code> if not a direct part of a diagram
59 IDiagram peekDiagram();
62 * (INTERNAL!) Invoked as a notification when this element is added to a
63 * diagram or removed from a diagram.
66 * diagram or <code>null</code> if the element was removed from a
69 void addedToDiagram(IDiagram diagram);
72 * Destroys the element from the world. Notifies all life-cycle handlers
73 * through {@link LifeCycle#onElementDestroyed(IElement)} of the event.
78 * Silently disposes of the element without performing any {@link LifeCycle}