Example usage for com.vaadin.ui Grid getFooterRow

List of usage examples for com.vaadin.ui Grid getFooterRow

Introduction

In this page you can find the example usage for com.vaadin.ui Grid getFooterRow.

Prototype

public FooterRow getFooterRow(int index) 

Source Link

Document

Returns the footer row at the given index.

Usage

From source file:com.haulmont.cuba.web.gui.components.WebDataGrid.java

License:Apache License

protected void initFooterRows(Grid component) {
    for (int i = 0; i < component.getFooterRowCount(); i++) {
        Grid.FooterRow gridRow = component.getFooterRow(i);
        addFooterRowInternal(gridRow);/*w  w w. j  a  v a  2 s.  c o m*/
    }
}

From source file:com.mycompany.controller.initUImethods.java

public void createButt(String day, Grid.MultiSelectionModel selectionOfGivenDay, Grid gridOfGivenDay,
        Grid.FooterRow footer) {//from w  ww.j a va  2 s  .c  om
    Button buttonThisDay = new Button("Add to cart", new Button.ClickListener() { //anonim inner class

        @Override
        public void buttonClick(Button.ClickEvent e) {
            for (Object itemId : selectionOfGivenDay.getSelectedRows()) {
                Property nameOfGiven = gridOfGivenDay.getContainerDataSource().getContainerProperty(itemId,
                        "name");
                Property priceOfGiven = gridOfGivenDay.getContainerDataSource().getContainerProperty(itemId,
                        "price");
                Property quantityOfGiven = gridOfGivenDay.getContainerDataSource().getContainerProperty(itemId,
                        "quantity");
                int price = Integer.parseInt(priceOfGiven.getValue().toString());
                int quan = Integer.parseInt(quantityOfGiven.getValue().toString());
                cartItems.add(new CartObject(day, nameOfGiven.getValue().toString(), price, quan,
                        Days.valueOf(day).getPriority()));
            }

            cart.getContainerDataSource().removeAllItems(); //sorbarendezs miatt, nem a legjobb de elmegy
            sum = 0;
            gridOfGivenDay.getSelectionModel().reset();
            cartItems.sort(Comparator.comparing(CartObject::getPriority));

            for (CartObject cartItem : cartItems) {
                cart.addRow(cartItem.getDay(), cartItem.getFoodName(), cartItem.getPrice(), cartItem.getQuan());
                sum += cartItem.getPrice() * cartItem.getQuan();
            }
            footer.getCell("Mennyisg").setText(Integer.toString(sum));
        }
    });

    gridOfGivenDay.getFooterRow(0).getCell("name").setComponent(buttonThisDay);
    buttonThisDay.setStyleName(ValoTheme.BUTTON_FRIENDLY);
}