Examples of HeaderCell


Examples of org.displaytag.model.HeaderCell

            // just be sure that the number of columns has not been altered by conditionally including column tags in
            // different rows. This is not supported, but better avoid IndexOutOfBounds...
            if (columnNumber < tableModel.getHeaderCellList().size())
            {
                HeaderCell header = tableModel.getHeaderCellList().get(columnNumber);
                header.addCell(new Column(header, cell, currentRow));
            }
        }
    }
View Full Code Here

Examples of org.displaytag.model.HeaderCell

                // dont't want to add the standard "class" property
                if (!"class".equals(propertyName)) //$NON-NLS-1$
                {
                    // creates a new header and add to the table model
                    HeaderCell headerCell = new HeaderCell();
                    headerCell.setBeanPropertyName(propertyName);

                    // handle title i18n
                    headerCell.setTitle(this.properties.geResourceProvider().getResource(
                        null,
                        propertyName,
                        this,
                        this.pageContext));
View Full Code Here

Examples of org.displaytag.model.HeaderCell

        if (this.varTotals != null)
        {
            List<HeaderCell> headers = this.tableModel.getHeaderCellList();
            for (Iterator<HeaderCell> iterator = headers.iterator(); iterator.hasNext();)
            {
                HeaderCell headerCell = iterator.next();
                if (headerCell.isTotaled())
                {
                    totalsMap.put("column" + (headerCell.getColumnNumber() + 1), new Double(headerCell.getTotal()));
                }
            }
        }
        return totalsMap;
    }
View Full Code Here

Examples of org.displaytag.model.HeaderCell

        super.init(context, decorated, model);
        List<HeaderCell> headerCells = model.getHeaderCellList();
        // go through each column, looking for grouped columns; add them to the group number map
        for (Iterator<HeaderCell> iterator = headerCells.iterator(); iterator.hasNext();)
        {
            HeaderCell headerCell = iterator.next();
            // containsTotaledColumns = containsTotaledColumns || headerCell.isTotaled();
            if (headerCell.getGroup() > 0)
            {
                GroupTotals groupTotals = new GroupTotals(headerCell.getColumnNumber());
                groupTotals.setStartRow(this.tableModel.getPageOffset());
                groupNumberToGroupTotal.put(new Integer(headerCell.getGroup()), groupTotals);
                if (headerCell.getGroup() > innermostGroup)
                {
                    innermostGroup = headerCell.getGroup();
                }
            }
        }
    }
View Full Code Here

Examples of org.displaytag.model.HeaderCell

                + " class=\"grandtotal-row\""
                + TagConstants.TAG_CLOSE);
            boolean first = true;
            for (Iterator<HeaderCell> iterator = headerCells.iterator(); iterator.hasNext();)
            {
                HeaderCell headerCell = iterator.next();
                if (first)
                {
                    output.append(getTotalsTdOpen(headerCell, getGrandTotalLabel()));
                    output.append(getGrandTotalDescription());
                    first = false;
                }
                else if (headerCell.isTotaled())
                {
                    // a total if the column should be totaled
                    Object total = getTotalForColumn(
                        headerCell.getColumnNumber(),
                        this.tableModel.getPageOffset(),
                        currentRow);
                    output.append(getTotalsTdOpen(headerCell, getGrandTotalSum()));
                    output.append(formatTotal(headerCell, total));
                }
View Full Code Here

Examples of org.displaytag.model.HeaderCell

            if (firstRowOfCurrentSet < currentRow) // If there is more than one row, show a total
            {
                out.append(totalsRowOpen);
                for (Iterator<HeaderCell> iterator = headerCells.iterator(); iterator.hasNext();)
                {
                    HeaderCell headerCell = iterator.next();

                    if (columnNumber == headerCell.getColumnNumber())
                    {
                        // a totals label if it is the column for the current group
                        String currentLabel = getCellValue(columnNumber, firstRowOfCurrentSet);
                        out.append(getTotalsTdOpen(headerCell, getTotalLabelClass() + " group-" + (columnNumber + 1)));
                        out.append(getTotalRowLabel(currentLabel));
                    }
                    else if (headerCell.isTotaled())
                    {
                        // a total if the column should be totaled
                        Object total = getTotalForColumn(headerCell.getColumnNumber(), firstRowOfCurrentSet, currentRow);
                        out.append(getTotalsTdOpen(headerCell, getTotalValueClass() + " group-" + (columnNumber + 1)));
                        out.append(formatTotal(headerCell, total));
                    }
                    else
                    {
                        // blank, if it is not a totals column
                        String style = "group-" + (columnNumber + 1);
                        if (headerCell.getColumnNumber() < innermostGroup)
                        {
                            style += " " + getTotalLabelClass() + " ";
                        }
                        out.append(getTotalsTdOpen(headerCell, style));
                    }
View Full Code Here

Examples of org.displaytag.model.HeaderCell

        subTotals.clear();
        previousValues.clear();

        for (Iterator<HeaderCell> it = tableModel.getHeaderCellList().iterator(); it.hasNext();)
        {
            HeaderCell cell = it.next();
            if (cell.getGroup() == 1)
            {
                groupPropertyName = cell.getBeanPropertyName();
            }
        }
    }
View Full Code Here

Examples of org.displaytag.model.HeaderCell

            previousValues.put(groupPropertyName, groupedPropertyValue);
        }

        for (Iterator<HeaderCell> it = tableModel.getHeaderCellList().iterator(); it.hasNext();)
        {
            HeaderCell cell = it.next();
            if (cell.isTotaled())
            {
                String totalPropertyName = cell.getBeanPropertyName();
                Number amount = (Number) evaluate(totalPropertyName);

                Number previousSubTotal = subTotals.get(totalPropertyName);
                Number previousGrandTotals = grandTotals.get(totalPropertyName);
View Full Code Here

Examples of org.displaytag.model.HeaderCell

        List<HeaderCell> headerCells = tableModel.getHeaderCellList();

        for (Iterator<HeaderCell> it = headerCells.iterator(); it.hasNext();)
        {
            HeaderCell cell = it.next();
            Object cssClassObj = cell.getHtmlAttributes().get("class");
            String cssClass = cssClassObj != null ? cssClassObj.toString() : StringUtils.EMPTY;

            buffer.append("<td"); //$NON-NLS-1$
            if (StringUtils.isNotEmpty(cssClass))
            {
                buffer.append(" class=\""); //$NON-NLS-1$
                buffer.append(cssClass);
                buffer.append("\""); //$NON-NLS-1$
            }
            buffer.append(">"); //$NON-NLS-1$

            if (cell.isTotaled())
            {
                String totalPropertyName = cell.getBeanPropertyName();
                Object total = grandTotal ? grandTotals.get(totalPropertyName) : subTotals.get(totalPropertyName);

                DisplaytagColumnDecorator[] decorators = cell.getColumnDecorators();
                for (int j = 0; j < decorators.length; j++)
                {
                    try
                    {
                        total = decorators[j].decorate(total, this.getPageContext(), tableModel.getMedia());
                    }
                    catch (DecoratorException e)
                    {
                        log.warn(e.getMessage(), e);
                        // ignore, use undecorated value for totals
                    }
                }
                buffer.append(total);
            }
            else if (groupPropertyName != null && groupPropertyName.equals(cell.getBeanPropertyName()))
            {
                buffer.append(grandTotal ? totalLabel : new MessageFormat(subtotalLabel, this.tableModel
                    .getProperties()
                    .getLocale()).format(new Object[]{previousValues.get(groupPropertyName)}));
            }
View Full Code Here

Examples of org.displaytag.model.HeaderCell

        Iterator iterator = this.tableModel.getHeaderCellList().iterator();

        while (iterator.hasNext())
        {
            // get the header cell
            HeaderCell headerCell = (HeaderCell) iterator.next();

            if (headerCell.getSortable())
            {
                String cssSortable = this.properties.getCssSortable();
                headerCell.addHeaderClass(cssSortable);
            }

            // if sorted add styles
            if (headerCell.isAlreadySorted())
            {
                // sorted css class
                headerCell.addHeaderClass(this.properties.getCssSorted());

                // sort order css class
                headerCell.addHeaderClass(this.properties.getCssOrder(this.tableModel.isSortOrderAscending()));
            }

            // append th with html attributes
            write(headerCell.getHeaderOpenTag());

            // title
            String header = headerCell.getTitle();

            // column is sortable, create link
            if (headerCell.getSortable())
            {
                // creates the link for sorting
                Anchor anchor = new Anchor(getSortingHref(headerCell), header);

                // append to buffer
                header = anchor.toString();
            }

            write(header);
            write(headerCell.getHeaderCloseTag());
        }

        // close tr
        write(TagConstants.TAG_TR_CLOSE);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.