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