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.handler;
\r
14 import org.simantics.g2d.diagram.IDiagram;
\r
15 import org.simantics.g2d.element.IElement;
\r
18 * All ElementContributions that implement LifeCycle get
\r
19 * element create and destroy events.
\r
21 * @author Toni Kalajainen
\r
25 public interface LifeCycle extends ElementHandler {
\r
28 * a new element has been spawned to the world
\r
31 void onElementCreated(IElement e);
\r
34 * Element has been destroyed from the world
\r
37 void onElementDestroyed(IElement e);
\r
40 * Element has been activated (after creation, cloning or loading)
\r
41 * and added to a diagram.
\r
46 void onElementActivated(IDiagram d, IElement e);
\r
49 * Element has been deactivated (disposed)
\r
53 void onElementDeactivated(IDiagram d, IElement e);
\r
56 * A stub implementation for {@link LifeCycle} that does not do anything.
\r
57 * Extend this to avoid having to implement all methods.
\r
59 public static class Stub implements LifeCycle {
\r
60 private static final long serialVersionUID = -569889719338663795L;
\r
63 public void onElementActivated(IDiagram d, IElement e) {
\r
67 public void onElementCreated(IElement e) {
\r
71 public void onElementDeactivated(IDiagram d, IElement e) {
\r
75 public void onElementDestroyed(IElement e) {
\r