]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.spreadsheet/src/org/simantics/spreadsheet/CellEditor.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.spreadsheet / src / org / simantics / spreadsheet / CellEditor.java
diff --git a/bundles/org.simantics.spreadsheet/src/org/simantics/spreadsheet/CellEditor.java b/bundles/org.simantics.spreadsheet/src/org/simantics/spreadsheet/CellEditor.java
new file mode 100644 (file)
index 0000000..3fb6a73
--- /dev/null
@@ -0,0 +1,72 @@
+/*******************************************************************************\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.spreadsheet;\r
+\r
+import java.util.List;\r
+import java.util.function.Consumer;\r
+\r
+import org.simantics.databoard.binding.Binding;\r
+import org.simantics.databoard.binding.mutable.MutableVariant;\r
+import org.simantics.databoard.binding.mutable.Variant;\r
+import org.simantics.spreadsheet.ClientModel.OperationMode;\r
+\r
+public interface CellEditor<O> {\r
+    \r
+       public interface Transaction<O> {\r
+           \r
+           void setContext(Object context);\r
+           \r
+           Object getContext();\r
+           \r
+           void add(O operation);\r
+           \r
+               /*\r
+                * Applies the operations collected with this transaction\r
+                * \r
+                */\r
+           void commit();\r
+           \r
+           boolean isOperationMode();\r
+        \r
+        List<Object> needSynchronization();\r
+\r
+        void needSynchronization(Object synchronizable);\r
+       }\r
+       \r
+       /*\r
+        * Sets the given property of the given cell\r
+        * \r
+        * @param transaction a combined transaction, null for immediate change\r
+        * @param location a cell location e.g. 'A1'\r
+        * @param property the name of the property\r
+        * @param value the property value\r
+        * @param binding used for serializing the value \r
+        */\r
+       <T> void edit(Transaction<O> transaction, String location, String property, T value, Binding binding, Consumer<?> callback);\r
+       /*\r
+        * Edits the given cell using the given textual input\r
+        * \r
+        * @param transaction a combined transaction, null for immediate change\r
+        * @param location a cell location e.g. 'A1'\r
+        * @param value a text describing the change\r
+        */\r
+    void edit(Transaction<O> transaction, String location, Variant variant, Consumer<?> callback);\r
+\r
+    void copy(Transaction<O> transaction, String location, MutableVariant variant, Consumer<?> callback);\r
+    \r
+       /*\r
+        * Creates a new transaction object\r
+        * \r
+        */\r
+    Transaction<O> startTransaction(OperationMode mode);\r
+    \r
+}\r