.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);