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:$.HelloPlugins.java

License:Apache License

@Override
    public void onModuleLoad() {
        Image img = new Image("http://code.google.com/webtoolkit/logo-185x175.png");
        Button button = new Button("Click me");

        VerticalPanel vPanel = new VerticalPanel();
        vPanel.setWidth("100%");
        vPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
        vPanel.add(img);//from w  ww . j a  v a 2  s. co m
        vPanel.add(button);

        RootPanel.get().add(vPanel);

        // Create the dialog box
        final DialogBox dialogBox = new DialogBox();

        // The content of the dialog comes from a User specified Preference
        dialogBox.setText("Hello from GWT Gerrit UI plugin");
        dialogBox.setAnimationEnabled(true);
        Button closeButton = new Button("Close");
        VerticalPanel dialogVPanel = new VerticalPanel();
        dialogVPanel.setWidth("100%");
        dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
        dialogVPanel.add(closeButton);

        closeButton.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                dialogBox.hide();
            }
        });

        // Set the contents of the Widget
        dialogBox.setWidget(dialogVPanel);

        button.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                dialogBox.center();
                dialogBox.show();
            }
        });
    }

From source file:asquare.gwt.tests.coordinates.client.Demo.java

License:Apache License

public void onModuleLoad() {
    DialogBox dialog = new DialogBox() {
        {//from  ww w .  j  av a 2s .com
            addDomHandler(new MouseDownHandler() {
                public void onMouseDown(MouseDownEvent event) {
                    Debug.println("DialogBox.onMouseDown(" + event.getX() + "," + event.getY() + ")");
                }
            }, MouseDownEvent.getType());
        }
    };
    dialog.setText("Dialog Caption");
    Image image = new Image("one.gif");
    DOM.setStyleAttribute(image.getElement(), "height", "100px");
    DOM.setStyleAttribute(image.getElement(), "width", "200px");

    dialog.setWidget(image);
    dialog.show();
    dialog.setPopupPosition(200, 200);

    Debug.enable();
    if (!GWT.isScript())
        DebugConsole.getInstance().disable();

    new DebugHierarchyInspector().install();
    new DebugElementDumpInspector().install();
    new DebugEventListener('a', Event.ONMOUSEDOWN, "Absolute position inspector") {
        protected void doEvent(Event event) {
            Element target = DOM.eventGetTarget(event);
            Debug.println(getTagName(target) + "[absLeft=" + DOM.getAbsoluteLeft(target) + ",absTop="
                    + DOM.getAbsoluteTop(target) + "]");
        }
    }.install();

    new DebugEventListener('o', Event.ONMOUSEDOWN, "Offset hierarchy inspector") {
        protected void doEvent(Event event) {
            Element target = DOM.eventGetTarget(event);
            printOffsetHierarchy(target);
        }
    }.install();

    new DebugEventListener().install();
}

From source file:asquare.gwt.tests.rtldrag.client.Demo.java

License:Apache License

public void onModuleLoad() {
    final DialogBox dialog = new DialogBox();
    dialog.setSize("200px", "100px");
    DOM.setStyleAttribute(dialog.getElement(), "border", "solid 1px black");
    dialog.setText("Drag me off the right side of the page");
    dialog.show();/*from w  w  w.ja v  a 2  s  .co  m*/

    Debug.installEventTracer('e', Event.ONMOUSEMOVE);
}

From source file:bingo.client.Bingo.java

License:Open Source License

private void initAdminGrid(final String userId, final BingoGrid bingoGrid, final boolean hasFinished) {
    final Timer timer = new Timer() {
        int totalParticipants = 0;

        @Override/*from w  ww  . j a v  a 2  s. com*/
        public void run() {
            bingoService.getTotalParticipants(userId, new AsyncCallback<Integer>() {
                @Override
                public void onFailure(Throwable caught) {
                }

                @Override
                public void onSuccess(Integer result) {
                    totalParticipants = result.intValue();
                }
            });

            bingoService.getVotes(userId, new AsyncCallback<int[][]>() {
                @Override
                public void onFailure(Throwable caught) {
                    message.setText(caught.getMessage());
                }

                @Override
                public void onSuccess(int[][] result) {
                    if (result == null) {
                        result = new int[BingoGrid.ROW][BingoGrid.COL];
                        for (int i = 0; i < BingoGrid.ROW; i++)
                            for (int j = 0; j < BingoGrid.COL; j++)
                                result[i][j] = 0;
                    }

                    for (int row = 0; row < BingoGrid.ROW; ++row)
                        for (int col = 0; col < BingoGrid.COL; ++col) {
                            bingoGrid.setVoteString(row, col, String.valueOf(result[row][col]),
                                    String.valueOf(totalParticipants));
                        }
                }
            });
        }
    };

    // If the game is not finished, repeat; if so, run once
    if (!hasFinished)
        timer.scheduleRepeating(ADMIN_TIMER);
    else
        timer.run();

    HorizontalPanel panel = new HorizontalPanel();
    panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    final Button finishButton = new Button();

    // If the game is not finished, allow finishing it; if so, allow download data
    if (!hasFinished)
        finishButton.setText(strings.finishBingo());
    else
        finishButton.setText(strings.download());

    finishButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (!hasFinished)
                bingoService.finishBingo(userId, new AsyncCallback<Void>() {
                    @Override
                    public void onFailure(Throwable caught) {
                        message.setText(caught.getMessage());
                    }

                    @Override
                    public void onSuccess(Void result) {
                        message.setText(strings.finishedBingo());
                        finishButton.setText(strings.download());
                        timer.cancel();
                    }
                });

            bingoService.getVotes(userId, new AsyncCallback<int[][]>() {
                @Override
                public void onFailure(Throwable caught) {
                    message.setText(caught.getMessage());
                }

                @Override
                public void onSuccess(int[][] result) {
                    // Create a popup dialog box
                    final DialogBox box = new DialogBox();
                    box.setText(strings.info());
                    box.setAnimationEnabled(true);

                    final Button boxAcceptButton = new Button(strings.accept());
                    boxAcceptButton.addClickHandler(new ClickHandler() {
                        @Override
                        public void onClick(ClickEvent event) {
                            box.hide();
                        }
                    });

                    Label boxLabel = new Label();
                    boxLabel.setText(strings.finishMessage());
                    HTML voteData = new HTML();
                    if (result == null) {
                        result = new int[BingoGrid.ROW][BingoGrid.COL];
                        for (int i = 0; i < BingoGrid.ROW; i++)
                            for (int j = 0; j < BingoGrid.COL; j++)
                                result[i][j] = 0;
                    }

                    String cellKey = "";
                    String cellString = "";
                    String voteDataString = "";
                    for (int row = 0; row < BingoGrid.ROW; ++row)
                        for (int col = 0; col < BingoGrid.COL; ++col) {
                            cellKey = "cell" + row + col;
                            cellString = strings.map().get(cellKey);
                            voteDataString += "&nbsp;&nbsp;&nbsp;" + cellString + " = " + result[row][col]
                                    + "<br>";
                        }
                    voteData.setHTML(voteDataString);
                    voteData.addStyleName("boxData");

                    VerticalPanel boxPanel = new VerticalPanel();
                    boxPanel.addStyleName("boxPanel");
                    boxPanel.add(boxLabel);
                    boxPanel.add(voteData);

                    HorizontalPanel buttonsPanel = new HorizontalPanel();
                    buttonsPanel.add(boxAcceptButton);
                    boxPanel.add(buttonsPanel);
                    boxPanel.setCellHorizontalAlignment(buttonsPanel, HasHorizontalAlignment.ALIGN_CENTER);

                    box.setWidget(boxPanel);
                    box.center();
                }
            });
        }
    });
    panel.add(finishButton);

    final Button terminateButton = new Button(strings.terminateButton());
    terminateButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            // Create a popup dialog box
            final DialogBox box = new DialogBox();
            box.setText(strings.warning());
            box.setAnimationEnabled(true);

            final Button boxCancelButton = new Button(strings.cancel());
            boxCancelButton.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    box.hide();
                }
            });
            final Button boxAcceptButton = new Button(strings.accept());
            boxAcceptButton.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    bingoService.terminateBingo(userId, new AsyncCallback<Void>() {
                        @Override
                        public void onFailure(Throwable caught) {
                            message.setText(caught.getMessage());
                        }

                        @Override
                        public void onSuccess(Void result) {
                            message.setText(strings.terminatedBingo());
                            timer.cancel();
                        }

                    });
                    box.hide();
                }
            });

            final Label boxLabel = new Label();
            boxLabel.setText(strings.terminateMessage());

            VerticalPanel boxPanel = new VerticalPanel();

            boxPanel.addStyleName("boxPanel");
            boxPanel.add(boxLabel);

            HorizontalPanel buttonsPanel = new HorizontalPanel();
            buttonsPanel.add(boxCancelButton);
            buttonsPanel.add(boxAcceptButton);
            boxPanel.add(buttonsPanel);

            box.setWidget(boxPanel);
            box.center();
        }
    });
    panel.add(terminateButton);

    RootPanel.get("buttons").clear();
    RootPanel.get("buttons").add(panel);
}

From source file:client.Tetris.java

License:Apache License

public static void gameOverEx() {
    // Create the dialog box
    final DialogBox dialogBox = new DialogBox();
    final String gameOverText = "You just lost <a href='http://www.google.com/"
            + "search?q=lost+the+game'>The Game</a>";
    dialogBox.setHTML(gameOverText);/*from  w w  w.j ava 2  s .  c  o m*/
    dialogBox.setAnimationEnabled(true);
    HTML html = new HTML("<u>Controls</u><br/>" + "<b>Right Left Down</b>: move around<br/>"
            + "<b>Up</b>: rotate clockwise<br/>" + "<b>Space</b>: drop");
    Button button = new Button("New Game");
    VerticalPanel dialogVPanel = new VerticalPanel();
    dialogVPanel.setWidth("100%");
    dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
    dialogVPanel.add(html);
    dialogVPanel.add(button);

    button.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            dialogBox.hide();
            newGame();
        }
    });

    // Set the contents of the Widget
    dialogBox.setWidget(dialogVPanel);
    dialogBox.center();
    dialogBox.show();
}

From source file:cmg.org.monitor.module.client.InviteUser.java

License:Open Source License

/**
 * Show dialog box./*ww w.j  ava2  s. com*/
 *
 * @param idUser the id user
 * @param actionType the action type
 * @param filter the filter
 */
static void showDialogBox(final String idUser, String actionType, String filter) {
    filterStatic = filter;
    ActionStatic = actionType;
    if (filter.equalsIgnoreCase(filter_Active)) {
        dialogFunction = new DialogBox();
        dialogFunction.setAnimationEnabled(true);
        VerticalPanel dialogVPanel = new VerticalPanel();
        //if filter is active so the idUser will be inactive or delete.we will do this in this
        String tempName = null;
        for (InvitedUser u : listUser3rds) {
            if (u.getEmail().toString().equals(idUser)) {
                tempName = u.getEmail();
            }
        }

        final Button closeButton = new Button("Cancel");
        closeButton.setStyleName("margin:6px;");
        closeButton.addStyleName("form-button");
        final Button okButton = new Button("OK");
        okButton.setStyleName("margin:6px;");
        okButton.addStyleName("form-button");
        final Button exitButton = new Button();
        exitButton.setStyleName("");
        exitButton.getElement().setId("closeButton");
        exitButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                dialogFunction.hide();
            }
        });
        HTML popupContent = new HTML();
        popupContent.setHTML("<h4>Do you want to " + actionType + " user : " + tempName + "?</h4>");
        popupContent.setWidth("400px");
        FlexTable flexHTML = new FlexTable();
        flexHTML.setWidget(0, 0, popupContent);
        flexHTML.getCellFormatter().setWidth(0, 0, "400px");
        flexHTML.setStyleName("table-popup");
        FlexTable table = new FlexTable();
        table.setCellPadding(5);
        table.setCellSpacing(5);
        table.setWidget(0, 0, okButton);
        table.setWidget(0, 1, closeButton);
        table.getCellFormatter().setHorizontalAlignment(0, 0, VerticalPanel.ALIGN_RIGHT);
        table.getCellFormatter().setHorizontalAlignment(0, 1, VerticalPanel.ALIGN_RIGHT);
        dialogVPanel.add(exitButton);
        dialogVPanel.add(flexHTML);
        dialogVPanel.add(table);
        dialogVPanel.setCellHorizontalAlignment(exitButton, VerticalPanel.ALIGN_RIGHT);
        dialogVPanel.setCellHorizontalAlignment(flexHTML, VerticalPanel.ALIGN_LEFT);
        dialogVPanel.setCellHorizontalAlignment(table, VerticalPanel.ALIGN_RIGHT);
        okButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                setVisibleWidget(HTMLControl.ID_BODY_CONTENT, false);
                setVisibleLoadingImage(true);
                popupAction(filterStatic, ActionStatic, idUser);
            }
        });
        closeButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                dialogFunction.hide();
            }
        });
        dialogFunction.setWidget(dialogVPanel);
        dialogFunction.getCaption().asWidget().setStyleName("myCaption");
        dialogFunction.center();

    }
    if (filter.equalsIgnoreCase(filter_requesting)) {
        //if filter requesting,so they will action to active this user
        dialogFunction = new DialogBox();
        dialogFunction.setAnimationEnabled(true);
        VerticalPanel dialogVPanel = new VerticalPanel();
        //if filter is active so the idUser will be inactive.we will do this in this
        String tempName = null;
        for (InvitedUser u : listUser3rds) {
            if (u.getEmail().toString().equals(idUser)) {
                tempName = u.getEmail();
            }
        }
        final Button closeButton = new Button("Cancel");
        closeButton.setStyleName("margin:6px;");
        closeButton.addStyleName("form-button");
        final Button okButton = new Button("OK");
        okButton.setStyleName("margin:6px;");
        okButton.addStyleName("form-button");
        final Button exitButton = new Button();
        exitButton.setStyleName("");
        exitButton.getElement().setId("closeButton");
        exitButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                dialogFunction.hide();
            }
        });
        HTML popupContent = new HTML();
        popupContent.setHTML("<h4>Assgin this" + " user : " + tempName + " to group</h4>");
        popupContent.setWidth("400px");
        listTemp = new ListBox();
        listTemp.setMultipleSelect(true);
        listTemp.setWidth("300px");
        listTemp.setHeight("80px");
        listTemp.addItem(DefaulValueOfListTemp);
        listAll = new ListBox();
        listAll.setWidth("150px");
        for (SystemGroup s : listGroup) {
            listAll.addItem(s.getName());
        }
        btt_MappingGroup = new Button("Mapping");
        btt_MappingGroup.addClickHandler(new MappingGroup());
        btt_UnMappingGroup = new Button("UnMapping");
        btt_UnMappingGroup.addClickHandler(new UnMappingGroup());
        panelValidateGroups = new AbsolutePanel();
        FlexTable flexHTML = new FlexTable();
        flexHTML.getCellFormatter().setWidth(1, 0, "100px");
        flexHTML.getCellFormatter().setWidth(1, 1, "100px");
        flexHTML.getCellFormatter().setWidth(1, 2, "100px");
        flexHTML.getCellFormatter().setWidth(1, 3, "200px");
        flexHTML.getCellFormatter().setWidth(1, 4, "400px");
        flexHTML.getFlexCellFormatter().setColSpan(0, 0, 5);
        flexHTML.setWidget(0, 0, popupContent);
        flexHTML.setWidget(1, 0, listAll);
        flexHTML.setWidget(1, 1, btt_MappingGroup);
        flexHTML.setWidget(1, 2, btt_UnMappingGroup);
        flexHTML.setWidget(1, 3, listTemp);
        flexHTML.setStyleName("table-popup");
        FlexTable table = new FlexTable();
        table.setCellPadding(5);
        table.setCellSpacing(5);
        table.setWidget(0, 0, okButton);
        table.setWidget(0, 1, closeButton);
        table.getCellFormatter().setHorizontalAlignment(0, 0, VerticalPanel.ALIGN_RIGHT);
        table.getCellFormatter().setHorizontalAlignment(0, 1, VerticalPanel.ALIGN_RIGHT);
        dialogVPanel.add(exitButton);
        dialogVPanel.add(flexHTML);
        dialogVPanel.add(table);
        dialogVPanel.setCellHorizontalAlignment(exitButton, VerticalPanel.ALIGN_RIGHT);
        dialogVPanel.setCellHorizontalAlignment(flexHTML, VerticalPanel.ALIGN_LEFT);
        dialogVPanel.setCellHorizontalAlignment(table, VerticalPanel.ALIGN_RIGHT);
        okButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                //send to server
                if (listTemp.getValue(0).equalsIgnoreCase(DefaulValueOfListTemp)) {
                    listTemp.setFocus(true);
                    return;
                } else {
                    setVisibleWidget(HTMLControl.ID_BODY_CONTENT, false);
                    setVisibleLoadingImage(true);
                    popupAction(filterStatic, ActionStatic, idUser);
                }

            }
        });
        closeButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                dialogFunction.hide();
            }
        });
        dialogFunction.setWidget(dialogVPanel);
        dialogFunction.getCaption().asWidget().setStyleName("myCaption");
        dialogFunction.center();
    }
    if (filter.equalsIgnoreCase(filter_pending)) {
        dialogFunction = new DialogBox();
        dialogFunction.setAnimationEnabled(true);
        VerticalPanel dialogVPanel = new VerticalPanel();
        //if filter is pending so the idUser will be delete.we will do this in this
        String tempName = null;
        for (InvitedUser u : listUser3rds) {
            if (u.getEmail().toString().equals(idUser)) {
                tempName = u.getEmail();
            }
        }

        final Button closeButton = new Button("Cancel");
        closeButton.setStyleName("margin:6px;");
        closeButton.addStyleName("form-button");
        final Button okButton = new Button("OK");
        okButton.setStyleName("margin:6px;");
        okButton.addStyleName("form-button");
        final Button exitButton = new Button();
        exitButton.setStyleName("");
        exitButton.getElement().setId("closeButton");
        exitButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                dialogFunction.hide();
            }
        });
        HTML popupContent = new HTML();
        popupContent.setHTML("<h4>Do you want to " + actionType + " user : " + tempName + "?</h4>");
        popupContent.setWidth("400px");
        FlexTable flexHTML = new FlexTable();
        flexHTML.setWidget(0, 0, popupContent);
        flexHTML.getCellFormatter().setWidth(0, 0, "400px");
        flexHTML.setStyleName("table-popup");
        FlexTable table = new FlexTable();
        table.setCellPadding(5);
        table.setCellSpacing(5);
        table.setWidget(0, 0, okButton);
        table.setWidget(0, 1, closeButton);
        table.getCellFormatter().setHorizontalAlignment(0, 0, VerticalPanel.ALIGN_RIGHT);
        table.getCellFormatter().setHorizontalAlignment(0, 1, VerticalPanel.ALIGN_RIGHT);
        dialogVPanel.add(exitButton);
        dialogVPanel.add(flexHTML);
        dialogVPanel.add(table);
        dialogVPanel.setCellHorizontalAlignment(exitButton, VerticalPanel.ALIGN_RIGHT);
        dialogVPanel.setCellHorizontalAlignment(flexHTML, VerticalPanel.ALIGN_LEFT);
        dialogVPanel.setCellHorizontalAlignment(table, VerticalPanel.ALIGN_RIGHT);
        okButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                setVisibleWidget(HTMLControl.ID_BODY_CONTENT, false);
                setVisibleLoadingImage(true);
                popupAction(filterStatic, ActionStatic, idUser);
            }
        });
        closeButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                dialogFunction.hide();
            }
        });
        dialogFunction.setWidget(dialogVPanel);
        dialogFunction.getCaption().asWidget().setStyleName("myCaption");
        dialogFunction.center();
    }
}

From source file:cmg.org.monitor.module.client.InviteUser.java

License:Open Source License

/**
 * Show dialog invited./*from w  w  w .j  av  a  2 s.c o  m*/
 */
static void showDialogInvited() {
    dialogInvite = new DialogBox();
    dialogInvite.setAnimationEnabled(true);
    final Button exitButton = new Button();
    exitButton.setStyleName("");
    exitButton.getElement().setId("closeButton");
    exitButton.addStyleName("align=right");
    exitButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            dialogInvite.hide();
        }
    });
    btt_invite = new Button("Invite");
    btt_invite.setStyleName("margin:6px;");
    btt_invite.addStyleName("form-button");
    btt_invite.addClickHandler(new inviteUserHandler());
    btt_reset = new Button("Reset");
    btt_reset.setStyleName("margin:6px;");
    btt_reset.addStyleName("form-button");
    btt_reset.addClickHandler(new ResetInviteHandler());
    txt_email = new TextArea();
    txt_email.setTitle("Invite user");
    txt_email.setWidth("400px");
    txt_email.setHeight("100px");
    FlexTable panelButton = new FlexTable();
    panelButton.setWidget(0, 0, btt_invite);
    panelButton.setWidget(0, 1, btt_reset);
    panelButton.setCellPadding(5);
    panelButton.setCellSpacing(5);
    panelValidateEmail = new AbsolutePanel();
    panelValidateEmail.setVisible(false);
    listGroupInvi = new ListBox();
    listGroupInvi.setTitle("List Group");
    listGroupInvi.setWidth("200px");
    for (SystemGroup s : listGroup) {
        listGroupInvi.addItem(s.getName());
    }
    Label lblEmail = new Label("Gmail Address");
    FlexTable table = new FlexTable();
    table.setCellPadding(5);
    table.setCellSpacing(5);
    table.setWidget(0, 0, lblEmail);
    table.setWidget(0, 1, txt_email);
    table.setWidget(0, 2, panelValidateEmail);
    table.setWidget(0, 3, listGroupInvi);
    /*table.setWidget(2, 0, panelLog);*/
    table.getCellFormatter().setHorizontalAlignment(0, 0, VerticalPanel.ALIGN_LEFT);
    table.getCellFormatter().setHorizontalAlignment(0, 1, VerticalPanel.ALIGN_RIGHT);
    VerticalPanel dialogVPanel = new VerticalPanel();
    dialogVPanel.add(exitButton);
    dialogVPanel.setCellHorizontalAlignment(exitButton, VerticalPanel.ALIGN_RIGHT);
    dialogVPanel.add(table);
    dialogVPanel.add(panelButton);
    dialogVPanel.setCellHorizontalAlignment(panelButton, VerticalPanel.ALIGN_RIGHT);
    dialogInvite.setWidget(dialogVPanel);
    dialogInvite.getCaption().asWidget().setStyleName("myCaption");
    dialogInvite.center();
}

From source file:co.edu.udea.iw.rtf.client.ui.CrearSolicitudViewImpl.java

License:Open Source License

public CrearSolicitudViewImpl() {
    initWidget(binder.createAndBindUi(this));

    labelNombresSolicitante = new Label("* Nombres: ");
    labelApellidosSolicitante = new Label("* Apellidos: ");
    labelCelular = new Label("Celular: ");
    labelCorreoElectronico = new Label("* Correo electrnico: ");
    labelConfirmacionCorreo = new Label("* Confirmacin del correo: ");
    labelTelefono = new Label("* Telefono: ");
    labelOtroProducto = new Label("Otro producto: ");
    labelProducto = new Label("* Producto: ");
    labelSucursal = new Label("* Sucursal: ");
    labelTextoSolicitud = new Label("* Texto de la solicitud: ");
    labelTipoSolicitud = new Label("* Tipo de solicitud: ");

    labelNombresSolicitanteError = new Label();
    labelApellidosSolicitanteError = new Label();
    labelCelularError = new Label();
    labelCorreoElectronicoError = new Label();
    labelConfirmacionCorreoError = new Label();
    labelTelefonoError = new Label();
    labelOtroProductoError = new Label();
    labelProductoError = new Label();
    labelSucursalError = new Label();
    labelTextoSolicitudError = new Label();
    labelTipoSolicitudError = new Label();
    textBoxApellidosSolicitante = new TextBox();
    textBoxCelular = new TextBox();
    textBoxConfirmacionCorreo = new TextBox();
    textBoxCorreoElectronico = new TextBox();
    textBoxNombresSolicitante = new TextBox();
    textBoxOtroProducto = new TextBox();
    textBoxTelefono = new TextBox();
    textBoxTextoSolicitud = new TextArea();
    listBoxProducto = new ListBox();
    listBoxSuscursal = new ListBox();
    listBoxTipoSolicitud = new ListBox();

    textBoxNombresSolicitante.setMaxLength(45);
    textBoxApellidosSolicitante.setMaxLength(45);
    textBoxTelefono.setMaxLength(15);//from  w ww  .  ja  v a  2  s  .c  om
    textBoxCelular.setMaxLength(15);
    textBoxCorreoElectronico.setMaxLength(120);
    textBoxConfirmacionCorreo.setMaxLength(120);

    labelNombresSolicitante.addStyleName("label");
    labelApellidosSolicitante.addStyleName("label");
    labelCelular.addStyleName("label");
    labelCorreoElectronico.addStyleName("label");
    labelConfirmacionCorreo.addStyleName("label");
    labelTelefono.addStyleName("label");
    labelOtroProducto.addStyleName("label");
    labelProducto.addStyleName("label");
    labelSucursal.addStyleName("label");
    labelTextoSolicitud.addStyleName("label");
    labelTipoSolicitud.addStyleName("label");
    textBoxNombresSolicitante.addStyleName("textBox");
    textBoxApellidosSolicitante.addStyleName("textBox");
    textBoxCorreoElectronico.addStyleName("textBox");
    textBoxConfirmacionCorreo.addStyleName("textBox");
    textBoxTelefono.addStyleName("textBox");
    textBoxCelular.addStyleName("textBox");
    textBoxOtroProducto.addStyleName("textBox");
    textBoxTextoSolicitud.addStyleName("area");
    listBoxProducto.addStyleName("lista");
    listBoxSuscursal.addStyleName("lista");
    listBoxTipoSolicitud.addStyleName("lista");

    tabla.setWidget(0, 0, labelNombresSolicitante);
    tabla.setWidget(0, 1, textBoxNombresSolicitante);
    tabla.setWidget(0, 2, labelNombresSolicitanteError);
    tabla.setWidget(1, 0, labelApellidosSolicitante);
    tabla.setWidget(1, 1, textBoxApellidosSolicitante);
    tabla.setWidget(1, 2, labelApellidosSolicitanteError);
    tabla.setWidget(2, 0, labelCorreoElectronico);
    tabla.setWidget(2, 1, textBoxCorreoElectronico);
    tabla.setWidget(2, 2, labelCorreoElectronicoError);
    tabla.setWidget(3, 0, labelConfirmacionCorreo);
    tabla.setWidget(3, 1, textBoxConfirmacionCorreo);
    tabla.setWidget(3, 2, labelConfirmacionCorreoError);
    tabla.setWidget(4, 0, labelTelefono);
    tabla.setWidget(4, 1, textBoxTelefono);
    tabla.setWidget(4, 2, labelTelefonoError);
    tabla.setWidget(5, 0, labelCelular);
    tabla.setWidget(5, 1, textBoxCelular);
    tabla.setWidget(5, 2, labelCelularError);
    tabla.setWidget(6, 0, labelProducto);
    tabla.setWidget(6, 1, listBoxProducto);
    tabla.setWidget(6, 2, labelProductoError);
    tabla.setWidget(7, 0, labelOtroProducto);
    tabla.setWidget(7, 1, textBoxOtroProducto);
    tabla.setWidget(7, 2, labelOtroProductoError);
    tabla.setWidget(8, 0, labelSucursal);
    tabla.setWidget(8, 1, listBoxSuscursal);
    tabla.setWidget(8, 2, labelSucursalError);
    tabla.setWidget(9, 0, labelTipoSolicitud);
    tabla.setWidget(9, 1, listBoxTipoSolicitud);
    tabla.setWidget(9, 2, labelTipoSolicitudError);
    tabla.setWidget(10, 0, labelTextoSolicitud);
    tabla.setWidget(10, 1, textBoxTextoSolicitud);
    tabla.setWidget(10, 2, labelTextoSolicitudError);

    dialogBox = new DialogBox();
    dialogBox.setText("Default Dialog Text");
    dialogBox.setAnimationEnabled(true);
    closeButton = new Button("Close");
    // We can set the id of a widget by accessing its Element
    closeButton.getElement().setId("closeButton");
    VerticalPanel dialogVPanel = new VerticalPanel();
    dialogVPanel.addStyleName("dialogVPanel");
    dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT);
    dialogVPanel.add(closeButton);
    dialogBox.setWidget(dialogVPanel);
    dialogBox.hide();
    // Add a handler to close the DialogBox
    closeButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            dialogBox.hide();
        }
    });
}

From source file:com.acme.gwt.client.TvGuide.java

License:Apache License

public void onModuleLoad() {

    //code from jnorthrup's fork, will be moved to a presenter soon enough
    EventBus eventBus = GWT.create(SimpleEventBus.class);
    final MyRequestFactory rf = GWT.create(MyRequestFactory.class);
    rf.initialize(eventBus);//from  ww  w.j  a  va2 s .c  o  m
    final GateKeeper gateKeeper = new GateKeeper();
    new DialogBox() {
        {
            final TextBox email = new TextBox() {
                {
                    setText("you@example.com");
                }
            };
            final PasswordTextBox passwordTextBox = new PasswordTextBox();
            setText("please log in");
            setWidget(new VerticalPanel() {
                {
                    add(new HorizontalPanel() {
                        {
                            add(new Label("email"));
                            add(email);
                        }
                    });
                    add(new HorizontalPanel() {
                        {
                            add(new Label("Password"));
                            add(passwordTextBox);
                        }
                    });
                    add(new Button("OK!!") {
                        {
                            addClickHandler(new ClickHandler() {
                                @Override
                                public void onClick(ClickEvent event) {
                                    String text = passwordTextBox.getText();
                                    String digest = Md5.md5Hex(text);
                                    Request<TvViewerProxy> authenticate = rf.reqViewer()
                                            .authenticate(email.getText(), digest);
                                    authenticate
                                            .with("geo", "name", "favoriteShows.name",
                                                    "favoriteShows.description")
                                            .to(gateKeeper).fire(new Receiver<Void>() {
                                                @Override
                                                public void onSuccess(Void response) {
                                                    hide(); //todo: review for a purpose
                                                    removeFromParent();
                                                }
                                            });
                                }
                            });
                        }
                    });
                }
            });
            center();
            show();
        }
    };
}

From source file:com.akjava.gwt.subplayer.client.SubPlayer.java

License:Apache License

private void loadSrt(final int selectIndex) {
    final String text = loadPanel.getText();

    final DialogBox dialog = new DialogBox();

    //dialog.setSize("200px", "200px");
    dialog.setText("Subtitle Parsing");
    //GWT.log(loadImg.getUrl());
    //loadImg.setVisible(true);
    VerticalPanel vpanel = new VerticalPanel();
    //Image img=new Image("../img/loadanime.gif");
    //GWT.log(img.getUrl());
    //loadImg.setVisible(true);
    vpanel.add(loadImg);/*from w  w  w  .ja v  a2 s . c  o  m*/
    dialog.setWidget(vpanel);
    dialog.setModal(true);
    dialog.setGlassEnabled(true);
    dialog.show();
    dialog.center();

    Timer timer = new Timer() {

        @Override
        public void run() {

            SRTParser parser = new SRTParser();
            SRTList list = parser.parse(text.split("\n"));
            dialog.hide();

            playerWidget.setSubLength(list.size());
            if (list.size() > 0) {
                preference.setSrtText(text);
                preference.setSrtSelectIndex(0);
                playerWidget.setSubIndex(0);
            }
            itemPanel.clear();
            for (int i = 0; i < list.size(); i++) {
                SRTObject srt = list.getSRTObjectAt(i);
                SRTItemPanel panel = new SRTItemPanel(srt);
                panel.addClickHandler(selectWidgetHandler);
                itemPanel.add(panel);
            }
            initPlayerSettings();
            tab.selectTab(0);//switch to view
            //label mode
            updateNoSubtitleWarning();
            selectWidget(selectIndex);
        }
    };
    timer.schedule(100);

}