Package org.displaytag.render

Examples of org.displaytag.render.TableTotaler


    public void setModel(TableModel m)
    {
        m.setTableDecorator(NOOP);
        if (m.getTotaler() == null || m.getTotaler() == TableTotaler.NULL)
        {
            TableTotaler tt = new TableTotaler();
            tt.init(m);
            m.setTotaler(tt);
        }
    }
View Full Code Here


    }

    @Override
    protected void writeSubgroupStart(TableModel model)
    {
        TableTotaler tt = model.getTotaler();

        // for each newly opened subgroup we need to output the opener, in order;
        //   so we need to know somehow which groups are new since we last wrote out openers; how about we track a list of the
        //    already opened groups, and ask the tt for a list of all known groups?
        for (int i : tt.getOpenedColumns())
        {
            xml.append("<subgroup grouped-by=\"").append(i).append("\">");

        }
    }
View Full Code Here

         }
    }

    protected void writeSubtotals(TableModel model, List<Integer> closedColumns)
    {
        TableTotaler tt = model.getTotaler();
        Collections.reverse(closedColumns);
        for (int i : closedColumns)
        {
            xml.append("<subtotal>\n");
            for (HeaderCell cell : model.getHeaderCellList())
            {
                if (cell.isTotaled())
                {
                    xml.append("\t<subtotal-cell ");
                    HtmlAttributeMap atts = cell.getHtmlAttributes();
                    writeAttributes(atts);
                    xml.append('>');
                    cdata( tt.formatTotal(cell, tt.getTotalForColumn(cell.getColumnNumber(), tt.asGroup(i))));
                    xml.append("</subtotal-cell>");
                }
                else
                {
                    xml.append("\t<subtotal-cell/>");
View Full Code Here

        TableModel m = getModel();
        for (HeaderCell cell : m.getHeaderCellList())
        {
            cell.setGroup(0);
        }
        TableTotaler tt = new TableTotaler();
        m.setTotaler(tt);
        HssfDoubleExportView view = new HssfDoubleExportView();
        tt.init(m);
        view.setParameters(m, true, true, true);

        File f = File.createTempFile("nogroups", null);
        FileOutputStream str = new FileOutputStream(f);
        view.doExport(str);
View Full Code Here

    @Test
    public void testSimpleTotalsCorrect() throws Exception
    {
        TableModel m = getModel();
        TableTotaler tt = new TableTotaler();
        m.setTotaler(tt);
        HssfDoubleExportView view = new HssfDoubleExportView();
        tt.init(m);
        view.setParameters(m, true, true, true);

        File f = File.createTempFile("displaytag", null);
        FileOutputStream str = new FileOutputStream(f);
        view.doExport(str);
View Full Code Here

        {
            tableDecorator.init(this.pageContext, this.list, this.tableModel);
            this.tableModel.setTableDecorator(tableDecorator);
        }

        TableTotaler totaler = this.properties.getDecoratorFactoryInstance().loadTableTotaler(
            pageContext,
            getTotalerName());
        if (totaler != null)
        {
            totaler.init(this.tableModel);
            this.tableModel.setTotaler(totaler);

        }

        // Figure out how we should sort this data, typically we just sort
View Full Code Here

TOP

Related Classes of org.displaytag.render.TableTotaler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.