I noticed some interest in my post about the fix in the displaytag libarary and have recently also been asked to post the fix:
here's what I did to the org.displaytag.decorator.TotalTableDecorator.java file:
public final String finishRow()
{
StringBuffer buffer = new StringBuffer(1000);
// Grand totals...
Object decoratedObject = getDecoratedObject();
int decObjSize=0;
if (decoratedObject instanceof Collection)
{
decObjSize = ((Collection)decoratedObject).size();
}
else
{
if (decoratedObject instanceof SortedMap[] )
{
decObjSize = ((Object[])decoratedObject).length;
}
}
if (getViewIndex() == (decObjSize - 1))
{
if (groupPropertyName != null)
{
buffer.append(createTotalRow(false));
}
buffer.append(createTotalRow(true));
}
return buffer.toString();
}
the main thing is that I also accept Arrays and not only Lists (as in the original code)
Monday, March 12, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment