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:com.metadot.book.connectr.client.presenter.FriendPopupPresenter.java

License:Apache License

public void bind() {
    this.display.getEditButton().addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            display.hide();//w w w .jav  a2  s. co  m
            eventBus.fireEvent(new FriendEditEvent(friend.getId()));
        }
    });

    this.display.getDeleteButton().addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            display.hide();
            if (Window.confirm("Are you sure?")) {
                deleteFriend(friend.getId());
            }
        }
    });

}

From source file:com.phideltcmu.recruiter.client.ui.MailerPanel.java

License:Creative Commons License

public MailerPanel() {
    Grid g = new Grid(1, 2);
    g.setWidget(0, 0, new Label("Subject:"));
    g.setWidget(0, 1, subject);/*from   w ww.  j  av a 2  s.c  om*/
    this.add(g);
    TEXT_AREA = new RichTextArea();
    RichTextToolbar tb = new RichTextToolbar(TEXT_AREA);
    sendButton.setWidth("100%");

    HorizontalPanel hp = new HorizontalPanel();
    VerticalPanel p = new VerticalPanel();
    p.add(tb);
    p.add(TEXT_AREA);

    TEXT_AREA.setHeight("14em");
    TEXT_AREA.setWidth("100%");
    tb.setWidth("100%");
    p.setWidth("100%");
    DOM.setStyleAttribute(p.getElement(), "marginRight", "4px");
    p.setWidth("32em");
    hp.add(p);
    VerticalPanel vp2 = new VerticalPanel();
    vp2.add(categoriesPanel);
    vp2.add(sendButton);
    hp.add(vp2);
    this.add(hp);

    sendButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent clickEvent) {
            /**
             * Check subject
             */
            if (subject.getText().length() == 0) {
                if (Window.confirm("Send without subject?")) {
                    subject.setText("NO SUBJECT");
                } else {
                    return;
                }
            }
            /**
             * Check body
             */
            if (TEXT_AREA.getText().length() == 0) {
                Window.alert("I refuse to send an empty message");
                return;
            }
            /**
             * Check categories
             */
            categories.clear();
            categories = CategoriesPanel.filterCategories(categoriesPanel.getCheckBooleanMap());
            mailSendPopup = new MailSendPopup(categories, t);
            mailSendPopup.generateWarning();
            mailSendPopup.display("Cancel");
        }
    });
}

From source file:com.pratikabu.pem.client.dash.components.TransactionDatabase.java

License:Apache License

public static void deleteT(final Long tId, boolean deleteFullTransaction) {
    if (!Window.confirm("Are you sure you want to delete this Transaction"
            + (deleteFullTransaction ? "" : " Entry") + "?\nThis step cannot be undone.")) {
        return;/*from   ww w  .  j a v a 2 s .  co  m*/
    }

    ServiceHelper.getPemservice().deleteTransaction(tId, deleteFullTransaction, new AsyncCallback<Boolean>() {
        @Override
        public void onSuccess(Boolean result) {
            if (result) {
                Utility.alert("Successfully Deleted.");
                // TODO get the transaction value to pass
                CentralEventHandler.transactionUpdated(null, CentralEventHandler.ACTION_DELETED);
            } else {
                Utility.alert("Error while deleting Transaction.");
            }
        }

        @Override
        public void onFailure(Throwable caught) {
            Utility.alert("Error while deleting Transaction.");
        }
    });
}

From source file:com.pratikabu.pem.client.dash.components.TransactionGroupDatabase.java

License:Apache License

public static void deleteTG(final Long tgId) {
    if (!Window.confirm("Are you sure you want to delete this Transaction Group?\n"
            + "All transactions under this will be deleted.\n" + "This step cannot be undone.")) {
        return;/*from   w  w w .j a  v  a 2 s. c o  m*/
    }

    ServiceHelper.getPemservice().deleteTransactionGroup(tgId, new AsyncCallback<Boolean>() {
        @Override
        public void onFailure(Throwable caught) {
            Utility.alert("Error while deleting Transaction Group.");
        }

        @Override
        public void onSuccess(Boolean result) {
            if (result) {
                Utility.alert("Successfully Deleted.");
                CentralEventHandler.transactionGroupUpdated(get().getTG(tgId),
                        CentralEventHandler.ACTION_DELETED);
            } else {
                Utility.alert("Error while deleting Transaction Group.");
            }
        }
    });
}

From source file:com.qualogy.qafe.gwt.client.ui.renderer.events.EventFactory.java

License:Apache License

public static void createMenuCloseEvent(final String uuid, final WindowPanel sender) {
    sender.addWindowClosingHandler(new ClosingHandler() {
        public void onWindowClosing(ClosingEvent event) {
            if (Window.confirm("Are you sure you want to close the application and all of its windows ?")) {
                MainFactoryActions.remove(uuid);
                ComponentRepository.getInstance().removeAllItemsForWindow(uuid, null);
                // ClientApplicationContext.getInstance().closeAllWindowsForUUID(uuid);
                // return true;
            } else {
                // return false;
            }// w  w w .  j a v  a  2s  . co m
            Window.prompt("Are you sure you want to close the application and all of its windows ?", "X");
        }
    });
}

From source file:com.risevision.ui.client.common.controller.PrerequisitesController.java

License:Open Source License

private void processPrereqInfo(PrerequisitesInfo result) {
    //Initialize the Configuration Controller.
    ConfigurationController configController = ConfigurationController.getInstance();
    configController.setConfiguration(result.getConfiguration());

    UserAccountWidget accountWidget = UserAccountWidget.getInstance();
    accountWidget.setRedirectUrl(result.getConfiguration().getLogoutURL());

    if (result.getCurrentUserStatus() == PrerequisitesInfo.STATUS_ERROR) {
        if (Window.confirm(
                "Your account information could not be retrieved. We apologize for the unexpected downtime. "
                        + "Would you like to retry?")) {
            load();//from  w  ww  .  j  av a 2s  . c  o m
        } else {
            accountWidget.logoutUser();
        }
    } else if (result.getCurrentUserStatus() == PrerequisitesInfo.STATUS_WRONG_USERNAME) {
        //         if (Window.confirm("We think your account authentication got mixed up with another account. " +
        //                     "If you want to login with " + result.getCurrentUser().getUserName() + " press okay and " +
        //                     "make sure you authorize that account. If this is wrong, or it doesn't work, " +
        //                     "we're sorry about this but your browser is confused, and the only way to fix " +
        //                     "it is to clear your browser cache and try again.")) {
        //            RiseAsyncCallback.reAuthenticateUser();
        //         }
        //         else {
        //            accountWidget.logoutUser();
        //         }

        new UserLoginHelpWidget().show(result.getCurrentUser().getUserName());
    } else {
        verifyTerms(result);
    }
}

From source file:com.risevision.ui.client.common.controller.PrerequisitesController.java

License:Open Source License

private void companyRegistrationFailed() {
    // if the user is coming from a preview, do not show him the notification
    if (getFromHash(Location.getHash(), UiEntryPoint.HASH_PARAM_FROM_COMPANY_ID) != null
            || Window.confirm("Requested Company is not accepting registrations. Would you "
                    + "like to register a regular account?")) {
        initNewUserCompany(null);/*  ww w .ja  v a 2  s.  com*/
    } else {
        UiEntryPoint.trackPageview("User_Registration_Failed");
        UserAccountWidget.getInstance().logoutUser();
        //         Window.Location.replace(ConfigurationController.getInstance().getConfiguration().getLogoutURL());
    }
}

From source file:com.risevision.ui.client.common.widgets.alerts.AlertURLWidget.java

License:Open Source License

private void resetAlertsURL() {
    if (Window.confirm(
            "Resetting the Web Service URL means alert providers can no longer connect to the service until they are updated with the new URL.")) {
        companyService.resetAlertsURL(SelectedCompanyController.getInstance().getSelectedCompanyId(),
                new RpcCallBackHandler());
    }//from  w w w .  j a  va  2  s .c  om
}

From source file:com.risevision.ui.client.common.widgets.demoContent.DemoContentGridWidget.java

License:Open Source License

public void onClick(ClickEvent event) {
    Object sender = event.getSource();
    DemoContentInfo item;//from w  w w .j  a v  a 2 s  .  c om

    if (sender instanceof Anchor) {
        Anchor b = (Anchor) sender;
        String keyString = actionMap.get(b);

        if (keyString != null && !keyString.isEmpty()) {
            int currentCommand = RiseUtils.strToInt(keyString.substring(0, 1), -1);
            int rowIndex = RiseUtils.strToInt(keyString.substring(1), 0);

            if (currentCommand == ACTION_SELECT) {
                item = demoContentList.get(rowIndex);
                demoContentManageWidget.show(item, onPlayListItemChanged);
            }

            if (currentCommand == ACTION_ADD) {
                item = new DemoContentInfo();
                demoContentManageWidget.show(item, true, onPlayListItemChanged);
            }

            if (currentCommand == ACTION_DELETE) {
                if (Window.confirm("Are you sure you want to delete this item?")) {
                    deleteDemoContentItem(rowIndex);
                }
            }
        }
    }
}

From source file:com.risevision.ui.client.common.widgets.financial.InstrumentListWidget.java

License:Open Source License

public void onClick(ClickEvent event) {
    Object sender = event.getSource();
    //      FinancialItemInfo item;
    int rowIndex;
    if (sender instanceof Anchor) {
        Anchor b = (Anchor) sender;/* w  ww . j av a 2  s  .co  m*/
        String keyString = actionMap.get(b);

        if (keyString != null && !keyString.isEmpty()) {
            currentCommand = RiseUtils.strToInt(keyString.substring(0, 1), -1);
            currentKey = keyString.substring(1);

            //            if (currentCommand == ACTION_SELECT) {
            //               rowIndex = RiseUtils.strToInt(currentKey, 0);
            //               item = financialItems.get(rowIndex);
            //               PlaylistItemManageWidget.getInstance().show(item, rowIndex);
            //            }

            if (currentCommand == ACTION_ADD) {
                stockSelector.show(addCommand);
            }

            //            if (currentCommand == ACTION_INSERT) {
            //               rowIndex = RiseUtils.strToInt(currentKey, 0);
            //               itemManageWidget.show(null, rowIndex);
            //               updateTable();
            //            }

            if (currentCommand == ACTION_DELETE) {
                if (Window.confirm("Are you sure you want to delete this item?")) {
                    rowIndex = RiseUtils.strToInt(currentKey, 0);
                    deleteItem(rowIndex);
                }
            }

            //            if (currentCommand == ACTION_MOVEUP) {
            //               if (financialItems.size() > 1) {
            //                  rowIndex = RiseUtils.strToInt(currentKey, 0);
            //                  if (rowIndex > 0) {
            //                     item = financialItems.get(rowIndex);
            //                     financialItems.remove(rowIndex);
            //                     financialItems.add(rowIndex-1, item);
            //                     updateTable();
            //                  }
            //               }
            //            }

            //            if (currentCommand == ACTION_MOVEDOWN) {
            //               if (financialItems.size() > 1) {
            //                  rowIndex = RiseUtils.strToInt(currentKey, 0);
            //                  if (rowIndex < (financialItems.size() - 1)) {
            //                     item = financialItems.get(rowIndex);
            //                     financialItems.remove(rowIndex);
            //                     financialItems.add(rowIndex+1, item);
            //                     updateTable();
            //                  }
            //               }
            //            }
        }
    }
}