]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.g2d/src/org/simantics/g2d/layers/IEditableLayer.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / layers / IEditableLayer.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
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
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.g2d.layers;
13
14 /**
15  * @author Antti Villberg
16  */
17 public interface IEditableLayer extends ILayer {
18
19     String PROP_NAME = "name";
20
21     /**
22      * 
23      */
24     public static class LayerChangeEvent {
25         private final ILayer source;
26         private final String property;
27         private final Object oldValue;
28         private final Object newValue;
29         public LayerChangeEvent(ILayer source, String property, Object oldValue, Object newValue) {
30             this.source = source;
31             this.property = property;
32             this.oldValue = oldValue;
33             this.newValue = newValue;
34         }
35         public ILayer getSource() {
36             return source;
37         }
38         public String getProperty() {
39             return property;
40         }
41         public Object getOldValue() {
42             return oldValue;
43         }
44         public Object getNewValue() {
45             return newValue;
46         }
47         
48     }
49
50     /**
51      * For listening to changes in a layer. For the time being the only thing
52      * that can change is the name.
53      */
54     public interface ILayerListener {
55         void layerChanged(LayerChangeEvent event);
56     }
57
58     void setName(String name);
59
60     void addLayerListener(ILayerListener l);
61     void removeLayerListener(ILayerListener l);
62
63 }