Package org.displaytag.model

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


        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

            buffer.append(ROW_START);
        }

        while (iterator.hasNext())
        {
            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

     * ToString() test.
     */
    @Test
    public void testHeaderCell()
    {
        checkToString(new HeaderCell());
    }
View Full Code Here

     * ToString() test.
     */
    @Test
    public void testColumn()
    {
        checkToString(new Column(new HeaderCell(), null, null));
    }
View Full Code Here

        xml.append("<header>\n");
        xml.append("\n");
        while (iterator.hasNext())
        {
            // get the header cell
            HeaderCell headerCell = iterator.next();
            xml.append("<header-cell>");
            cdata(headerCell.getTitle());
            xml.append("</header-cell>\n");
        }
        xml.append("</header>\n");
        xml.append("<data>");
        xml.append("<subgroup grouped-by=\""+TableTotaler.WHOLE_TABLE+"\">");
View Full Code Here

    {
        TableProperties props = TableProperties.getInstance(null);
        TableModel model = new TableModel(props, "", null);
        model.setRowListPage(model.getRowListFull());
        {
            HeaderCell ha = new HeaderCell();
            ha.setTitle("ColumnAnt");
            ha.setBeanPropertyName("ant");
            ha.setHtmlAttributes(new HtmlAttributeMap());
            ha.setGroup(1);
            model.addColumnHeader(ha);
        }
        {
            HeaderCell hb = new HeaderCell();
            hb.setTitle("Column2");
            hb.setHtmlAttributes(new HtmlAttributeMap());
            hb.setBeanPropertyName("bee");
            hb.setGroup(2);
            model.addColumnHeader(hb);
        }
        {
            HeaderCell hb = new HeaderCell();
            hb.setTitle("long");
            hb.setBeanPropertyName("camel");
            hb.setTotaled(false);
            HtmlAttributeMap mm = new HtmlAttributeMap();
            mm.put(TagConstants.ATTRIBUTE_STYLE, "font-weight: bold; text-align: right");
            mm.put(TagConstants.ATTRIBUTE_CLASS, new MultipleHtmlAttribute("right rowish"));
            hb.setHtmlAttributes(mm);
            model.addColumnHeader(hb);
        }
        {
            HeaderCell hb = new HeaderCell();
            hb.setTitle("Column3");
            hb.setHtmlAttributes(new HtmlAttributeMap());
            hb.setBeanPropertyName("two");
            hb.setTotaled(true);
            model.addColumnHeader(hb);
        }
        model.addRow(new Row(new KnownValue(), 0));
        model.addRow(new Row(new KnownValue(), 1));
        KnownValue third = new KnownValue();
View Full Code Here

                .getProperties()
                .geResourceProvider()
                .getResource(this.titleKey, 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<DisplaytagColumnDecorator> decorators = new ArrayList<DisplaytagColumnDecorator>();

        // 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(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<Object> 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)
                {
                    // 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();

                    // 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

    {
        Iterator<HeaderCell> iterator = this.model.getHeaderCellList().iterator();

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

            String columnHeader = headerCell.getTitle();

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

            PdfPCell hdrCell = getCell(columnHeader);
            hdrCell.setGrayFill(0.9f);
            tablePDF.addCell(hdrCell);
View Full Code Here

                Iterator<HeaderCell> iterator = this.model.getHeaderCellList().iterator();

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

                    HSSFCell cell = xlsRow.createCell(colNum++);
                    cell.setCellValue(new HSSFRichTextString(getHeaderCellValue(headerCell)));
                    cell.setCellStyle(createHeaderStyle(getWb(), headerCell));
                }
View Full Code Here

TOP

Related Classes of org.displaytag.model.HeaderCell

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.