01: package org.dbbrowser.ui.helper.exporthelper.wizard;
02:
03: import java.util.HashMap;
04: import java.util.Map;
05:
06: /**
07: * A singleton class which represents the state of the wizard
08: * @author amangat
09: */
10: public class WizardState {
11: private static WizardState wizardState = new WizardState();
12: private Map mapOfNameToState = new HashMap();
13:
14: /**
15: * Constructer is private as it is a singleton
16: *
17: */
18: private WizardState() {
19: }
20:
21: /**
22: * Returns the single instance
23: * @return
24: */
25: public static WizardState getInstance() {
26: return wizardState;
27: }
28:
29: public void clearState() {
30: mapOfNameToState = null;
31: mapOfNameToState = new HashMap();
32: }
33:
34: /**
35: * Returns the state for the key
36: * @param key
37: * @return
38: */
39: public Object getState(Object key) {
40: return mapOfNameToState.get(key);
41: }
42:
43: /**
44: * Sets the state
45: * @param key
46: * @param value
47: */
48: public void setState(Object key, Object value) {
49: mapOfNameToState.put(key, value);
50: }
51:
52: /**
53: * Returns the state as a map
54: * @return
55: */
56: public Map getWizardState() {
57: return mapOfNameToState;
58: }
59: }
|