|
Lines 37-43
Link Here
|
| 37 |
|
37 |
|
| 38 |
|
38 |
|
| 39 |
//default values |
39 |
//default values |
| 40 |
private static final StreetAddress STREET_DEFAULT = new StreetAddress(); |
40 |
private static StreetAddress STREET_DEFAULT = new StreetAddress(); |
| 41 |
private static final String CITY_DEFAULT = MessageUtil.getString("unspecified_city"); //$NON-NLS-1$ |
41 |
private static final String CITY_DEFAULT = MessageUtil.getString("unspecified_city"); //$NON-NLS-1$ |
| 42 |
private static final Integer PROVINCE_DEFAULT = new Integer(0); |
42 |
private static final Integer PROVINCE_DEFAULT = new Integer(0); |
| 43 |
private static final String POSTALCODE_DEFAULT = "A1B2C3"; //$NON-NLS-1$ |
43 |
private static final String POSTALCODE_DEFAULT = "A1B2C3"; //$NON-NLS-1$ |
|
Lines 86-93
Link Here
|
| 86 |
|
86 |
|
| 87 |
//check for proper length |
87 |
//check for proper length |
| 88 |
if (testPostalCode.length() != 6) { |
88 |
if (testPostalCode.length() != 6) { |
| 89 |
//fail |
89 |
return MessageUtil.getString("postal_code_is_incomplete"); //$NON-NLS-1$ |
| 90 |
return MessageUtil.format("_is_an_invalid_format_for_a_postal_code", new Object[] {testPostalCode}); //$NON-NLS-1$ |
|
|
| 91 |
} |
90 |
} |
| 92 |
|
91 |
|
| 93 |
//check for proper format |
92 |
//check for proper format |
|
Lines 203-215
Link Here
|
| 203 |
*/ |
202 |
*/ |
| 204 |
public StreetAddress getStreet() { |
203 |
public StreetAddress getStreet() { |
| 205 |
if(street == null) |
204 |
if(street == null) |
| 206 |
street = STREET_DEFAULT; |
205 |
street = new StreetAddress(); |
| 207 |
return street; |
206 |
return street; |
| 208 |
} |
207 |
} |
| 209 |
/* (non-Javadoc) |
208 |
/* (non-Javadoc) |
| 210 |
* Method declared on IPropertySource |
209 |
* Method declared on IPropertySource |
| 211 |
*/ |
210 |
*/ |
| 212 |
public boolean isPropertySet(Object property) { |
211 |
public boolean isPropertySet(Object property) { |
|
|
212 |
if (property.equals(P_ID_PROVINCE)) |
| 213 |
return getProvince() != PROVINCE_DEFAULT; |
| 214 |
if (property.equals(P_ID_STREET)) |
| 215 |
return getStreet() != STREET_DEFAULT; |
| 216 |
if (property.equals(P_ID_CITY)) |
| 217 |
return getCity() != CITY_DEFAULT; |
| 218 |
if (property.equals(P_ID_POSTALCODE)) |
| 219 |
return getPostalCode() != POSTALCODE_DEFAULT; |
| 213 |
return false; |
220 |
return false; |
| 214 |
} |
221 |
} |
| 215 |
/* (non-Javadoc) |
222 |
/* (non-Javadoc) |
|
Lines 229-234
Link Here
|
| 229 |
return; |
236 |
return; |
| 230 |
}; |
237 |
}; |
| 231 |
if (P_ID_STREET.equals(property)) { |
238 |
if (P_ID_STREET.equals(property)) { |
|
|
239 |
STREET_DEFAULT = new StreetAddress(); |
| 232 |
setStreet(STREET_DEFAULT); |
240 |
setStreet(STREET_DEFAULT); |
| 233 |
return; |
241 |
return; |
| 234 |
} |
242 |
} |
|
Lines 270-276
Link Here
|
| 270 |
return; |
278 |
return; |
| 271 |
} |
279 |
} |
| 272 |
if (P_ID_STREET.equals(name)) { |
280 |
if (P_ID_STREET.equals(name)) { |
| 273 |
//setStreet((StreetAddress) value); |
281 |
setStreet(getStreet()); |
| 274 |
return; |
282 |
return; |
| 275 |
} |
283 |
} |
| 276 |
|
284 |
|
|
Lines 288-294
Link Here
|
| 288 |
street = newStreet; |
296 |
street = newStreet; |
| 289 |
} |
297 |
} |
| 290 |
/** |
298 |
/** |
| 291 |
* The value as displayed in the Property Sheet. Will not print default values |
299 |
* The value as displayed in the Property Sheet. |
| 292 |
* @return java.lang.String |
300 |
* @return java.lang.String |
| 293 |
*/ |
301 |
*/ |
| 294 |
public String toString() { |
302 |
public String toString() { |
|
Lines 299-315
Link Here
|
| 299 |
outStringBuffer.append(getStreet()); |
307 |
outStringBuffer.append(getStreet()); |
| 300 |
outStringBuffer.append(comma_space); |
308 |
outStringBuffer.append(comma_space); |
| 301 |
} |
309 |
} |
| 302 |
if (!getCity().equals(CITY_DEFAULT)) { |
310 |
|
| 303 |
outStringBuffer.append(getCity()); |
311 |
outStringBuffer.append(getCity()); |
| 304 |
outStringBuffer.append(space); |
312 |
outStringBuffer.append(space); |
| 305 |
} |
313 |
outStringBuffer.append(provinceValues[getProvince().intValue()]); |
| 306 |
if (!getProvince().equals(PROVINCE_DEFAULT)) { |
314 |
outStringBuffer.append(comma_space); |
| 307 |
outStringBuffer.append(provinceValues[getProvince().intValue()]); |
315 |
outStringBuffer.append(getPostalCode()); |
| 308 |
} |
316 |
|
| 309 |
if (!getPostalCode().equals(POSTALCODE_DEFAULT)) { |
|
|
| 310 |
outStringBuffer.append(comma_space); |
| 311 |
outStringBuffer.append(getPostalCode()); |
| 312 |
} |
| 313 |
return outStringBuffer.toString(); |
317 |
return outStringBuffer.toString(); |
| 314 |
} |
318 |
} |
| 315 |
} |
319 |
} |