Examples of HeaderCell


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 headers = this.tableModel.getHeaderCellList();
            for (Iterator iterator = headers.iterator(); iterator.hasNext();)
            {
                HeaderCell 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

                this.property,
                tableTag,
                this.pageContext);
        }

        HeaderCell headerCell = new HeaderCell();
        headerCell.setHeaderAttributes((HtmlAttributeMap) this.headerAttributeMap.clone());
        headerCell.setHtmlAttributes((HtmlAttributeMap) this.attributeMap.clone());
        headerCell.setTitle(evalTitle);
        headerCell.setSortable(this.sortable);

        List decorators = new ArrayList();

        // handle multiple chained decorators, whitespace separated
        if (StringUtils.isNotEmpty(this.decorator))
        {
            String[] decoratorNames = StringUtils.split(this.decorator);
            for (int j = 0; j < decoratorNames.length; j++)
            {
                decorators.add(tableTag.getProperties().getDecoratorFactoryInstance().loadColumnDecorator(
                    this.pageContext,
                    decoratorNames[j]));
            }
        }

        // "special" decorators
        if (this.escapeXml)
        {
            decorators.add(EscapeXmlColumnDecorator.INSTANCE);
        }
        if (this.autolink)
        {
            decorators.add(AutolinkColumnDecorator.INSTANCE);
        }
        if (StringUtils.isNotBlank(this.format))
        {
            decorators.add(new MessageFormatColumnDecorator(this.format, tableTag.getProperties().getLocale()));
        }

        headerCell.setColumnDecorators((DisplaytagColumnDecorator[]) decorators
            .toArray(new DisplaytagColumnDecorator[decorators.size()]));

        headerCell.setBeanPropertyName(this.property);
        headerCell.setShowNulls(this.nulls);
        headerCell.setMaxLength(this.maxLength);
        headerCell.setMaxWords(this.maxWords);
        headerCell.setGroup(this.group);
        headerCell.setSortProperty(this.sortProperty);
        headerCell.setTotaled(this.totaled);

        Comparator headerComparator = (comparator != null) ? comparator : new DefaultComparator(Collator
            .getInstance(tableTag.getProperties().getLocale()));

        headerCell.setComparator(headerComparator);
        headerCell.setDefaultSortOrder(this.defaultorder);
        headerCell.setSortName(this.sortName);

        // href and parameter, create link
        if (this.href != null)
        {
            Href colHref;

            // empty base url, use href with parameters from parent table
            if (StringUtils.isEmpty(this.href.getBaseUrl()))
            {
                colHref = (Href) tableTag.getBaseHref().clone();
            }
            else
            {
                colHref = (Href) this.href.clone();
            }

            if (this.paramId != null)
            {
                // parameter value is in a different object than the iterated one
                if (this.paramName != null || this.paramScope != null)
                {
                    // create a complete string for compatibility with previous version before expression evaluation.
                    // this approach is optimized for new expressions, not for previous property/scope parameters
                    StringBuffer expression = new StringBuffer();

                    // append scope
                    if (StringUtils.isNotBlank(this.paramScope))
                    {
                        expression.append(this.paramScope).append("Scope.");
                    }

                    // base bean name
                    if (this.paramId != null)
                    {
                        expression.append(this.paramName);
                    }
                    else
                    {
                        expression.append(tableTag.getName());
                    }

                    // append property
                    if (StringUtils.isNotBlank(this.paramProperty))
                    {
                        expression.append('.').append(this.paramProperty);
                    }

                    // evaluate expression.
                    // note the value is fixed, not based on any object created during iteration
                    // this is here for compatibility with the old version mainly
                    Object paramValue = tableTag.evaluateExpression(expression.toString());

                    // add parameter
                    colHref.addParameter(this.paramId, paramValue);
                }
                else
                {
                    // set id
                    headerCell.setParamName(this.paramId);

                    // set property
                    headerCell.setParamProperty(this.paramProperty);
                }
            }

            // sets the base href
            headerCell.setHref(colHref);

        }

        tableTag.addColumn(headerCell);
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

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 headers = this.tableModel.getHeaderCellList();
            for (Iterator iterator = headers.iterator(); iterator.hasNext();)
            {
                HeaderCell 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

            ArrayList structsForRow = new ArrayList(model.getHeaderCellList().size());
            lowestEndedGroup = NO_RESET_GROUP;
            lowestStartedGroup = NO_RESET_GROUP;
            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, header.getGroup());

                    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;
                        }
                    }
                    if (tableDecorator != null)
                    {
                        struct.decoratedValue = tableDecorator.displayGroupedValue(struct.bodyValue,
                                groupingValue, header.getColumnNumber());
                    }
                    else if (groupingValue == GROUP_END || groupingValue == GROUP_NO_CHANGE)
                    {
                        struct.decoratedValue = TagConstants.EMPTY_STRING;
                    }
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

                this.property,
                tableTag,
                this.pageContext);
        }

        HeaderCell headerCell = new HeaderCell();
        headerCell.setHeaderAttributes((HtmlAttributeMap) this.headerAttributeMap.clone());
        headerCell.setHtmlAttributes((HtmlAttributeMap) this.attributeMap.clone());
        headerCell.setTitle(evalTitle);
        headerCell.setSortable(this.sortable);

        List decorators = new ArrayList();

        // handle multiple chained decorators, whitespace separated
        if (StringUtils.isNotEmpty(this.decorator))
        {
            String[] decoratorNames = StringUtils.split(this.decorator);
            for (int j = 0; j < decoratorNames.length; j++)
            {
                decorators.add(tableTag.getProperties().getDecoratorFactoryInstance().loadColumnDecorator(
                    this.pageContext,
                    decoratorNames[j]));
            }
        }

        // "special" decorators
        if (this.escapeXml)
        {
            decorators.add(EscapeXmlColumnDecorator.INSTANCE);
        }
        if (this.autolink)
        {
            decorators.add(AutolinkColumnDecorator.INSTANCE);
        }
        if (StringUtils.isNotBlank(this.format))
        {
            decorators.add(new MessageFormatColumnDecorator(this.format, tableTag.getProperties().getLocale()));
        }

        headerCell.setColumnDecorators((DisplaytagColumnDecorator[]) decorators
            .toArray(new DisplaytagColumnDecorator[decorators.size()]));

        headerCell.setBeanPropertyName(this.property);
        headerCell.setShowNulls(this.nulls);
        headerCell.setMaxLength(this.maxLength);
        headerCell.setMaxWords(this.maxWords);
        headerCell.setGroup(this.group);
        headerCell.setSortProperty(this.sortProperty);
        headerCell.setTotaled(this.totaled);

        Comparator headerComparator = (comparator != null) ? comparator : tableTag.getProperties().getDefaultComparator();

        headerCell.setComparator(headerComparator);
        headerCell.setDefaultSortOrder(this.defaultorder);
        headerCell.setSortName(this.sortName);

        // href and parameter, create link
        if (this.href != null)
        {
            Href colHref;

            // empty base url, use href with parameters from parent table
            if (StringUtils.isEmpty(this.href.getBaseUrl()))
            {
                colHref = (Href) tableTag.getBaseHref().clone();
            }
            else
            {
                colHref = (Href) this.href.clone();
            }

            if (this.paramId != null)
            {
                // parameter value is in a different object than the iterated one
                if (this.paramName != null || this.paramScope != null)
                {
                    // create a complete string for compatibility with previous version before expression evaluation.
                    // this approach is optimized for new expressions, not for previous property/scope parameters
                    StringBuffer expression = new StringBuffer();

                    // append scope
                    if (StringUtils.isNotBlank(this.paramScope))
                    {
                        expression.append(this.paramScope).append("Scope.");
                    }

                    // base bean name
                    if (this.paramId != null)
                    {
                        expression.append(this.paramName);
                    }
                    else
                    {
                        expression.append(tableTag.getName());
                    }

                    // append property
                    if (StringUtils.isNotBlank(this.paramProperty))
                    {
                        expression.append('.').append(this.paramProperty);
                    }

                    // evaluate expression.
                    // note the value is fixed, not based on any object created during iteration
                    // this is here for compatibility with the old version mainly
                    Object paramValue = tableTag.evaluateExpression(expression.toString());

                    // add parameter
                    colHref.addParameter(this.paramId, paramValue);
                }
                else
                {
                    // set id
                    headerCell.setParamName(this.paramId);

                    // set property
                    headerCell.setParamProperty(this.paramProperty);
                }
            }

            // sets the base href
            headerCell.setHref(colHref);

        }

        tableTag.addColumn(headerCell);
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();
            containsTotaledColumns = containsTotaledColumns || headerCell.isTotaled();
            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
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.