]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.g2d/src/org/simantics/g2d/layers/IEditableLayer.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / layers / IEditableLayer.java
diff --git a/bundles/org.simantics.g2d/src/org/simantics/g2d/layers/IEditableLayer.java b/bundles/org.simantics.g2d/src/org/simantics/g2d/layers/IEditableLayer.java
new file mode 100644 (file)
index 0000000..ef6384d
--- /dev/null
@@ -0,0 +1,63 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.g2d.layers;\r
+\r
+/**\r
+ * @author Antti Villberg\r
+ */\r
+public interface IEditableLayer extends ILayer {\r
+\r
+    String PROP_NAME = "name";\r
+\r
+    /**\r
+     * \r
+     */\r
+    public static class LayerChangeEvent {\r
+        private final ILayer source;\r
+        private final String property;\r
+        private final Object oldValue;\r
+        private final Object newValue;\r
+        public LayerChangeEvent(ILayer source, String property, Object oldValue, Object newValue) {\r
+            this.source = source;\r
+            this.property = property;\r
+            this.oldValue = oldValue;\r
+            this.newValue = newValue;\r
+        }\r
+        public ILayer getSource() {\r
+            return source;\r
+        }\r
+        public String getProperty() {\r
+            return property;\r
+        }\r
+        public Object getOldValue() {\r
+            return oldValue;\r
+        }\r
+        public Object getNewValue() {\r
+            return newValue;\r
+        }\r
+        \r
+    }\r
+\r
+    /**\r
+     * For listening to changes in a layer. For the time being the only thing\r
+     * that can change is the name.\r
+     */\r
+    public interface ILayerListener {\r
+        void layerChanged(LayerChangeEvent event);\r
+    }\r
+\r
+    void setName(String name);\r
+\r
+    void addLayerListener(ILayerListener l);\r
+    void removeLayerListener(ILayerListener l);\r
+\r
+}\r