Example usage for com.google.gwt.user.client Window confirm

List of usage examples for com.google.gwt.user.client Window confirm

Introduction

In this page you can find the example usage for com.google.gwt.user.client Window confirm.

Prototype

public static boolean confirm(String msg) 

Source Link

Usage

From source file:io.pelle.mango.client.gwt.modules.dictionary.editor.DictionaryEditorModuleUI.java

License:Open Source License

/** {@inheritDoc} */
@Override/*from  w w  w  .j  a  v a2 s .  c  o  m*/
public boolean close() {

    if (getModule().getDictionaryEditor().isDirty()) {
        return Window.confirm(MangoClientWeb.getInstance().getMessages().editorClose());
    } else {
        return true;
    }
}

From source file:it.pep.EsamiGWT.client.maschere.MascheraPrincipale.java

License:Apache License

private MenuBar creaMenu() {
    // Create a menu bar
    menu.setAutoOpen(true);/*from   w  ww.  j a  va 2 s .c o m*/
    menu.setWidth("100%");
    menu.setAnimationEnabled(true);

    // Create the file menu
    MenuBar fileMenu = new MenuBar(true);
    fileMenu.setAnimationEnabled(true);
    fileMenu.addItem("Impostazioni", true, new Command() {

        public void execute() {
            Window.alert("scelto Impostazioni");
        }
    });

    fileMenu.addItem("Logout", true, new Command() {

        public void execute() {
            //                Window.alert("scelto logout");
            if (Window.confirm("Vuoi terminare la sessione di lavoro?")) {
                tornaAMascheraLogin();
            }
        }
    });
    menu.addItem(new MenuItem("File", fileMenu));

    // Create the file menu
    MenuBar domandeMenu = new MenuBar(true);
    domandeMenu.setAnimationEnabled(true);
    domandeMenu.addItem("blocca tutte", true, new Command() {

        public void execute() {
            eseguiSBlocco(true);
        }
    });
    domandeMenu.addItem("sblocca tutte", true, new Command() {

        public void execute() {
            eseguiSBlocco(false);
        }
    });
    menu.addItem(new MenuItem("Domande", domandeMenu));

    // Create the file menu
    MenuBar elaboratiMenu = new MenuBar(true);
    elaboratiMenu.setAnimationEnabled(true);
    elaboratiMenu.addItem("importa correzione", true, new Command() {

        public void execute() {
            eseguiImportazione();
        }
    });
    menu.addItem(new MenuItem("Elaborati", elaboratiMenu));

    menuPanel.add(menu);
    return menu;
}

From source file:main.client.ui.SimpleCrudPortlet.java

License:Open Source License

private void delete() {
    Contact c = getSelectedContact();//from   ww w  .j a  v  a2  s  .co  m
    if (Window.confirm("Are you sure you want to delete " + c.name + "?")) {
        // send the id of the contact to delete to the server via refresh
        Factory f = new Factory(this);
        f.deleteContactId = c.contactId;
        refresh(f);
    }
}

From source file:net.exclaimindustries.paste.braket.client.ui.BracketUserBar.java

License:Open Source License

@UiHandler("loginLink")
void loginClick(ClickEvent event) {
    if (thisUser == null) {
        // do nothing
        return;/*from ww  w . j  a  va 2  s  .c  o m*/
    }
    if (!thisUser.isLoggedIn()) {
        Window.Location.assign(thisUser.getLogInLink());
    } else {
        if (Window.confirm(
                "Choosing to log out will log you out out of all of Google's services (including, for example, Gmail).")) {
            Window.Location.assign(thisUser.getLogOutLink());
        }
    }
}

From source file:net.scran24.admin.client.UserManager.java

public UserManager() {
    FlowPanel contents = new FlowPanel();

    final FormPanel form = new FormPanel();
    form.setAction(GWT.getModuleBaseURL() + "uploadUserInfo");

    form.setEncoding(FormPanel.ENCODING_MULTIPART);
    form.setMethod(FormPanel.METHOD_POST);

    VerticalPanel panel = new VerticalPanel();
    form.setWidget(panel);//from  ww w.ja v  a  2 s . c  o  m

    final FileUpload upload = new FileUpload();
    upload.setName("file");
    panel.add(upload);

    RadioButton append = new RadioButton("mode", "Append to existing user list");
    append.setFormValue("append");

    final RadioButton replace = new RadioButton("mode", "Replace existing user list");
    replace.setFormValue("replace");

    replace.setValue(true);

    panel.add(append);
    panel.add(replace);

    panel.add(WidgetFactory.createButton("Upload", new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            form.submit();
        }
    }));

    form.addSubmitHandler(new SubmitHandler() {
        @Override
        public void onSubmit(SubmitEvent event) {
            if (upload.getFilename().isEmpty()) {
                Window.alert("Please choose a .csv file containing user information to upload");
                event.cancel();
            } else if (replace.getValue())
                if (!Window.confirm(
                        "Doing this will delete all user information from the database and replace it with the list you are submitting. Proceed?"))
                    event.cancel();
        }
    });

    form.addSubmitCompleteHandler(new SubmitCompleteHandler() {
        @Override
        public void onSubmitComplete(SubmitCompleteEvent event) {
            // This is not a very robust way of detecting the status code,
            // but unfortunately there does not seem to be a better way of doing
            // this
            // that supports IE8 -- Ivan.
            // https://code.google.com/p/google-web-toolkit/issues/detail?id=7365

            String result = event.getResults();

            if (result.equals("OK"))
                Window.alert("User information uploaded.");
            else if (result.startsWith("ERR:")) {
                Window.alert("There was a problem uploading the user information: " + result.substring(4));
            } else if (result.contains("401")) {
                LoginForm.showPopup(new Callback1<UserInfo>() {
                    @Override
                    public void call(UserInfo info) {
                        form.submit();
                    }
                });
            } else if (result.contains("403")) {
                // User is not authorised, e.g. someone has logged on as admin,
                // opened the user upload tab and timed out, then someone else
                // logged on as someone who does not have the right to
                // upload users. In this case, let them know and refresh the page
                // to either show the UI that corresponds to their set of permissions
                // or redirect them to another page.

                Window.alert("You are not authorised to upload user information.");
                Location.reload();
            }
        }
    });
    contents.add(new HTMLPanel("<h2>Staff user accounts</h2>"));
    contents.add(new Button("Add"));

    contents.add(new HTMLPanel("<h2>Respondent user accounts</h2>"));
    contents.add(form);

    initWidget(contents);
}

From source file:nz.org.winters.appspot.acrareporter.client.ui.ACRAReportView.java

License:Apache License

@UiHandler("buttonDeleteReport")
void onButtonDeleteReportClick(ClickEvent event) {
    if (!Window.confirm(constants.acraReportViewConfirmDelete())) {
        return;//w  ww  . j a va  2  s.c om
    }

    startLoading();

    final BasicErrorInfo beio = mSelectedBasicErrorInfo;

    remoteService.deleteReport(beio.REPORT_ID, new AsyncCallback<Void>() {

        @Override
        public void onSuccess(Void result) {
            clearData();
            mCallbackReloadPackageList.reloadPackageList();
        }

        @Override
        public void onFailure(Throwable caught) {
            // TODO Auto-generated method stub
            stopLoading();

        }
    });

}

From source file:nz.org.winters.appspot.acrareporter.client.ui.MainErrorsList.java

License:Apache License

private void setupMenus() {
    popupActions.setVisible(false);// w  w  w .ja v  a2  s . com
    miErrorsAllEMailed.setScheduledCommand(new Command() {

        @Override
        public void execute() {
            startLoading();
            final Set<BasicErrorInfo> selected = multipleSelectionModel.getSelectedSet();
            Iterator<BasicErrorInfo> iter = selected.iterator();
            ArrayList<String> reportIds = new ArrayList<String>();
            while (iter.hasNext()) {
                reportIds.add(iter.next().REPORT_ID);
            }
            remoteService.markReportsEMailed(reportIds, true, new AsyncCallback<Void>() {

                @Override
                public void onSuccess(Void result) {
                    Iterator<BasicErrorInfo> iter = selected.iterator();
                    while (iter.hasNext()) {
                        iter.next().emailed = true;
                    }
                    stopLoading();

                }

                @Override
                public void onFailure(Throwable caught) {
                    stopLoading();
                }
            });
        }
    });

    miErrorsAllFixed.setScheduledCommand(new Command() {

        @Override
        public void execute() {
            startLoading();
            final Set<BasicErrorInfo> selected = multipleSelectionModel.getSelectedSet();
            Iterator<BasicErrorInfo> iter = selected.iterator();
            ArrayList<String> reportIds = new ArrayList<String>();
            while (iter.hasNext()) {
                reportIds.add(iter.next().REPORT_ID);
            }
            remoteService.markReportsFixed(reportIds, true, new AsyncCallback<Void>() {

                @Override
                public void onSuccess(Void result) {
                    Iterator<BasicErrorInfo> iter = selected.iterator();
                    while (iter.hasNext()) {
                        iter.next().fixed = true;
                    }
                    stopLoading();

                }

                @Override
                public void onFailure(Throwable caught) {
                    stopLoading();
                }
            });
        }
    });

    miErrorsAllLookedAt.setScheduledCommand(new Command() {

        @Override
        public void execute() {
            startLoading();
            final Set<BasicErrorInfo> selected = multipleSelectionModel.getSelectedSet();
            Iterator<BasicErrorInfo> iter = selected.iterator();
            ArrayList<String> reportIds = new ArrayList<String>();
            while (iter.hasNext()) {
                reportIds.add(iter.next().REPORT_ID);
            }
            remoteService.markReportsLookedAt(reportIds, true, new AsyncCallback<Void>() {

                @Override
                public void onSuccess(Void result) {
                    Iterator<BasicErrorInfo> iter = selected.iterator();
                    while (iter.hasNext()) {
                        iter.next().lookedAt = true;
                    }
                    stopLoading();

                }

                @Override
                public void onFailure(Throwable caught) {
                    stopLoading();
                }
            });

        }
    });

    miReportsEMailSelected.setScheduledCommand(new Command() {

        @Override
        public void execute() {
            final Set<BasicErrorInfo> selected = multipleSelectionModel.getSelectedSet();
            Iterator<BasicErrorInfo> iter = selected.iterator();
            ArrayList<String> reportIds = new ArrayList<String>();
            while (iter.hasNext()) {
                reportIds.add(iter.next().REPORT_ID);
            }

            EMailTemplateSend.doDialog(mLoginInfo, mAppPackage, reportIds, remoteService,
                    new EMailTemplateSend.DialogCallback() {

                        @Override
                        public void result(boolean ok) {
                            if (ok) {
                                refreshList();
                            }

                        }
                    });

        }
    });

    miErrorsDeleteSelected.setScheduledCommand(new Command() {

        @Override
        public void execute() {
            if (multipleSelectionModel.getSelectedSet().isEmpty())
                return;
            if (!Window.confirm(constants.errorListConfirmDelete()))
                return;

            final Set<BasicErrorInfo> selected = multipleSelectionModel.getSelectedSet();
            Iterator<BasicErrorInfo> iter = selected.iterator();
            ArrayList<String> ids = new ArrayList<String>();
            startLoading();
            while (iter.hasNext()) {
                ids.add(iter.next().REPORT_ID);
            }
            remoteService.deleteReports(ids, new AsyncCallback<Void>() {

                @Override
                public void onSuccess(Void result) {
                    refreshList();

                }

                @Override
                public void onFailure(Throwable caught) {
                    stopLoading();
                    Window.alert(caught.toString());
                }
            });

        }
    });

}

From source file:nz.org.winters.appspot.acrareporter.client.ui.MappingList.java

License:Apache License

void setupMenus() {
    itemDelete.setScheduledCommand(new Command() {

        @Override/*ww  w  .  ja  va  2  s  . c  om*/
        public void execute() {
            if (selectionModel.getSelectedSet().isEmpty())
                return;
            if (!Window.confirm(constants.mappingListConformDelete()))
                return;

            final Set<MappingFileInfo> selected = selectionModel.getSelectedSet();
            Iterator<MappingFileInfo> iter = selected.iterator();
            ArrayList<Long> ids = new ArrayList<Long>();
            while (iter.hasNext()) {
                ids.add(iter.next().id);
            }
            AppLoadingView.getInstance().start();

            remoteService.deleteMappings(ids, new AsyncCallback<Void>() {

                @Override
                public void onSuccess(Void result) {
                    remoteService.getMappingFiles(packageName, new getMappingsCallback());

                }

                @Override
                public void onFailure(Throwable caught) {
                    AppLoadingView.getInstance().stop();

                    Window.alert(caught.toString());
                }
            });
        }
    });

    itemUpload.setScheduledCommand(new Command() {

        @Override
        public void execute() {
            MappingUpload.doEditDialog(loginInfo, packageName, new MappingUpload.DialogCallback() {

                @Override
                public void result(boolean ok) {
                    AppLoadingView.getInstance().start();

                    remoteService.getMappingFiles(packageName, new getMappingsCallback());
                }
            });

        }
    });

    itemEdit.setScheduledCommand(new Command() {

        @Override
        public void execute() {
            if (selectionModel.getSelectedSet().isEmpty())
                return;
            final MappingFileInfo mfs = selectionModel.getSelectedSet().iterator().next();

            InputDialog.doInput(constants.mappingListLabelEditMapping(), constants.mappingListGridVersion(),
                    mfs.version, new InputDialog.DialogCallback() {

                        @Override
                        public void result(boolean ok, String inputValue) {
                            if (ok) {
                                AppLoadingView.getInstance().start();

                                remoteService.editMappingVersion(mfs.id, inputValue, new AsyncCallback<Void>() {

                                    @Override
                                    public void onSuccess(Void result) {
                                        remoteService.getMappingFiles(packageName, new getMappingsCallback());
                                    }

                                    @Override
                                    public void onFailure(Throwable caught) {
                                        AppLoadingView.getInstance().stop();

                                        Window.alert(caught.toString());

                                    }
                                });
                            }

                        }
                    });
        }
    });

}

From source file:org.aksw.TripleCheckMate.client.widgets.EvaluationPage.java

License:Apache License

public EvaluationPage() {
    super();/*w  w  w  . j  ava  2 s .c  om*/
    initWidget(uiBinder.createAndBindUi(this));

    setContentVisible(false);

    // Resource selection Dialog
    dlgEvalSelect.setText("Resource selection options");
    dlgEvalSelect.setTitle("Resource selection options");
    dlgEvalSelect.setGlassEnabled(true);
    dlgEvalSelect.add(pnlEvalSelect);
    dlgEvalSelect.hide();

    ClickHandler handler = new ClickHandler() {

        public void onClick(ClickEvent event) {
            // The user must select any option to enable
            btnSave.setEnabled(true);
            if (rdValid.getValue() == true)
                ckMissing.setValue(false);
            txtComments.setEnabled(!rdValid.getValue());
            ckMissing.setEnabled(!rdValid.getValue());

        }
    };
    rdValid.addClickHandler(handler);
    rdErrors.addClickHandler(handler);
    ckMissing.setEnabled(false);
    txtComments.setEnabled(false);

    btnSave.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            if (rdValid.getValue() == true) {
                if (tblEval.hasMarkedErrors() == true) {
                    Window.alert("You have marked some triples as wrong.\nPlease unmark them.");
                    return;
                }
            }

            if (ckMissing.getValue() == true) {
                if (txtComments.getText().equals("")) {
                    Window.alert(
                            "Please provide some comments on what type of \ninformation is missing i.e. no rdf:type");
                    return;
                }
            }

            if (rdErrors.getValue() == true) {
                if (tblEval.hasEmptyMarkedErrors() == true) {
                    Window.alert("You have marked triples as wrong but without description.");
                }
                if (ckMissing.getValue() == false && tblEval.hasMarkedErrors() == false) {
                    Window.alert("You have not marked any wrong triples.");
                    return;
                }
            }

            if (Window.confirm("You are going to submit the selected errors, procceed? "))
                submitEvaluation();
        }
    });

    btnSkip.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            if (Window.confirm("Are sou sure you want to skip this resource? ")) {
                SessionContext.latestEvaluateResource.isSkipped = true;
                openSelectDialog();
            }

        }
    });

}

From source file:org.apache.hupa.client.activity.ContactsListActivity.java

License:Apache License

private void bindTo(final EventBus eventBus) {
    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x0_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x2_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x3_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x1_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x20x0_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x20x1");
    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x00x00x1_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x00x00x10x0_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x00x00x10x10x1_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x00x00x10x10x0_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x00x0_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x00x00x0_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x0_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x00x00x10x1");
    this.registerHandler(display.getDelete().addClickHandler(new ClickHandler() {
        @Override//w w w.  j  a  v  a 2  s .  c om
        public void onClick(ClickEvent event) {
            InstrumentationLoggerProvider.get().instrument(
                    "org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x00x00x10x10x1208950cc");
            InstrumentationLoggerProvider.get().instrument(
                    "org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x00x00x10x10x1208950cc0x3_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x00x00x10x10x1208950cc0x2_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x00x00x10x10x1208950cc0x20x0_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x00x00x10x10x1208950cc0x1_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x00x00x10x10x1208950cc0x0");
            if (Window.confirm("Are you sure?")) {
                InstrumentationLoggerProvider.get().instrument(
                        "org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x00x00x10x10x1208950cc0x30x00x0_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x00x00x10x10x1208950cc0x30x00x1_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x00x00x10x10x1208950cc0x30x0");
                InstrumentationLoggerProvider.get().instrument(
                        "org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x00x00x10x10x1208950cc0x30x00x10x00x0_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x00x00x10x10x1208950cc0x30x00x10x00x00x00x0_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x00x00x10x10x1208950cc0x30x00x10x00x00x0_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x00x00x10x10x1208950cc0x30x00x10x0");
                eventBus.fireEvent(new DeleteFolderEvent());
            }
        }
    }));
    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x10x00x0_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x10x0_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x10x00x00x0_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x1_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x10x00x00x1");
    eventBus.addHandler(DeleteFolderEvent.TYPE, new DeleteFolderEventHandler() {
        @Override
        public void onDeleteFolderEvent(DeleteFolderEvent event) {
            InstrumentationLoggerProvider.get().instrument(
                    "org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x10x00x00x1bb16f9ca0x1_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x10x00x00x1bb16f9ca0x2_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x10x00x00x1bb16f9ca0x0_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x10x00x00x1bb16f9ca0x3_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x10x00x00x1bb16f9ca0x20x0");
            InstrumentationLoggerProvider.get().instrument(
                    "org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x10x00x00x1bb16f9ca");
            InstrumentationLoggerProvider.get().instrument(
                    "org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x10x00x00x1bb16f9ca0x30x0_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x10x00x00x1bb16f9ca0x30x00x0");
            deleteSelected();
        }
    });
    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x20x0_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x20x00x00x0_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x20x00x00x1_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x2_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x20x00x0");
    eventBus.addHandler(RefreshLabelListEvent.TYPE, new RefreshLabelListEventHandler() {
        @Override
        public void onRefreshEvent(RefreshLabelListEvent event) {
            InstrumentationLoggerProvider.get().instrument(
                    "org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x20x00x00x13314012f0x20x0_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x20x00x00x13314012f0x3_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x20x00x00x13314012f0x1_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x20x00x00x13314012f0x2_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x20x00x00x13314012f0x0");
            InstrumentationLoggerProvider.get().instrument(
                    "org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x20x00x00x13314012f");
            InstrumentationLoggerProvider.get().instrument(
                    "org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x20x00x00x13314012f0x30x0_____org_apache_hupa_client_activity_ContactsListActivity_java0x0860da61dda82389f0x30x20x00x00x13314012f0x30x00x0");
            display.refresh();
        }
    });
}