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

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

Introduction

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

Prototype

public DialogBox() 

Source Link

Document

Creates an empty dialog box.

Usage

From source file:edu.cudenver.bios.glimmpse.client.panels.ResultsDisplayPanel.java

License:Open Source License

private void buildWaitDialog() {
    waitDialog = new DialogBox();
    waitDialog.setGlassEnabled(true);/*from  w  ww .  j a  va2  s  .  c om*/
    HTML text = new HTML("Processing, Please Wait...");
    text.setStyleName("waitDialogText");
    waitDialog.setStyleName("waitDialog");
    waitDialog.setWidget(text);
}

From source file:edu.iastate.airl.semtus.client.SEMTUSWEBAPP.java

License:Open Source License

/**
 * This is the entry point method.//from   w  w  w .  j  a v a 2 s. co  m
 */
public void onModuleLoad() {

    MenuBar menu = (MenuBar) createMenu();

    sendButton = new Button("Send");
    inputField = new TextArea();
    inputField.setText(
            "Input some text based on the uploaded ontology for analysis.\n\n [PS: Remember to upload an ontology model for your domain to get relevant results.");
    final Label errorLabel = new Label();

    // We can add style names to widgets
    sendButton.addStyleName("sendButton");
    inputField.setSize("590px", "200px");

    // Create a table to layout the form options
    FlexTable layout = new FlexTable();
    layout.setCellSpacing(6);
    FlexCellFormatter cellFormatter = layout.getFlexCellFormatter();

    // Add a title to the form
    cellFormatter.setColSpan(0, 0, 3);
    cellFormatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER);

    // Add some standard form options
    layout.setWidget(1, 1, inputField);
    layout.setWidget(2, 1, sendButton);

    DecoratorPanel panel = new DecoratorPanel();

    // Add the nameField and sendButton to the RootPanel
    panel.add(layout);

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

    // Create the popup dialog box
    dialogBox = new DialogBox();
    dialogBox.setText(
            "<p align=\"center\"><font color=\"#000000\" face=\"verdana\" size=\"2\">Visualize Complete RDF Graph</font></p>");
    dialogBox.setAnimationEnabled(true);
    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();
    serverResponseLabel = new HTML();

    dialogBoxLoadingBar = new DialogBox();
    dialogBoxLoadingBar.setAnimationEnabled(true);
    final VerticalPanel dialogVPanelLoadingBar = new VerticalPanel();
    dialogVPanelLoadingBar.setWidth("200");
    dialogVPanelLoadingBar
            .add(new Label("---------------------------------- Processing --------------------------------"));
    dialogVPanelLoadingBar.add(new Image("http://sushain.com/profile/images/con-bar3.gif"));
    dialogBoxLoadingBar.setWidget(dialogVPanelLoadingBar);

    dialogVPanel = new VerticalPanel();
    dialogVPanel.addStyleName("dialogVPanel");
    // dialogVPanel.add(textToServerLabel);
    // dialogVPanel.add(new HTML("<br><b>Server replies:</b>"));
    dialogVPanel.add(serverResponseLabel);
    dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
    dialogVPanel.add(closeButton);
    dialogBox.setWidget(dialogVPanel);

    announcementBox = new DialogBox();
    announcementBox.setHTML(
            "<p align=\"center\"><font color=\"#000000\" face=\"verdana\" size=\"2\">SEMANTIXS Analysis Complexity Level Setting</font></p>");
    announcementCloseButton = new Button("Close");
    announcementDialogVPanel = new VerticalPanel();
    announcementLabel = new HTML();
    announcementDialogVPanel.addStyleName("announcementDialogVPanel");
    announcementDialogVPanel.add(announcementLabel);
    announcementDialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
    announcementDialogVPanel.add(announcementCloseButton);
    announcementBox.setWidget(announcementDialogVPanel);

    // Create a tab panel
    tabPanel = new DecoratedTabPanel();
    tabPanel.setWidth("645px");
    tabPanel.setHeight("100px");
    tabPanel.setAnimationEnabled(true);

    // Add a home tab
    String[] tabTitles = new String[] { "Workspace View", "Input Ontology-based Text Here",
            "View Extracted Semantic Data" };
    HTML homeText = new HTML("<p align=\"center\"><font color=\"#e0c190\" face=\"Times\" size=\"6\">"
            + "<b>SEMANTIXS</b></font>"
            + "<br/><font color=\"#e0c190\" face=\"Times\" size=\"3\">version 1.0.1</font><br/>" + "</p>");

    tabPanel.add(homeText, tabTitles[0]);

    // Add a tab
    VerticalPanel vPanel = new VerticalPanel();
    vPanel.add(panel);
    tabPanel.add(vPanel, tabTitles[1]);

    // Create a table to layout the form options
    FlexTable layout1 = new FlexTable();
    layout1.setCellSpacing(6);
    FlexCellFormatter cellFormatter1 = layout1.getFlexCellFormatter();

    // Add a title to the form
    cellFormatter1.setColSpan(0, 0, 3);
    cellFormatter1.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER);

    resultField = new TextArea();
    resultField.setText("Send some text for processing before trying to view the results in this tab.");
    resultField.setSize("590px", "225px");

    // Add some standard form options
    layout1.setWidget(1, 1, resultField);
    DecoratorPanel panel1 = new DecoratorPanel();

    // Add the nameField and sendButton to the RootPanel
    panel1.add(layout1);
    VerticalPanel vPanel1 = new VerticalPanel();
    vPanel1.add(panel1);
    tabPanel.add(vPanel1, tabTitles[2]);

    tabPanel.selectTab(0);
    tabPanel.ensureDebugId("cwTabPanel");

    panelHoldingTabPanel = new DecoratorPanel();
    panelHoldingTabPanel.setHeight("450px");
    panelHoldingTabPanel.setWidth("650px");
    panelHoldingTabPanel.setWidget(tabPanel);
    panelHoldingTabPanel.setVisible(false);

    panelHoldingTabPanel.setStyleName("panelHoldingTabPanel");

    RootPanel.get("nameFieldContainer").add(menu);
    RootPanel.get("sendButtonContainer").add(panelHoldingTabPanel);
    // RootPanel.get("errorLabelContainer").add(errorLabel);

    RootPanel.getBodyElement().setId("main");

    FormPanel uploadForm = upload();
    uploadBox = new DialogBox();
    uploadBox.setText("Ontology Upload");
    uploadBox.setAnimationEnabled(true);
    uploadBox.setWidget(uploadForm);
    uploadBox.hide();

    // Set default analysis level for SEMANTIXS as 1
    level = LEVEL_ONE;

    // Add a handler to close the DialogBox
    closeButton.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {

            dialogBox.hide();
            tabPanel.selectTab(2);
            sendButton.setEnabled(true);
            sendButton.setFocus(false);
        }
    });

    // Add a handler to close the AnnouncementBox
    announcementCloseButton.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {

            announcementBox.hide();
        }
    });

    // 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) {
            sendTextToServer();
        }

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

        /**
         * Send the name from the nameField to the server and wait for a
         * response.
         */
        private void sendTextToServer() {
            // First, we validate the input.
            errorLabel.setText("");
            String textToServer = inputField.getText();

            if (!FieldVerifier.isValidName(textToServer)) {
                errorLabel.setText(
                        "Please enter a long enough sentence for SEMANTIXS to be able to map it to the ontology definitions");
                return;
            }

            dialogBoxLoadingBar.center();

            // Then, we send the input to the server.
            sendButton.setEnabled(false);

            textToServerLabel.setText(textToServer);
            serverResponseLabel.setText("");

            greetingService.handleInput(textToServer, level, new AsyncCallback<String>() {
                public void onFailure(Throwable caught) {
                    // Show the RPC error message to the user

                    dialogBoxLoadingBar.hide();
                    sendButton.setEnabled(false);
                    dialogBox.setText("Remote Procedure Call - Failure");
                    serverResponseLabel.addStyleName("serverResponseLabelError");
                    serverResponseLabel.setHTML(SERVER_ERROR);
                    dialogBox.center();
                    closeButton.setFocus(true);
                }

                public void onSuccess(String result) {

                    dialogBoxLoadingBar.hide();
                    sendButton.setEnabled(false);
                    dialogBox.setText("SEMANTIXS response:");
                    serverResponseLabel.removeStyleName("serverResponseLabelError");

                    serverResponseLabel.setHTML(
                            "<b>SEMANTIXS has finished processing the text. Please view the extracted results under - \"View Extracted Semantic Data\" tab.</b>");
                    resultField.setText(result);
                    dialogBox.center();
                    closeButton.setFocus(true);
                }
            });
        }
    }

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

From source file:edu.ucdenver.bios.glimmpseweb.client.shared.CancelDialogBox.java

License:Open Source License

public Widget cancelDialogBox() {
    DialogBox dialogBox = new DialogBox();
    dialogBox.setGlassEnabled(true);//from w ww .  j a  va2 s  . c o m
    dialogBox.setAnimationEnabled(true);
    HTML query = new HTML(GlimmpseWeb.constants.cancelDialogBoxQuery());
    Button saveButton = new Button("Save", new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            // TODO Auto-generated method stub

        }

    });
    Button discardChangesButton = new Button("Discard Changes", new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            // TODO Auto-generated method stub

        }

    });
    Button continueButton = new Button("Continue", new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            // TODO Auto-generated method stub

        }

    });

    saveButton.setStyleName(STYLE_BUTTON);
    discardChangesButton.setStyleName(STYLE_BUTTON);
    continueButton.setStyleName(STYLE_BUTTON);
    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.add(saveButton);
    horizontalPanel.add(discardChangesButton);
    horizontalPanel.add(continueButton);
    horizontalPanel.setSpacing(10);

    VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.add(query);
    verticalPanel.add(horizontalPanel);

    dialogBox.setText("Cancel Dialog Box");
    dialogBox.add(verticalPanel);
    dialogBox.show();

    return dialogBox;
}

From source file:edu.ucdenver.bios.glimmpseweb.client.shared.ResultsDisplayPanel.java

License:Open Source License

/**
 * Build a processing dialog//w  w  w . ja va2s. co  m
 */
private void buildWaitDialog() {
    waitDialog = new DialogBox();
    waitDialog.setGlassEnabled(true);
    HTML text = new HTML("Processing, Please Wait...");
    text.setStyleName("waitDialogText");
    waitDialog.setStyleName("waitDialog");
    waitDialog.setWidget(text);
}

From source file:edu.udes.bio.genus.client.algo.match.MatchCallback.java

License:Open Source License

@Override
public void onSuccess(AbsAlgorithm result) {
    VerticalPanel vp;//from   w w w  .ja va2 s.co  m
    HorizontalPanel hp;
    Image img;

    this.result = result;

    img = new Image(this.parent.imagesBundle.checkButtonIcon());// Image("Red_X.png");
    // img.addClickHandler(new CancelClickHandler());
    this.parent.imageContainer.clear();
    this.parent.imageContainer.add(img);

    this.db = new DialogBox();
    vp = new VerticalPanel();

    vp.add(new Label("Result : "));

    hp = new HorizontalPanel();
    hp.add(new Label("Strand : "));
    hp.add(new Label(result.getStructsResult()[0].rna.getSequence()));
    vp.add(hp);

    hp = new HorizontalPanel();
    hp.add(new Label("Matches : "));
    hp.add(new Label("" + result.getStructsResult()[0].match));
    vp.add(hp);

    this.ch = new CheckBox("Add strand to pool");
    this.ch.setValue(true);
    this.ch.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            MatchCallback.this.txtName.setEnabled(MatchCallback.this.ch.getValue());
        }
    });

    vp.add(this.ch);

    hp = new HorizontalPanel();

    this.txtName = new TextBox();
    this.txtName.setText("Match Algo");
    // txtName.setEnabled(false);

    hp.add(new Label("Name : "));
    hp.add(this.txtName);

    vp.add(hp);

    vp.add(new Button("Close", new CloseHandler()));

    vp.setPixelSize(250, 250);
    this.db.add(vp);
    this.db.setPixelSize(250, 250);

    this.db.setText("Server answer");
    this.db.center();
    this.db.show();
}

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

License:Apache License

/**
 * This is the entry point method./* w  w  w.ja v a2  s .c o  m*/
 */
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

/**
 * Create the dialog box for this example.
 * //from w  ww .j a  v  a2 s.  c  o m
 * @return the new dialog box
 */
private DialogBox createSearchDialogBox() {
    // Create a dialog box and set the caption text
    final DialogBox dialogBox = new DialogBox();
    dialogBox.ensureDebugId("cwDialogBox");
    dialogBox.setText(EuropeanaClientConstants.SEARCHDIALOGMSG);
    dialogBox.setModal(true);

    // Create a table to layout the content
    VerticalPanel dialogContents = new VerticalPanel();
    dialogContents.setSpacing(0);
    dialogBox.setWidget(dialogContents);
    Image activity = new Image(EuropeanaClientConstants.QUERYIMAGELOC);

    // Add some text to the top of the dialog

    dialogContents.add(activity);
    dialogContents.setCellHorizontalAlignment(activity, HasHorizontalAlignment.ALIGN_CENTER);

    // Return the dialog box
    return dialogBox;
}

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

License:EUPL

/**
 * Creates an import dialog/*www .  ja v  a 2  s. 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  ww w .j  a v  a2  s. 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: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);//from www .j  a va  2s .co m
    dialogBox.setText("I can haz popups?");
    dialogBox.setAutoHideEnabled(false);
    dialogBox.setAnimationEnabled(true);
    dialogBox.setAutoHideOnHistoryEventsEnabled(true);
    dialogBox.setGlassEnabled(true);

    dialogBox.center();
}