1 /*******************************************************************************
2 * Copyright (c) 2012 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Semantum Oy - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.browsing.ui;
17 * @author Antti Villberg
18 * @see GraphExplorer#setPersistor(StatePersistor)
20 public interface StatePersistor {
23 * Deserializes a possibly stored state for the specified input from the
24 * specified location. The locality of the restored state is up to the
25 * implementation to decide (i.e. input-specific or more global).
27 * @param stateLocation
28 * the base location to deserialize the possible state from
30 * the current input to deserialize the state for or
31 * <code>null</code> if no input is defined
32 * @return the deserialized state, may not be <code>null</code>.
33 * Implementations may return {@link ExplorerState#EMPTY} if there's
34 * no state to restore.
35 * @see ExplorerState#EMPTY
37 ExplorerState deserialize(File stateLocation, NodeContext root);
40 * Serializes the specified explorer state for the specified input to the
41 * specified location. The locality of the stored state is up to the
42 * implementation to decide (i.e. input-specific or more global).
44 * @param stateLocation
45 * the base location to serialize the state to
47 * the current input to serialize the state for or
48 * <code>null</code> if no input is defined
50 * the state to serialize
52 void serialize(File stateLocation, NodeContext root, ExplorerState state);