1 /*******************************************************************************
\r
2 * Copyright (c) 2012 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 * Semantum Oy - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.browsing.ui;
\r
14 import java.io.File;
\r
17 * @author Antti Villberg
\r
18 * @see GraphExplorer#setPersistor(StatePersistor)
\r
20 public interface StatePersistor {
\r
23 * Deserializes a possibly stored state for the specified input from the
\r
24 * specified location. The locality of the restored state is up to the
\r
25 * implementation to decide (i.e. input-specific or more global).
\r
27 * @param stateLocation
\r
28 * the base location to deserialize the possible state from
\r
30 * the current input to deserialize the state for or
\r
31 * <code>null</code> if no input is defined
\r
32 * @return the deserialized state, may not be <code>null</code>.
\r
33 * Implementations may return {@link ExplorerState#EMPTY} if there's
\r
34 * no state to restore.
\r
35 * @see ExplorerState#EMPTY
\r
37 ExplorerState deserialize(File stateLocation, NodeContext root);
\r
40 * Serializes the specified explorer state for the specified input to the
\r
41 * specified location. The locality of the stored state is up to the
\r
42 * implementation to decide (i.e. input-specific or more global).
\r
44 * @param stateLocation
\r
45 * the base location to serialize the state to
\r
47 * the current input to serialize the state for or
\r
48 * <code>null</code> if no input is defined
\r
50 * the state to serialize
\r
52 void serialize(File stateLocation, NodeContext root, ExplorerState state);
\r