01: /* uDig - User Friendly Desktop Internet GIS client
02: * http://udig.refractions.net
03: * (C) 2004, Refractions Research Inc.
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation;
08: * version 2.1 of the License.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: */
15: package net.refractions.udig.ui.operations;
16:
17: import java.util.Set;
18: import java.util.concurrent.CopyOnWriteArraySet;
19:
20: /**
21: * Abstract class that can be used as a superclass for PropertyValue implementations.
22: *
23: * @author Jesse
24: * @since 1.1.0
25: */
26: public abstract class AbstractPropertyValue<T> implements
27: PropertyValue<T> {
28: protected Set<IOpFilterListener> listeners = new CopyOnWriteArraySet<IOpFilterListener>();
29:
30: public void addListener(IOpFilterListener listener) {
31: listeners.add(listener);
32: }
33:
34: public void removeListener(IOpFilterListener listener) {
35: listeners.add(listener);
36: }
37:
38: /**
39: * Notifies listener that the value of the filter has changed.
40: */
41: public void notifyListeners(Object changed) {
42: for (IOpFilterListener listener : listeners) {
43: listener.notifyChange(changed);
44: }
45: }
46:
47: }
|