Example usage for com.vaadin.ui.components.grid FooterCell setHtml

List of usage examples for com.vaadin.ui.components.grid FooterCell setHtml

Introduction

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

Prototype

public void setHtml(String html);

Source Link

Document

Sets the HTML content displayed in this cell.

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  2s .  c  o m

    //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");
}