1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package org.nuiton.validator.bean;
23
24 import java.beans.PropertyChangeListener;
25 import java.beans.PropertyChangeSupport;
26
27 public class SimpleBean {
28
29 protected int intValue;
30
31 protected String stringValue;
32
33 final PropertyChangeSupport p;
34
35 public SimpleBean() {
36 p = new PropertyChangeSupport(this);
37 }
38
39 public int getIntValue() {
40 return intValue;
41 }
42
43 public String getStringValue() {
44 return stringValue;
45 }
46
47 public void setStringValue(String stringValue) {
48 String old = this.stringValue;
49 this.stringValue = stringValue;
50 p.firePropertyChange("stringValue", old, stringValue);
51 }
52
53 public void setIntValue(int intValue) {
54 int old = this.intValue;
55 this.intValue = intValue;
56 p.firePropertyChange("intValue", old, intValue);
57 }
58
59 public void addPropertyChangeListener(PropertyChangeListener listener) {
60 p.addPropertyChangeListener(listener);
61 }
62
63 public void addPropertyChangeListener(String propertyName,
64 PropertyChangeListener listener) {
65 p.addPropertyChangeListener(propertyName, listener);
66 }
67
68 public void removePropertyChangeListener(PropertyChangeListener listener) {
69 p.removePropertyChangeListener(listener);
70 }
71
72 public void removePropertyChangeListener(String propertyName,
73 PropertyChangeListener listener) {
74 p.removePropertyChangeListener(propertyName, listener);
75 }
76 }