Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 2909 | Differences between
and this patch

Collapse All | Expand All

(-)Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/Address.java (-17 / +21 lines)
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
}
(-)Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/Birthday.java (-1 / +7 lines)
Lines 151-156 Link Here
151
 * Method declared on IPropertySource
151
 * Method declared on IPropertySource
152
 */
152
 */
153
public boolean isPropertySet(Object property) {
153
public boolean isPropertySet(Object property) {
154
	if (P_ID_DAY.equals(property))
155
		return getDay() != DAY_DEFAULT;
156
	if (P_ID_MONTH.equals(property))
157
		return getMonth() != MONTH_DEFAULT;
158
	if (P_ID_YEAR.equals(property))
159
		return getYear() != YEAR_DEFAULT;
154
	return false;
160
	return false;
155
}
161
}
156
/* (non-Javadoc)
162
/* (non-Javadoc)
Lines 216-222 Link Here
216
	year = newYear;
222
	year = newYear;
217
}
223
}
218
/**
224
/**
219
 * The value as displayed in the Property Sheet. Will not print default values
225
 * The value as displayed in the Property Sheet.
220
 * @return java.lang.String
226
 * @return java.lang.String
221
 */
227
 */
222
public String toString() {
228
public String toString() {
(-)Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/EmailAddress.java (-10 / +2 lines)
Lines 10-16 Link Here
10
10
11
/**
11
/**
12
 * Example IPropertySource is editable and whose childern properties are itself not editable.
12
 * Example IPropertySource is editable and whose childern properties are itself not editable.
13
 * The values of "userid" and "mailserver" are parsed from seting "email"
13
 * The values of "userid" and "mailserver" are parsed from setting "email"
14
 */
14
 */
15
public class EmailAddress implements IPropertySource {
15
public class EmailAddress implements IPropertySource {
16
16
Lines 117-130 Link Here
117
 * Method declared on IPropertySource
117
 * Method declared on IPropertySource
118
 */
118
 */
119
public void resetPropertyValue(Object property) {
119
public void resetPropertyValue(Object property) {
120
	if (property.equals(P_ID_USERID)) {
121
		setUserid(USERID_DEFAULT);
122
		return;
123
	}
124
	if (property.equals(P_ID_DOMAIN)) {
125
		setDomain(DOMAIN_DEFAULT);
126
		return;
127
	}
128
	return;
120
	return;
129
}
121
}
130
/**
122
/**
Lines 177-183 Link Here
177
	userid = newUserid;
169
	userid = newUserid;
178
}
170
}
179
/**
171
/**
180
 * The value as displayed in the Property Sheet. Will not print default values
172
 * The value as displayed in the Property Sheet.
181
 * @return java.lang.String
173
 * @return java.lang.String
182
 */
174
 */
183
public String toString() {
175
public String toString() {
(-)Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/Name.java (-12 / +24 lines)
Lines 27-32 Link Here
27
	public static String P_LASTNAME = MessageUtil.getString("LastName"); //$NON-NLS-1$
27
	public static String P_LASTNAME = MessageUtil.getString("LastName"); //$NON-NLS-1$
28
	public static String P_MIDDLENAME = MessageUtil.getString("Middle"); //$NON-NLS-1$
28
	public static String P_MIDDLENAME = MessageUtil.getString("Middle"); //$NON-NLS-1$
29
	
29
	
30
	// default values
31
	//
32
	private static final String FIRSTNAME_DEFAULT = null;
33
	private static final String LASTNAME_DEFAULT = null;
34
	private static final String MIDDLENAME_DEFAULT = null;
35
	
30
	public static final String P_DESCRIPTORS = "properties"; //$NON-NLS-1$
36
	public static final String P_DESCRIPTORS = "properties"; //$NON-NLS-1$
31
	static private Vector descriptors;	
37
	static private Vector descriptors;	
32
	static
38
	static
Lines 113-118 Link Here
113
 * Method declared on IPropertySource
119
 * Method declared on IPropertySource
114
 */
120
 */
115
public boolean isPropertySet(Object key) {
121
public boolean isPropertySet(Object key) {
122
	if (key.equals(P_ID_FIRSTNAME))
123
		return getFirstName() != FIRSTNAME_DEFAULT;
124
	if (key.equals(P_ID_LASTNAME))
125
		return getLastName() != LASTNAME_DEFAULT;
126
	if (key.equals(P_ID_MIDDLENAME))
127
		return getInitial() != MIDDLENAME_DEFAULT;
116
	return false;
128
	return false;
117
}
129
}
118
/**
130
/**
Lines 124-138 Link Here
124
 */
136
 */
125
public void resetPropertyValue(Object property) {
137
public void resetPropertyValue(Object property) {
126
	if (P_ID_FIRSTNAME.equals(property)) {
138
	if (P_ID_FIRSTNAME.equals(property)) {
127
		setFirstName(null);
139
		setFirstName(FIRSTNAME_DEFAULT);
128
		return;
140
		return;
129
	}
141
	}
130
	if (P_ID_LASTNAME.equals(property)) {
142
	if (P_ID_LASTNAME.equals(property)) {
131
		setLastName(null);
143
		setLastName(LASTNAME_DEFAULT);
132
		return;
144
		return;
133
	}
145
	}
134
	if (P_ID_MIDDLENAME.equals(property)) {
146
	if (P_ID_MIDDLENAME.equals(property)) {
135
		setInitial(null);
147
		setInitial(MIDDLENAME_DEFAULT);
136
		return;
148
		return;
137
	}
149
	}
138
}
150
}
Lines 175-181 Link Here
175
		setLastName((String) val);
187
		setLastName((String) val);
176
		return;
188
		return;
177
	}
189
	}
178
	if (P_ID_MIDDLENAME.equals(propName)){
190
	if (P_ID_MIDDLENAME.equals(propName)) {
179
		setInitial((String) val);
191
		setInitial((String) val);
180
		return;
192
		return;
181
	}
193
	}
Lines 186-201 Link Here
186
 */
198
 */
187
public String toString(){
199
public String toString(){
188
	StringBuffer outStringBuffer = new StringBuffer();
200
	StringBuffer outStringBuffer = new StringBuffer();
189
	if(getFirstName()!=null)
201
	if(getFirstName()!=FIRSTNAME_DEFAULT) {
190
	{	outStringBuffer.append(getFirstName());
202
		outStringBuffer.append(getFirstName());
191
		outStringBuffer.append(" "); //$NON-NLS-1$
203
		outStringBuffer.append(" "); //$NON-NLS-1$
192
		if(getInitial()!=null)
193
		{	outStringBuffer.append(getInitial());
194
			outStringBuffer.append(" "); //$NON-NLS-1$
195
		}
196
	}
204
	}
197
	if(getLastName()!=null)
205
	if(getInitial()!=MIDDLENAME_DEFAULT) {
198
	{	outStringBuffer.append(getLastName());
206
		outStringBuffer.append(getInitial());
207
		outStringBuffer.append(" "); //$NON-NLS-1$
208
	}
209
	if(getLastName()!=LASTNAME_DEFAULT) {
210
		outStringBuffer.append(getLastName());
199
	}
211
	}
200
	
212
	
201
	return outStringBuffer.toString();
213
	return outStringBuffer.toString();
(-)Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/StreetAddress.java (+6 lines)
Lines 140-145 Link Here
140
 * Method declared on IPropertySource
140
 * Method declared on IPropertySource
141
 */
141
 */
142
public boolean isPropertySet(Object property) {
142
public boolean isPropertySet(Object property) {
143
	if (property.equals(P_ID_BUILD_NO))
144
		return getBuildNo() != BUILD_NO_DEFAULT;
145
	if (property.equals(P_ID_APTBOX))
146
		return getAptBox() != APTBOX_DEFAULT;
147
	if (property.equals(P_ID_STREET))
148
		return getStreetName() != STREETNAME_DEFAULT;
143
	return false;
149
	return false;
144
}
150
}
145
/* (non-Javadoc)
151
/* (non-Javadoc)

Return to bug 2909