Example usage for com.vaadin.ui.components.grid HeaderRow getCell

List of usage examples for com.vaadin.ui.components.grid HeaderRow getCell

Introduction

In this page you can find the example usage for com.vaadin.ui.components.grid HeaderRow getCell.

Prototype

public HeaderCell getCell(Grid.Column<?, ?> column);

Source Link

Document

Returns the cell on this row corresponding to the given column.

Usage

From source file:org.jpos.qi.minigl.AccountsView.java

License:Open Source License

public void formatEntriesGrid() {
    String pattern = getApp().getMessage("datetime");
    SimpleDateFormat dateFormat = new SimpleDateFormat(pattern);
    entryGrid.getColumn("account").setHidden(true);
    entryGrid.addColumn(glEntry -> glEntry.getTransaction().getTimestamp()).setId("timestamp")
            .setRenderer(new DateRenderer(dateFormat)).setCaption(getCaptionFromId("timestamp"))
            .setSortable(true).setHidable(false);
    entryGrid.addColumn(GLEntry::getBalance).setId("balance").setRenderer(createAmountRenderer())
            .setStyleGenerator(cellStyle -> "align-right").setCaption(getCaptionFromId("balance"))
            .setSortable(true).setHidable(false);
    entryGrid.sort("timestamp");
    entryGrid.setColumnOrder("timestamp", "detail", "tags", "layer", "debit", "credit", "balance");
    entryGrid.setHeightByRows(10);/*from  w w  w  .  j a v a 2  s. c  om*/

    //HEADER
    entryGrid.getDefaultHeaderRow().getCell("balance").setStyleName("align-right");
    HeaderRow initialBalanceHeader = entryGrid.appendHeaderRow();
    HeaderCell label = initialBalanceHeader.join("timestamp", "detail", "tags", "layer", "credit", "debit");
    label.setText("Initial Balance");
    HeaderCell value = initialBalanceHeader.getCell("balance");
    value.setStyleName("amount-header");

    //FOOTER
    FooterRow footer = entryGrid.appendFooterRow();
    FooterCell totalCell = footer.join("timestamp", "detail", "tags", "layer");
    totalCell.setHtml("<strong>TOTAL</strong>");
    FooterCell debitTotal = footer.getCell("debit");
    debitTotal.setStyleName("align-right");
    FooterCell creditTotal = footer.getCell("credit");
    creditTotal.setStyleName("align-right");
    FooterCell balanceTotal = footer.getCell("balance");
    balanceTotal.setStyleName("align-right");
}