Search in sources :

Example 1 with DialogBox

use of com.google.gwt.user.client.ui.DialogBox in project opennms by OpenNMS.

the class DefaultLocationManager method displayDialog.

/**
 * <p>displayDialog</p>
 *
 * @param title a {@link java.lang.String} object.
 * @param contents a {@link java.lang.String} object.
 */
protected void displayDialog(final String title, final String contents) {
    final DialogBox db = new DialogBox();
    db.setAutoHideEnabled(true);
    db.setModal(true);
    db.setText(title);
    db.setWidget(new Label(contents, true));
    db.show();
}
Also used : Label(com.google.gwt.user.client.ui.Label) DialogBox(com.google.gwt.user.client.ui.DialogBox)

Example 2 with DialogBox

use of com.google.gwt.user.client.ui.DialogBox in project google-gin by gwtplus.

the class DefaultGameDialogs method show.

public void show(String title) {
    final DialogBox box = new DialogBox();
    box.setAnimationEnabled(true);
    box.setText(title);
    // It's an higherlower, folks!
    box.setWidth("200px");
    VerticalPanel verticalPanel = new VerticalPanel();
    Button higher = new Button("Higher, higher!");
    higher.addStyleName("centered");
    higher.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            box.hide();
            gameHost.get().playerGuess(RelationshipToPreviousCard.HIGHER);
        }
    });
    verticalPanel.add(higher);
    Button lower = new Button("Down, boy!");
    lower.addStyleName("centered");
    lower.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            box.hide();
            gameHost.get().playerGuess(RelationshipToPreviousCard.LOWER);
        }
    });
    verticalPanel.add(lower);
    HorizontalPanel hp = new HorizontalPanel();
    hp.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
    hp.add(verticalPanel);
    box.setWidget(hp);
    box.center();
    box.show();
}
Also used : VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) Button(com.google.gwt.user.client.ui.Button) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) DialogBox(com.google.gwt.user.client.ui.DialogBox)

Example 3 with DialogBox

use of com.google.gwt.user.client.ui.DialogBox in project gerrit by GerritCodeReview.

the class ProjectListPopup method createWidgets.

private void createWidgets(final String popupText, final String currentPageLink) {
    filterPanel = new HorizontalPanel();
    filterPanel.setStyleName(Gerrit.RESOURCES.css().projectFilterPanel());
    final Label filterLabel = new Label(com.google.gerrit.client.admin.AdminConstants.I.projectFilter());
    filterLabel.setStyleName(Gerrit.RESOURCES.css().projectFilterLabel());
    filterPanel.add(filterLabel);
    filterTxt = new NpTextBox();
    filterTxt.addKeyUpHandler(new KeyUpHandler() {

        @Override
        public void onKeyUp(KeyUpEvent event) {
            Query q = new Query(filterTxt.getValue());
            if (!match.equals(q.qMatch)) {
                if (query == null) {
                    q.run();
                }
                query = q;
            }
        }
    });
    filterPanel.add(filterTxt);
    projectsTab = new HighlightingProjectsTable() {

        @Override
        protected void movePointerTo(final int row, final boolean scroll) {
            super.movePointerTo(row, scroll);
            onMovePointerTo(getRowItem(row).name());
        }

        @Override
        protected void onOpenRow(final int row) {
            super.onOpenRow(row);
            openRow(getRowItem(row).name());
        }
    };
    projectsTab.setSavePointerId(currentPageLink);
    closeTop = createCloseButton();
    closeBottom = createCloseButton();
    popup = new DialogBox();
    popup.setModal(false);
    popup.setText(popupText);
}
Also used : KeyUpEvent(com.google.gwt.event.dom.client.KeyUpEvent) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) Label(com.google.gwt.user.client.ui.Label) KeyUpHandler(com.google.gwt.event.dom.client.KeyUpHandler) NpTextBox(com.google.gwtexpui.globalkey.client.NpTextBox) DialogBox(com.google.gwt.user.client.ui.DialogBox)

Example 4 with DialogBox

use of com.google.gwt.user.client.ui.DialogBox in project pentaho-platform by pentaho.

the class FilesListPanel method populateFilesList.

public void populateFilesList(SolutionBrowserPanel perspective, SolutionTree solutionTree, TreeItem item, JsArrayString filters) {
    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
    // BISERVER-9599 - Custom Sort
    Collections.sort(files, new RepositoryFileComparator());
    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()) {
                    // $NON-NLS-1$
                    icon = "mantle/images/folderIcon.png";
                }
                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
                // $NON-NLS-1$
                fileLabel.getElement().setId(file.getPath());
                fileLabel.addFileSelectionChangedListener(toolbar);
                // $NON-NLS-1$
                fileLabel.setWidth("100%");
                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 {
                                // $NON-NLS-1$
                                fileLabel.setStyleName("fileLabelSelected");
                            }
                            selectedFileItems.add(fileLabel);
                            // if we do not break this loop, it will go forever! (we added an item)
                            break;
                        }
                    }
                } else {
                    if (file.isHidden()) {
                        // $NON-NLS-1$
                        fileLabel.setStyleName("hiddenFileLabel");
                    } else {
                        // $NON-NLS-1$
                        fileLabel.setStyleName("fileLabel");
                    }
                }
            }
        }
    }
}
Also used : RepositoryFile(org.pentaho.gwt.widgets.client.filechooser.RepositoryFile) JsArrayString(com.google.gwt.core.client.JsArrayString) RepositoryFileTree(org.pentaho.gwt.widgets.client.filechooser.RepositoryFileTree) ContentTypePlugin(org.pentaho.mantle.client.solutionbrowser.PluginOptionsHelper.ContentTypePlugin) DialogBox(com.google.gwt.user.client.ui.DialogBox)

Example 5 with DialogBox

use of com.google.gwt.user.client.ui.DialogBox in project google-gin by gwtplus.

the class DefaultGameDialogs method showEndGame.

public void showEndGame(final Runnable runnable) {
    final DialogBox box = new DialogBox();
    box.setAnimationEnabled(true);
    box.setText("Thanks for playing Higher or Lower! *ding*ding*ding*ding*");
    Button b = new Button("Thanks for having me!");
    b.addStyleName("centered");
    b.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            runnable.run();
            box.hide();
        }
    });
    box.setWidget(b);
    box.center();
    box.show();
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) Button(com.google.gwt.user.client.ui.Button) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) DialogBox(com.google.gwt.user.client.ui.DialogBox)

Aggregations

DialogBox (com.google.gwt.user.client.ui.DialogBox)5 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)2 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)2 Button (com.google.gwt.user.client.ui.Button)2 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)2 Label (com.google.gwt.user.client.ui.Label)2 JsArrayString (com.google.gwt.core.client.JsArrayString)1 KeyUpEvent (com.google.gwt.event.dom.client.KeyUpEvent)1 KeyUpHandler (com.google.gwt.event.dom.client.KeyUpHandler)1 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)1 NpTextBox (com.google.gwtexpui.globalkey.client.NpTextBox)1 RepositoryFile (org.pentaho.gwt.widgets.client.filechooser.RepositoryFile)1 RepositoryFileTree (org.pentaho.gwt.widgets.client.filechooser.RepositoryFileTree)1 ContentTypePlugin (org.pentaho.mantle.client.solutionbrowser.PluginOptionsHelper.ContentTypePlugin)1