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