--- /dev/null
+/*******************************************************************************\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.diagram;\r
+\r
+import org.simantics.g2d.element.ElementClass;\r
+import org.simantics.g2d.element.IElement;\r
+\r
+/**\r
+ * An interface that is used for writing diagram modifications into the\r
+ * back-end. It is basically a queue of ordered modifications. Performing these\r
+ * modifications will cause back-end data model listeners to fire, making it\r
+ * possible for the back-end => diagram synchronizer to keep the visual\r
+ * appearance up-to-date with the data model.\r
+ * \r
+ * <p>\r
+ * To guarantee proper synchronization between back-end data model tracking and\r
+ * back-end mutation, methods of this class should only be invoked within\r
+ * diagram write transactions. See\r
+ * {@link DiagramUtils#inDiagramTransaction(IDiagram, org.simantics.g2d.diagram.handler.TransactionContext.TransactionType, Runnable)}\r
+ * and\r
+ * {@link DiagramUtils#mutateDiagram(IDiagram, org.simantics.utils.datastructures.Callback)}.\r
+ * \r
+ * @author Antti Villberg\r
+ * @author Tuukka Lehtonen\r
+ * \r
+ * @deprecated will be completely removed asap, do not use this, just write the\r
+ * data directly into the database.\r
+ */\r
+@Deprecated\r
+public interface DiagramMutator {\r
+\r
+ /**\r
+ * Creates a modification that forces the hints of the specified element to\r
+ * be synchronized with the back-end.\r
+ * \r
+ * @param element\r
+ */\r
+ void synchronizeHintsToBackend(IElement element);\r
+\r
+ void modifyTransform(IElement element);\r
+\r
+ IElement newElement(ElementClass clazz);\r
+\r
+ /**\r
+ * Set the Z-Order of the specified element.\r
+ * \r
+ * @param element\r
+ * @param position\r
+ */\r
+ void synchronizeElementOrder();\r
+\r
+ /**\r
+ * Retrieve objects bound using {@link #register(IElement, Object)}. These\r
+ * bindings will only stay alive until either {@link #clear()} or\r
+ * {@link #commit()} is invoked.\r
+ * \r
+ * @param <T>\r
+ * @param element\r
+ * @return\r
+ */\r
+ <T> T backendObject(IElement element);\r
+\r
+ /**\r
+ * For registering an element <-> back-end object binding which will be kept\r
+ * until either {@link #clear()} or {@link #commit()} is invoked.\r
+ * {@link #backendObject(IElement)} can be to retrieve the objects based on\r
+ * these bindings which is necessary in cases where the write-back process\r
+ * produces new back-end resources that are needed by modifications that are\r
+ * performed later.\r
+ * \r
+ * @param element\r
+ * @param object\r
+ */\r
+ void register(IElement element, Object object);\r
+\r
+ /**\r
+ * Commits all changes that have been queue into the mutator since the\r
+ * previous {@link #commit()} or {@link #clear()} invocation. A successful\r
+ * commit will empty the mutator into a state which is essentially the same\r
+ * as after invoking {@link #clear()}.\r
+ */\r
+ void commit();\r
+\r
+ /**\r
+ * Discard any changes that have been queued in the mutator by invocations\r
+ * to any modifying methods. After this the queue will be empty. Can be\r
+ * invoked at any time.\r
+ */\r
+ void clear();\r
+\r
+}\r