Example usage for com.vaadin.ui.components.grid HeaderCell setText

List of usage examples for com.vaadin.ui.components.grid HeaderCell setText

Introduction

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

Prototype

public void setText(String text);

Source Link

Document

Sets the textual caption of 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  a2  s .  com*/

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