});
// Add email form
IModel<String> emptyEmailModel = Model.of("");
final EmailTextField emailField = new EmailTextField("email", emptyEmailModel);
emailField.setRequired(true);
final Form<String> addEmailForm = new Form<String>("addEmailForm", emptyEmailModel);
addEmailForm.add(emailField);
addEmailForm.add(new AjaxSubmitLink("addEmailLink", addEmailForm) {
private static final long serialVersionUID = 6935376642872117563L;
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
try {
User user = UserNotificationManagementPanel.this.getModelObject();
String emailValue = emailField.getModelObject();
if (emailValue != null) {
userService.addEmailAddress(user, emailValue);
getSession().success(getString("profile.addEmail.success"));
}
} catch (Exception e) {
LOGGER.error("Error occured while sending add email notification.");
getSession().error(getString("profile.addEmail.error"));
}
emailField.setModelObject(null);
target.add(getPage());
FeedbackUtils.refreshFeedback(target, getPage());
}
@Override