Java 类com.vaadin.ui.Grid.FooterRow 实例源码

项目:KrishnasSpace    文件:FooterGrid.java   
/**
 * Method to setup Footer
 */
private void setUpFooter() {

    FooterRow mainFooter = grid.prependFooterRow();
    FooterCell mainFooterCell = mainFooter.join(CATEGORY, MANUFACTURER,
            MODEL_NAME);
    mainFooterCell.setText("Total Vehicles Sold Per Quarter");
    FooterRow secondaryFooter = grid.appendFooterRow();
    FooterCell secondaryFooterCell = secondaryFooter.join(CATEGORY,
            MANUFACTURER, MODEL_NAME);
    secondaryFooterCell.setText("Total Vehicles Sold Per Year");
    setUpFooterForDataConsolidation(mainFooter, secondaryFooter);
}
项目:KrishnasSpace    文件:FooterGrid.java   
/**
 * 
 * Note: Variable names are not followed This is for Calculating
 * QuarterlyValues, naming convention was not used to make is easy for
 * tutorial
 * 
 * @param mainFooter
 * @param secondaryFooter
 */
private void setUpFooterForDataConsolidation(FooterRow mainFooter,
        FooterRow secondaryFooter) {

    @SuppressWarnings("unchecked")
    BeanItemContainer<VehicleInfo> container = (BeanItemContainer<VehicleInfo>) grid
            .getContainerDataSource();
    // String to Long Converter
    Converter<String, Long> convertor = new StringToLongConverter();
    for (int i = 2012; i < 2015; i++) {
        FooterCell yearlySalesCell = secondaryFooter.join("sales" + i
                + ".q1", "sales" + i + ".q2", "sales" + i + ".q3", "sales"
                + i + ".q4");
        long yearlySalesValue = 0l;
        // Iterating over all items and calculating values over each quarter
        for (int quarter = 1; quarter <= 4; quarter++) {
            long quarterSales = 0l;
            final String columnName = "sales" + i + ".q" + quarter;
            FooterCell sumOfQuarterlySales = mainFooter.getCell(columnName);
            // Iterate over each quarter and calculate
            for (Object itemId : container.getItemIds()) {
                Item item = container.getItem(itemId);
                Integer q1Value = (Integer) item
                        .getItemProperty(columnName).getValue();
                quarterSales += Long.valueOf(q1Value);
            }
            sumOfQuarterlySales.setText(convertor.convertToPresentation(
                    quarterSales, String.class, grid.getLocale()));
            yearlySalesValue += quarterSales;
        }
        yearlySalesCell.setText(convertor.convertToPresentation(
                yearlySalesValue, String.class, grid.getLocale()));
        yearlySalesCell.setHtml("<b>"
                + convertor.convertToPresentation(yearlySalesValue,
                        String.class, grid.getLocale()) + " <b>");
    }

}
项目:holon-vaadin7    文件:AbstractGridItemListingBuilder.java   
@Override
public FooterRow addRowAt(int index) {
    return grid.getFooterRow(index);
}
项目:holon-vaadin7    文件:AbstractGridItemListingBuilder.java   
@Override
public FooterRow appendRow() {
    return grid.appendFooterRow();
}
项目:holon-vaadin7    文件:AbstractGridItemListingBuilder.java   
@Override
public FooterRow getRowAt(int index) {
    return grid.getFooterRow(index);
}
项目:holon-vaadin7    文件:AbstractGridItemListingBuilder.java   
@Override
public FooterRow getDefaultRow() {
    throw new UnsupportedOperationException("Grid footer does not support a default row");
}
项目:holon-vaadin7    文件:AbstractGridItemListingBuilder.java   
@Override
public FooterRow prependRow() {
    return grid.prependFooterRow();
}
项目:holon-vaadin7    文件:AbstractGridItemListingBuilder.java   
@Override
public void removeRow(FooterRow row) {
    grid.removeFooterRow(row);
}
项目:holon-vaadin7    文件:AbstractGridItemListingBuilder.java   
@Override
public void setDefaultRow(FooterRow row) {
    throw new UnsupportedOperationException("Grid footer does not support a default row");
}
项目:holon-vaadin7    文件:ItemListingBuilder.java   
/**
 * Build Grid footer rows.
 * @param footer Footer rows container
 */
void buildFooter(GridSection<FooterRow> footer);
项目:holon-vaadin7    文件:ItemListingBuilder.java   
/**
 * Updates the footer row contents.
 * @param listing Source listing component
 * @param footer Footer row reference
 */
void updateFooter(ItemListing<T, P> listing, GridSection<FooterRow> footer);