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:org.nightcode.gwt.selectio.client.Selector.java

License:Apache License

private static DialogBox createDialogBox(final String url, final RootPanel input, final String function,
        final String selection, final String title) {
    final DialogBox dialogBox = new DialogBox(new SelectorHeader());
    dialogBox.setStyleName("modal-content");
    if (title != null) {
        dialogBox.getCaption().setText(title);
    }//from   w ww.j  a v  a  2s  .co m

    SelectorRequestFactory requestFactory = new SelectorRequestFactoryJson(url);
    final ItemSelector itemSelector = new ItemSelector(requestFactory, 490);

    if (selection != null) {
        SelectionJso selectionJso = SelectionJso.selectionFromJson(selection);
        itemSelector.setSelection(selectionJso);
    }

    VerticalPanel dialogContents = new VerticalPanel();
    dialogContents.setSize("300px", "500px");
    dialogContents.setStyleName("selectio");
    dialogBox.setWidget(dialogContents);

    dialogContents.add(itemSelector);
    dialogContents.setCellHeight(itemSelector, "490px");

    Button doneButton = new Button(MESSAGES.done(), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            final SelectionJso selection = SelectionJso.create();
            itemSelector.fillSelection(selection);
            input.getElement().setAttribute("value", new JSONObject(selection).toString());
            onChange(function, input.getElement());
            dialogBox.hide();
        }
    });
    doneButton.setStyleName("btn btn-primary");

    Button cancelButton = new Button(MESSAGES.cancel(), new ClickHandler() {
        @Override
        public void onClick(ClickEvent clickEvent) {
            dialogBox.hide();
        }
    });
    cancelButton.setStyleName("btn btn-default");

    Panel buttonPanel = new FlowPanel();
    buttonPanel.setStyleName("btn-toolbar pull-right");
    buttonPanel.add(doneButton);
    buttonPanel.add(cancelButton);

    dialogContents.add(buttonPanel);
    dialogContents.setCellHeight(buttonPanel, "20px");
    dialogContents.setCellHorizontalAlignment(buttonPanel, HasHorizontalAlignment.ALIGN_RIGHT);

    return dialogBox;
}

From source file:org.pentaho.mantle.client.solutionbrowser.filelist.FilesListPanel.java

License:Open Source License

public void populateFilesList(SolutionBrowserPanel perspective, SolutionTree solutionTree, TreeItem item,
        JsArrayString filters) {// www.  j  a v  a2 s . co  m
    filesList.clear();
    List<RepositoryFile> files;

    if (item == solutionTree.getTrashItem()) { // If we're populating from the trash then
        files = solutionTree.getTrashItems();
    } else {
        files = new ArrayList<RepositoryFile>();
        // Get the user object.
        RepositoryFileTree tree = (RepositoryFileTree) item.getUserObject();
        // Since we are only listing the files here. Get to each item of the tree and get the file from it
        for (RepositoryFileTree treeItem : tree.getChildren()) {
            String fileName = treeItem.getFile().getName();
            if (filters != null) {
                for (int i = 0; i < filters.length(); i++) {
                    if (fileName.endsWith(filters.get(i))) {
                        files.add(treeItem.getFile());
                    }
                }
            }
        }
    }
    // let's sort this list based on localized name
    Collections.sort(files, new RepositoryFileComparator()); // BISERVER-9599 - Custom Sort

    if (files != null) {
        int rowCounter = 0;
        for (RepositoryFile file : files) {
            if ((item == solutionTree.getTrashItem())
                    || (!file.isFolder() && (isShowHiddenFiles() || !file.isHidden()))) {
                // TODO Currently Old solution repository stores url type files. New repository does not have that
                // concept. What do we need to do here
                //String url = fileElement.getAttribute("url"); //$NON-NLS-1$
                ContentTypePlugin plugin = PluginOptionsHelper.getContentTypePlugin(file.getName());
                String icon = null;
                if (plugin != null) {
                    icon = plugin.getFileIcon();
                }
                if (item == solutionTree.getTrashItem() && file.isFolder()) {
                    icon = "mantle/images/folderIcon.png"; //$NON-NLS-1$
                }

                final FileItem fileLabel = new FileItem(file, this,
                        PluginOptionsHelper.getEnabledOptions(file.getName()), true, icon);
                // BISERVER-2317: Request for more IDs for Mantle UI elements
                // set element id as the filename
                fileLabel.getElement().setId(file.getPath()); //$NON-NLS-1$
                fileLabel.addFileSelectionChangedListener(toolbar);
                fileLabel.setWidth("100%"); //$NON-NLS-1$
                try {
                    perspective.getDragController().makeDraggable(fileLabel);
                } catch (Throwable e) {
                    Throwable throwable = e;
                    String text = "Uncaught exception: ";
                    while (throwable != null) {
                        StackTraceElement[] stackTraceElements = throwable.getStackTrace();
                        text += throwable.toString() + "\n";
                        for (int ii = 0; ii < stackTraceElements.length; ii++) {
                            text += "    at " + stackTraceElements[ii] + "\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();
                }

                fileLabel.setRepositoryFile(file);
                filesList.setWidget(rowCounter++, 0, fileLabel);

                if (selectedFileItems != null && selectedFileItems.size() > 0) {
                    for (FileItem fileItem : selectedFileItems) {
                        if (fileItem.getRepositoryFile().equals(fileLabel.getRepositoryFile())) {
                            if (file.isHidden()) {
                                fileLabel.setStyleName("hiddenFileLabelSelected");
                            } else {
                                fileLabel.setStyleName("fileLabelSelected"); //$NON-NLS-1$  
                            }
                            selectedFileItems.add(fileLabel);
                            // if we do not break this loop, it will go forever! (we added an item)
                            break;
                        }
                    }
                } else {
                    if (file.isHidden()) {
                        fileLabel.setStyleName("hiddenFileLabel"); //$NON-NLS-1$
                    } else {
                        fileLabel.setStyleName("fileLabel"); //$NON-NLS-1$  
                    }
                }
            }
        }
    }
}

From source file:org.primaresearch.web.layouteditor.client.WebLayoutEditor.java

License:Apache License

/**
 * Shows the help dialogue./*from  ww  w .  j a v  a  2s . c o m*/
 */
private void showHelp() {
    try {
        final DialogBox helpDialog = new DialogBox(true);
        helpDialog.setGlassEnabled(true);

        //Renders "help.html" in an iframe.
        Frame frame = new Frame("Help.html");
        frame.setWidth(CONSTANTS.HelpDialogWidth());
        frame.setHeight(CONSTANTS.HelpDialogWidth());
        frame.getElement().getStyle().setBorderWidth(0, Unit.PX);
        helpDialog.setWidget(frame);

        helpDialog.center();

        helpDialog.show();
    } catch (Exception exc) {
        logManager.logError(ERROR_SHOWING_HELP_DIALOG, "Error on trying to display the help dialogue");
        exc.printStackTrace();
    }
}

From source file:org.primordion.xholon.io.AbstractXholonGui.java

License:Open Source License

/**
 * Provide some "getting started" help information.
 *//*  ww w . j a v  a  2s .  c  o  m*/
protected void gettingStarted(String title, String htmlText, int width, int height) {
    final DialogBox db = new DialogBox(true);
    db.setText(title);
    // htmlText is safe to use here; it's just the static final splashText in this class
    db.setWidget(new HTML(htmlText)); // HTML(String) is safe to use here

    //Button ok = new Button("OK");
    //ok.addClickHandler(new ClickHandler() {
    //  public void onClick(ClickEvent event) {
    //    db.hide();
    //  }
    //});
    //db.setWidget(ok);

    db.show();
}

From source file:org.rest.client.activity.RequestActivity.java

License:Apache License

private void fromGoogleDriveFile(final String entryId) {

    final DialogBox loader = new DialogBox(false);
    loader.setAnimationEnabled(false);//  www. ja v a 2s .  c  om
    loader.setAutoHideEnabled(false);
    loader.setAutoHideOnHistoryEventsEnabled(true);
    loader.setGlassEnabled(true);

    HTML html = new HTML("<div class=\"dialogTitle\">Loading file from Google Drive </div>");
    loader.add(html);

    loader.show();
    loader.center();

    DriveApi.hasSession(new DriveApi.SessionHandler() {
        @Override
        public void onResult(DriveAuth result) {
            if (result == null) {
                //not logged in user
                DriveApi.auth(new DriveApi.SessionHandler() {
                    @Override
                    public void onResult(DriveAuth result) {
                        if (result == null) {
                            loader.hide();
                            return;
                        }
                        getFileMetadataFromDrive(entryId, loader);
                    }
                }, false);
                return;
            }
            getFileMetadataFromDrive(entryId, loader);
        }
    });
}

From source file:org.rest.client.ui.desktop.RequestViewImpl.java

License:Apache License

@UiHandler("deleteEndpoint")
void onDeleteEndpoint(ClickEvent e) {
    e.preventDefault();/* w  w w.java 2 s .  c o m*/
    final DialogBox dialog = new DialogBox(true);
    dialog.setAnimationEnabled(true);
    dialog.setGlassEnabled(true);
    dialog.setModal(true);

    HTMLPanel wrapper = new HTMLPanel("");
    Label message = new Label("Delete selected endpoint?");
    HTMLPanel buttons = new HTMLPanel("");
    buttons.setStyleName("dialogButtons");
    Button confirm = new Button("Confirm");
    confirm.setStyleName("button");
    Button cancel = new Button("Cancel");
    cancel.setStyleName("button");
    buttons.add(confirm);
    buttons.add(cancel);
    wrapper.add(message);
    wrapper.add(buttons);
    dialog.add(wrapper);
    dialog.show();
    dialog.center();
    cancel.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            dialog.hide();
        }
    });
    confirm.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            dialog.hide();
            listener.deleteCurrentEndpoint();
        }
    });
}

From source file:org.vectomatic.svg.edit.client.SvgrealApp.java

License:Open Source License

public void onModuleLoad() {
    instance = this;
    GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {
        public void onUncaughtException(Throwable throwable) {
            GWT.log("Uncaught exception", throwable);
            if (!GWT.isScript()) {
                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";
                    }//from w ww.ja va 2s  .  c o  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();
            }
        }
    });
    AppBundle.INSTANCE.css().ensureInjected();

    // Create graphical context
    OMSVGDocument doc = OMSVGParser.currentDocument();
    SVGElement element = doc.createSVGPathElement().getElement().cast();
    element.getStyle().setProperty(SVGConstants.CSS_FILL_PROPERTY, SVGConstants.CSS_LIGHTBLUE_VALUE);
    element.getStyle().setProperty(SVGConstants.CSS_STROKE_PROPERTY, SVGConstants.CSS_BLACK_VALUE);
    SVGNamedElementModel.createTitleDesc(element, AppConstants.INSTANCE.graphicalContext());
    cssContext = new CssContextModel(element);

    svgWindows = new ArrayList<SVGWindow>();
    viewport = new ViewportExt();

    viewport.setLayout(new BorderLayout());
    HBoxLayout hboxLayout = new HBoxLayout();
    hboxLayout.setHBoxLayoutAlign(HBoxLayoutAlign.TOP);
    LayoutContainer menuBarContainer = new LayoutContainer(hboxLayout);
    HBoxLayoutData layoutData = new HBoxLayoutData();
    layoutData.setFlex(1);
    menuBarContainer.add(createMenuBar(), layoutData);
    menuBarContainer.add(createLanguageBar(), new HBoxLayoutData());
    viewport.add(menuBarContainer, new BorderLayoutData(LayoutRegion.NORTH, getWindowBarHeight()));
    viewport.setStyleAttribute("background-color", SVGConstants.CSS_BEIGE_VALUE);

    commandToolBar = new CommandFactoryToolBar(CommandFactories.getAllFactoriesStore(),
            getCommandFactorySelector());
    ContentPanel commandPanel = new ContentPanel();
    commandPanel.setHeaderVisible(false);
    commandPanel.setBottomComponent(commandToolBar);
    viewport.add(commandPanel, new BorderLayoutData(LayoutRegion.SOUTH, getWindowBarHeight()));

    update();

    fileUpload = new FileUploadExt();
    Style style = fileUpload.getElement().getStyle();
    style.setVisibility(Visibility.HIDDEN);
    style.setWidth(0, Unit.PX);
    style.setHeight(0, Unit.PX);
    fileUpload.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            processFiles(fileUpload.getFiles());
        }
    });

    RootPanel.get().add(viewport);
    RootPanel.get().add(fileUpload);

    ImageLoader loader = new ImageLoader();
    loader.addInitializeHandler(new InitializeHandler() {

        @Override
        public void onInitialize(InitializeEvent event) {
            ImageLoader loader = (ImageLoader) event.getSource();
            imageCache = new DecoratedImageCache(loader.getImages());
            init();
        }
    });
    loader.loadImages(new ImageResource[] { AppBundle.INSTANCE.altGlyphDef(), AppBundle.INSTANCE.altGlyphItem(),
            AppBundle.INSTANCE.altGlyph(), AppBundle.INSTANCE.animateColor(),
            AppBundle.INSTANCE.animateMotion(), AppBundle.INSTANCE.animate(),
            AppBundle.INSTANCE.animateTransform(), AppBundle.INSTANCE.circle(), AppBundle.INSTANCE.clipPath(),
            AppBundle.INSTANCE.colorProfile(), AppBundle.INSTANCE.cursor(), AppBundle.INSTANCE.defs(),
            AppBundle.INSTANCE.desc(), AppBundle.INSTANCE.ellipse(), AppBundle.INSTANCE.feBlend(),
            AppBundle.INSTANCE.feColorMatrix(), AppBundle.INSTANCE.feComponentTransfer(),
            AppBundle.INSTANCE.feComposite(), AppBundle.INSTANCE.feConvolveMatrix(),
            AppBundle.INSTANCE.feDiffuseLighting(), AppBundle.INSTANCE.feDisplacementMap(),
            AppBundle.INSTANCE.feDistantLight(), AppBundle.INSTANCE.feFlood(), AppBundle.INSTANCE.feFuncA(),
            AppBundle.INSTANCE.feFuncB(), AppBundle.INSTANCE.feFuncG(), AppBundle.INSTANCE.feFuncR(),
            AppBundle.INSTANCE.feGaussianBlur(), AppBundle.INSTANCE.feMergeNode(), AppBundle.INSTANCE.feMerge(),
            AppBundle.INSTANCE.feMorphology(), AppBundle.INSTANCE.feOffset(), AppBundle.INSTANCE.fePointLight(),
            AppBundle.INSTANCE.feSpecularLight(), AppBundle.INSTANCE.feSpotLight(), AppBundle.INSTANCE.feTile(),
            AppBundle.INSTANCE.feTurbulence(), AppBundle.INSTANCE.filter(), AppBundle.INSTANCE.fontFaceFormat(),
            AppBundle.INSTANCE.fontFaceName(), AppBundle.INSTANCE.fontFace(), AppBundle.INSTANCE.fontFaceSrc(),
            AppBundle.INSTANCE.fontFaceUri(), AppBundle.INSTANCE.font(), AppBundle.INSTANCE.foreignObject(),
            AppBundle.INSTANCE.glyph(), AppBundle.INSTANCE.glyphRef(), AppBundle.INSTANCE.g(),
            AppBundle.INSTANCE.hkern(), AppBundle.INSTANCE.image(), AppBundle.INSTANCE.linearGradient(),
            AppBundle.INSTANCE.line(), AppBundle.INSTANCE.marker(), AppBundle.INSTANCE.mask(),
            AppBundle.INSTANCE.metadata(), AppBundle.INSTANCE.missingGlyph(), AppBundle.INSTANCE.mpath(),
            AppBundle.INSTANCE.path(), AppBundle.INSTANCE.pattern(), AppBundle.INSTANCE.polygon(),
            AppBundle.INSTANCE.polyline(), AppBundle.INSTANCE.radialGradient(), AppBundle.INSTANCE.rect(),
            AppBundle.INSTANCE.script(), AppBundle.INSTANCE.set(), AppBundle.INSTANCE.stop(),
            AppBundle.INSTANCE.style(), AppBundle.INSTANCE.svg(), AppBundle.INSTANCE.switch_(),
            AppBundle.INSTANCE.symbol(), AppBundle.INSTANCE.textPath(), AppBundle.INSTANCE.text(),
            AppBundle.INSTANCE.title(), AppBundle.INSTANCE.tref(), AppBundle.INSTANCE.tspan(),
            AppBundle.INSTANCE.use(), AppBundle.INSTANCE.view(), AppBundle.INSTANCE.vkern(),
            AppBundle.INSTANCE.error(), AppBundle.INSTANCE.warning(), });
}

From source file:org.vectomatic.svg.edit.client.VectomaticApp2.java

License:Open Source License

public void onModuleLoad() {
    APP = this;//from  w w w .  j  av a2s .com
    GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {
        public void onUncaughtException(Throwable throwable) {
            GWT.log("Uncaught exception", throwable);
            if (!GWT.isScript()) {
                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";
                    }
                    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();
            }
        }
    });
    AppBundle.INSTANCE.css().ensureInjected();
    windows = new ArrayList<SVGWindow>();
    viewPort = new Viewport();

    Menu fileMenu = new Menu();
    final MenuItem openUrlItem = new MenuItem(AppConstants.INSTANCE.openUrlMenuItem());
    fileMenu.add(openUrlItem);
    final MenuItem openRssFeedItem = new MenuItem(AppConstants.INSTANCE.openRssFeedMenuItem());
    fileMenu.add(openRssFeedItem);
    MenuItem recentDocumentsItem = new MenuItem(AppConstants.INSTANCE.recentDocumentsMenuItem());
    recentDocsMenu = new Menu();
    recentDocumentsItem.setSubMenu(recentDocsMenu);
    fileMenu.add(recentDocumentsItem);

    Menu windowMenu = new Menu();
    resetViewItem = new MenuItem(AppConstants.INSTANCE.resetViewMenuItem());
    windowMenu.add(resetViewItem);
    windowMenu.add(new SeparatorMenuItem());
    tileWindowsItem = new MenuItem(AppConstants.INSTANCE.tileWindowsMenuItem());
    windowMenu.add(tileWindowsItem);
    stackWindowsItem = new MenuItem(AppConstants.INSTANCE.stackWindowsMenuItem());
    windowMenu.add(stackWindowsItem);
    windowMenu.add(new SeparatorMenuItem());
    closeWindowItem = new MenuItem(AppConstants.INSTANCE.closeWindowMenuItem());
    windowMenu.add(closeWindowItem);

    Menu aboutMenu = new Menu();
    final MenuItem aboutItem = new MenuItem(AppConstants.INSTANCE.aboutMenuItem());
    aboutMenu.add(aboutItem);

    menuBar = new MenuBar();
    menuBar.setBorders(true);
    menuBar.setStyleAttribute("borderTop", "none");
    menuBar.add(new MenuBarItem(AppConstants.INSTANCE.fileMenu(), fileMenu));
    menuBar.add(new MenuBarItem(AppConstants.INSTANCE.windowMenu(), windowMenu));
    menuBar.add(new MenuBarItem(AppConstants.INSTANCE.aboutMenu(), aboutMenu));

    dispatcher = new SelectionListener<MenuEvent>() {
        @Override
        public void componentSelected(MenuEvent me) {
            MenuItem item = (MenuItem) me.getItem();
            if (item.getParentMenu() == recentDocsMenu) {
                openRecent(item.getText());
            } else if (item == openUrlItem) {
                openUrl();
            } else if (item == openRssFeedItem) {
                openRssFeed();
            } else if (item == resetViewItem) {
                resetView();
            } else if (item == tileWindowsItem) {
                tileWindows();
            } else if (item == stackWindowsItem) {
                stackWindows();
            } else if (item == closeWindowItem) {
                closeWindow(activeWindow);
            } else if (item == aboutItem) {
                about();
            }
        }
    };
    openUrlItem.addSelectionListener(dispatcher);
    openRssFeedItem.addSelectionListener(dispatcher);
    resetViewItem.addSelectionListener(dispatcher);
    tileWindowsItem.addSelectionListener(dispatcher);
    stackWindowsItem.addSelectionListener(dispatcher);
    closeWindowItem.addSelectionListener(dispatcher);
    aboutItem.addSelectionListener(dispatcher);

    viewPort.add(menuBar);
    addWindow(AppBundle.INSTANCE.fish().getSvg(), "fish.svg");
    addWindow(AppBundle.INSTANCE.fries().getSvg(), "fries.svg");
    viewPort.setStyleAttribute("background-color", SVGConstants.CSS_BEIGE_VALUE);

    update();
    RootPanel.get().add(viewPort);
}

From source file:org.vectomatic.svg.edu.client.commons.Utils.java

License:Open Source License

public static void handleFatalError(Throwable throwable) {
    String text = "Uncaught exception: ";
    GWT.log(text, throwable);/*from  ww  w  .  j a v a  2s.  c  o m*/
    while (throwable != null) {
        StackTraceElement[] stackTraceElements = throwable.getStackTrace();
        text += 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();
}

From source file:org.vectomatic.svg.edu.client.Intro.java

License:Open Source License

@Override
public void onModuleLoad() {
    final String debugParam = Window.Location.getParameter("debug");
    GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {
        public void onUncaughtException(Throwable throwable) {
            if (!GWT.isScript() || debugParam != null) {
                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  a v  a 2s .  com
                    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                                                    
    DeferredCommand.addCommand(new Command() {
        @Override
        public void execute() {
            onModuleLoad2();
        }
    });
}