} else {
uifactory.addSpacerElement("spacer_" + userPropertyHandler.getName(), formLayout, true);
}
// add input field to container
FormItem formItem = userPropertyHandler.addFormItem(getLocale(), this.identity.getUser(), this.usageIdentifier, this.isAdministrativeUser, formLayout);
String propertyName = userPropertyHandler.getName();
this.formItems.put(propertyName, formItem);
if (formItem instanceof TextElement) {
// it's a text field, so get the value of this property into the text field
TextElement textElement = (TextElement)formItem;
textElement.setValue(this.identity.getUser().getProperty(propertyName, getLocale()));
} else if (formItem instanceof MultipleSelectionElement) {
// it's a checkbox, so set the box to checked if the corresponding property is set to "true"
MultipleSelectionElement checkbox = (MultipleSelectionElement)formItem;
String value = this.identity.getUser().getProperty(propertyName, getLocale());
if (value != null) {
checkbox.select(propertyName, value.equals("true"));
} else {
// assume "false" if the property is not present
checkbox.select(propertyName, false);
}
}
// special case for email field
if (userPropertyHandler.getName().equals("email")) {
RegistrationManager rm = RegistrationManager.getInstance();
String key = this.identity.getUser().getProperty("emchangeKey", null);
TemporaryKeyImpl tempKey = rm.loadTemporaryKeyByRegistrationKey(key);
if (tempKey != null) {
XStream xml = new XStream();
HashMap<String, String> mails = (HashMap<String, String>) xml.fromXML(tempKey.getEmailAddress());
formItem.setExampleKey("email.change.form.info", new String[] {mails.get("changedEMail")});
}
}
}
// add the "about me" text field.