Examples of HeaderCell


Examples of org.displaytag.model.HeaderCell

            buffer.append(ROW_START);
        }

        while (iterator.hasNext())
        {
            HeaderCell headerCell = (HeaderCell) iterator.next();

            String columnHeader = headerCell.getTitle();

            if (columnHeader == null)
            {
                columnHeader = StringUtils.capitalize(headerCell.getBeanPropertyName());
            }

            columnHeader = escapeColumnValue(columnHeader);

            if (CELL_START != null)
View Full Code Here

Examples of org.displaytag.model.HeaderCell

            Iterator headerCellsIter = model.getHeaderCellList().iterator();
            boolean hasReachedGroupEnd = false;
            ArrayList structsForRow = new ArrayList(model.getHeaderCellList().size());
            while (headerCellsIter.hasNext())
            {
                HeaderCell header = (HeaderCell) headerCellsIter.next();

                // Get the value to be displayed for the column
                CellStruct struct = (CellStruct) currentRowValues.get(new Integer(header.getColumnNumber()));
                struct.decoratedValue = struct.bodyValue;
                // Check and see if there is a grouping transition. If there is, then notify the decorator
                if (header.getGroup() != -1)
                {
                    CellStruct prior = (CellStruct) previousRowValues.get(new Integer(header.getColumnNumber()));
                    CellStruct next = (CellStruct) nextRowValues.get(new Integer(header.getColumnNumber()));
                    // Why npe?
                    String priorBodyValue = prior != null ? prior.bodyValue : null;
                    String nextBodyValue = next != null ? next.bodyValue : null;
                    short groupingValue = groupColumns(struct.bodyValue, priorBodyValue, nextBodyValue);
                    hasReachedGroupEnd = hasReachedGroupEnd
                        || groupingValue == GROUP_END
                        || groupingValue == GROUP_NO_CHANGE;

                    if (tableDecorator != null)
                    {
                        switch (groupingValue)
                        {
                            case GROUP_START :
                                tableDecorator.startOfGroup(struct.bodyValue, header.getGroup());
                                break;
                            case GROUP_END :
                                tableDecorator.endOfGroup(struct.bodyValue, header.getGroup());
                                break;
                            case GROUP_START_AND_END :
                                tableDecorator.startOfGroup(struct.bodyValue, header.getGroup());
                                tableDecorator.endOfGroup(struct.bodyValue, header.getGroup());
                                break;
                            default :
                                break;
                        }
                    }
View Full Code Here

Examples of org.displaytag.model.HeaderCell

    {
        Iterator iterator = this.model.getHeaderCellList().iterator();

        while (iterator.hasNext())
        {
            HeaderCell headerCell = (HeaderCell) iterator.next();

            String columnHeader = headerCell.getTitle();

            if (columnHeader == null)
            {
                columnHeader = StringUtils.capitalize(headerCell.getBeanPropertyName());
            }

            Cell hdrCell = getCell(columnHeader);
            hdrCell.setGrayFill(0.9f);
            hdrCell.setHeader(true);
View Full Code Here

Examples of org.displaytag.model.HeaderCell

        super.init(context, decorated, model);
        List headerCells = model.getHeaderCellList();
        // go through each column, looking for grouped columns; add them to the group number map
        for (Iterator iterator = headerCells.iterator(); iterator.hasNext();)
        {
            HeaderCell headerCell = (HeaderCell) iterator.next();
            if (headerCell.getGroup() > 0)
            {
                groupNumberToGroupTotal.put(new Integer(headerCell.getGroup()), new GroupTotals(headerCell
                    .getColumnNumber()));
                if (headerCell.getGroup() > innermostGroup)
                {
                    innermostGroup = headerCell.getGroup();
                }
            }
        }
    }
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(getTotalsRowOpen());
                for (Iterator iterator = headerCells.iterator(); iterator.hasNext();)
                {
                    HeaderCell 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
                        double 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

        Iterator iterator = model.getHeaderCellList().iterator();

        float[] widths = new float[model.getNumberOfColumns()];
        for (int i = 0; iterator.hasNext(); i++)
        {
            HeaderCell headerCell = (HeaderCell) iterator.next();
            widths[i] = this.getCellWidth(headerCell);

            String columnHeader = headerCell.getTitle();

            if (columnHeader == null)
            {
                columnHeader = StringUtils.capitalize(headerCell.getBeanPropertyName());
            }

            Cell hdrCell = this.getHeaderCell(columnHeader);
            this.table.addCell(hdrCell);
        }
View Full Code Here

Examples of org.displaytag.model.HeaderCell

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

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

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

Examples of org.displaytag.model.HeaderCell

        List headerCells = tableModel.getHeaderCellList();

        for (Iterator it = headerCells.iterator(); it.hasNext();)
        {
            HeaderCell cell = (HeaderCell) it.next();
            String cssClass = ObjectUtils.toString(cell.getHtmlAttributes().get("class"));

            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 : MessageFormat.format(subtotalLabel, new Object[]{previousValues
                    .get(groupPropertyName)}));
            }
View Full Code Here

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 = (HeaderCell) tableModel.getHeaderCellList().get(columnNumber);
                header.addCell(new Column(header, cell, currentRow));
            }
        }
    }
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.