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.diagram.handler;
\r
14 import java.util.Collection;
\r
16 import org.simantics.g2d.diagram.IDiagram;
\r
17 import org.simantics.g2d.element.IElement;
\r
20 * @author Toni Kalajainen
\r
22 public interface LifeCycle extends DiagramHandler {
\r
25 * New empty diagram has spawned to the world.
\r
29 void onDiagramCreated(IDiagram diagram);
\r
32 * An old diagram has been restored from a other form of state
\r
33 * (loaded or cloned).
\r
37 void onDiagramLoaded(IDiagram diagram, Collection<IElement> initialElements);
\r
40 * Diagram is about to be disposed
\r
43 void onDiagramDisposed(IDiagram diagram);
\r
46 * Diagram is about to be destoyed permanently from the world
\r
49 void onDiagramDestroyed(IDiagram diagram);
\r
52 * A stub implementation for {@link LifeCycle} that does not do anything.
\r
53 * Extend this to avoid having to implement all methods.
\r
55 public class Stub implements LifeCycle {
\r
57 public void onDiagramCreated(IDiagram diagram) {
\r
61 public void onDiagramLoaded(IDiagram diagram, Collection<IElement> initialElements) {
\r
65 public void onDiagramDisposed(IDiagram diagram) {
\r
69 public void onDiagramDestroyed(IDiagram diagram) {
\r