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:com.palantir.gerrit.gerritci.ui.client.ConfigurationScreen.java

License:Apache License

/**
 * Creates a DialogBox object with the specified header and content and
 * returns it to be displayed./* w w  w  . j  av  a 2s  .c om*/
 *
 * @param header
 *            Title for the alert dialog
 * @param content
 *            Inner message content to display
 * @return A DialogBox object configured with the specified strings
 */
public static DialogBox alertWidget(final String header, final String content) {
    final DialogBox dialogBox = new DialogBox();
    final VerticalPanel verticalPanel = new VerticalPanel();

    final Label emptyLabel = new Label("");
    emptyLabel.setSize("auto", "25px");

    dialogBox.setText(header);

    verticalPanel.add(emptyLabel);
    verticalPanel.add(new Label(content));
    verticalPanel.add(emptyLabel);

    final Button buttonClose = new Button("Close", new ClickHandler() {

        @Override
        public void onClick(final ClickEvent event) {
            dialogBox.hide();
        }
    });
    buttonClose.setWidth("100px");
    verticalPanel.add(buttonClose);
    verticalPanel.setCellHorizontalAlignment(buttonClose, HasAlignment.ALIGN_CENTER);

    dialogBox.add(verticalPanel);
    return dialogBox;
}

From source file:com.palantir.gerrit.gerritci.ui.client.ProjectConfigurationScreen.java

License:Apache License

public static DialogBox alertWidget(final String header, final String content) {
    final DialogBox dialogBox = new DialogBox();
    final VerticalPanel verticalPanel = new VerticalPanel();

    final Label emptyLabel = new Label("");
    emptyLabel.setSize("auto", "25px");

    dialogBox.setText(header);/*from  www .  ja v a2  s. c  o  m*/

    verticalPanel.add(emptyLabel);
    verticalPanel.add(new Label(content));
    verticalPanel.add(emptyLabel);

    final Button buttonClose = new Button("Close", new ClickHandler() {

        @Override
        public void onClick(final ClickEvent event) {
            dialogBox.hide();
        }
    });
    buttonClose.setWidth("100px");
    verticalPanel.add(buttonClose);
    verticalPanel.setCellHorizontalAlignment(buttonClose, HasAlignment.ALIGN_CENTER);

    dialogBox.add(verticalPanel);
    dialogBox.setWidth("400px");
    return dialogBox;
}

From source file:com.piusvelte.mosaic.gwt.client.Mosaic.java

License:Open Source License

public void onModuleLoad() {

    // 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 name 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);//from ww w . j a va  2 s  . com
    dialogBox.setWidget(dialogVPanel);

    // Add a handler to close the DialogBox
    closeButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            dialogBox.hide();
        }
    });

    final Button authButton = new Button("Sign in");
    RootPanel.get("authContainer").add(authButton);
    authButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            webClientService.getAuthenticationURL(Window.Location.getHref(), new AsyncCallback<String>() {

                @Override
                public void onFailure(Throwable caught) {
                    dialogBox.setText("Remote Procedure Call - Failure");
                    serverResponseLabel.addStyleName("serverResponseLabelError");
                    serverResponseLabel.setHTML(SERVER_ERROR);
                    dialogBox.center();
                    closeButton.setFocus(true);
                }

                @Override
                public void onSuccess(String result) {
                    Window.Location.replace(result);
                }

            });
        }

    });

    webClientService.getUserNickname(new AsyncCallback<String>() {

        @Override
        public void onFailure(Throwable caught) {
            authButton.setText("Sign in");
        }

        @Override
        public void onSuccess(String result) {
            authButton.setText(result);
            webClientService.getMessages(page, new AsyncCallback<WebClientMessage[]>() {

                @Override
                public void onFailure(Throwable caught) {
                    // TODO Auto-generated method stub

                }

                @Override
                public void onSuccess(WebClientMessage[] result) {
                    // TODO Auto-generated method stub

                }

            });
        }

    });
}

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

License:Open Source License

public void showError(String msg) {
    final DialogBox err = new DialogBox();
    err.setText("Alert!");
    DockPanel contents = new DockPanel();
    contents.add(new Label(msg), DockPanel.CENTER);
    Button ok = new Button("OK");
    ok.addClickListener(new ClickListener() {
        public void onClick(Widget arg0) {
            err.hide();/*from   w w  w  .  j  av a2  s.  com*/
        }
    });
    contents.add(ok, DockPanel.SOUTH);
    err.setWidget(contents);
    err.show();
}

From source file:com.unilorraine.projetdevie.client.ui.viewmodules.unitchoosermodule.UnitChooserViewImpl.java

License:Open Source License

public UnitChooserViewImpl() {

    viewerPictureSmall = new DetailViewerField("picture");
    viewerPictureSmall.setType("image");
    viewerPictureSmall.setImageWidth(50);
    viewerPictureSmall.setImageHeight(50);

    viewerPicture = new DetailViewerField("picture");
    viewerPicture.setType("image");
    viewerPicture.setImageWidth(100);// w  w w  . ja  v  a  2s. c  o  m
    viewerPicture.setImageHeight(100);

    viewerName = new DetailViewerField("name");

    VerticalPanel verticalPanel = new VerticalPanel();
    add(verticalPanel);
    verticalPanel.setSize("602px", "602px");

    Label title = new Label("Cr\u00E9ateur commun du projet de vie");
    title.setStyleName("title");

    verticalPanel.add(title);

    EdgedCanvas edgedCanvasChoice = new EdgedCanvas();
    edgedCanvasChoice.setSize("590px", "150px");

    unitChoiceGrid = new TileGrid();
    unitChoiceGrid.setSize("590px", "135px");
    unitChoiceGrid.setSelectionType(SelectionStyle.SINGLE);
    unitChoiceGrid.setFields(viewerPicture, viewerName);

    unitChoiceGrid.setEdgeSize(0);
    unitChoiceGrid.setShowEdges(false);

    unitChoiceGrid.setCanAcceptDrop(true);
    unitChoiceGrid.setCanDrag(true);

    unitChoiceGrid.setTileWidth(120);
    unitChoiceGrid.setTileHeight(120);

    edgedCanvasChoice.addChild(unitChoiceGrid);
    verticalPanel.add(edgedCanvasChoice);

    VerticalPanel middlePanel = new VerticalPanel();
    middlePanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    middlePanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.add(middlePanel);
    middlePanel.setSize("602px", "155px");

    EdgedCanvas edgedCanvas = new EdgedCanvas();
    edgedCanvas.setSize("150px", "150px");
    edgedCanvas.setAlign(Alignment.CENTER);

    Label dropText = new Label("La cible");

    targetGrid = new TileGrid();
    targetGrid.setSize("125px", "125px");
    targetGrid.setSelectionType(SelectionStyle.SINGLE);
    targetGrid.setFields(viewerPicture, viewerName);

    targetGrid.setEdgeSize(0);
    targetGrid.setShowEdges(false);

    targetGrid.setCanAcceptDrop(true);
    targetGrid.setCanDrag(true);

    targetGrid.setTileWidth(120);
    targetGrid.setTileHeight(120);
    targetGrid.setData(new ActivityRecord[1]);

    targetGrid.addDropHandler(new DropHandler() {

        @Override
        public void onDrop(DropEvent event) {
            if (targetGrid.getData().length >= 1) {
                event.cancel();
                System.out.println("Target full");
            }
        }
    });

    edgedCanvas.addChild(targetGrid);
    middlePanel.add(dropText);
    middlePanel.add(edgedCanvas);

    DisclosurePanel disclosurePanel = new DisclosurePanel("Activites choisies");
    verticalPanel.add(disclosurePanel);
    disclosurePanel.setWidth("586px");

    ScrollPanel scrollPanel = new ScrollPanel();
    disclosurePanel.setContent(scrollPanel);
    scrollPanel.setSize("581px", "112px");

    activityGrid = new TileGrid();
    activityGrid.setSize("572px", "106px");
    activityGrid.setSelectionType(SelectionStyle.NONE);
    activityGrid.setFields(viewerPictureSmall, viewerName);

    activityGrid.setEdgeSize(0);
    activityGrid.setShowEdges(false);

    activityGrid.setCanAcceptDrop(false);
    activityGrid.setCanDrag(false);

    activityGrid.setTileWidth(80);
    activityGrid.setTileHeight(80);

    scrollPanel.setWidget(activityGrid);

    box = new DialogBox();

    // Set the dialog box's caption.
    box.setText("My First Dialog");

    // Enable animation.
    box.setAnimationEnabled(true);

    // Enable glass background.
    box.setGlassEnabled(true);

    // DialogBox is a SimplePanel, so you have to set its widget 
    // property to whatever you want its contents to be.
    Button ok = new Button("OK");

    ok.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            box.hide();
        }
    });

    Label label = new Label("Il n'y a plus d'unit\u00E9 de choix");

    VerticalPanel panel = new VerticalPanel();
    panel.setHeight("100");
    panel.setWidth("300");
    panel.setSpacing(10);
    panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    panel.add(label);
    panel.add(ok);

    box.setWidget(panel);

}

From source file:com.vo.search.admin.client.content.widgets.CwQueryIndex.java

License:Apache License

/**
 * Initialize this widget.//w w  w  .  j a  v  a2  s  . c  o  m
 */
@Override
public Widget onInitialize() {

    // initialize search box
    searchBox = new TextBox();
    searchBox.ensureDebugId("cwBasicText-textbox");
    // Set the text box to automatically adjust its direction according
    // to the input text. Use the Any-RTL heuristic, which sets an RTL
    // direction
    // iff the text contains at least one RTL character.
    searchBox.setDirectionEstimator(AnyRtlDirectionEstimator.get());

    // innitialize label
    label = new Label(constants.cwQueryIndexEnterQuery());
    label.ensureDebugId("cwQueryIndex-label");
    // initialize submit button
    submitButton = new Button(constants.cwQueryIndexButtonSubmit());
    submitButton.ensureDebugId("cwBasicButton-normal");

    // Create the popup dialog box
    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText("Remote Procedure Call");
    dialogBox.setAnimationEnabled(true);

    // Set a key provider that provides a unique key for each content.
    dataGrid = new DataGrid<ContentInfo>(ContentInfo.KEY_PROVIDER);

    // Set the message to display when the table is empty.
    dataGrid.setWidth("100%");
    dataGrid.setEmptyTableWidget(new Label(constants.cwDataGridEmpty()));
    // Initialize data provider
    if (dataProvider == null) {
        dataProvider = new ListDataProvider<ContentInfo>();
    }
    dataProvider.addDataDisplay(dataGrid);

    // Create a Pager to control the table.
    SimplePager.Resources pagerResources = GWT.create(SimplePager.Resources.class);
    pager = new SimplePager(TextLocation.CENTER, pagerResources, false, 0, true);
    pager.setDisplay(dataGrid);

    // Create a handler for the sendButton and nameField
    class MyHandler implements ClickHandler {
        /**
         * Fired when the user clicks on the sendButton.
         */
        public void onClick(ClickEvent event) {
            sendQueryToServer();
        }

        /**
         * Send the name from the nameField to the server and wait for a
         * response.
         */
        private void sendQueryToServer() {
            String queryToServer = searchBox.getText();
            // Then, we send the input to the server.

            greetingService.queryServer(queryToServer, new AsyncCallback<QueryResult>() {
                public void onFailure(Throwable caught) {
                    // Show the RPC error message to the user
                    dialogBox.setText("Remote Procedure Call - Failure");
                    dialogBox.center();
                    submitButton.setEnabled(false);
                }

                public void onSuccess(QueryResult result) {
                    // Initialize the columns.
                    dataProvider.getList().clear();
                    dataProvider.setList(result.getResults());
                    initTableData(result);

                }
            });
        }
    }

    // Add a handler to send the name to the server
    MyHandler handler = new MyHandler();
    submitButton.addClickHandler(handler);

    // Create the UiBinder.
    Binder uiBinder = GWT.create(Binder.class);
    return uiBinder.createAndBindUi(this);

}

From source file:com.webgocommerce.client.view.uimenu.UIMenuImpl.java

@Override
public void showTreeMenuBar() {
    List<MenuBar> lista = new ArrayList<MenuBar>();
    Iterator<MenuBarProxy> iterador = grid.getData().iterator();
    while (iterador.hasNext()) {
        MenuBarProxy beanProxy = iterador.next();
        MenuBar bean = new MenuBar();
        bean.setIdMenuBar(beanProxy.getIdMenuBar());
        bean.setVariable(beanProxy.getVariable());
        bean.setDescripcion(beanProxy.getDescripcion());
        bean.setGrupo(beanProxy.getGrupo());
        bean.setNivel(beanProxy.getNivel());
        bean.setOrden(beanProxy.getOrden());
        bean.setTipo(beanProxy.getTipo());
        bean.setNumSubMenu(beanProxy.getNumSubMenu());
        bean.setIdMenuPadre(beanProxy.getIdMenuPadre());
        lista.add(bean);/*from   w  ww  .j  a  v  a  2 s  .c o  m*/
    }
    MenuBar root = createTree(lista.get(0), lista);
    DialogBox popup = new DialogBox();
    popup.setText("Vista previa de Menu");
    popup.setAnimationEnabled(true);
    popup.setAutoHideEnabled(true);
    popup.setGlassEnabled(true);
    ScrollPanel scroll = new ScrollPanel();
    TreeMenuModel model = new TreeMenuModel(root);
    CellTree tree = new CellTree(model, root);
    tree.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
    scroll.setSize("500px", "500px");
    scroll.setWidget(tree);
    popup.add(scroll);
    popup.setSize("500px", "500px");
    popup.center();
    popup.show();
}

From source file:cz.filmtit.client.dialogs.TimeEditDialog.java

License:Open Source License

/**
 * show the dialog/*from  www. jav  a 2  s  .c o  m*/
 */
private void showDialog() {
    dialogBox = new DialogBox();
    dialogBox.setAnimationEnabled(true);
    dialogBox.setGlassEnabled(true);
    dialogBox.addStyleName("timeEditDialog");
    dialogBox.setHTML("<h3>Change chunk timing</h3>");
    dialogBox.setWidget(this);
    dialogBox.center();
}

From source file:cz.incad.kramerius.editor.client.view.LoadViewImpl.java

License:Open Source License

@Override
public void show() {
    if (dialogBox == null) {
        dialogBox = new DialogBox();
        dialogBox.setText(I18N.loadViewTitle());
        dialogBox.setAnimationEnabled(true);
        dialogBox.setWidget(this);
        dialogBox.setGlassEnabled(true);
        dialogBox.setWidth("400px");
    }/*from   ww  w .ja v a 2  s.  c om*/

    errorLabel.setVisible(false);
    clearError();
    textBox.setText("");
    oracleTextBox.setText("");
    waiting(false);

    //        dialogBox.show();
    dialogBox.center();
    oracleTextBox.setFocus(true);
}

From source file:cz.incad.kramerius.editor.client.view.SaveViewImpl.java

License:Open Source License

@Override
public void show() {
    if (this.dialogBox == null) {
        this.dialogBox = new DialogBox();
        this.dialogBox.setText(I18N.saveViewTitle());
        this.dialogBox.setAnimationEnabled(true);
        this.dialogBox.setGlassEnabled(true);
        this.dialogBox.setWidget(asWidget());
    }//from  w ww . java  2s . c  o  m

    this.dialogBox.center();
    this.okButton.setFocus(true);
}