]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Spreadsheet changes
authorAntti Villberg <antti.villberg@semantum.fi>
Fri, 21 Dec 2018 12:32:53 +0000 (14:32 +0200)
committerAntti Villberg <antti.villberg@semantum.fi>
Thu, 27 Dec 2018 14:10:36 +0000 (16:10 +0200)
Change-Id: Id02f01e1b19e227ea8d0ae6c0887a945874ac317

15 files changed:
bundles/org.simantics.spreadsheet.common/src/org/simantics/spreadsheet/util/SpreadsheetUtils.java
bundles/org.simantics.spreadsheet.graph/scl/Spreadsheet/All.scl
bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/GraphUI.java
bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/SpreadsheetGraphUtils.java
bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/celleditor/GraphCellEditorAdapter.java
bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/function/All.java
bundles/org.simantics.spreadsheet.ui/src/org/simantics/spreadsheet/ui/ClientTableModel.java
bundles/org.simantics.spreadsheet.ui/src/org/simantics/spreadsheet/ui/ExcelAdapter.java
bundles/org.simantics.spreadsheet.ui/src/org/simantics/spreadsheet/ui/SpreadsheetModel.java
bundles/org.simantics.spreadsheet.ui/src/org/simantics/spreadsheet/ui/SpreadsheetTable.java
bundles/org.simantics.spreadsheet/src/org/simantics/spreadsheet/CellEditor.java
bundles/org.simantics.spreadsheet/src/org/simantics/spreadsheet/ClientModel.java
bundles/org.simantics.spreadsheet/src/org/simantics/spreadsheet/OperationMode.java [new file with mode: 0644]
bundles/org.simantics.spreadsheet/src/org/simantics/spreadsheet/Transaction.java [new file with mode: 0644]
bundles/org.simantics.spreadsheet/src/org/simantics/spreadsheet/solver/SpreadsheetCell.java

index dcd88cf61306f80730fc047441c940e87bde2ea2..3559a8006c34561b89b531b5f8bde1d703dd3439 100644 (file)
@@ -46,16 +46,14 @@ import org.simantics.document.server.io.SimpleFont;
 import org.simantics.layer0.Layer0;
 import org.simantics.scl.runtime.function.Function1;
 import org.simantics.scl.runtime.tuple.Tuple;
-import org.simantics.spreadsheet.CellEditor;
-import org.simantics.spreadsheet.CellEditor.Transaction;
 import org.simantics.spreadsheet.ClientModel;
-import org.simantics.spreadsheet.ClientModel.OperationMode;
+import org.simantics.spreadsheet.OperationMode;
 import org.simantics.spreadsheet.Range;
 import org.simantics.spreadsheet.Spreadsheets;
+import org.simantics.spreadsheet.Transaction;
 import org.simantics.spreadsheet.common.TableCell;
 import org.simantics.spreadsheet.common.cell.StringCellParser;
 import org.simantics.spreadsheet.resource.SpreadsheetResource;
-import org.simantics.spreadsheet.synchronization.LineContentBean;
 import org.simantics.utils.datastructures.Pair;
 
 public class SpreadsheetUtils {
@@ -174,7 +172,7 @@ public class SpreadsheetUtils {
                return true;
        }
 
-       public static void schedule(CellEditor.Transaction<?> transaction, Write write) {
+       public static void schedule(Transaction<?> transaction, Write write) {
 
                if(transaction == null) {
 
@@ -199,7 +197,7 @@ public class SpreadsheetUtils {
                return new TransactionImpl(mode);
        }       
 
-       static class TransactionImpl implements CellEditor.Transaction<Write> {
+       static class TransactionImpl implements Transaction<Write> {
 
                private ArrayList<Write> writes = new ArrayList<>();
                private final OperationMode mode;
index a6660e57bcfc8e0bdb089ca8221fd51943fdc773..b493d65f53b549a5380b52e8b674d4273b395f5b 100644 (file)
@@ -5,12 +5,41 @@ include "Simantics/UI"
 include "Document/All"
 include "File"
 
+
+effect SpreadsheetTransaction 
+    "spreadsheetTransaction" 
+    "org.simantics.spreadsheet.Transaction"
+
 importJava "org.simantics.spreadsheet.graph.ExternalRef" where
     data ExternalRef
 
 importJava "org.simantics.spreadsheet.common.TableCell" where
     data TableCell
 
+importJava "java.util.function.Consumer" where
+    data Consumer
+
+importJava "org.simantics.spreadsheet.CellEditor" where
+    data CellEditor
+    startTransaction :: CellEditor -> OperationMode -> <Proc> Transaction
+    @JavaName "edit"
+    editProperty_ :: CellEditor -> String -> String -> a -> Binding a -> Maybe Consumer -> <SpreadsheetTransaction> () 
+    @JavaName "edit"
+    editContent :: CellEditor -> String -> Variant -> Maybe Consumer -> <SpreadsheetTransaction> () 
+
+@inline
+editProperty :: Serializable a => CellEditor -> String -> String -> a -> Maybe Consumer -> <SpreadsheetTransaction> ()
+editProperty editor location property value consumer = editProperty_ editor location property value binding consumer
+
+importJava "org.simantics.spreadsheet.OperationMode" where
+    data OperationMode
+    OPERATION :: OperationMode
+    EDIT_MODE :: OperationMode
+
+importJava "org.simantics.spreadsheet.Transaction" where
+    data Transaction
+    commit :: Transaction -> <Proc> ()
+
 importJava "org.simantics.spreadsheet.common.TreeTableCell" where
     data TreeTableCell
 
@@ -47,6 +76,12 @@ importJava "org.simantics.spreadsheet.graph.SpreadsheetGraphUtils" where
     invalidateAll :: Variable -> <ReadGraph> ()
     extRefVariable :: Variable -> <ReadGraph> Variant
     extRefActiveVariable :: Variable -> <ReadGraph> Variant
+    cellEditor :: Resource -> <ReadGraph> CellEditor
+    syncExec :: CellEditor -> OperationMode -> (<SpreadsheetTransaction, Proc> a) -> <Proc> a
+    cellColumn :: Variable -> <ReadGraph> Integer
+
+importJava "org.simantics.spreadsheet.Spreadsheets" where
+     cellName :: Integer -> Integer -> String
 
 importJava "org.simantics.spreadsheet.util.SpreadsheetUtils" where
     createSheet :: Resource -> String -> <WriteGraph> Resource
@@ -65,6 +100,9 @@ importJava "org.simantics.spreadsheet.util.SpreadsheetUtils" where
     setSCLLine :: Resource -> Integer -> String -> <WriteGraph> ()
     sheetRun :: Resource -> Variable -> <ReadGraph> Variable
 
+sheetRunDefault :: Resource -> <ReadGraph> Variable
+sheetRunDefault sheet = sheetRun sheet (resourceVariable sheet)
+
 importJava "org.simantics.spreadsheet.graph.SpreadsheetSessionManager" where
     removeSpreadsheetSession :: Variable -> <Proc, WriteGraph> ()
 
index 0f0175bfc86dad3be7ad410242a973a2c9ac080d..5717aa80744c4c90589799367ae4aa8d196ce675 100644 (file)
@@ -59,8 +59,9 @@ import org.simantics.simulator.toolkit.StandardRealm;
 import org.simantics.spreadsheet.Adaptable;
 import org.simantics.spreadsheet.CellEditor;
 import org.simantics.spreadsheet.ClientModel;
-import org.simantics.spreadsheet.ClientModel.OperationMode;
+import org.simantics.spreadsheet.OperationMode;
 import org.simantics.spreadsheet.SheetCommands;
+import org.simantics.spreadsheet.Transaction;
 import org.simantics.spreadsheet.event.model.RemoveCellHandler;
 import org.simantics.spreadsheet.resource.SpreadsheetResource;
 import org.simantics.spreadsheet.solver.SheetNode;
index 52b7cab5cea0e542218d1a4ec666a0dbf7232f09..ee57745ae857bf6bdf4cfd46ce6b0bba87364c2a 100644 (file)
@@ -30,20 +30,29 @@ import org.simantics.db.common.utils.LiteralFileUtil;
 import org.simantics.db.exception.DatabaseException;
 import org.simantics.db.exception.ServiceException;
 import org.simantics.db.layer0.util.Layer0Utils;
+import org.simantics.db.layer0.variable.StandardGraphChildVariable;
 import org.simantics.db.layer0.variable.Variable;
 import org.simantics.db.layer0.variable.Variables;
 import org.simantics.db.procedure.Listener;
 import org.simantics.db.service.ClusteringSupport;
 import org.simantics.layer0.Layer0;
+import org.simantics.scl.compiler.commands.CommandSession;
+import org.simantics.scl.runtime.SCLContext;
+import org.simantics.scl.runtime.function.Function;
+import org.simantics.scl.runtime.tuple.Tuple0;
 import org.simantics.scl.runtime.tuple.Tuple2;
 import org.simantics.simulator.toolkit.StandardRealm;
+import org.simantics.spreadsheet.CellEditor;
 import org.simantics.spreadsheet.ExternalRef;
+import org.simantics.spreadsheet.OperationMode;
 import org.simantics.spreadsheet.Range;
 import org.simantics.spreadsheet.Spreadsheets;
+import org.simantics.spreadsheet.Transaction;
 import org.simantics.spreadsheet.graph.synchronization.SpreadsheetSynchronizationEventHandler;
 import org.simantics.spreadsheet.resource.SpreadsheetResource;
 import org.simantics.spreadsheet.solver.SheetNode;
 import org.simantics.spreadsheet.solver.SpreadsheetBook;
+import org.simantics.spreadsheet.solver.SpreadsheetCell;
 import org.simantics.spreadsheet.solver.SpreadsheetEngine;
 import org.simantics.spreadsheet.solver.SpreadsheetLine;
 import org.simantics.spreadsheet.solver.SpreadsheetStyle;
@@ -566,4 +575,47 @@ public class SpreadsheetGraphUtils {
         
     }
     
+    public static CellEditor cellEditor(ReadGraph graph, Resource sheet) throws DatabaseException {
+        SpreadsheetResource SHEET = SpreadsheetResource.getInstance(graph);
+        Variable sheetVariable = Variables.getVariable(graph, sheet);
+        return sheetVariable.getPropertyValue(graph, SHEET.cellEditor);
+    }
+    
+    public static final String SPREADSHEET_TRANSACTION = "spreadsheetTransaction";
+
+    @SuppressWarnings({ "rawtypes", "unchecked" })
+    public static Object syncExec(CellEditor editor, OperationMode mode, Function fun) throws InterruptedException {
+        
+        Transaction tr = editor.startTransaction(mode);
+        
+        SCLContext context = SCLContext.getCurrent();
+        Transaction oldTransaction = (Transaction)context.put(SPREADSHEET_TRANSACTION, tr);
+        
+        Object result = null;
+        
+        try {
+
+            result = fun.apply(Tuple0.INSTANCE);
+            
+        } finally {
+            
+            tr.commit();
+            
+            context.put(SPREADSHEET_TRANSACTION, oldTransaction);
+            
+        }
+        
+        return result;
+        
+    }
+    
+    public static int cellColumn(ReadGraph graph, Variable cell) {
+        if(cell instanceof StandardGraphChildVariable) {
+            StandardGraphChildVariable sgcv = (StandardGraphChildVariable)cell;
+            SpreadsheetCell sc = (SpreadsheetCell)sgcv.node.node;
+            return sc.getColumn();
+        }
+        throw new IllegalStateException("Expected StandardGraphChildVariable, got " + cell.getClass().getName());
+    }
+    
 }
index ae22581a2d3076769268dc33d078790e74d8980f..9cabb6c3249beb96098974f0327ff7738687a2d5 100644 (file)
@@ -12,7 +12,8 @@ import org.simantics.db.layer0.util.Layer0Utils;
 import org.simantics.db.layer0.variable.Variable;
 import org.simantics.db.request.Write;
 import org.simantics.spreadsheet.CellEditor;
-import org.simantics.spreadsheet.ClientModel.OperationMode;
+import org.simantics.spreadsheet.OperationMode;
+import org.simantics.spreadsheet.Transaction;
 import org.simantics.spreadsheet.util.SpreadsheetUtils;
 
 public class GraphCellEditorAdapter implements CellEditor<Write> {
index 865a60ebe8c89e0d56eeb95024be98ceda1512e9..bc034086c7d1841eddc76d778b0d9c12e3b80171 100644 (file)
@@ -55,6 +55,7 @@ import org.simantics.spreadsheet.CellEditor;
 import org.simantics.spreadsheet.ClientModel;
 import org.simantics.spreadsheet.Range;
 import org.simantics.spreadsheet.Spreadsheets;
+import org.simantics.spreadsheet.Transaction;
 import org.simantics.spreadsheet.graph.SpreadsheetGraphUtils;
 import org.simantics.spreadsheet.graph.SpreadsheetNodeManager;
 import org.simantics.spreadsheet.graph.SpreadsheetSessionManager;
@@ -560,88 +561,96 @@ public class All {
         }
 
     };
+    
+    public static class DefaultSheetCellEditor extends GraphCellEditorAdapter {
+
+        final public Variable sheet;
+        
+        public DefaultSheetCellEditor(Variable sheet, Variable cell) {
+            super(cell);
+            this.sheet = sheet;
+        }
 
+        @Override
+        public <T> void edit(final Transaction<Write> transaction, final String location, final String property, final T value, final Binding binding, Consumer<?> callback) {
 
-    @SCLValue(type = "ReadGraph -> Resource -> Variable -> CellEditor")
-    public static CellEditor<Write> defaultSheetCellEditor(ReadGraph graph, Resource resource, final Variable context_) throws DatabaseException {
-
-        final Variable sheet = context_.getParent(graph);
-
-        return new GraphCellEditorAdapter(null) {
+            SpreadsheetUtils.schedule(transaction, new WriteRequest() {
 
-            @Override
-            public <T> void edit(final Transaction<Write> transaction, final String location, final String property, final T value, final Binding binding, Consumer<?> callback) {
+                @Override
+                public void perform(WriteGraph graph) throws DatabaseException {
+                    CellEditor<Write> editor = getPossibleCellEditor(graph, location, value == null ? null : new Variant(binding, value));
+                    if (editor == null)
+                        return;
+                    editor.edit(transaction, location, property, value, binding, callback);
+                }
+            });
 
-                SpreadsheetUtils.schedule(transaction, new WriteRequest() {
+        }
 
-                    @Override
-                    public void perform(WriteGraph graph) throws DatabaseException {
-                        CellEditor<Write> editor = getPossibleCellEditor(graph, location, value == null ? null : new Variant(binding, value));
-                        if (editor == null)
-                            return;
-                        editor.edit(transaction, location, property, value, binding, callback);
-                    }
-                });
+        @Override
+        public void edit(final Transaction<Write> transaction, final String location, final Variant value, Consumer<?> callback) {
+            SpreadsheetUtils.schedule(transaction, new WriteRequest() {
 
-            }
+                @Override
+                public void perform(WriteGraph graph) throws DatabaseException {
+                    CellEditor<Write> editor = getPossibleCellEditor(graph, location, value);
+                    if (editor == null)
+                        return;
+                    editor.edit(transaction, location, value, callback);
+                }
+            });
 
-            @Override
-            public void edit(final Transaction<Write> transaction, final String location, final Variant value, Consumer<?> callback) {
-                SpreadsheetUtils.schedule(transaction, new WriteRequest() {
-
-                    @Override
-                    public void perform(WriteGraph graph) throws DatabaseException {
-                        CellEditor<Write> editor = getPossibleCellEditor(graph, location, value);
-                        if (editor == null)
-                            return;
-                        editor.edit(transaction, location, value, callback);
-                    }
-                });
+        }
 
-            }
+        private CellEditor<Write> getPossibleCellEditor(WriteGraph graph, String location, Variant value) throws DatabaseException {
+            SpreadsheetResource SHEET = SpreadsheetResource.getInstance(graph);
+            Range range = Spreadsheets.decodePossibleCellAbsolute(location);
+            if(range == null) return null; //No editor found
 
-            private CellEditor<Write> getPossibleCellEditor(WriteGraph graph, String location, Variant value) throws DatabaseException {
-                SpreadsheetResource SHEET = SpreadsheetResource.getInstance(graph);
-                Range range = Spreadsheets.decodePossibleCellAbsolute(location);
-                if(range == null) return null; //No editor found
-
-                List<Variable> cells = SpreadsheetGraphUtils.possibleConfigurationCellVariables(graph, sheet, range);
-                if (cells.isEmpty()) {
-                    if (value == null) {
-                        return null;
-                    } else {
-                        cells = SpreadsheetGraphUtils.getOrCreateConfigurationCellVariables(graph, sheet, range);
-                    }
+            List<Variable> cells = SpreadsheetGraphUtils.possibleConfigurationCellVariables(graph, sheet, range);
+            if (cells.isEmpty()) {
+                if (value == null) {
+                    return null;
+                } else {
+                    cells = SpreadsheetGraphUtils.getOrCreateConfigurationCellVariables(graph, sheet, range);
                 }
-                if (cells.size() != 1)
-                    throw new DatabaseException("Can edit only one cell at a time!");
-
-                return cells.iterator().next().getPropertyValue(graph, SHEET.cellEditor);
             }
+            if (cells.size() != 1)
+                throw new DatabaseException("Can edit only one cell at a time!");
 
-            @Override
-            public void copy(final Transaction<Write> transaction, final String location, final MutableVariant variant, Consumer<?> callback) {
+            return cells.iterator().next().getPropertyValue(graph, SHEET.cellEditor);
+        }
+
+        @Override
+        public void copy(final Transaction<Write> transaction, final String location, final MutableVariant variant, Consumer<?> callback) {
 
-                SpreadsheetUtils.schedule(transaction, new WriteRequest() {
+            SpreadsheetUtils.schedule(transaction, new WriteRequest() {
 
-                    @Override
-                    public void perform(WriteGraph graph) throws DatabaseException {
+                @Override
+                public void perform(WriteGraph graph) throws DatabaseException {
 
-                        SpreadsheetResource SHEET = SpreadsheetResource.getInstance(graph);
-                        Variable variable = sheet.getPossibleChild(graph, location);
-                        if(variable != null) {
-                            CellEditor<Write> editor = variable.getPossiblePropertyValue(graph, SHEET.cellEditor);
-                            if(editor != null) {
-                                editor.copy(transaction, location, variant, null);
-                            }
+                    SpreadsheetResource SHEET = SpreadsheetResource.getInstance(graph);
+                    Variable variable = sheet.getPossibleChild(graph, location);
+                    if(variable != null) {
+                        CellEditor<Write> editor = variable.getPossiblePropertyValue(graph, SHEET.cellEditor);
+                        if(editor != null) {
+                            editor.copy(transaction, location, variant, null);
                         }
                     }
+                }
 
-                });
+            });
 
-            }
+        }
+        
+    }
 
-        };
+
+    @SCLValue(type = "ReadGraph -> Resource -> Variable -> CellEditor")
+    public static CellEditor<Write> defaultSheetCellEditor(ReadGraph graph, Resource resource, final Variable context_) throws DatabaseException {
+
+        final Variable sheet = context_.getParent(graph);
+        return new DefaultSheetCellEditor(sheet, null);
 
     }
 
index 08a1b0ef6f898a5796b2e48017176f297236e75b..b77350a0cce6f37c755e8c46b79af712032d4cbc 100644 (file)
@@ -18,7 +18,7 @@ import javax.swing.table.DefaultTableModel;
 
 import org.simantics.spreadsheet.ClientModel;
 import org.simantics.spreadsheet.ClientModel.ClientModelListener;
-import org.simantics.spreadsheet.ClientModel.OperationMode;
+import org.simantics.spreadsheet.OperationMode;
 import org.simantics.spreadsheet.Spreadsheets;
 import org.simantics.spreadsheet.solver.SpreadsheetStyle;
 import org.simantics.spreadsheet.util.SpreadsheetUtils;
index a51b32a0fc1f14bc90ea06a2836c0c5636570c37..f39e92c7a42613d555ae13445bfafe0066b8c6e8 100644 (file)
@@ -24,11 +24,11 @@ import org.simantics.databoard.binding.mutable.MutableVariant;
 import org.simantics.databoard.binding.mutable.Variant;
 import org.simantics.spreadsheet.Adaptable;
 import org.simantics.spreadsheet.CellEditor;
-import org.simantics.spreadsheet.CellEditor.Transaction;
 import org.simantics.spreadsheet.ClientModel;
-import org.simantics.spreadsheet.ClientModel.OperationMode;
+import org.simantics.spreadsheet.OperationMode;
 import org.simantics.spreadsheet.Range;
 import org.simantics.spreadsheet.Spreadsheets;
+import org.simantics.spreadsheet.Transaction;
 import org.simantics.spreadsheet.common.cell.StringCellParser;
 import org.simantics.spreadsheet.util.SpreadsheetUtils;
 import org.simantics.utils.threads.logger.ITask;
index 7d60519470116eb066866dc1ba0e48d452c9c38e..137cde7a44832cc160e6825f5cbb4659df0fd667 100644 (file)
@@ -68,11 +68,11 @@ import org.simantics.scenegraph.INode;
 import org.simantics.scenegraph.swing.JScrollPaneSG;
 import org.simantics.spreadsheet.Adaptable;
 import org.simantics.spreadsheet.CellEditor;
-import org.simantics.spreadsheet.CellEditor.Transaction;
 import org.simantics.spreadsheet.ClientModel;
-import org.simantics.spreadsheet.ClientModel.OperationMode;
+import org.simantics.spreadsheet.OperationMode;
 import org.simantics.spreadsheet.SheetCommands;
 import org.simantics.spreadsheet.Spreadsheets;
+import org.simantics.spreadsheet.Transaction;
 import org.simantics.spreadsheet.common.cell.Parsers;
 import org.simantics.spreadsheet.common.cell.StringCellParser;
 import org.simantics.spreadsheet.event.model.RemoveCellHandler;
index ee9a55b1da8b707bd6d4e895b24da4df20b32e4f..96254ae63334cb4f4ea74b56d751201de0132756 100644 (file)
@@ -30,7 +30,7 @@ import org.simantics.scenegraph.INode;
 import org.simantics.scenegraph.swing.JTableSG;
 import org.simantics.spreadsheet.CellEditor;
 import org.simantics.spreadsheet.ClientModel;
-import org.simantics.spreadsheet.ClientModel.OperationMode;
+import org.simantics.spreadsheet.OperationMode;
 
 public class SpreadsheetTable extends JTableSG {
        
index a90cf51466127cd0c378a9eef616247dae943a08..4448a87988c67f6d59447187749f736ff15e388f 100644 (file)
  *******************************************************************************/
 package org.simantics.spreadsheet;
 
-import java.util.List;
 import java.util.function.Consumer;
 
 import org.simantics.databoard.binding.Binding;
 import org.simantics.databoard.binding.mutable.MutableVariant;
 import org.simantics.databoard.binding.mutable.Variant;
-import org.simantics.spreadsheet.ClientModel.OperationMode;
 
 public interface CellEditor<O> {
 
-    public interface Transaction<O> {
-
-        void setContext(Object context);
-
-        Object getContext();
-
-        void add(O operation);
-
-        /*
-         * Applies the operations collected with this transaction
-         * 
-         */
-        void commit();
-
-        boolean isOperationMode();
-
-        List<Object> needSynchronization();
-
-        void needSynchronization(Object synchronizable);
-    }
-
     /*
      * Sets the given property of the given cell
      * 
index 7304419d17db9cdb07286ade159a5a9b0beb8f48..bd9b5d1a18791d7164a60e1d53ec498118d5b915 100644 (file)
@@ -19,11 +19,6 @@ import org.simantics.utils.datastructures.Pair;
 
 public interface ClientModel extends CellModifier {
 
-    public enum OperationMode {
-        OPERATION,
-        EDIT_MODE
-    }
-
     public interface ClientModelListener {
 
         public void rows(int amount);
diff --git a/bundles/org.simantics.spreadsheet/src/org/simantics/spreadsheet/OperationMode.java b/bundles/org.simantics.spreadsheet/src/org/simantics/spreadsheet/OperationMode.java
new file mode 100644 (file)
index 0000000..f894cc5
--- /dev/null
@@ -0,0 +1,6 @@
+package org.simantics.spreadsheet;
+
+public enum OperationMode {
+    OPERATION,
+    EDIT_MODE
+}
\ No newline at end of file
diff --git a/bundles/org.simantics.spreadsheet/src/org/simantics/spreadsheet/Transaction.java b/bundles/org.simantics.spreadsheet/src/org/simantics/spreadsheet/Transaction.java
new file mode 100644 (file)
index 0000000..3702a22
--- /dev/null
@@ -0,0 +1,24 @@
+package org.simantics.spreadsheet;
+
+import java.util.List;
+
+public interface Transaction<O> {
+
+    void setContext(Object context);
+
+    Object getContext();
+
+    void add(O operation);
+
+    /*
+     * Applies the operations collected with this transaction
+     * 
+     */
+    void commit();
+
+    boolean isOperationMode();
+
+    List<Object> needSynchronization();
+
+    void needSynchronization(Object synchronizable);
+}
\ No newline at end of file
index 6f6a372163681ea4a1243040a9cb607b209dd877..dd05bf370fa92af0ddc41a2f1ba5f16bc8633c54 100644 (file)
@@ -61,6 +61,10 @@ public class SpreadsheetCell implements SpreadsheetElement, SheetNode {
     public void setContent(Object newContent) {
         this.content = newContent;
     }
+    
+    public int getColumn() {
+       return column;
+    }
 
     @Override
     public String getName() {