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.xwork2.field;
23
24 import java.beans.PropertyChangeListener;
25 import java.beans.PropertyChangeSupport;
26 import java.io.File;
27 import java.util.Collection;
28
29 public class ValidatorBean {
30
31 public static class ValidatorBeanEntry {
32
33 protected int intValue;
34
35 protected String stringValue;
36
37 protected String stringValue2;
38
39 public ValidatorBeanEntry(int intValue, String stringValue) {
40 this.intValue = intValue;
41 this.stringValue = stringValue;
42 }
43
44 public ValidatorBeanEntry(int intValue, String stringValue, String stringValue2) {
45 this.intValue = intValue;
46 this.stringValue = stringValue;
47 this.stringValue2 = stringValue2;
48 }
49
50 public int getIntValue() {
51 return intValue;
52 }
53
54 public void setIntValue(int intValue) {
55 this.intValue = intValue;
56 }
57
58 public String getStringValue() {
59 return stringValue;
60 }
61
62 public void setStringValue(String stringValue) {
63 this.stringValue = stringValue;
64 }
65
66 public String getStringValue2() {
67 return stringValue2;
68 }
69
70 public void setStringValue2(String stringValue2) {
71 this.stringValue2 = stringValue2;
72 }
73 }
74
75 protected File existingFile;
76
77 protected File notExistingFile;
78
79 protected File existingDirectory;
80
81 protected File notExistingDirectory;
82
83 protected Collection<ValidatorBeanEntry> entries;
84
85 protected String stringValue;
86
87 protected ValidatorBeanEntry entry;
88
89 PropertyChangeSupport p;
90
91 public ValidatorBean() {
92 p = new PropertyChangeSupport(this);
93 }
94
95 public void addPropertyChangeListener(PropertyChangeListener listener) {
96 p.addPropertyChangeListener(listener);
97 }
98
99 public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
100 p.addPropertyChangeListener(propertyName, listener);
101 }
102
103 public void removePropertyChangeListener(PropertyChangeListener listener) {
104 p.removePropertyChangeListener(listener);
105 }
106
107 public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
108 p.removePropertyChangeListener(propertyName, listener);
109 }
110
111 public String getStringValue() {
112 return stringValue;
113 }
114
115 public File getExistingFile() {
116 return existingFile;
117 }
118
119 public File getNotExistingFile() {
120 return notExistingFile;
121 }
122
123 public File getExistingDirectory() {
124 return existingDirectory;
125 }
126
127 public File getNotExistingDirectory() {
128 return notExistingDirectory;
129 }
130
131 public ValidatorBeanEntry getEntry() {
132 return entry;
133 }
134
135 public Collection<ValidatorBeanEntry> getEntries() {
136 return entries;
137 }
138
139 public void setStringValue(String stringValue) {
140 String old = this.stringValue;
141 this.stringValue = stringValue;
142 p.firePropertyChange("stringValue", old, existingFile);
143 }
144
145 public void setExistingFile(File existingFile) {
146 File old = this.existingFile;
147 this.existingFile = existingFile;
148 p.firePropertyChange("existingFile", old, existingFile);
149 }
150
151 public void setNotExistingFile(File notExistingFile) {
152 File old = this.notExistingFile;
153 this.notExistingFile = notExistingFile;
154 p.firePropertyChange("notExistingFile", old, notExistingFile);
155 }
156
157 public void setExistingDirectory(File existingDirectory) {
158 File old = this.existingDirectory;
159 this.existingDirectory = existingDirectory;
160 p.firePropertyChange("existingDirectory", old, existingDirectory);
161 }
162
163 public void setNotExistingDirectory(File notExistingDirectory) {
164 File old = this.notExistingDirectory;
165 this.notExistingDirectory = notExistingDirectory;
166 p.firePropertyChange("notExistingDirectory", old, notExistingDirectory);
167 }
168
169 public void setEntries(Collection<ValidatorBeanEntry> entries) {
170 this.entries = entries;
171
172
173 p.firePropertyChange("entries", null, entries);
174 }
175
176 public void setEntry(ValidatorBeanEntry entry) {
177 this.entry = entry;
178 p.firePropertyChange("entry", null, entry);
179 }
180 }