01: /*
02: * $RCSfile: PropertyChangeEventJAI.java,v $
03: *
04: * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
05: *
06: * Use is subject to license terms.
07: *
08: * $Revision: 1.1 $
09: * $Date: 2005/02/11 04:57:16 $
10: * $State: Exp $
11: */
12: package javax.media.jai;
13:
14: import java.beans.PropertyChangeEvent;
15:
16: /**
17: * A class instances of which represent Java Bean-style events emitted by
18: * JAI objects. This class definition adds no functionality to that provided
19: * by the superclass. The significance of the derivation is that bean events
20: * will be easily identifiable as having been generated by JAI classes by
21: * virtue of their being instances of this event class. Note that this does
22: * not prevent JAI properties from colliding with other Java Bean properties
23: * in the Bean property name space.
24: *
25: * @since JAI 1.1
26: */
27: public class PropertyChangeEventJAI extends PropertyChangeEvent {
28: /**
29: * The case-retained property name as supplied to the constructor.
30: */
31: private String originalPropertyName;
32:
33: /**
34: * Constructs a <code>PropertyChangeEventJAI</code>.
35: * <code>propertyName</code> is forced to lower case; all other
36: * parameters are passed unmodified to the superclass constructor.
37: * The original property name may be obtained by invoking
38: * <code>getOriginalPropertyName()</code>.
39: *
40: * @exception NullPointerException if <code>propertyName</code> is
41: * <code>null</code>.
42: * @exception IllegalArgumentException if <code>source</code> is
43: * <code>null</code> or if <code>oldValue</code> and
44: * <code>newValue</code> are both <code>null</code>.
45: */
46: public PropertyChangeEventJAI(Object source, String propertyName,
47: Object oldValue, Object newValue) {
48: super (source, propertyName.toLowerCase(), oldValue, newValue);
49:
50: if (source == null) {
51: throw new IllegalArgumentException(JaiI18N
52: .getString("PropertyChangeEventJAI0"));
53: } else if (oldValue == null && newValue == null) {
54: throw new IllegalArgumentException(JaiI18N
55: .getString("PropertyChangeEventJAI1"));
56: }
57:
58: originalPropertyName = propertyName.equals(getPropertyName()) ? getPropertyName()
59: : propertyName;
60: }
61:
62: /**
63: * Returns the value of <code>propertyName</code> originally passed to
64: * the class constructor. This name has its case retained.
65: */
66: public String getOriginalPropertyName() {
67: return originalPropertyName;
68: }
69: }
|