01: /**
02: * CurrentStorage.java
03: * Created on 13.02.2003, 18:30:59 Alex
04: * Package: net.sf.memoranda.util
05: *
06: * @author Alex V. Alishevskikh, alex@openmechanics.net
07: * Copyright (c) 2003 Memoranda Team. http://memoranda.sf.net
08: */package net.sf.memoranda.util;
09:
10: import java.awt.event.ActionEvent;
11: import java.awt.event.ActionListener;
12: import java.util.Collection;
13: import java.util.Vector;
14:
15: /**
16: *
17: */
18: /*$Id: CurrentStorage.java,v 1.3 2004/01/30 12:17:42 alexeya Exp $*/
19: public class CurrentStorage {
20:
21: /**
22: * @todo: implement storage congiguration
23: */
24: private static Storage _storage = new FileStorage();
25:
26: private static Vector actionListeners = new Vector();
27:
28: public static Storage get() {
29: return _storage;
30: }
31:
32: public static void set(Storage storage) {
33: _storage = storage;
34: storageChanged();
35: }
36:
37: public static void addChangeListener(ActionListener al) {
38: actionListeners.add(al);
39: }
40:
41: public static Collection getChangeListeners() {
42: return actionListeners;
43: }
44:
45: private static void storageChanged() {
46: for (int i = 0; i < actionListeners.size(); i++)
47: ((ActionListener) actionListeners.get(i))
48: .actionPerformed(new ActionEvent(null, 0,
49: "Current storage changed"));
50: }
51:
52: }
|