Example usage for com.google.gwt.user.client.ui DialogBox setWidget

List of usage examples for com.google.gwt.user.client.ui DialogBox setWidget

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui DialogBox setWidget.

Prototype

@Override
    public void setWidget(Widget w) 

Source Link

Usage

From source file:com.databasepreservation.visualization.client.common.Dialogs.java

public static DialogBox showLoadingModel() {
    final DialogBox dialogBox = new DialogBox(false, true);
    dialogBox.setText("Loading...");

    FlowPanel layout = new FlowPanel();
    Label messageLabel = new Label(messages.executingTaskMessage());

    layout.add(messageLabel);/*from  w  ww. j  a  v a  2 s.c o m*/

    dialogBox.setWidget(layout);

    dialogBox.setGlassEnabled(true);
    dialogBox.setAnimationEnabled(false);

    dialogBox.addStyleName("wui-dialog-information");
    layout.addStyleName("wui-dialog-layout");
    messageLabel.addStyleName("wui-dialog-message");

    dialogBox.center();
    dialogBox.show();
    return dialogBox;
}

From source file:com.dawg6.gwt.client.ApplicationPanel.java

License:Open Source License

public static DialogBox showDialogBox(String title, IsWidget component, int buttons,
        final DialogBoxResultHandler handler) {
    // Create the popup dialog box
    final DialogBox dialogBox = createDialogBox();
    dialogBox.setText(title);/*  w w  w  .j  a v a 2  s.c om*/
    dialogBox.setAnimationEnabled(true);
    dialogBox.setModal(false);
    FlexTable table = new FlexTable();
    table.setWidget(0, 0, component);
    dialogBox.setWidget(table);

    HorizontalPanel row = new HorizontalPanel();
    row.setSpacing(5);
    row.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    row.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    table.setWidget(1, 0, row);

    boolean firstButton = true;

    if (buttons == 0)
        buttons = OK;

    for (final ButtonInfo b : allButtons) {
        if ((buttons > 0) && ((buttons & b.id) != 0)) {
            final Button button = createDialogBoxButton(b.label);

            button.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    dialogBox.hide();

                    if (handler != null)
                        handler.dialogBoxResult(b.id);
                }
            });
            row.add(button);

            if (firstButton) {
                button.setFocus(true);
                firstButton = false;
            }
        }
    }

    dialogBox.center();

    return dialogBox;
}

From source file:com.ephesoft.dcma.gwt.admin.bm.client.presenter.documenttype.DocumentTypeViewPresenter.java

License:Open Source License

/**
 * To perform operations in case of test table button clicked.
 * /*ww w  . j av a 2s. co m*/
 * @param identifier String
 */
public void onTestTableButtonClicked(String identifier) {
    ScreenMaskUtility.maskScreen();
    controller.setTableInfoSelectedField(controller.getSelectedDocument().getTableInfoByIdentifier(identifier));

    controller.getRpcService().testTablePattern(controller.getBatchClass(),
            controller.getSelectedTableInfoField(), new EphesoftAsyncCallback<List<TestTableResultDTO>>() {

                @Override
                public void customFailure(Throwable throwable) {
                    ScreenMaskUtility.unmaskScreen();
                    final ConfirmationDialog dialog = ConfirmationDialogUtil.showConfirmationDialog(
                            throwable.getMessage(), MessageConstants.TITLE_TEST_FAILURE, Boolean.TRUE,
                            Boolean.TRUE);
                    dialog.addDialogListener(new DialogListener() {

                        @Override
                        public void onOkClick() {
                            dialog.hide(true);
                        }

                        @Override
                        public void onCancelClick() {
                            // TODO Auto-generated method stub
                        }
                    });

                    dialog.okButton.setStyleName(AdminConstants.BUTTON_STYLE);

                }

                @Override
                public void onSuccess(List<TestTableResultDTO> outputDtos) {
                    ScreenMaskUtility.unmaskScreen();
                    DialogBox dialogBox = new DialogBox();
                    dialogBox.addStyleName("width500px");
                    dialogBox.setHeight("200px");
                    tableTestResultView.createTestTableList(outputDtos);
                    tableTestResultView.setDialogBox(dialogBox);
                    dialogBox.setText(MessageConstants.TEST_TABLE_RESULT_HEADER);
                    dialogBox.setWidget(tableTestResultView);
                    dialogBox.center();
                    tableTestResultView.getBackButton().setFocus(true);
                    dialogBox.show();
                }
            });
}

From source file:com.ephesoft.dcma.gwt.admin.bm.client.presenter.fieldtype.FieldTypeViewPresenter.java

License:Open Source License

/**
 * To perform operations when test KV button is clicked.
 * /*from   ww  w.  j  a v a 2 s.  com*/
 * @param identifier String
 */
public void onTestKVButtonClicked(String identifier) {
    ScreenMaskUtility.maskScreen();
    controller.setSelectedKVExtraction(
            controller.getSelectedDocumentLevelField().getKVExtractionDTOByIdentifier(identifier));
    controller.getRpcService().testKVExtraction(controller.getBatchClass(),
            controller.getSelectedKVExtraction(), null, false,
            new EphesoftAsyncCallback<List<OutputDataCarrierDTO>>() {

                @Override
                public void customFailure(Throwable throwable) {
                    ScreenMaskUtility.unmaskScreen();
                    final ConfirmationDialog dialog = ConfirmationDialogUtil.showConfirmationDialog(
                            throwable.getMessage(), MessageConstants.TITLE_TEST_FAILURE, Boolean.TRUE);
                    dialog.addDialogListener(new DialogListener() {

                        @Override
                        public void onOkClick() {
                            dialog.hide(true);
                        }

                        @Override
                        public void onCancelClick() {
                            // TODO Auto-generated method stub
                        }
                    });

                }

                @Override
                public void onSuccess(List<OutputDataCarrierDTO> outputDtos) {
                    ScreenMaskUtility.unmaskScreen();
                    DialogBox dialogBox = new DialogBox();
                    dialogBox.addStyleName("width500px");
                    dialogBox.setHeight("200px");
                    kvExtractionTestResultView.createKVFieldList(outputDtos);
                    kvExtractionTestResultView.setDialogBox(dialogBox);
                    dialogBox.setText(KV_EXTRACTION_RESULT);
                    dialogBox.setWidget(kvExtractionTestResultView);
                    dialogBox.center();
                    kvExtractionTestResultView.getBackButton().setFocus(true);
                    dialogBox.show();
                }
            });
}

From source file:com.ephesoft.dcma.gwt.admin.bm.client.presenter.kvextraction.advancedkvextraction.AdvancedKVExtractionPresenter.java

License:Open Source License

/**
 * To perform operations on Test Advanced KV Button click.
 *//*  w w w  .j a  v a 2s . c  om*/
public void onTestAdvancedKvButtonClicked() {
    final String fileName = advancedKVExtractionDTO.getImageName();
    if (validateFields()) {
        ScreenMaskUtility.maskScreen();
        saveDataInDTO(controller.getSelectedKVExtraction());
        controller.getRpcService().testAdvancedKVExtraction(controller.getBatchClass(),
                controller.getSelectedKVExtraction(), view.getDocName(), fileName,
                new EphesoftAsyncCallback<List<OutputDataCarrierDTO>>() {

                    @Override
                    public void customFailure(Throwable throwable) {
                        ScreenMaskUtility.unmaskScreen();
                        ConfirmationDialogUtil.showConfirmationDialog(throwable.getMessage(),
                                MessageConstants.TITLE_TEST_FAILURE, Boolean.TRUE);
                    }

                    @Override
                    public void onSuccess(List<OutputDataCarrierDTO> outputDtos) {
                        ScreenMaskUtility.unmaskScreen();
                        getUpdatedFileName(fileName);
                        DialogBox dialogBox = new DialogBox();
                        dialogBox.addStyleName(STYLE_WIDTH500PX);
                        dialogBox.setHeight("200px");
                        view.getKvExtractionTestResultView().createKVFieldList(outputDtos);
                        view.getKvExtractionTestResultView().setDialogBox(dialogBox);
                        dialogBox.setText(KV_EXTRACTION_RESULT);
                        dialogBox.setWidget(view.getKvExtractionTestResultView());
                        dialogBox.center();
                        view.getKvExtractionTestResultView().getBackButton().setFocus(true);
                        dialogBox.show();
                    }

                    private void getUpdatedFileName(final String fileName) {
                        controller.getRpcService().getUpdatedTestFileName(view.getBatchClassID(),
                                view.getDocName(), fileName, new EphesoftAsyncCallback<String>() {

                                    @Override
                                    public void customFailure(Throwable arg0) {

                                    }

                                    @Override
                                    public void onSuccess(String updatedFileName) {
                                        advancedKVExtractionDTO.setImageName(updatedFileName);
                                    }
                                });
                    }
                });
    }
}

From source file:com.ephesoft.dcma.gwt.admin.bm.client.presenter.tableinfo.TableInfoViewPresenter.java

License:Open Source License

/**
 * To perform operations on Test Table Button Click.
 *///from  w  w  w  .  j ava  2s .c o m
public void onTestTableButtonClicked() {
    ScreenMaskUtility.maskScreen();
    controller.setTableInfoSelectedField(controller.getSelectedTableInfoField());

    controller.getRpcService().testTablePattern(controller.getBatchClass(),
            controller.getSelectedTableInfoField(), new EphesoftAsyncCallback<List<TestTableResultDTO>>() {

                @Override
                public void customFailure(Throwable throwable) {
                    ScreenMaskUtility.unmaskScreen();
                    final ConfirmationDialog dialog = ConfirmationDialogUtil.showConfirmationDialog(
                            throwable.getMessage(), MessageConstants.TITLE_TEST_FAILURE, Boolean.TRUE,
                            Boolean.TRUE);
                    dialog.addDialogListener(new DialogListener() {

                        @Override
                        public void onOkClick() {
                            dialog.hide(true);
                        }

                        @Override
                        public void onCancelClick() {
                            // TODO Auto-generated method stub
                        }
                    });

                    dialog.okButton.setStyleName(AdminConstants.BUTTON_STYLE);

                }

                @Override
                public void onSuccess(List<TestTableResultDTO> outputDtos) {
                    ScreenMaskUtility.unmaskScreen();
                    DialogBox dialogBox = new DialogBox();
                    dialogBox.addStyleName("width500px");
                    dialogBox.setHeight("200px");
                    tableTestResultView.createTestTableList(outputDtos);
                    tableTestResultView.setDialogBox(dialogBox);
                    dialogBox.setText(MessageConstants.TEST_TABLE_RESULT_HEADER);
                    dialogBox.setWidget(tableTestResultView);
                    dialogBox.center();
                    tableTestResultView.getBackButton().setFocus(true);
                    dialogBox.show();
                }
            });
}

From source file:com.ephesoft.dcma.gwt.rv.client.view.ValidatePanel.java

License:Open Source License

/**
 * @param value/*from w w w  .j  a v a 2  s .c o  m*/
 */
private void performFuzzySearch(String value) {
    if (presenter.document != null) {
        presenter.rpcService.fuzzyTextSearch(presenter.batchDTO.getBatch(), presenter.document.getType(), value,
                new AsyncCallback<List<List<String>>>() {

                    @Override
                    public void onFailure(Throwable arg0) {
                        final ConfirmationDialog confirmationDialog = ConfirmationDialogUtil
                                .showConfirmationDialog(
                                        LocaleDictionary.get().getMessageValue(
                                                ReviewValidateMessages.MSG_FUZZY_SEARCH_UNSUCCESSFUL),
                                        LocaleDictionary.get().getConstantValue(
                                                ReviewValidateConstants.FUZZY_SEARCH_TOOLTIP),
                                        Boolean.TRUE);

                        confirmationDialog.addDialogListener(new DialogListener() {

                            @Override
                            public void onOkClick() {
                                confirmationDialog.hide();
                                ScreenMaskUtility.unmaskScreen();
                                presenter.setFocus();
                            }

                            @Override
                            public void onCancelClick() {
                                ScreenMaskUtility.unmaskScreen();
                                presenter.setFocus();
                            }
                        });

                    }

                    @Override
                    public void onSuccess(List<List<String>> arg0) {

                        if (arg0 == null || arg0.isEmpty()) {
                            final ConfirmationDialog confirmationDialog = ConfirmationDialogUtil
                                    .showConfirmationDialog(
                                            LocaleDictionary.get().getMessageValue(
                                                    ReviewValidateMessages.MSG_FUZZY_SEARCH_NO_RESULT),
                                            LocaleDictionary.get().getConstantValue(
                                                    ReviewValidateConstants.FUZZY_SEARCH_TOOLTIP),
                                            Boolean.TRUE);

                            confirmationDialog.addDialogListener(new DialogListener() {

                                @Override
                                public void onOkClick() {
                                    confirmationDialog.hide();
                                    ScreenMaskUtility.unmaskScreen();
                                    presenter.setFocus();
                                }

                                @Override
                                public void onCancelClick() {
                                    ScreenMaskUtility.unmaskScreen();
                                    presenter.setFocus();
                                }

                            });

                        } else {
                            fuzzyDataCarrier = arg0;

                            final DialogBox dialogBox = new DialogBox();
                            dialogBox.addStyleName(ReviewValidateConstants.CONFIGURED_DIMENSIONS_DIALOG);
                            final FuzzySearchResultView fuzzySearchResultView = new FuzzySearchResultView(
                                    presenter, presenter.batchDTO.getFuzzySearchPopUpXDimension(),
                                    presenter.batchDTO.getFuzzySearchPopUpYDimension());
                            fuzzySearchResultView.setEventBus(eventBus);
                            dialogBox.setWidget(fuzzySearchResultView);
                            fuzzySearchResultView.setDialogBox(dialogBox);
                            fuzzySearchResultView.createBatchList(arg0);

                            fuzzySearchResultView.setWidth(presenter.batchDTO.getFuzzySearchPopUpYDimension());
                            dialogBox.center();
                            dialogBox.setText(LocaleDictionary.get()
                                    .getConstantValue(ReviewValidateConstants.FUZZY_SEARCH_TITLE));
                            dialogBox.show();
                            fuzzySearchResultView.getSelectBtn().setFocus(true);
                        }
                    }

                });
    }
}

From source file:com.google.appinventor.client.editor.blocks.BlocklyPanel.java

License:Open Source License

/**
 * Create a Dialog Box. We call this from Javascript (blockly) to
 * display a dialog box.  We do this here because we can get calls
 * from the blocklyframe when it is not visible.  Because we are in
 * the parent window, we can display dialogs that will be visible
 * even when the blocklyframe is not visible.
 *
 * @param title      Title for the Dialog Box
 * @param mess       The message to display
 * @param buttonName The string to display in the "OK" button.
 * @param size       0 or 1. 0 makes a smaller box 1 makes a larger box.
 * @param callback   an opague JavaScriptObject that contains the
 *                   callback function provided by the Javascript code.
 * @return The created dialog box./*from w w  w.j a  va  2s  .co  m*/
 */

public static DialogBox createDialog(String title, String mess, final String buttonName,
        final String cancelButtonName, int size, final JavaScriptObject callback) {
    final DialogBox dialogBox = new DialogBox();
    dialogBox.setStylePrimaryName("ode-DialogBox");
    dialogBox.setText(title);
    if (size == 0) {
        dialogBox.setHeight("150px");
    } else {
        dialogBox.setHeight("400px");
    }
    dialogBox.setWidth("400px");
    dialogBox.setGlassEnabled(true);
    dialogBox.setAnimationEnabled(true);
    dialogBox.center();
    VerticalPanel DialogBoxContents = new VerticalPanel();
    HTML message = new HTML(mess);
    HorizontalPanel holder = new HorizontalPanel();
    if (buttonName != null) { // If buttonName and cancelButtonName are null
        Button ok = new Button(buttonName); // We won't have any buttons and other
        ok.addClickHandler(new ClickHandler() { // code is needed to dismiss us
            @Override
            public void onClick(ClickEvent event) {
                doCallBack(callback, buttonName);
            }
        });
        holder.add(ok);
    }
    if (cancelButtonName != null) {
        Button cancel = new Button(cancelButtonName);
        cancel.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                doCallBack(callback, cancelButtonName);
            }
        });
        holder.add(cancel);
    }
    DialogBoxContents.add(message);
    DialogBoxContents.add(holder);
    dialogBox.setWidget(DialogBoxContents);
    terminateDrag(); // cancel a drag before showing the modal dialog
    dialogBox.show();
    return dialogBox;
}

From source file:com.google.appinventor.client.editor.youngandroid.BlocklyPanel.java

License:Open Source License

/**
 * Create a Dialog Box. We call this from Javascript (blockly) to
 * display a dialog box.  We do this here because we can get calls
 * from the blocklyframe when it is not visible.  Because we are in
 * the parent window, we can display dialogs that will be visible
 * even when the blocklyframe is not visible.
 *
 * @param title      Title for the Dialog Box
 * @param mess       The message to display
 * @param buttonName The string to display in the "OK" button.
 * @param size       0 or 1. 0 makes a smaller box 1 makes a larger box.
 * @param callback   an opague JavaScriptObject that contains the
 *                   callback function provided by the Javascript code.
 * @return The created dialog box./*from   www  . ja v a 2  s  . c o m*/
 */

public static DialogBox createDialog(String title, String mess, final String buttonName,
        final String cancelButtonName, int size, final JavaScriptObject callback) {
    final DialogBox dialogBox = new DialogBox();
    dialogBox.setStylePrimaryName("ode-DialogBox");
    dialogBox.setText(title);
    if (size == 0) {
        dialogBox.setHeight("150px");
    } else {
        dialogBox.setHeight("400px");
    }
    dialogBox.setWidth("400px");
    dialogBox.setGlassEnabled(true);
    dialogBox.setAnimationEnabled(true);
    dialogBox.center();
    VerticalPanel DialogBoxContents = new VerticalPanel();
    HTML message = new HTML(mess);
    message.setStyleName("DialogBox-message");
    HorizontalPanel holder = new HorizontalPanel();
    if (buttonName != null) { // If buttonName and cancelButtonName are null
        Button ok = new Button(buttonName); // We won't have any buttons and other
        ok.addClickListener(new ClickListener() { // code is needed to dismiss us
            public void onClick(Widget sender) {
                doCallBack(callback, buttonName);
            }
        });
        holder.add(ok);
    }
    if (cancelButtonName != null) {
        Button cancel = new Button(cancelButtonName);
        cancel.addClickListener(new ClickListener() {
            public void onClick(Widget sender) {
                doCallBack(callback, cancelButtonName);
            }
        });
        holder.add(cancel);
    }
    DialogBoxContents.add(message);
    DialogBoxContents.add(holder);
    dialogBox.setWidget(DialogBoxContents);
    dialogBox.show();
    return dialogBox;
}

From source file:com.google.appinventor.client.editor.youngandroid.TutorialPanel.java

License:Open Source License

/**
 * Creates video on page!/* w w  w.java 2s . com*/
 */
private static void createVideoDialog(String tutorialId) {
    // Create the UI elements of the DialogBox
    final DialogBox dialogBox = new DialogBox(true, true); // DialogBox(autohide, modal)
    dialogBox.setStylePrimaryName("ode-DialogBox");
    dialogBox.setText("Tutorial Video");
    dialogBox.setGlassEnabled(true);
    dialogBox.setAnimationEnabled(true);
    VerticalPanel DialogBoxContents = new VerticalPanel();
    // Adds Youtube Video
    HTML message = new HTML("<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/"
            + tutorialId + "?rel=0&autoplay=1\" frameborder=\"0\" allowfullscreen></iframe>");
    message.setStyleName("DialogBox-message");
    FlowPanel holder = new FlowPanel();
    Button ok = new Button("Close");
    ok.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            dialogBox.hide();
        }
    });
    ok.setStyleName("DialogBox-button");
    holder.add(ok);
    DialogBoxContents.add(message);
    DialogBoxContents.add(holder);
    dialogBox.setWidget(DialogBoxContents);
    dialogBox.center();
    dialogBox.show();
}