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

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

Introduction

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

Prototype

@Override
    public void show() 

Source Link

Usage

From source file:org.eobjects.datacleaner.monitor.util.ErrorHandler.java

License:Open Source License

/**
 * Shows an error dialog/*from  w ww.java 2  s .c o  m*/
 * 
 * @param messageHeader
 * @param details
 * @param additionalDetails
 */
public static void showErrorDialog(String messageHeader, String details, String additionalDetails) {
    final DialogBox dialogBox = getDialogBox();

    final FlowPanel panel = new FlowPanel();
    final Label messageLabel = new Label(messageHeader);
    messageLabel.addStyleName("Message");
    panel.add(messageLabel);

    if (details != null && details.trim().length() > 0) {
        final TextArea textArea = new TextArea();
        textArea.setText(details);
        textArea.setReadOnly(true);
        textArea.addStyleName("Details");

        panel.add(textArea);
    }

    if (additionalDetails != null && additionalDetails.trim().length() > 0) {
        final TextArea textArea = new TextArea();
        textArea.setText(additionalDetails);
        textArea.setReadOnly(true);
        textArea.addStyleName("AdditionalMessageDetails");

        panel.add(textArea);
    }

    final Button closeButton = new Button("Close");
    closeButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            dialogBox.hide();
        }
    });

    final ButtonPanel buttonPanel = new ButtonPanel();
    buttonPanel.add(closeButton);
    panel.add(buttonPanel);

    dialogBox.setWidget(panel);
    dialogBox.center();
    dialogBox.show();
}

From source file:org.gatein.management.gadget.client.Application.java

License:Open Source License

@Override
protected void init(UserPreferences preferences) {
    ((ServiceDefTarget) gtnService).setServiceEntryPoint(SERVLET_CONTEXT_PATH + "/gtnService");
    TreeImages images = GWT.create(TreeImages.class);

    RootPanel rootPanel = RootPanel.get();
    rootPanel.setSize("885px", "490px");
    rootPanel.addStyleName("rootpanelstyle");

    DecoratedTabPanel decoratedTabPanel = new DecoratedTabPanel();
    decoratedTabPanel.setAnimationEnabled(true);
    rootPanel.add(decoratedTabPanel, 10, 10);
    decoratedTabPanel.setSize("870px", "480px");

    AbsolutePanel absolutePanel = new AbsolutePanel();
    absolutePanel.setSize("847px", "425px");

    DecoratorPanel decoratorPanelWest = new DecoratorPanel();
    absolutePanel.add(decoratorPanelWest, 10, 10);
    decoratorPanelWest.setSize("240px", "400px");

    AbsolutePanel treePanel = new AbsolutePanel();
    treePanel.setSize("230px", "395px");
    decoratorPanelWest.setWidget(treePanel);

    ScrollPanel treeScrollPanel = new ScrollPanel();
    treePanel.add(treeScrollPanel, 10, 10);
    treeScrollPanel.setSize("210px", "375px");

    final Tree tree = getTree(images);
    treeScrollPanel.setWidget(tree);/*w  ww.j a  v a  2 s.  co  m*/

    final DecoratorPanel decoratorPanelCenter = new DecoratorPanel();

    absolutePanel.add(decoratorPanelCenter, 256, 10);
    decoratorPanelCenter.setSize("400px", "402px");

    AbsolutePanel centerAbsolutePanel = new AbsolutePanel();
    centerAbsolutePanel.setSize("97%", "100%");

    this.header = new HTML("Select an item");
    this.header.setDirectionEstimator(true);
    centerAbsolutePanel.add(this.header, 10, 10);
    this.header.setSize("450px", "50px");
    this.header.setStyleName("header-style");

    this.details = new HTML("No item selected");
    centerAbsolutePanel.add(this.details, 10, 76);
    this.details.setSize("450px", "156px");

    HTML html = new HTML("<hr />", true);
    centerAbsolutePanel.add(html, 10, 43);
    html.setSize("380px", "15px");

    this.frame = new NamedFrame("download-frame");
    frame.setStyleName("download-frame");
    rootPanel.add(frame);

    this.exportButton = new Button("Export site", new ClickHandler() {

        public void onClick(ClickEvent event) {
            frame.setUrl(exportHref);
        }
    });
    this.exportButton.setEnabled(false);
    centerAbsolutePanel.add(this.exportButton, 10, 359);
    decoratorPanelCenter.setWidget(centerAbsolutePanel);
    centerAbsolutePanel.setSize("400px", "393px");

    DecoratorPanel decoratorPanelEast = new DecoratorPanel();
    absolutePanel.add(decoratorPanelEast, 672, 10);
    decoratorPanelEast.setSize("165px", "405px");
    AbsolutePanel absolutePanelImportLink = new AbsolutePanel();
    absolutePanelImportLink.setSize("162px", "395px");

    final Anchor importAnchor = new Anchor("Import site");
    absolutePanelImportLink.add(importAnchor, 10, 10);
    importAnchor.setWidth("90%");

    decoratorPanelEast.setWidget(absolutePanelImportLink);

    decoratedTabPanel.add(absolutePanel, "Export/Import sites", false);
    Widget userManagementWidget = getUserManagementTab();
    decoratedTabPanel.add(userManagementWidget, "User management", false);

    importAnchor.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            DialogBox dialogBox = createDialogBox();
            dialogBox.setPopupPosition(267, 60);
            dialogBox.show();
        }
    });

    decoratedTabPanel.selectTab(0);
}

From source file:org.gatein.management.gadget.mop.exportimport.client.Application.java

License:Open Source License

@Override
protected void init(UserPreferences preferences) {
    ((ServiceDefTarget) gtnService).setServiceEntryPoint(EXPORT_IMPORT_SERVLET_BASE + "/GateInService");

    selectionHandler = createSelectionHandler();
    openHandler = createOpenHandler();/*from  w ww  . ja v  a 2s .  co  m*/

    TreeImages images = GWT.create(TreeImages.class);

    RootPanel rootPanel = RootPanel.get();

    FlowPanel gadgetPanel = new FlowPanel();
    gadgetPanel.setStyleName("ImportExportContent");
    rootPanel.add(gadgetPanel);

    DecoratedTabPanel decoratedTabPanel = new DecoratedTabPanel();
    decoratedTabPanel.setAnimationEnabled(true);
    gadgetPanel.add(decoratedTabPanel);
    decoratedTabPanel.setSize("870px", "480px");

    AbsolutePanel absolutePanel = new AbsolutePanel();
    absolutePanel.setSize("847px", "425px");

    DecoratorPanel decoratorPanelWest = new DecoratorPanel();
    absolutePanel.add(decoratorPanelWest, 10, 10);
    decoratorPanelWest.setSize("240px", "400px");

    AbsolutePanel treePanel = new AbsolutePanel();
    treePanel.setSize("230px", "395px");
    decoratorPanelWest.setWidget(treePanel);

    ScrollPanel treeScrollPanel = new ScrollPanel();
    treePanel.add(treeScrollPanel, 10, 10);
    treeScrollPanel.setSize("210px", "375px");

    final Tree tree = getTree(images);
    treeScrollPanel.setWidget(tree);

    final DecoratorPanel decoratorPanelCenter = new DecoratorPanel();

    absolutePanel.add(decoratorPanelCenter, 256, 10);
    decoratorPanelCenter.setSize("400px", "402px");

    AbsolutePanel centerAbsolutePanel = new AbsolutePanel();
    centerAbsolutePanel.setSize("97%", "100%");

    this.header = new HTML("Select an item");
    this.header.setDirectionEstimator(true);
    centerAbsolutePanel.add(this.header, 10, 10);
    this.header.setSize("450px", "50px");
    this.header.setStyleName("header-style");

    this.details = new HTML("No item selected");
    centerAbsolutePanel.add(this.details, 10, 76);
    this.details.setSize("450px", "156px");

    HTML html = new HTML("<hr />", true);
    centerAbsolutePanel.add(html, 10, 43);
    html.setSize("380px", "15px");

    this.frame = new NamedFrame("download-frame");
    frame.setStyleName("download-frame");
    gadgetPanel.add(frame);

    this.exportButton = new Button("Export site", new ClickHandler() {

        public void onClick(ClickEvent event) {
            frame.setUrl(exportHref);
        }
    });
    this.exportButton.setEnabled(false);
    centerAbsolutePanel.add(this.exportButton, 10, 359);
    decoratorPanelCenter.setWidget(centerAbsolutePanel);
    centerAbsolutePanel.setSize("400px", "393px");

    DecoratorPanel decoratorPanelEast = new DecoratorPanel();
    absolutePanel.add(decoratorPanelEast, 672, 10);
    decoratorPanelEast.setSize("165px", "405px");
    AbsolutePanel absolutePanelImportLink = new AbsolutePanel();
    absolutePanelImportLink.setSize("162px", "395px");

    final Anchor importAnchor = new Anchor("Import site");
    absolutePanelImportLink.add(importAnchor, 10, 10);
    importAnchor.setWidth("90%");

    decoratorPanelEast.setWidget(absolutePanelImportLink);

    decoratedTabPanel.add(absolutePanel, "Export/Import sites", false);
    importAnchor.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            DialogBox dialogBox = createDialogBox();
            dialogBox.setPopupPosition(267, 60);
            dialogBox.show();
        }
    });

    decoratedTabPanel.selectTab(0);
}

From source file:org.geosdi.geoplatform.gui.client.action.menu.legend.GetLegendGraphicsBox.java

License:Open Source License

@Override
public void componentSelected(MenuEvent ce) {
    GPBeanTreeModel item = (GPBeanTreeModel) this.treePanel.getSelectionModel().getSelectedItem();
    DialogBox legendDialog = new DialogBox();
    legendDialog.setModal(false);/*from  ww w .  j  a v  a 2s. com*/
    if (item instanceof RasterTreeNode) {
        String dataSource = ((RasterTreeNode) item).getDataSource();
        legendDialog.setText(((RasterTreeNode) item).getName());
        legendDialog.setAnimationEnabled(true);
        legendDialog.setAutoHideEnabled(true);
        Image image;

        if (dataSource.contains("gwc/service/wms")) {
            dataSource = dataSource.replaceAll("gwc/service/wms", "wms");
        } else if (!(dataSource.startsWith("http://ows")) && (dataSource.contains("/ows"))) {
            dataSource = dataSource.replaceAll("/ows", "/wms");
        } else {
            dataSource = dataSource.replaceAll("/wfs", "/wms");
        }
        StringBuilder imageURL = new StringBuilder();
        imageURL.append(dataSource).append(GET_LEGEND_REQUEST).append(((RasterTreeNode) item).getName())
                .append("&scale=5000&service=WMS");
        if (((RasterTreeNode) item).getStyles() != null && ((RasterTreeNode) item).getStyles().size() > 0) {
            imageURL.append("&STYLE=").append(((RasterTreeNode) item).getStyles().get(0).getStyleString());
        }
        String authkeyTuple = GSAuthKeyManager.getAuthKeyTuple();
        if (!authkeyTuple.equals("")) {
            imageURL.append('&').append(authkeyTuple);
        }
        image = new Image(imageURL.toString());
        legendDialog.add(image);

        legendDialog.show();

        legendDialog.setPopupPosition(ce.getMenu().getPosition(true).x, ce.getMenu().getPosition(true).y);

    }

}

From source file:org.gss_project.gss.web.client.commands.ViewImageCommand.java

License:Open Source License

@Override
public void execute() {
    containerPanel.hide();/* w w  w .j a v a2s.com*/

    final Image image = new Image();
    // Hook up a load handler, so that we can be informed if the image
    // fails to load.
    image.addLoadHandler(new LoadHandler() {

        @Override
        public void onLoad(LoadEvent event) {
            errorLabel.setText("");
        }
    });
    image.addErrorHandler(new ErrorHandler() {

        @Override
        public void onError(ErrorEvent event) {
            errorLabel.setText("An error occurred while loading.");
        }
    });
    image.setUrl(imageDownloadURL);
    final DialogBox imagePopup = new DialogBox(true, true);
    imagePopup.setAnimationEnabled(true);
    imagePopup.setText("Showing image in actual size");
    VerticalPanel imageViewPanel = new VerticalPanel();
    errorLabel.setText("loading image...");
    imageViewPanel.add(errorLabel);
    imageViewPanel.add(image);
    imagePopup.setWidget(imageViewPanel);
    image.setTitle("Click to close");
    image.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            imagePopup.hide();
        }
    });
    imagePopup.setPopupPosition(0, 0);
    imagePopup.show();
}

From source file:org.jboss.ci.tracker.client.widgets.ResultList.java

License:Open Source License

@UiHandler("filterButton")
void onFilterButtonClick(ClickEvent event) {
    DialogBox filterDialogBox = CustomWidgets.filterDialogBox(this, categorizationList, categoryList,
            possibleResultList, filter);
    filterDialogBox.setPopupPosition(filterButton.getAbsoluteLeft(),
            filterButton.getAbsoluteTop() + filterButton.getOffsetHeight());
    filterDialogBox.show();
}

From source file:org.kepler.web.client.DynaTableWidget.java

License:Apache License

public void onCellClicked(SourcesTableEvents sender, int row, int cell) {
    // Select the row that was clicked (-1 to account for header row).
    if (((row + currentBeginRecordNum) - 2) < currentEndRecordNum) {
        if (row > 0) {
            selectRow(row - 1);//www  .j av  a 2s .c  om
        }

        if (cell == 0) {
            //create the dialog and send the name and docid to the dialog
            DialogBox dlg = new InfoDialog(grid.getText(row, 1), grid.getText(row, 2));
            int left = 50;
            int top = 50;
            dlg.setPopupPosition(left, top);
            dlg.show();
        }
    }
}

From source file:org.nightcode.gwt.selectio.client.Selector.java

License:Apache License

/**
 * Shows selector dialog panel.//from  w  ww  . ja  v a 2 s.  c o m
 *
 * @param inputId id of html element which will contain user input
 * @param entityName name of entity
 * @param server server name
 * @param function js function which will be executed if OK button pushed
 */
public static void showSelector(String inputId, String entityName, String server, String function,
        String selection, String title) {
    String url = server + "/selectio?q=" + entityName;

    DialogBox dialogBox = createDialogBox(url, RootPanel.get(inputId), function, selection, title);
    dialogBox.setGlassEnabled(true);
    dialogBox.setAnimationEnabled(true);
    dialogBox.center();
    dialogBox.show();
}

From source file:org.nuxeo.ecm.platform.gwt.client.model.GetDocument.java

License:Open Source License

@Override
public void onFailure(Throwable cause) {
    if (cause instanceof ServerException) {
        ServerException e = (ServerException) cause;
        if (e.getStatusCode() == 401) {
            DialogBox box = new DialogBox();
            box.setSize("400", "300");
            box.setTitle("Login");
            box.show();
            // TODO new LoginCommand().execute();
            return;
        }/*from w  w  w  . j  a  v  a2 s . c  o  m*/
        super.onFailure(cause);
    }
}

From source file:org.nuxeo.opensocial.container.client.view.ContainerBuilderWidget.java

License:Open Source License

public void showHTMLCode(String codeSource) {
    final DialogBox codePopup = new DialogBox(true, true);
    codePopup.setGlassEnabled(true);//  www  .  ja  va 2  s.  c  o m
    codePopup.setText(constants.showCodeTitle());

    String[] lignesCode = codeSource.split("\n");

    VerticalPanel tab = new VerticalPanel();

    for (String ligneCode : lignesCode) {
        String maLigne = new String(ligneCode);

        String[] ligne = ligneCode.split("\t");
        for (String texte : ligne) {
            if (texte.equals("")) {
                maLigne = "&nbsp;&nbsp;&nbsp;&nbsp;" + maLigne;
            }
        }
        maLigne = maLigne.replace("<", "&lt;");
        maLigne = maLigne.replace("div", "<span style='color: blue;'>div</span>");
        maLigne = maLigne.replace("id=", "<span style='color: red;'>id</span>=");
        maLigne = maLigne.replace("class", "<span style='color: red;'>class</span>");

        int commentBegin = maLigne.indexOf("&lt;!--");

        if (commentBegin != -1) {
            int commentEnd = maLigne.indexOf("-->");
            String comment = maLigne.substring(commentBegin, commentEnd + 3);
            maLigne = maLigne.replace(comment, "<span style='color: #008000;'>" + comment + "</span>");
        }

        HTML htmlLine = new HTML(maLigne);
        htmlLine.setStyleName("builder-source");
        tab.add(htmlLine);
    }

    Button closeButton = new Button(constants.close(), new ClickHandler() {
        public void onClick(ClickEvent event) {
            codePopup.hide();
        }
    });

    tab.add(closeButton);
    tab.setCellHorizontalAlignment(closeButton, HasHorizontalAlignment.ALIGN_CENTER);

    codePopup.add(tab);
    codePopup.center();
    codePopup.show();
}