Hi all,
I am *really* new to the users list but have been using displaytag for
over 2 yrs now and feel that I have a pretty good understanding of its
architecture. However, I have come across something that is truly
perplexing me and I have tried to research the general internet as well
as this users list to no avail.
What I am observing is that when I write my own extension to
TableDecorator [1] and include properties that are *not* properties of
the underlying object, I get a PropertyNotFoundException. It seems to
be examining the underlying object instead of the decorator as the
following text from the website explains:
http://displaytag.homeip.net/displaytag-examples-1.2/example-decorator.j
sp
[Using decorators to transform data...]
The way this works is that a single decorator object is created right
before the table tag starts iterating through your List, before it
starts processing a particular row, it gives the object for that row to
the decorator, then as the various properties getXXX() methods - the
decorator will be called first and if the decorator doesn't implement
the given property, the method will be called on the original object in
your List.
I seem to have come across several examples on the web that suggest this
approach. For example, your custom table decorator might include a
getFullname() method when the underlying object only implements
getFirstname() and getLastname().
I have examined this problem over and over, even for such things as
typos, etc. and keep coming to the conclusion that this is either a bug
in the code or a bug in the documentation (or my perception of the
documentation). Any displaytag gurus who might know what I am talking
about without me including all the rest of my code/JSP? Maybe the
predominant masses use ColumnDecorators instead of this approach? Which
is why it doesn't appear in more web searches?
Thanks for any input,
Rick
[Attachment 1]
public class ContractDecorator extends
org.displaytag.decorator.TableDecorator {
public ContractDecorator() {
super();
int i = 1; i++; // just for breakpoint
}
public String addRowClass() {
return "xyz";
}
public String getDelivCount() {
return
Integer.toString(this.getCurrentContract().getDelivs().size());
}
public String getDelivPending() {
return "5";
}
public String getDelivWaiting() {
return "5";
}
public String getDelivDue() {
return "5";
}
public String getDelivLate() {
return "5";
}
public String getDelivReceived() {
return "5";
}
public String getDelivComplete() {
return "5";
}
private Contract getCurrentContract(){
return (Contract)this.getCurrentRowObject();
}
}
------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing.
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
displaytag-user mailing list
displaytag-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/displaytag-user