Example usage for com.google.gwt.user.client.ui VerticalPanel add

List of usage examples for com.google.gwt.user.client.ui VerticalPanel add

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui VerticalPanel add.

Prototype

@Override
    public void add(Widget w) 

Source Link

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);
        vPanel.add(button);//  w ww .ja  v a  2  s  .  c  om

        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.debug.client.DebugConsole.java

License:Apache License

/**
 * Creates the console, installs the enabler key listener. 
 * The console is not yet attached to the DOM. 
 *///w ww .j av a2 s  .com
protected DebugConsole() {
    super(false, false);
    setStyleName("tk-DebugConsole");
    DOM.setStyleAttribute(getElement(), "border", "solid black 1px");
    DOM.setStyleAttribute(getElement(), "background", "white");

    setHTML("<div style='margin: 2px; padding: 3px; background-color: rgb(195, 217, 255); font-weight: bold; font-size: smaller; cursor: default;'>Debug Console</div>");

    m_content.setWordWrap(false);
    DOM.setStyleAttribute(m_content.getElement(), "margin", "2px");
    DOM.setStyleAttribute(m_content.getElement(), "padding", "3px");

    VerticalPanel outer = new VerticalPanel();

    ScrollPanel scrollPanel = new ScrollPanel(m_content);
    scrollPanel.setAlwaysShowScrollBars(true);
    scrollPanel.setSize("40em", "20em");
    outer.add(scrollPanel);

    HorizontalPanel controls = new HorizontalPanel();
    DOM.setStyleAttribute(controls.getElement(), "margin", "2px");
    controls.setWidth("100%");
    outer.add(controls);

    HorizontalPanel controlsLeft = new HorizontalPanel();
    controls.add(controlsLeft);
    controls.setCellHorizontalAlignment(controlsLeft, HorizontalPanel.ALIGN_LEFT);

    HorizontalPanel controlsRight = new HorizontalPanel();
    controls.add(controlsRight);
    controls.setCellHorizontalAlignment(controlsRight, HorizontalPanel.ALIGN_RIGHT);

    final Button toggleDebugButton = new Button("Toggle&nbsp;Debug");
    DOM.setElementProperty(toggleDebugButton.getElement(), "title", "Toggles output of debug statements");
    controlsLeft.add(toggleDebugButton);

    updateDisableButtonText();
    DOM.setElementProperty(m_disableButton.getElement(), "title",
            "Prevents this console from appearing when debug statements are printed");
    controlsLeft.add(m_disableButton);

    final Button clearButton = new Button("Clear");
    DOM.setElementProperty(clearButton.getElement(), "title", "Clears all messages in the console");
    controlsRight.add(clearButton);

    final Button hideButton = new Button("Hide");
    DOM.setStyleAttribute(hideButton.getElement(), "textAlign", "right");
    controlsRight.add(hideButton);

    setWidget(outer);
    m_left = Window.getClientWidth() / 2 - 640 / 2;
    m_top = Window.getClientHeight() / 2;

    m_enabler.install();

    ClickHandler handler = new ClickHandler() {
        public void onClick(ClickEvent event) {
            Widget sender = (Widget) event.getSource();
            if (sender == clearButton) {
                clearMessages();
            } else if (sender == hideButton) {
                hide();
            } else if (sender == m_disableButton) {
                disable();
            } else if (sender == toggleDebugButton) {
                if (Debug.isEnabled()) {
                    Debug.disable();
                } else {
                    Debug.enable();
                }
            } else {
                assert false;
            }
        }
    };
    toggleDebugButton.addClickHandler(handler);
    m_disableButton.addClickHandler(handler);
    clearButton.addClickHandler(handler);
    hideButton.addClickHandler(handler);

    sinkEvents(Event.ONMOUSEDOWN);
    preventSelectionInIE(getElement());
}

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

License:Apache License

private Widget createDemoPanel() {
    VerticalPanel outer = new VerticalPanel();

    final TextArea output = new TextArea();
    outer.add(output);

    Label label = new Label("Click me");
    label.addMouseDownHandler(new MouseDownHandler() {
        public void onMouseDown(MouseDownEvent event) {
            // this works
            output.setText("x=" + DOM2.eventGetClientX());

            // this results in an infinite loop
            output.setText(output.getText() + "\r\ny=" + DOM2.eventGetClientY());
        }//from w  w w  .j  a  va 2 s  . c  om
    });
    DOM.setStyleAttribute(label.getElement(), "border", "solid black 1px");
    outer.insert(label, 0);

    return outer;
}

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

License:Apache License

private Widget createDemoPanel() {
    VerticalPanel outer = new VerticalPanel();
    TextBox input = new TextBox();
    input.setText("Click Here");
    TextArea output = new TextArea();
    outer.add(input);
    outer.add(output);/*from  w w  w .ja  va2s  .c o  m*/

    MouseHandler handler = new MouseHandler(output);
    HandlesAllMouseEvents.handle(input, handler);
    return outer;
}

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

License:Apache License

public void onModuleLoad() {
    RootPanel body = RootPanel.get();/*from www .j a v a2s .  co  m*/
    DOM.setStyleAttribute(body.getElement(), "background", "blue");
    final Button showPopupButton = new Button("Show popup");
    showPopupButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            final PopupPanel popup = new PopupPanel(true);
            VerticalPanel outer = new VerticalPanel();
            outer.add(new HTML("Click outside the popup to dismiss it"));
            outer.add(new Button("DOM.setStyleAttribute(popup.getElement(), \"visibility\", \"hidden\")",
                    new ClickHandler() {
                        public void onClick(ClickEvent event) {
                            DOM.setStyleAttribute(popup.getElement(), "visibility", "hidden");
                        }
                    }));
            popup.setWidget(outer);
            DOM.setStyleAttribute(popup.getElement(), "border", "double black 4px");
            DOM.setStyleAttribute(popup.getElement(), "background", "red");
            popup.setSize("20em", "20em");
            int x = showPopupButton.getAbsoluteLeft();
            int y = showPopupButton.getAbsoluteTop() + showPopupButton.getOffsetHeight();
            popup.setPopupPosition(x, y);
            popup.show();
        }
    });
    body.add(showPopupButton);
}

From source file:asquare.gwt.tkdemo.client.demos.FocusCycleDemo.java

License:Apache License

private Widget createFocusCycle2() {
    BasicPanel cycle2 = new BasicPanel("div", "block");
    FocusModel focusModel = new FocusModel();
    TabFocusController focusController = (TabFocusController) GWT.create(TabFocusController.class);
    focusController.setModel(focusModel);

    cycle2.add(new Label("Cycle 2"));
    Label label = new Label("A custom focus cycle across containers");
    DomUtil.setStyleAttribute(label, "fontSize", "smaller");
    cycle2.add(label);//w  ww.ja  v  a 2  s  .  c  o  m
    HorizontalPanel containers = new HorizontalPanel();

    FocusStyleDecorator[] buttons = new FocusStyleDecorator[6];
    for (int i = 0; i < buttons.length; i++) {
        buttons[i] = new FocusStyleDecorator(new Button("index&nbsp;" + i));
    }
    VerticalPanel container1 = new VerticalPanel();
    container1.addStyleName("focus-container");
    VerticalPanel container2 = new VerticalPanel();
    container2.addStyleName("focus-container");

    for (int i = 0; i < buttons.length; i += 2) {
        container1.add(buttons[i]);
        focusModel.add(buttons[i]);
        container2.add(buttons[i + 1]);
        focusModel.add(buttons[i + 1]);
    }

    containers.add(new CWrapper(container1).addController(focusController));
    containers.add(new CWrapper(container2).addController(focusController));
    cycle2.add(containers);

    new WidgetFocusStyleController(focusModel);

    return cycle2;
}

From source file:at.ait.dme.yuma.client.image.annotation.StandardImageAnnotationForm.java

License:EUPL

/**
 * Adds a resource link (checkbox with text)
 * @param t a {@link LinkedAnnotationResource}
 * @param checked whether the checkbox is checked when the link is added
 *//*from  w w  w. j  a  va2  s  .c  o m*/
private void addLink(SemanticTag t, VerticalPanel p, boolean checked) {
    Checkbox linkBox = new Checkbox();
    linkBox.setValue(checked);

    String shortDescription = t.getDescription();
    if (shortDescription.length() > 50) {
        shortDescription = shortDescription.substring(0, 50) + "...";
    }
    linkBox.setHTML(
            "<a title=\"" + t.getDescription() + "\"href=\"" + t.getURI() + "\">" + shortDescription + "</a>");
    linkBox.setStyleName("imageAnnotation-form-checkbox");
    linkBox.setResource(t);
    linkBox.addClickHandler(new SelectImageAnnotationTagClickHandler(this));
    p.add(linkBox);
}

From source file:bingo.client.Bingo.java

License:Open Source License

/**
 * This is the entry point method./*from  w  w w . j a va2  s.  co  m*/
 */
public void onModuleLoad() {
    Label titleLabel = new Label();
    titleLabel.setText(strings.title());
    RootPanel.get("title").add(titleLabel);

    // This is the general notification text box
    RootPanel.get("message").add(message);

    // Cheking if the user has already an user id
    final String cookie = Cookies.getCookie(COOKIE_ID);

    // Validating the cookie
    bingoService.statusUserId(cookie, new AsyncCallback<Integer>() {
        @Override
        public void onFailure(Throwable caught) {
            message.setText(caught.getMessage());
            Cookies.removeCookie(COOKIE_ID);
        }

        @Override
        public void onSuccess(Integer status) {
            // TODO: Control the logged status (I should not get a user if s/he is already logged)
            if (status.intValue() == BingoService.NO_LOGGED || status.intValue() == BingoService.LOGGED) {
                bingoService.getUserId(new AsyncCallback<String>() {
                    @Override
                    public void onFailure(Throwable caught) {
                        message.setText(strings.errorUserCreation());
                    }

                    @Override
                    public void onSuccess(String result) {
                        userId = result;
                    }
                });

                message.setHTML("");

                // Showing image to enter
                ImageResource imageResource = BingoResources.INSTANCE.entry();
                Image entryImage = new Image(imageResource.getSafeUri());
                RootPanel.get("buttons").add(entryImage);

                // Selecting behavior (admin / voter) 
                HorizontalPanel entryPoint = new HorizontalPanel();

                entryPoint.setStyleName("mainSelectorPanel");
                entryPoint.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
                entryPoint.setSpacing(50);

                // 
                // CREATING A BINGO
                //
                VerticalPanel leftPanel = new VerticalPanel();
                leftPanel.setStyleName("selectorPanel");

                Label leftPanelTitle = new Label();
                leftPanelTitle.setStyleName("selectorPanelTitle");
                leftPanelTitle.setText(strings.leftPanelTitle());
                leftPanel.add(leftPanelTitle);
                leftPanel.setCellHorizontalAlignment(leftPanelTitle, HasHorizontalAlignment.ALIGN_CENTER);

                Grid leftSubPanel = new Grid(2, 2);
                leftSubPanel.setWidget(0, 0, new Label(strings.createBingoName()));
                final TextBox bingoNameBox = new TextBox();
                leftSubPanel.setWidget(0, 1, bingoNameBox);

                leftSubPanel.setWidget(1, 0, new Label(strings.createBingoPassword()));
                final PasswordTextBox bingoPasswordBox = new PasswordTextBox();
                leftSubPanel.setWidget(1, 1, bingoPasswordBox);
                leftPanel.add(leftSubPanel);

                final Button createButton = new Button("Create");
                createButton.addClickHandler(new ClickHandler() {
                    public void onClick(ClickEvent event) {
                        bingoService.createBingo(userId, bingoNameBox.getText(), bingoPasswordBox.getText(),
                                new AsyncCallback<String>() {
                                    @Override
                                    public void onFailure(Throwable caught) {
                                        message.setText(caught.getMessage());
                                    }

                                    @Override
                                    public void onSuccess(final String gameId) {
                                        final BingoGrid bingoGrid = new BingoGrid();
                                        initAdminGrid(userId, bingoGrid, false);
                                        RootPanel.get("bingoTable").clear();
                                        RootPanel.get("bingoTable").add(bingoGrid);
                                        message.setText(strings.welcomeMessageCreation());

                                        // Setting the cookie
                                        Date expirationDate = new Date();
                                        expirationDate.setHours(expirationDate.getHours() + EXPIRATION_VALUE);
                                        Cookies.setCookie(COOKIE_ID, userId, expirationDate);
                                    }
                                });
                    }
                });
                leftPanel.add(createButton);
                leftPanel.setCellHorizontalAlignment(createButton, HasHorizontalAlignment.ALIGN_CENTER);
                entryPoint.add(leftPanel);

                // 
                // JOINING
                //
                VerticalPanel rightPanel = new VerticalPanel();
                rightPanel.setStyleName("selectorPanel");

                Label rightPanelTitle = new Label();
                rightPanelTitle.setStyleName("selectorPanelTitle");
                rightPanelTitle.setText(strings.rightPanelTitle());
                rightPanel.add(rightPanelTitle);
                rightPanel.setCellHorizontalAlignment(rightPanelTitle, HasHorizontalAlignment.ALIGN_CENTER);

                Grid rightSubPanel = new Grid(2, 2);
                rightSubPanel.setWidget(0, 0, new Label(strings.joinToBingoName()));
                final ListBox joinExistingBingoBox = new ListBox();
                bingoService.getBingos(new AsyncCallback<String[][]>() {
                    @Override
                    public void onFailure(Throwable caught) {
                        joinExistingBingoBox.addItem(strings.noBingos());
                    }

                    @Override
                    public void onSuccess(String[][] result) {
                        if (result == null) {
                            joinExistingBingoBox.addItem(strings.noBingos());
                        } else {
                            for (int i = 0; i < result.length; i++) {
                                String gameName = result[i][0];
                                String gameId = result[i][1];
                                joinExistingBingoBox.addItem(gameName, gameId);
                            }
                        }
                    }
                });
                rightSubPanel.setWidget(0, 1, joinExistingBingoBox);

                rightSubPanel.setWidget(1, 0, new Label(strings.joinToBingoPassword()));
                final PasswordTextBox joinBingoPasswordBox = new PasswordTextBox();
                rightSubPanel.setWidget(1, 1, joinBingoPasswordBox);
                rightPanel.add(rightSubPanel);

                final Button joinButton = new Button("Join");
                joinButton.addClickHandler(new ClickHandler() {
                    public void onClick(ClickEvent event) {
                        int index = joinExistingBingoBox.getSelectedIndex();
                        if (index < 0)
                            message.setText(strings.noSelectedItem());
                        else {
                            final String gameId = joinExistingBingoBox.getValue(index);
                            if (gameId == null)
                                message.setText(strings.noSelectedItem());
                            else {
                                bingoService.joinBingo(userId, gameId, joinBingoPasswordBox.getText(),
                                        new AsyncCallback<Void>() {
                                            @Override
                                            public void onFailure(Throwable caught) {
                                                message.setText(caught.getMessage());
                                            }

                                            @Override
                                            public void onSuccess(Void result) {
                                                final BingoGrid bingoGrid = new BingoGrid();
                                                initUserGrid(bingoGrid);
                                                RootPanel.get("bingoTable").clear();
                                                RootPanel.get("bingoTable").add(bingoGrid);

                                                message.setText(strings.welcomeMessageJoin());

                                                // Setting the cookie
                                                Date expirationDate = new Date();
                                                expirationDate
                                                        .setHours(expirationDate.getHours() + EXPIRATION_VALUE);
                                                Cookies.setCookie(COOKIE_ID, userId, expirationDate);
                                            }
                                        });
                            }
                        }
                    }
                });
                rightPanel.add(joinButton);
                rightPanel.setCellHorizontalAlignment(joinButton, HasHorizontalAlignment.ALIGN_CENTER);
                entryPoint.add(rightPanel);

                RootPanel.get("bingoTable").add(entryPoint);

            } else if (status.intValue() == BingoService.ADMIN) {
                message.setText("Detected cookie: " + cookie + " as admin");
                userId = cookie;

                bingoService.statusBingo(userId, new AsyncCallback<Integer>() {
                    @Override
                    public void onFailure(Throwable caught) {
                        message.setText(caught.getMessage());
                    }

                    @Override
                    public void onSuccess(Integer result) {
                        int status = result.intValue();
                        final BingoGrid bingoGrid = new BingoGrid();
                        if (status == BingoService.RUNNING) {
                            initAdminGrid(userId, bingoGrid, false);
                            message.setText(strings.welcomeMessageCreation());
                        } else if (status == BingoService.FINISHED) {
                            initAdminGrid(userId, bingoGrid, true);
                            message.setText(strings.finishMessage());
                        }
                        RootPanel.get("bingoTable").clear();
                        RootPanel.get("bingoTable").add(bingoGrid);
                    }
                });

            } else if (status.intValue() == BingoService.PARTICIPANT) {
                message.setText("Detected cookie: " + cookie + " as participant");
                userId = cookie;

                final BingoGrid bingoGrid = new BingoGrid();
                initUserGrid(bingoGrid);
                updateUserGrid(bingoGrid, null);
                RootPanel.get("bingoTable").clear();
                RootPanel.get("bingoTable").add(bingoGrid);
            }
        }
    });
}

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  ww  w . j a  v  a2  s.c o  m*/
        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:burrito.client.crud.widgets.LinkedEntityWidget.java

License:Apache License

protected void reloadLinkViews() {
    VerticalPanel vp = new VerticalPanel();
    for (final LinkedEntityValue v : added) {
        HorizontalPanel hp = new HorizontalPanel();
        hp.add(v);/*w  w w . ja v a 2s. c  o  m*/
        Anchor remove = new Anchor(labels.delete());
        remove.addClickHandler(new ClickHandler() {

            public void onClick(ClickEvent event) {
                added.remove(v);
                reloadLinkViews();
                add.setVisible(true);
            }
        });
        hp.add(remove);
        vp.add(hp);
    }
    linkViewPlaceholder.setWidget(vp);
}