View Javadoc

1   /*
2    *  File: IViewstateSaver.java 
3    *  Copyright (c) 2004-2007  Peter Kliem (Peter.Kliem@jaret.de)
4    *  A commercial license is available, see http://www.jaret.de.
5    *
6    *  This program is free software; you can redistribute it and/or modify
7    *  it under the terms of the GNU General Public License as published by
8    *  the Free Software Foundation; either version 2 of the License, or
9    *  (at your option) any later version.
10   *
11   *  This program is distributed in the hope that it will be useful,
12   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   *  GNU General Public License for more details.
15   *
16   *  You should have received a copy of the GNU General Public License
17   *  along with this program; if not, write to the Free Software
18   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19   */
20  package de.jaret.util.ui.timebars.addon;
21  
22  import org.eclipse.ui.IMemento;
23  
24  import de.jaret.util.ui.timebars.swt.TimeBarViewer;
25  
26  /***
27   * Interface for a service saving and restoring the viewstate of a timebarviewer. When dealing with hierarchical
28   * models a HierarchyIdService is needed for identifying the nodes.
29   * 
30   * @author kliem
31   * @version $Id: IViewstateSaver.java 340 2007-04-02 21:52:03Z olk $
32   */
33  public interface IViewstateSaver {
34      /***
35       * Save the viewstate. Previously saved state will be overwritten.
36       * 
37       * @param timeBarViewer viewer to save state of
38       * @param idService HierarchyIdService needed when handling hierarchical models. May be <code>null</code> when 
39       * dealing with a flat model
40       * @param id id used to create a child memento when not <code>null</code>
41       * @param memento memento to write to
42       */
43      void saveViewstate(TimeBarViewer timeBarViewer, IHierarchyIdService idService, String id, IMemento memento);
44      /***
45       * Restore the viewstate. Will not fail if no state can be found in the memento.
46       * 
47       * @param timeBarViewer viewer to restore state of
48       * @param idService HierarchyIdService needed when handling hierarchical models. May be <code>null</code> when 
49       * dealing with a flat model
50       * @param id id of a child memento to read from. May be <code>null</code>.
51       * @param memento memento to read from
52       */
53      void restoreViewstate(TimeBarViewer timeBarViewer, IHierarchyIdService idService, String id, IMemento memento);
54  
55  }