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:eu.europeana.uim.gui.cp.client.europeanawidgets.ImportResourcesWidget.java

License:EUPL

/**
 * Creates an import dialog//from  ww w  .  ja  v a2s  .co  m
 * 
 * @return
 */
private DialogBox createImportDialog() {
    // Create a dialog box and set the caption text
    final DialogBox dialogBox = new DialogBox();
    progressBar = new ProgressBar(0, 100);
    progressBar.setWidth("100%");

    dialogBox.ensureDebugId("impDialogBox");
    dialogBox.setText(EuropeanaClientConstants.IMPORTMENULABEL);
    dialogBox.setModal(true);

    Button closeButton = new Button();
    closeButton.setText("Close");

    closeButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            dialogBox.hide();
            progressBar.setProgress(0);
            impResultsTable.removeAllRows();
        }
    });

    // Create a table to layout the content
    VerticalPanel dialogContents = new VerticalPanel();

    dialogContents.setSpacing(4);
    dialogBox.setWidget(dialogContents);
    dialogContents.add(progressBar);

    ScrollPanel scrollPanel = new ScrollPanel();

    scrollPanel.setWidth("600px");
    scrollPanel.setHeight("500px");

    scrollPanel.add(impResultsTable);

    dialogContents.add(scrollPanel);

    dialogContents.add(closeButton);
    HTML details = new HTML("ImportStatus");

    dialogContents.setCellHorizontalAlignment(details, HasHorizontalAlignment.ALIGN_CENTER);
    return dialogBox;
}

From source file:fr.drop.client.content.projects.CwDialogBox.java

License:Apache License

/**
 * Create the dialog box for this example.
 *
 * @return the new dialog box/*from   w w  w . ja v a 2s.  c o  m*/
 */
@DropSource
private DialogBox createDialogBox() {
    // Create a dialog box and set the caption text
    final DialogBox dialogBox = new DialogBox();
    dialogBox.ensureDebugId("cwDialogBox");
    dialogBox.setText(constants.cwDialogBoxCaption());

    // Create a table to layout the content
    VerticalPanel dialogContents = new VerticalPanel();
    dialogContents.setSpacing(4);
    dialogBox.setWidget(dialogContents);

    // Add some text to the top of the dialog
    HTML details = new HTML(constants.cwDialogBoxDetails());
    dialogContents.add(details);
    dialogContents.setCellHorizontalAlignment(details, HasHorizontalAlignment.ALIGN_CENTER);

    // Add an image to the dialog
    Image image = new Image(Drop.images.jimmy());
    dialogContents.add(image);
    dialogContents.setCellHorizontalAlignment(image, HasHorizontalAlignment.ALIGN_CENTER);

    // Add a close button at the bottom of the dialog
    Button closeButton = new Button(constants.cwDialogBoxClose(), new ClickHandler() {
        public void onClick(ClickEvent event) {
            dialogBox.hide();
        }
    });
    dialogContents.add(closeButton);
    if (LocaleInfo.getCurrentLocale().isRTL()) {
        dialogContents.setCellHorizontalAlignment(closeButton, HasHorizontalAlignment.ALIGN_LEFT);

    } else {
        dialogContents.setCellHorizontalAlignment(closeButton, HasHorizontalAlignment.ALIGN_RIGHT);
    }

    // Return the dialog box
    return dialogBox;
}

From source file:ilarkesto.gwt.client.desktop.Desktop.java

License:Open Source License

public static void showError(String message) {
    DialogBox dialog = new DialogBox(true, true);
    dialog.setText("Autsch!");
    Label messageLabel = new Label(message);
    VerticalPanel vertical = new VerticalPanel();
    vertical.getElement().getStyle().setPadding(20, Unit.PX);
    vertical.add(messageLabel);// w  ww.j  a  v  a 2s . c o  m
    dialog.setWidget(vertical);
    dialog.center();
    dialog.show();
}

From source file:ilarkesto.gwt.client.desktop.Widgets.java

License:Open Source License

public static DialogBox dialog(boolean autoHide, String title, IsWidget widget) {
    DialogBox dialog = new ExtendedDialogBox(autoHide, true);
    dialog.getElement().getStyle().setProperty("maxWidth", "90%");
    dialog.setText(title);//from  w  ww .j ava  2s . c  o m
    dialog.setWidget(widget);
    dialog.setGlassEnabled(true);
    Style style = dialog.getElement().getStyle();
    style.setPadding(0, Unit.PX);
    dialog.center();

    return dialog;
}

From source file:info.piwai.rockslide.client.ui.ExampleButton.java

License:Apache License

@Override
public void onClick(ClickEvent event) {
    DialogBox dialogBox = new DialogBox();
    DialogBoxContent content = new DialogBoxContent(dialogBox);
    dialogBox.setWidget(content);
    dialogBox.setText("I can haz popups?");
    dialogBox.setAutoHideEnabled(false);
    dialogBox.setAnimationEnabled(true);
    dialogBox.setAutoHideOnHistoryEventsEnabled(true);
    dialogBox.setGlassEnabled(true);/*from  w w w.j av  a2 s  .  c  o  m*/

    dialogBox.center();
}

From source file:it.unibo.cs.v2.client.NewMachineWizard.java

License:Open Source License

@Override
public void onFailure(Throwable caught) {
    DialogBox errorDialog = new DialogBox();
    errorDialog.setAnimationEnabled(true);
    errorDialog.setWidget(new HTML("An error occured while querying the RPC server, please refresh the page."));
    errorDialog.show();/*from ww w .  ja v  a  2s  . c o m*/
}

From source file:lv.abuzdin.client.simple.SimplePanelExample.java

License:Open Source License

public SimplePanelExample() {
    HorizontalPanel panel = new HorizontalPanel();
    panel.setWidth("100%");

    final Button sendButton = new Button(messages.sendButton());
    sendButton.addStyleName("sendButton");
    panel.add(sendButton);//from   ww w  . ja  va 2 s  .c o  m

    final TextBox nameField = new TextBox();
    nameField.setText(messages.nameField());
    nameField.setFocus(true);
    nameField.selectAll();
    panel.add(nameField);

    final Label errorLabel = new Label();
    panel.add(errorLabel);

    panel.setCellHorizontalAlignment(sendButton, HasHorizontalAlignment.ALIGN_RIGHT);
    panel.setCellHorizontalAlignment(errorLabel, HasHorizontalAlignment.ALIGN_LEFT);

    final Button closeButton = new Button("Close");
    closeButton.getElement().setId("closeButton");

    final Label textToServerLabel = new Label();
    final HTML serverResponseLabel = new HTML();

    VerticalPanel dialogVPanel = new VerticalPanel();
    dialogVPanel.addStyleName("dialogVPanel");
    dialogVPanel.add(new HTML("<b>Sending name to the server:</b>"));
    dialogVPanel.add(textToServerLabel);
    dialogVPanel.add(new HTML("<br><b>Server replies:</b>"));
    dialogVPanel.add(serverResponseLabel);
    dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT);
    dialogVPanel.add(closeButton);

    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText("Remote Procedure Call");
    dialogBox.setAnimationEnabled(true);
    dialogBox.setWidget(dialogVPanel);

    // Add a handler to close the DialogBox
    closeButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            dialogBox.hide();
            sendButton.setEnabled(true);
            sendButton.setFocus(true);
        }
    });

    // Create a handler for the sendButton and nameField
    class MyHandler implements ClickHandler, KeyUpHandler {
        /**
         * Fired when the user clicks on the sendButton.
         */
        public void onClick(ClickEvent event) {
            sendNameToServer();
        }

        /**
         * Fired when the user types in the nameField.
         */
        public void onKeyUp(KeyUpEvent event) {
            if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
                sendNameToServer();
            }
        }

        /**
         * Send the name from the nameField to the server and wait for a response.
         */
        private void sendNameToServer() {
            // First, we validate the input.
            errorLabel.setText("");
            String textToServer = nameField.getText();
            if (!FieldVerifier.isValidName(textToServer)) {
                errorLabel.setText("Please enter at least four characters");
                return;
            }

            // Then, we send the input to the server.
            sendButton.setEnabled(false);
            textToServerLabel.setText(textToServer);
            serverResponseLabel.setText("");
            greetingService.greetServer(textToServer, new AsyncCallback<String>() {
                @Override
                public void onSuccess(String result) {
                    dialogBox.setText("Remote Procedure Call");
                    serverResponseLabel.removeStyleName("serverResponseLabelError");
                    serverResponseLabel.setHTML(result);
                    dialogBox.center();
                    closeButton.setFocus(true);
                }

                @Override
                public void onFailure(Throwable throwable) {
                }
            });
        }
    }

    // Add a handler to send the name to the server
    MyHandler handler = new MyHandler();
    sendButton.addClickHandler(handler);
    nameField.addKeyUpHandler(handler);

    initWidget(panel);
}

From source file:net.meddeb.md.admin.client.MenuLauncher.java

License:Open Source License

private void doShowError(String msg) {
    final DialogBox errorBox = new DialogBox();
    msg = "<strong>" + mainMsg.loginError() + "</strong><p>" + msg + "</p>";
    final HTML helpMessage = new HTML(msg);
    VerticalPanel helpPanel = new VerticalPanel();
    final Button closeButton = new Button(mainMsg.close());
    closeButton.getElement().setId("closeButton");
    closeButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            errorBox.hide();/*from  w  w  w .  j  av  a2  s. c o  m*/
        }
    });
    errorBox.setText(mainMsg.errorTitle());
    helpPanel.addStyleName("dialogPanel");
    helpPanel.add(helpMessage);
    helpPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT);
    helpPanel.add(closeButton);
    errorBox.setWidget(helpPanel);
    errorBox.center();
    closeButton.setFocus(true);
}

From source file:net.meddeb.md.admin.client.MenuLauncher.java

License:Open Source License

private void doHelpLink() {
    final DialogBox helpBox = new DialogBox();
    String msg = mainMsg.help1();
    msg = msg + "<p><a href=\"" + mainMsg.help2() + " \"target=\"_blank\">" + mainMsg.help2() + "</a></p>";
    final HTML helpMessage = new HTML(msg);
    VerticalPanel helpPanel = new VerticalPanel();
    final Button closeButton = new Button(mainMsg.close());
    closeButton.getElement().setId("closeButton");
    closeButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            helpBox.hide();/*from w  w  w  .  j a v  a  2s.  c  om*/
        }
    });
    helpBox.setText(mainMsg.helpLink());
    helpPanel.addStyleName("dialogPanel");
    helpPanel.add(helpMessage);
    helpPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT);
    helpPanel.add(closeButton);
    helpBox.setWidget(helpPanel);
    helpBox.center();
    closeButton.setFocus(true);
}

From source file:net.meddeb.md.admin.client.MenuLauncher.java

License:Open Source License

private void doHelpAbout() {
    final DialogBox aboutBox = new DialogBox();
    String msg = "<b>mdDiradmin</b>, " + mainMsg.appTitle();
    msg = msg + "<p>" + VERSION;
    msg = msg + "<br/>Copyright (C) 2015  Abdelhamid MEDDEB <abdelhamid@meddeb.net></p>";
    msg = msg + "<p>" + mainMsg.gnuLicense() + "</p>";
    msg = msg + "<p>" + mainMsg.noWarranty() + "</p>";
    final HTML aboutMessage = new HTML(msg);
    VerticalPanel aboutPanel = new VerticalPanel();
    final Button closeButton = new Button(mainMsg.close());
    closeButton.getElement().setId("closeButton");
    closeButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            aboutBox.hide();/*  w  ww .  ja  v  a2s . c  om*/
        }
    });
    aboutBox.setText(mainMsg.helpAbout());
    aboutPanel.addStyleName("dialogPanel");
    aboutPanel.add(aboutMessage);
    aboutPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT);
    aboutPanel.add(closeButton);
    aboutBox.setWidget(aboutPanel);
    aboutBox.center();
    closeButton.setFocus(true);
}