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
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.spreadsheet;
\r
14 import java.util.List;
\r
15 import java.util.function.Consumer;
\r
17 import org.simantics.databoard.binding.Binding;
\r
18 import org.simantics.databoard.binding.mutable.MutableVariant;
\r
19 import org.simantics.databoard.binding.mutable.Variant;
\r
20 import org.simantics.spreadsheet.ClientModel.OperationMode;
\r
22 public interface CellEditor<O> {
\r
24 public interface Transaction<O> {
\r
26 void setContext(Object context);
\r
28 Object getContext();
\r
30 void add(O operation);
\r
33 * Applies the operations collected with this transaction
\r
38 boolean isOperationMode();
\r
40 List<Object> needSynchronization();
\r
42 void needSynchronization(Object synchronizable);
\r
46 * Sets the given property of the given cell
\r
48 * @param transaction a combined transaction, null for immediate change
\r
49 * @param location a cell location e.g. 'A1'
\r
50 * @param property the name of the property
\r
51 * @param value the property value
\r
52 * @param binding used for serializing the value
\r
54 <T> void edit(Transaction<O> transaction, String location, String property, T value, Binding binding, Consumer<?> callback);
\r
56 * Edits the given cell using the given textual input
\r
58 * @param transaction a combined transaction, null for immediate change
\r
59 * @param location a cell location e.g. 'A1'
\r
60 * @param value a text describing the change
\r
62 void edit(Transaction<O> transaction, String location, Variant variant, Consumer<?> callback);
\r
64 void copy(Transaction<O> transaction, String location, MutableVariant variant, Consumer<?> callback);
\r
67 * Creates a new transaction object
\r
70 Transaction<O> startTransaction(OperationMode mode);
\r