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