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(Caption captionWidget) 

Source Link

Document

Creates an empty dialog box specifying its Caption .

Usage

From source file:com.gmail.cjbooms.thesis.pythonappengine.client.menus.git.GitCommitLocalChangesDialogWidget.java

License:Open Source License

/**
 * Create the New Project Dialog Window/*w ww . j a  va  2  s  .  c  o  m*/
 *
 * @return dialog The created Dialog Box
 */
private DialogBox createCommitChangesDialog() {
    gitCommands = new GITCommands();

    DialogBox dialog = new DialogBox(true);
    dialog.setAnimationEnabled(true);
    dialog.center();
    dialog.setText(title);
    dialog.setGlassEnabled(true);

    VerticalPanel panel = new VerticalPanel();
    panel.setSpacing(5);
    panel.add(createCommitterNameEntry());
    panel.add(createCommitterEmailEntry());
    panel.add(createLogMessageTextBox());
    panel.add(createExecuteAndCancelButtons());

    dialog.add(panel);
    dialog.setAutoHideEnabled(true);
    return dialog;
}

From source file:com.gmail.cjbooms.thesis.pythonappengine.client.menus.HelpDialogWidget.java

License:Open Source License

private DialogBox createDialog() {
    VerticalPanel panel = new VerticalPanel();
    DialogBox dialog = new DialogBox(true);
    dialog.setAnimationEnabled(true);/*from w ww  . j  av  a  2  s .  co m*/
    dialog.center();
    dialog.setText(title);
    dialog.setGlassEnabled(true);
    panel.add(createHtmlContent());
    panel.add(createCloseButton());
    dialog.add(panel);

    //dialog.setAutoHideEnabled(false);
    return dialog;
}

From source file:com.gmail.cjbooms.thesis.pythonappengine.client.menus.OperationResultDialog.java

License:Open Source License

/**
 * Create the GIT Clone Dialog Window//ww  w  .  j  a  v  a  2s. co m
 *
 * @return dialog The created Dialog Box
 */
private DialogBox createGitStatusDialog(String message) {
    DialogBox dialog = new DialogBox(true);
    dialog.setAnimationEnabled(true);
    dialog.center();
    dialog.setText(title);
    dialog.setGlassEnabled(true);

    VerticalPanel panel = new VerticalPanel();
    panel.add(createHtmlContent(message));
    panel.add(createCloseDialogButton());

    dialog.add(panel);
    dialog.setAutoHideEnabled(true);
    return dialog;
}

From source file:com.google.caliper.cloud.client.BenchmarkDataViewer.java

License:Apache License

public void rebuildResultsTable() {
    if (plainText) {
        Label label = new Label();
        label.setStyleName("plaintext");
        label.setText(gridToString(toGrid()));

        resultsDiv.clear();//from  w  w w.j  a va 2  s .  c  o  m
        resultsDiv.add(label);
        resultsDiv.add(new PlainTextEditor().getWidget());
        HTML dash = new HTML(" - ", false);
        dash.setStyleName("inline");
        resultsDiv.add(dash);
        resultsDiv.add(new SnapshotCreator().getWidget());
        return;
    }

    FlexTable table = new FlexTable();
    table.setStyleName("data");
    int r = 0;
    int c = 0;
    int evenRowMod = 0;

    // results header #1: cValue variables
    if (cVariable != null) {
        evenRowMod = 1;
        table.insertRow(r);
        table.getRowFormatter().setStyleName(r, "valueRow");
        table.getRowFormatter().addStyleName(r, "headerRow");

        table.addCell(r);
        table.getFlexCellFormatter().setColSpan(r, 0, rVariables.size());
        c++;
        for (Value cValue : cValues) {
            table.addCell(r);
            table.getFlexCellFormatter().setColSpan(r, c, 3);
            table.getCellFormatter().setStyleName(r, c, "parameterKey");

            Widget contents = newVariableLabel(cVariable, cValue.getLabel(), rVariables.size());
            contents.setStyleName("valueHeader");

            table.setWidget(r, c++, contents);
        }
        r++;
    }

    // results header 2: rValue variables, followed by "nanos/barchart" column pairs
    c = 0;
    table.insertRow(r);
    table.getRowFormatter().setStyleName(r, "evenRow");
    table.getRowFormatter().addStyleName(r, "headerRow");
    for (Variable variable : rVariables) {
        table.addCell(r);
        table.getCellFormatter().setStyleName(r, c, "parameterKey");
        table.setWidget(r, c, newVariableLabel(variable, variable.getName(), c));
        c++;
    }
    for (Value unused : cValues) {
        table.addCell(r);
        table.getCellFormatter().setStyleName(r, c, "parameterKey");
        table.setWidget(r, c++, newUnitLabel(unitMap.get(selectedType).trim()));

        table.addCell(r);
        table.getCellFormatter().setStyleName(r, c, "parameterKey");
        table.setWidget(r, c++, newRuntimeLabel());

        table.addCell(r);
        table.getCellFormatter().setStyleName(r, c, "parameterKey");
        table.setWidget(r, c++, new InlineLabel("%"));
    }
    r++;

    Key key = newDefaultKey();
    for (RowsIterator rows = new RowsIterator(rVariables); rows.nextRow();) {
        rows.updateKey(key);

        table.insertRow(r);
        table.getRowFormatter().setStyleName(r, r % 2 == evenRowMod ? "evenRow" : "oddRow");
        c = 0;
        for (int v = 0, size = rVariables.size(); v < size; v++) {
            table.addCell(r);
            table.setWidget(r, c++, new Label(rows.getRValue(v).getLabel()));
        }

        for (Value value : cValues) {
            table.addCell(r);
            table.addCell(r);

            if (cVariable != null) {
                key.set(cVariable, value);
            }

            final Datapoint datapoint = keysToDatapoints.get(key);
            table.getCellFormatter().setStyleName(r, c, "numericCell");
            table.getCellFormatter().setStyleName(r, c + 1, "bar");
            table.getCellFormatter().setStyleName(r, c + 2, "numericCell");
            MeasurementSet measurementSet;
            if (datapoint != null
                    && (measurementSet = datapoint.scenarioResults.getMeasurementSet(selectedType)) != null) {
                double rawMedian = getMedian(selectedType, measurementSet);
                String displayedValue = numberFormatMap.get(selectedType)
                        .format(rawMedian / divideByMap.get(selectedType));
                Anchor valueAnchor = new Anchor(displayedValue, false);
                valueAnchor.setStyleName("subtleLink");
                valueAnchor.setStyleName("nanos", true);

                final DialogBox eventLogPopup = new DialogBox(true);
                eventLogPopup.setText("");

                valueAnchor.addClickHandler(new ClickHandler() {
                    public void onClick(ClickEvent clickEvent) {
                        // Do this lazily since it takes quite a bit of time to render these popups for all
                        // the scenarios shown, and quite often they won't even be used.
                        if (eventLogPopup.getText().isEmpty()) {
                            eventLogPopup.setText("Event Log");
                            String eventLog = datapoint.scenarioResults.getEventLog(selectedType);
                            if (eventLog == null || eventLog.isEmpty()) {
                                eventLog = "No event log recorded.";
                            }
                            FlowPanel panel = new FlowPanel();
                            for (String line : eventLog.split("\n")) {
                                panel.add(new Label(line));
                            }
                            panel.setStyleName("eventLog");
                            eventLogPopup.add(panel);
                        }
                        eventLogPopup.center();
                        eventLogPopup.show();
                    }
                });

                table.setWidget(r, c, valueAnchor);
                table.setWidget(r, c + 1, newBar(datapoint.style, measurementSet, value));
                table.setWidget(r, c + 2, newPercentOfReferencePointLabel(rawMedian, value));
            } else {
                table.setWidget(r, c, new Label(""));
                table.setWidget(r, c + 1, new Label(""));
                table.setWidget(r, c + 2, new Label(""));
            }
            c += 3;
        }

        r++;
    }
    resultsDiv.clear();
    resultsDiv.add(table);
    resultsDiv.add(new PlainTextEditor().getWidget());
    HTML dash = new HTML(" - ", false);
    dash.setStyleName("inline");
    resultsDiv.add(dash);
    resultsDiv.add(new SnapshotCreator().getWidget());
}

From source file:com.google.gwt.demos.glasspanel.client.GlassPanelDemo.java

License:Apache License

public void onModuleLoad() {
    // Set the uncaught exception handler
    GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {
        public void onUncaughtException(Throwable throwable) {
            String text = "Uncaught exception: ";
            while (throwable != null) {
                StackTraceElement[] stackTraceElements = throwable.getStackTrace();
                text += throwable.toString() + "\n";
                for (int i = 0; i < stackTraceElements.length; i++) {
                    text += "    at " + stackTraceElements[i] + "\n";
                }// ww  w  .j  av  a2  s .co m
                throwable = throwable.getCause();
                if (throwable != null) {
                    text += "Caused by: ";
                }
            }
            DialogBox dialogBox = new DialogBox(true);
            DOM.setStyleAttribute(dialogBox.getElement(), "backgroundColor", "#ABCDEF");
            System.err.print(text);
            text = text.replaceAll(" ", "&nbsp;");
            dialogBox.setHTML("<pre>" + text + "</pre>");
            dialogBox.center();
        }
    });

    // Use a deferred command so that the UncaughtExceptionHandler catches
    // exceptions thrown in onModuleLoad2()
    DeferredCommand.addCommand(new Command() {
        public void execute() {
            onModuleLoad2();
        }
    });
}

From source file:com.ics.tcg.web.workflow.client.BaseEntryPoint.java

License:Apache License

/**
 * Catches non handled exceptions and presents them in dialog box.
 * //  w  w  w .  j av a 2s .com
 * @see com.google.gwt.core.client.EntryPoint#onModuleLoad()
 */
public void onModuleLoad() {
    // set uncaught exception handler
    GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {
        public void onUncaughtException(Throwable throwable) {
            String text = "Uncaught exception: ";
            while (throwable != null) {
                StackTraceElement[] stackTraceElements = throwable.getStackTrace();
                text += new String(throwable.toString() + "\n");
                for (int i = 0; i < stackTraceElements.length; i++) {
                    text += "    at " + stackTraceElements[i] + "\n";
                }
                throwable = throwable.getCause();
                if (throwable != null) {
                    text += "Caused by: ";
                }
            }
            DialogBox dialogBox = new DialogBox(true);
            DOM.setStyleAttribute(dialogBox.getElement(), "backgroundColor", "#ABCDEF");
            System.err.print(text);
            text = text.replaceAll(" ", "&nbsp;");
            dialogBox.setHTML("<pre>" + text + "</pre>");
            dialogBox.center();
        }
    });

    // use a deferred command so that the handler catches onLoad()
    // exceptions
    DeferredCommand.addCommand(new Command() {
        public void execute() {
            onLoad();
        }
    });
}

From source file:com.mycompany.client.MyApplication2.java

License:Apache License

/**
 * Main entry point method./*from  w  ww.j av a 2s .  c  om*/
 */
@Override
public void onModuleLoad() {
    // set uncaught exception handler
    GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {

        @Override
        public void onUncaughtException(Throwable throwable) {
            String text = "Uncaught exception: ";
            while (throwable != null) {
                StackTraceElement[] stackTraceElements = throwable.getStackTrace();
                text += throwable.toString() + "\n";
                for (StackTraceElement element : stackTraceElements) {
                    text += "    at " + element + "\n";
                }
                throwable = throwable.getCause();
                if (throwable != null) {
                    text += "Caused by: ";
                }
            }
            DialogBox dialogBox = new DialogBox(true);
            DOM.setStyleAttribute(dialogBox.getElement(), "backgroundColor", "#ABCDEF");
            System.err.print(text);
            text = text.replaceAll(" ", "&nbsp;");
            dialogBox.setHTML("<pre>" + text + "</pre>");
            dialogBox.center();
        }
    });

    // use a deferred command so that the handler catches onModuleLoad2() exceptions
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {
        @Override
        public void execute() {
            onModuleLoad2();
        }
    });
}

From source file:com.objetdirect.tatami.demo.client.GfxDemo.java

License:Open Source License

/**
 * Show some properties about a <code>GraphicObjectw</code>
 * @param object the <code>GraphicObject</code> to show the properties
 * TODO change the layout of the dialog//from   w ww.  j a  v  a2s  .c  o m
 */
private void showProperties(GraphicObject object) {
    final DialogBox dialog = new DialogBox(false);
    dialog.setText("Properties");
    Grid panel = new Grid(5, 4);
    panel.setCellPadding(5);
    panel.setCellSpacing(10);
    panel.setWidget(0, 0, new HTML("<b>Position</b>"));
    panel.setWidget(0, 1, new Label(object.getX() + "," + object.getY()));
    panel.setWidget(0, 2, new HTML("<b>Center</b>"));
    panel.setWidget(0, 3, new Label(object.getCenterX() + "," + object.getCenterY()));
    panel.setWidget(1, 0, new HTML("<b>Size</b>"));
    panel.setWidget(1, 1, new Label("? x ? px"));
    panel.setWidget(2, 0, new HTML("<b>Color of the stroke</b>"));
    final String color = lastStrokeColor.toHex();
    final Label label = new Label(color);
    label.setTitle(color);
    DOM.setStyleAttribute(label.getElement(), "color", color);
    panel.setWidget(2, 1, label);
    panel.setWidget(2, 2, new HTML("<b>Size of the stroke</b>"));
    panel.setWidget(2, 3, new Label(lastStrokeSize + "px"));
    panel.setWidget(3, 0, new HTML("<b>Fill color</b>"));
    final String fillColor = object.getFillColor().toHex();
    final Label labelFill = new Label(fillColor);
    labelFill.setTitle(fillColor);
    panel.setWidget(3, 1, labelFill);
    DOM.setStyleAttribute(labelFill.getElement(), "color", fillColor);

    Button close = new Button("Close");
    close.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            dialog.hide();
        }
    });
    panel.setWidget(4, 0, close);

    dialog.setPopupPosition(Window.getClientWidth() / 2, Window.getClientHeight() / 2);
    dialog.addStyleName("GfxDemo-properties");
    dialog.setWidget(panel);
    dialog.show();
    System.out.println("bounds " + object.getBounds());
}

From source file:com.sun.labs.aura.dbbrowser.client.query.ResultsPanel.java

License:Open Source License

public ResultsPanel(ItemDesc[] items, final TabbedQueryUI parent) {
    this.items = items;
    this.parent = parent;
    results = new FlexTable();
    setStylePrimaryName("db-ResultsPanel");
    setSpacing(5);//from w  w  w. j  a v a  2  s .  c  o m
    //
    // Put in the headers
    results.setText(0, NAME_COL, "Item Name");
    results.setText(0, KEY_COL, "Item Key");
    results.setText(0, TYPE_COL, "Type");
    results.setText(0, SRC_ATTN_COL, "Attn For Source");
    results.setText(0, TRG_ATTN_COL, "Attn for Target");
    results.setText(0, DELETE_COL, "Delete?");
    RowFormatter rf = results.getRowFormatter();
    rf.setStylePrimaryName(0, "db-TableHeader");
    fillItems();
    center.add(results);
    add(center, CENTER);
    ItemDesc time = items[0];
    add(new Label("Query took: " + time.getQueryTime() + "ms"), SOUTH);
    Button close = new Button("Close");
    close.addClickListener(new ClickListener() {
        public void onClick(Widget arg0) {
            parent.removeTab(arg0.getParent());
        }
    });
    add(close, SOUTH);

    itemInfo = new DialogBox(true);

    service = GWTMainEntryPoint.getDBService();
}

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

License:Open Source License

public static DialogBox getDialogBox() {
    final DialogBox popup = new DialogBox(true);
    return popup;
}