Search in sources :

Example 1 with WebProtegeDialog

use of edu.stanford.bmir.protege.web.client.library.dlg.WebProtegeDialog in project webprotege by protegeproject.

the class CsvImportPresenter method startImport.

public void startImport() {
    UploadFileResultHandler uploadResultHandler = new UploadFileResultHandler() {

        @Override
        public void handleFileUploaded(final DocumentId fileDocumentId) {
            WebProtegeDialog<CSVImportDescriptor> csvImportDialog = new WebProtegeDialog<>(new CSVImportDialogController(projectId, fileDocumentId, baseClass, dispatchServiceManager, new CSVImportViewImpl(primitiveDataEditorProvider)));
            csvImportDialog.setVisible(true);
        }

        @Override
        public void handleFileUploadFailed(String errorMessage) {
            ProgressMonitor.get().hideProgressMonitor();
            MessageBox.showAlert("Error uploading CSV file", errorMessage);
        }
    };
    UploadFileDialogController controller = new UploadFileDialogController("Upload CSV", uploadResultHandler);
    WebProtegeDialog.showDialog(controller);
}
Also used : CSVImportViewImpl(edu.stanford.bmir.protege.web.client.csv.CSVImportViewImpl) UploadFileResultHandler(edu.stanford.bmir.protege.web.client.upload.UploadFileResultHandler) WebProtegeDialog(edu.stanford.bmir.protege.web.client.library.dlg.WebProtegeDialog) DocumentId(edu.stanford.bmir.protege.web.shared.csv.DocumentId) CSVImportDialogController(edu.stanford.bmir.protege.web.client.csv.CSVImportDialogController) UploadFileDialogController(edu.stanford.bmir.protege.web.client.upload.UploadFileDialogController) CSVImportDescriptor(edu.stanford.bmir.protege.web.shared.csv.CSVImportDescriptor)

Example 2 with WebProtegeDialog

use of edu.stanford.bmir.protege.web.client.library.dlg.WebProtegeDialog in project webprotege by protegeproject.

the class ShowFreshEntitySettingsHandlerImpl method showDialog.

private void showDialog(final GetEntityCrudKitSettingsResult result) {
    EntityCrudKitSettingsDialogController controller = dialogControllerProvider.get();
    WebProtegeDialog<EntityCrudKitSettings<?>> dlg = new WebProtegeDialog<>(controller);
    dlg.getController().setDialogButtonHandler(DialogButton.OK, (data, closer) -> updateFreshEntitySettings(result.getSettings(), data, closer));
    dlg.setPopupPositionAndShow((w, h) -> dlg.setPopupPosition((Window.getClientWidth() - w) / 2, 100));
    controller.getEditor().setValue(result.getSettings());
}
Also used : EntityCrudKitSettingsDialogController(edu.stanford.bmir.protege.web.client.crud.EntityCrudKitSettingsDialogController) WebProtegeDialog(edu.stanford.bmir.protege.web.client.library.dlg.WebProtegeDialog)

Example 3 with WebProtegeDialog

use of edu.stanford.bmir.protege.web.client.library.dlg.WebProtegeDialog in project webprotege by protegeproject.

the class WatchPresenter method start.

public void start(final OWLEntity forEntity) {
    final UserId userId = loggedInUserProvider.getCurrentUserId();
    dispatchServiceManager.execute(new GetWatchesAction(projectId, userId, forEntity), new DispatchServiceCallback<GetWatchesResult>() {

        @Override
        public void handleSuccess(GetWatchesResult result) {
            Set<Watch> watches = result.getWatches();
            updateDialog(watches);
            WebProtegeDialog<WatchTypeSelection> dlg = new WebProtegeDialog<>(controller);
            dlg.show();
            controller.setDialogButtonHandler(DialogButton.OK, (data, closer) -> {
                closer.hide();
                handleWatchTypeForEntity(data, forEntity);
            });
        }
    });
}
Also used : ImmutableSet(com.google.common.collect.ImmutableSet) Set(java.util.Set) GWT(com.google.gwt.core.client.GWT) DispatchServiceCallback(edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceCallback) DialogButton(edu.stanford.bmir.protege.web.client.library.dlg.DialogButton) Inject(javax.inject.Inject) UserId(edu.stanford.bmir.protege.web.shared.user.UserId) edu.stanford.bmir.protege.web.shared.watches(edu.stanford.bmir.protege.web.shared.watches) LoggedInUserProvider(edu.stanford.bmir.protege.web.client.user.LoggedInUserProvider) DispatchServiceManager(edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceManager) OWLEntity(org.semanticweb.owlapi.model.OWLEntity) Optional(java.util.Optional) WebProtegeDialog(edu.stanford.bmir.protege.web.client.library.dlg.WebProtegeDialog) ProjectId(edu.stanford.bmir.protege.web.shared.project.ProjectId) Collections(java.util.Collections) ImmutableSet(com.google.common.collect.ImmutableSet) Set(java.util.Set) UserId(edu.stanford.bmir.protege.web.shared.user.UserId) WebProtegeDialog(edu.stanford.bmir.protege.web.client.library.dlg.WebProtegeDialog)

Example 4 with WebProtegeDialog

use of edu.stanford.bmir.protege.web.client.library.dlg.WebProtegeDialog 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)4 UserId (edu.stanford.bmir.protege.web.shared.user.UserId)2 Optional (java.util.Optional)2 ImmutableSet (com.google.common.collect.ImmutableSet)1 GWT (com.google.gwt.core.client.GWT)1 EntityCrudKitSettingsDialogController (edu.stanford.bmir.protege.web.client.crud.EntityCrudKitSettingsDialogController)1 CSVImportDialogController (edu.stanford.bmir.protege.web.client.csv.CSVImportDialogController)1 CSVImportViewImpl (edu.stanford.bmir.protege.web.client.csv.CSVImportViewImpl)1 DispatchServiceCallback (edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceCallback)1 DispatchServiceManager (edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceManager)1 DialogButton (edu.stanford.bmir.protege.web.client.library.dlg.DialogButton)1 UploadFileDialogController (edu.stanford.bmir.protege.web.client.upload.UploadFileDialogController)1 UploadFileResultHandler (edu.stanford.bmir.protege.web.client.upload.UploadFileResultHandler)1 LoggedInUserProvider (edu.stanford.bmir.protege.web.client.user.LoggedInUserProvider)1 CSVImportDescriptor (edu.stanford.bmir.protege.web.shared.csv.CSVImportDescriptor)1 DocumentId (edu.stanford.bmir.protege.web.shared.csv.DocumentId)1 SetEmailAddressAction (edu.stanford.bmir.protege.web.shared.mail.SetEmailAddressAction)1 ProjectId (edu.stanford.bmir.protege.web.shared.project.ProjectId)1 EmailAddress (edu.stanford.bmir.protege.web.shared.user.EmailAddress)1 edu.stanford.bmir.protege.web.shared.watches (edu.stanford.bmir.protege.web.shared.watches)1