Debian Codegraph @

display/src/amap/PropertyChangeHandler.java

raw
1
2 //============================================================================
3 //
4 // file: PropertyChangeHandler.java
5 //
6 // Copyright (c) 2007, Michael E. Smoot
7 //
8 // This program is free software; you can redistribute it and/or modify it
9 // under the terms of the GNU General Public License as published by the
10 // Free Software Foundation; either version 2 of the License, or (at your
11 // option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful, but
14 // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 // for more details.
17 //
18 // You should have received a copy of the GNU General Public License along
19 // with this program; if not, write to the Free Software Foundation, Inc.,
20 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 //
22 //============================================================================
23
24 package amap;
25
26 import java.util.*;
27 import java.beans.*;
28
29
30 public class PropertyChangeHandler {
31
32 private static PropertyChangeSupport pcs;
33 private static Object o;
34
35 static {
36 o = new Object();
37 pcs = new PropertyChangeSupport( o );
38 }
39
40 public static PropertyChangeSupport getPropertyChangeSupport() {
41 return pcs;
42 }
43
44 public static void firePropertyChange(String id, Object oldValue, Object newValue) {
45 try {
46 PropertyChangeIDs.valueOf(id);
47 } catch (IllegalArgumentException ex) {
48 System.err.println("Illegal PropertyChangeEvent ID: " + id + " ignoring!");
49 return;
50 }
51 PropertyChangeEvent e = new PropertyChangeEvent(pcs, id, oldValue, newValue);
52 pcs.firePropertyChange(e);
53 }
54 }