Search in sources :

Example 1 with SetEmailAddressAction

use of edu.stanford.bmir.protege.web.shared.mail.SetEmailAddressAction in project webprotege by protegeproject.

the class ChangeEmailAddressPresenter method showDialog.

private void showDialog(Optional<EmailAddress> emailAddress) {
    final UserId userId = loggedInUserProvider.getCurrentUserId();
    ChangeEmailAddressDialogController controller = new ChangeEmailAddressDialogController();
    emailAddress.ifPresent(controller::setValue);
    controller.setDialogButtonHandler(DialogButton.OK, (data, closer) -> {
        if (data.isPresent()) {
            dispatchServiceManager.execute(new SetEmailAddressAction(userId, data.get().getEmailAddress()), result -> {
                if (result.getResult() == ADDRESS_ALREADY_EXISTS) {
                    MessageBox.showMessage("Address already taken", "The email address that you have specified is taken by another user.  " + "Please specify a different email address.");
                } else {
                    closer.hide();
                }
            });
        } else {
            MessageBox.showAlert("The specified email addresses do not match.");
        }
    });
    WebProtegeDialog<Optional<EmailAddress>> dlg = new WebProtegeDialog<Optional<EmailAddress>>(controller);
    dlg.setVisible(true);
}
Also used : Optional(java.util.Optional) UserId(edu.stanford.bmir.protege.web.shared.user.UserId) WebProtegeDialog(edu.stanford.bmir.protege.web.client.library.dlg.WebProtegeDialog) SetEmailAddressAction(edu.stanford.bmir.protege.web.shared.mail.SetEmailAddressAction) EmailAddress(edu.stanford.bmir.protege.web.shared.user.EmailAddress)

Aggregations

WebProtegeDialog (edu.stanford.bmir.protege.web.client.library.dlg.WebProtegeDialog)1 SetEmailAddressAction (edu.stanford.bmir.protege.web.shared.mail.SetEmailAddressAction)1 EmailAddress (edu.stanford.bmir.protege.web.shared.user.EmailAddress)1 UserId (edu.stanford.bmir.protege.web.shared.user.UserId)1 Optional (java.util.Optional)1