24 */
25 package java.beans;
26
27 import java.io.Serializable;
28 import java.io.ObjectStreamField;
29 import java.io.ObjectOutputStream;
30 import java.io.ObjectInputStream;
31 import java.io.IOException;
32 import java.util.Hashtable;
33 import java.util.Map.Entry;
34
35 /**
36 * This is a utility class that can be used by beans that support constrained
37 * properties. It manages a list of listeners and dispatches
38 * {@link PropertyChangeEvent}s to them. You can use an instance of this class
39 * as a member field of your bean and delegate these types of work to it.
40 * The {@link VetoableChangeListener} can be registered for all properties
41 * or for a property specified by name.
42 * <p>
43 * Here is an example of {@code VetoableChangeSupport} usage that follows
44 * the rules and recommendations laid out in the JavaBeans™ specification:
45 * <pre>{@code
46 * public class MyBean {
47 * private final VetoableChangeSupport vcs = new VetoableChangeSupport(this);
48 *
49 * public void addVetoableChangeListener(VetoableChangeListener listener) {
50 * this.vcs.addVetoableChangeListener(listener);
51 * }
52 *
53 * public void removeVetoableChangeListener(VetoableChangeListener listener) {
54 * this.vcs.removeVetoableChangeListener(listener);
55 * }
56 *
57 * private String value;
58 *
59 * public String getValue() {
60 * return this.value;
61 * }
62 *
63 * public void setValue(String newValue) throws PropertyVetoException {
64 * String oldValue = this.value;
|
24 */
25 package java.beans;
26
27 import java.io.Serializable;
28 import java.io.ObjectStreamField;
29 import java.io.ObjectOutputStream;
30 import java.io.ObjectInputStream;
31 import java.io.IOException;
32 import java.util.Hashtable;
33 import java.util.Map.Entry;
34
35 /**
36 * This is a utility class that can be used by beans that support constrained
37 * properties. It manages a list of listeners and dispatches
38 * {@link PropertyChangeEvent}s to them. You can use an instance of this class
39 * as a member field of your bean and delegate these types of work to it.
40 * The {@link VetoableChangeListener} can be registered for all properties
41 * or for a property specified by name.
42 * <p>
43 * Here is an example of {@code VetoableChangeSupport} usage that follows
44 * the rules and recommendations laid out in the JavaBeans specification:
45 * <pre>{@code
46 * public class MyBean {
47 * private final VetoableChangeSupport vcs = new VetoableChangeSupport(this);
48 *
49 * public void addVetoableChangeListener(VetoableChangeListener listener) {
50 * this.vcs.addVetoableChangeListener(listener);
51 * }
52 *
53 * public void removeVetoableChangeListener(VetoableChangeListener listener) {
54 * this.vcs.removeVetoableChangeListener(listener);
55 * }
56 *
57 * private String value;
58 *
59 * public String getValue() {
60 * return this.value;
61 * }
62 *
63 * public void setValue(String newValue) throws PropertyVetoException {
64 * String oldValue = this.value;
|