Hi list,
I've just made a small patch to allow header decoration: it basically adds a decorateHeader(String header) method to the TableDecorator, which by default just returns it's original value. Users overriding this method could for example plug they own i18n system in there or whatever. I've been needing this for a while, so now I just took a couple of minutes to do it myself ;-)
I'll attach the patch to this mail, since your jira project doesn't seem to be public (yet?).
Hope you like and apply it ! ;)
Cheers,
greg
<cid:[EMAIL PROTECTED]>
Index: src/java/org/displaytag/decorator/TableDecorator.java =================================================================== RCS file: /cvsroot/displaytag/displaytag2/src/java/org/displaytag/decorator/TableDecorator.java,v retrieving revision 1.9 diff -b -u -r1.9 TableDecorator.java --- src/java/org/displaytag/decorator/TableDecorator.java 17 Sep 2004 15:28:35 -0000 1.9 +++ src/java/org/displaytag/decorator/TableDecorator.java 23 Sep 2004 23:31:52 -0000 @@ -93,4 +93,14 @@ super.finish(); } + /** + * Called when displaying the header of a column. This default implementation simply + * returns the value of the header title as passed to the column tag. Users can + * override this to provide custom i18n for example, or images, or just about + * anything, I guess. + */ + public String decorateHeader(String defaultHeaderValue) + { + return defaultHeaderValue; + } } \ No newline at end of file Index: src/java/org/displaytag/tags/TableTag.java =================================================================== RCS file: /cvsroot/displaytag/displaytag2/src/java/org/displaytag/tags/TableTag.java,v retrieving revision 1.76 diff -b -u -r1.76 TableTag.java --- src/java/org/displaytag/tags/TableTag.java 21 Sep 2004 18:35:15 -0000 1.76 +++ src/java/org/displaytag/tags/TableTag.java 23 Sep 2004 23:31:55 -0000 @@ -1301,7 +1301,16 @@ buffer.append(headerCell.getHeaderOpenTag()); // title - String header = headerCell.getTitle(); + TableDecorator tableDecorator = this.tableModel.getTableDecorator(); + String header; + if (tableDecorator != null) + { + header = tableDecorator.decorateHeader(headerCell.getTitle()); + } + else + { + header = headerCell.getTitle(); + } // column is sortable, create link if (headerCell.getSortable())