Ejemplo n.º 1
0
 /**
  * Shows a confirm dialog
  *
  * @param title the text to be displayed as the caption of the message box
  * @param message the text to be displayed in the body of the message box
  * @param okHandler a handler for the OK button click event
  * @param cancelHandler a handler for the Cancel button click event
  */
 public static ConfirmDialog show(
     String title, String message, OkHandler okHandler, CancelHandler cancelHandler) {
   return show(
       title,
       message,
       WidgetMsgFactory.getMessages().okLabel(),
       WidgetMsgFactory.getMessages().cancelLabel(),
       okHandler,
       cancelHandler,
       DEFAULT_STYLE_NAME,
       false);
 }
Ejemplo n.º 2
0
  /**
   * Creates the Cancel button
   *
   * @return
   */
  private Button createCancelButton() {
    Button cancelButton = new Button();

    cancelButton.setText(WidgetMsgFactory.getMessages().cancelLabel());
    cancelButton.addStyleName("button");
    cancelButton.addStyleName("cancelButton");
    cancelButton.addSelectHandler(
        new SelectHandler() {
          public void onSelect(SelectEvent event) {
            hide();
            try {
              CancelEvent.fire(ConfirmDialog.this);
            } catch (Throwable e) {
              Crux.getErrorHandler().handleError(e);
            }
          }
        });
    return cancelButton;
  }