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

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

Introduction

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

Prototype

@Override
    public void hide() 

Source Link

Usage

From source file:com.sun.labs.aura.dbbrowser.client.viz.VizUI.java

License:Open Source License

protected static void addConfDialog(final Label clickable, final ClickListener listener, final String msg) {
    ///*from w  w w. j a  v  a 2  s .c  o  m*/
    // create the logic to show a dialog when the widget is clicked
    clickable.addClickListener(new ClickListener() {
        public void onClick(Widget arg0) {
            //
            // make the dialog
            final DialogBox dbox = new DialogBox(true, true);
            FlowPanel contents = new FlowPanel();
            dbox.setWidget(contents);
            contents.add(new Label(msg));
            Button b = new Button("Yes");
            b.addClickListener(listener);
            b.addClickListener(new ClickListener() {
                public void onClick(Widget arg0) {
                    dbox.hide();
                }
            });
            contents.add(b);
            dbox.setPopupPosition(clickable.getAbsoluteLeft(), clickable.getAbsoluteTop());
            dbox.show();
        }
    });
}

From source file:com.sun.labs.aura.music.wsitm.client.ui.Popup.java

License:Open Source License

public static void showPopup(Widget w, String title, final DialogBox popup) {

    DockPanel docPanel = new DockPanel();

    Label closeButton = new Label("Close");
    closeButton.setStyleName("clickableLabel");
    closeButton.addStyleName("whiteTxt");
    closeButton.addClickHandler(new ClickHandler() {
        @Override/*w ww.j  ava2 s .co m*/
        public void onClick(ClickEvent ce) {
            popup.hide();
        }
    });

    FlowPanel container = new FlowPanel();
    container.setStyleName("outerpopup");
    container.add(w);

    docPanel.add(container, DockPanel.CENTER);
    docPanel.add(closeButton, DockPanel.SOUTH);
    docPanel.setCellHorizontalAlignment(closeButton, DockPanel.ALIGN_RIGHT);
    popup.add(docPanel);
    popup.setText(title);
    popup.setAnimationEnabled(true);
    popup.center();
}

From source file:edu.caltech.ipac.firefly.data.dyn.DynUtils.java

static public void PopupMessage(String title, String message) {
    final DialogBox p = new DialogBox(false, false);
    //p.setStyleName(INFO_MSG_STYLE);

    if (title != null) {
        p.setTitle(title);/*from  w w w.  j a va2s.  c  o m*/
    }

    VerticalPanel vp = new VerticalPanel();
    vp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    vp.setSpacing(10);
    vp.add(new HTML(message));
    vp.add(new HTML(""));

    Button b = new Button("Close");
    vp.add(b);

    p.setWidget(vp);
    p.center();

    b.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            p.hide();
            p.clear();
        }

    });

    p.show();
}

From source file:eu.cloud4soa.gwt.client.Application.java

License:Apache License

/**
 * This is the entry point method./*from  ww w  .  j a  v  a2 s.c  om*/
 */
public void onModuleLoad() {
    final Button sendButton = new Button("Try UC9 Sequence");
    final TextBox nameField = new TextBox();
    nameField.setText("webapp");
    final Label errorLabel = new Label();

    // We can add style names to widgets
    sendButton.addStyleName("sendButton");

    // Add the nameField and sendButton to the RootPanel
    // Use RootPanel.get() to get the entire body element
    RootPanel.get("nameFieldContainer").add(nameField);
    RootPanel.get("sendButtonContainer").add(sendButton);
    RootPanel.get("errorLabelContainer").add(errorLabel);

    // Focus the cursor on the name field when the app loads
    nameField.setFocus(true);
    nameField.selectAll();

    // Create the popup dialog box
    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText("Remote Procedure Call");
    dialogBox.setAnimationEnabled(true);
    final Button closeButton = new Button("Close");
    // We can set the id of a widget by accessing its Element
    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 application 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);
    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>() {
                public void onFailure(Throwable caught) {
                    // Show the RPC error message to the user
                    dialogBox.setText("Remote Procedure Call - Failure");
                    serverResponseLabel.addStyleName("serverResponseLabelError");
                    serverResponseLabel.setHTML(SERVER_ERROR);
                    dialogBox.center();
                    closeButton.setFocus(true);
                }

                public void onSuccess(String result) {
                    dialogBox.setText("Remote Procedure Call");
                    serverResponseLabel.removeStyleName("serverResponseLabelError");
                    serverResponseLabel.setHTML(result);
                    dialogBox.center();
                    closeButton.setFocus(true);
                }
            });
        }
    }

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

From source file:eu.europeana.uim.gui.cp.client.europeanawidgets.ImportResourcesWidget.java

License:EUPL

/**
 * Creates an import dialog// www . j  a v  a 2 s  . c  o 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/* ww  w.j  a  v  a 2  s.c om*/
 */
@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:gov.nist.appvet.gwt.client.gui.AppVetPanel.java

License:Open Source License

public static void killDialogBox(DialogBox dialogBox) {
    if (dialogBox != null) {
        dialogBox.hide();
        dialogBox = null;/*from  w w w.  j  a v  a2  s .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);/*w ww.j a  v  a  2s . 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();
        }//w  w w  .  j  a v a  2 s  .  c  om
    });
    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();
        }/*w  w  w  .j  a  v a  2  s.  co  m*/
    });
    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);
}