]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.browsing.ui/src/org/simantics/browsing/ui/StatePersistor.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.browsing.ui / src / org / simantics / browsing / ui / StatePersistor.java
diff --git a/bundles/org.simantics.browsing.ui/src/org/simantics/browsing/ui/StatePersistor.java b/bundles/org.simantics.browsing.ui/src/org/simantics/browsing/ui/StatePersistor.java
new file mode 100644 (file)
index 0000000..49213b7
--- /dev/null
@@ -0,0 +1,54 @@
+/*******************************************************************************\r
+ * Copyright (c) 2012 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
+ *     Semantum Oy - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.browsing.ui;\r
+\r
+import java.io.File;\r
+\r
+/**\r
+ * @author Antti Villberg\r
+ * @see GraphExplorer#setPersistor(StatePersistor)\r
+ */\r
+public interface StatePersistor {\r
+\r
+       /**\r
+        * Deserializes a possibly stored state for the specified input from the\r
+        * specified location. The locality of the restored state is up to the\r
+        * implementation to decide (i.e. input-specific or more global).\r
+        * \r
+        * @param stateLocation\r
+        *            the base location to deserialize the possible state from\r
+        * @param root\r
+        *            the current input to deserialize the state for or\r
+        *            <code>null</code> if no input is defined\r
+        * @return the deserialized state, may not be <code>null</code>.\r
+        *         Implementations may return {@link ExplorerState#EMPTY} if there's\r
+        *         no state to restore.\r
+        * @see ExplorerState#EMPTY\r
+        */\r
+       ExplorerState deserialize(File stateLocation, NodeContext root);\r
+\r
+       /**\r
+        * Serializes the specified explorer state for the specified input to the\r
+        * specified location. The locality of the stored state is up to the\r
+        * implementation to decide (i.e. input-specific or more global).\r
+        * \r
+        * @param stateLocation\r
+        *            the base location to serialize the state to\r
+        * @param root\r
+        *            the current input to serialize the state for or\r
+        *            <code>null</code> if no input is defined\r
+        * @param state\r
+        *            the state to serialize\r
+        */\r
+       void serialize(File stateLocation, NodeContext root, ExplorerState state);\r
+\r
+}\r