[ http://jira.codehaus.org/browse/DISPL-298?page=comments#action_59922 ] 

Jorge L. Barroso commented on DISPL-298:
----------------------------------------

Fabrizio, what's your take on this solution, a combination of the old and new 
behavior?
1.  If only one decorator is configured, in the table property, then assume 
it's meant to be used with all media.  
2a.  If media-specific decorators are configured, assume the one configured in 
the table prop is for html, and use the others with the appropriate exporters.
2b. Alternate to 2a, if media-specfic decorators are configured, ignore 
decorator configured in table decorator prop.  Would force user to explicity 
configure html decorator if other media decorators are configured, but it could 
be considered more consistent.  

I vote for 1. and 2a.

> TableDecorator created with 1.0 doesn't work properly with 1.1. Properties 
> defined only it decorator
> ----------------------------------------------------------------------------------------------------
>
>          Key: DISPL-298
>          URL: http://jira.codehaus.org/browse/DISPL-298
>      Project: DisplayTag
>         Type: Bug

>     Versions: 1.1
>     Reporter: Frode Halvorsen
>      Fix For: 1.1

>
>
> I made a TableDecorator to use displaytags on a list of Object[], where I 
> defined all properties in the customized TableDecorator.
> It seem to work fine when displayin on web, with sorting and everything, but 
> when trying to export to Excel, it throws an exception for propertyNotFound.
> the class :
> package no.song.polka.web.decorators;
> import org.displaytag.decorator.TableDecorator;
> import org.apache.log4j.Logger;
> import no.song.polka.business.*;
> /**
>  * Created by IntelliJ IDEA.
>  * User: Frode Halvorsen
>  * Date: 12.feb.2005
>  * Time: 02:05:18
>  * To change this template use File | Settings | File Templates.
>  */
> public class ResponsibleProviders extends TableDecorator {
>     private final Logger log = Logger.getLogger(getClass().getName() + "(" + 
> System.identityHashCode(this) + ")");
>     private Object[] getObjects() {
>         return (Object[]) getCurrentRowObject();
>         //     return  (Object[]) ((ArrayList) 
> getDecoratedObject()).get(getListIndex());
>     }
>     public String getFromNumber() {
>         return ((String) getObjects()[0]).split("-")[0];
>     }
>     public String getSeries() {
>         String series = (String) getObjects()[0];
>         String numbers[] = series.split("-");
>         return numbers[0].equals(numbers[1]) ? numbers[0] : series;
>     }
>     public String getToNumber() {
>         String numbers[] = ((String) getObjects()[0]).split("-");
>         return numbers[0].equals(numbers[1]) ? " " : numbers[1];
>     }
>     public String getDsp() {
>         return "" + (Destination) getObjects()[1];
>     }
>     public String getOdsp() {
>         return "" + (Destination) getObjects()[2];
>     }
> }
> ....
> the usage :
> <display:table name="result"  htmlId="searchResult" id="row" class="polka" 
> export="true" requestURI="p_17.spr?reuse=true" 
> decorator="no.song.polka.web.decorators.ResponsibleProviders">
>     <display:setProperty name="basic.msg.empty_list_row" value='<tr 
> class="empty"><td colspan="{0}">Søk på nytt.</td></tr>'/>
>     <display:setProperty name="export.excel.filename" value="providers.xls"/>
>     <!--display:column property="fromNumber" title="Telefonnummer" /-->
>     <!--display:column property="toNumber" title="(serie-slutt)" /-->
>     <display:column property="series" title="Telefonnummer" sortable="true"/>
>     <display:column property="dsp" title="Nåværende Tilbyder" />
>     <display:column property="odsp" title="Opprinnelig tilbyder" />
> </display:table>
> ....
> the stacktrace when clicking 'excel' :
> Exception: [.LookupUtil] Error looking up property "series" in object type 
> "[Ljava.lang.Object;". Cause: Unknown property 'series'
>       at org.displaytag.util.LookupUtil.getBeanProperty(LookupUtil.java:141)
>       at org.displaytag.model.Column.getValue(Column.java:124)
>       at 
> org.displaytag.export.BaseExportView.doExport(BaseExportView.java:265)
>       at org.displaytag.tags.TableTag.writeExport(TableTag.java:1469)
>       at org.displaytag.tags.TableTag.doExport(TableTag.java:1356)
>       at org.displaytag.tags.TableTag.doEndTag(TableTag.java:1227)
>       at org.apache.jsp.p_17_jsp._jspService(p_17_jsp.java:437)
> .
> .
> .
> .

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
displaytag-devel mailing list
displaytag-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/displaytag-devel

Reply via email to