01: /*
02: * Copyright (c) 2000, Jacob Smullyan.
03: *
04: * This is part of SkunkDAV, a WebDAV client. See http://skunkdav.sourceforge.net/
05: * for the latest version.
06: *
07: * SkunkDAV is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License as published
09: * by the Free Software Foundation; either version 2, or (at your option)
10: * any later version.
11: *
12: * SkunkDAV is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public License
18: * along with SkunkDAV; see the file COPYING. If not, write to the Free
19: * Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20: * 02111-1307, USA.
21: */
22:
23: package org.skunk.dav.client.gui;
24:
25: import org.skunk.trace.Debug;
26:
27: import java.util.Collections;
28: import java.util.ArrayList;
29: import java.util.List;
30:
31: public class BusinessTracker {
32: private static List busyKeys = Collections
33: .synchronizedList(new ArrayList());
34:
35: public static void addBusy(Object key) {
36: Debug.trace(BusinessTracker.class, Debug.DP4,
37: "adding busy object: {0}", key);
38: if (!busyKeys.contains(key))
39: busyKeys.add(key);
40: if (busyKeys.size() == 1)
41: publishBusyState(true);
42: }
43:
44: public static void removeBusy(Object key) {
45: Debug.trace(BusinessTracker.class, Debug.DP4,
46: "removing busy object: {0}", key);
47: if (busyKeys.contains(key))
48: busyKeys.remove(key);
49: if (busyKeys.isEmpty())
50: publishBusyState(false);
51:
52: }
53:
54: public static void removeAllBusy() {
55: Debug.trace(BusinessTracker.class, Debug.DP4,
56: "clearing all busy objects");
57: busyKeys.clear();
58: publishBusyState(false);
59:
60: }
61:
62: private static void publishBusyState(boolean busy) {
63: Debug.trace(BusinessTracker.class, Debug.DP3,
64: "publishing busy state: " + busy);
65: StateMonitor.setProperty(StateProperties.BUSY,
66: new Boolean(busy), null);
67: }
68: }
69:
70: /* $Log: BusinessTracker.java,v $
71: /* Revision 1.3 2000/12/19 22:36:05 smulloni
72: /* adjustments to preamble.
73: /*
74: /* Revision 1.2 2000/12/14 06:36:25 smulloni
75: /* changes to search and replace in text editor.
76: /* */
|