Hi Erwan,
could we discuss this a bit? Maybe there is a better solution for this. Jacopo On Mar 8, 2010, at 4:36 PM, [hidden email] wrote: > Author: erwan > Date: Mon Mar 8 15:36:04 2010 > New Revision: 920359 > > URL: http://svn.apache.org/viewvc?rev=920359&view=rev > Log: > When making CSV or PDF exports, and having sort-field as table headers, the descriptions weren't displayed in the exported documents. > > Modified: > ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java > ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java > ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFopViewHandler.java > > Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java?rev=920359&r1=920358&r2=920359&view=diff > ============================================================================== > --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java (original) > +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java Mon Mar 8 15:36:04 2010 > @@ -95,6 +95,7 @@ > protected HttpServletResponse response; > protected boolean javaScriptEnabled = false; > protected boolean renderPagination = true; > + protected String contentType; > > public MacroFormRenderer(String macroLibraryPath, Appendable writer, HttpServletRequest request, HttpServletResponse response) throws TemplateException, IOException { > macroLibrary = FreeMarkerWorker.getTemplate(macroLibraryPath); > @@ -108,6 +109,11 @@ > internalEncoder = StringUtil.getEncoder("string"); > } > > + public MacroFormRenderer(String macroLibraryPath, Appendable writer, HttpServletRequest request, HttpServletResponse response, String contentType) throws TemplateException, IOException { > + this(macroLibraryPath, writer, request, response); > + this.contentType = contentType; > + } > + > public boolean getRenderPagination() { > return this.renderPagination; > } > @@ -2605,7 +2611,7 @@ > sr.append(title); > sr.append("\" />"); > executeMacro(sr.toString()); > - } else if (modelFormField.isSortField()) { > + } else if (modelFormField.isSortField() && !"text/csv".equals(this.getContentType()) && !"application/pdf".equals(this.getContentType())) { > renderSortField (writer, context, modelFormField, titleText); > } else if (modelFormField.isRowSubmit()) { > StringWriter sr = new StringWriter(); > @@ -2954,4 +2960,12 @@ > sr.append("\" />"); > executeMacro(sr.toString()); > } > + > + public void setContentType(String contentType){ > + this.contentType = contentType; > + } > + > + public String getContentType(){ > + return this.contentType; > + } > } > > Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java?rev=920359&r1=920358&r2=920359&view=diff > ============================================================================== > --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java (original) > +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java Mon Mar 8 15:36:04 2010 > @@ -88,7 +88,7 @@ > } > > ScreenStringRenderer screenStringRenderer = new MacroScreenRenderer(UtilProperties.getPropertyValue("widget", getName() + ".name"), UtilProperties.getPropertyValue("widget", getName() + ".screenrenderer"), writer); > - FormStringRenderer formStringRenderer = new MacroFormRenderer(UtilProperties.getPropertyValue("widget", getName() + ".formrenderer"), writer, request, response); > + FormStringRenderer formStringRenderer = new MacroFormRenderer(UtilProperties.getPropertyValue("widget", getName() + ".formrenderer"), writer, request, response, contentType); > TreeStringRenderer treeStringRenderer = new MacroTreeRenderer(UtilProperties.getPropertyValue("widget", getName() + ".treerenderer"), writer); > // TODO: uncomment these lines when the renderers are implemented > //MenuStringRenderer menuStringRenderer = new MacroMenuRenderer(UtilProperties.getPropertyValue("widget", getName() + ".menurenderer"), writer); > > Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFopViewHandler.java > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFopViewHandler.java?rev=920359&r1=920358&r2=920359&view=diff > ============================================================================== > --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFopViewHandler.java (original) > +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFopViewHandler.java Mon Mar 8 15:36:04 2010 > @@ -68,7 +68,7 @@ > Writer writer = new StringWriter(); > try { > ScreenStringRenderer screenStringRenderer = new MacroScreenRenderer(UtilProperties.getPropertyValue("widget", getName() + ".name"), UtilProperties.getPropertyValue("widget", getName() + ".screenrenderer"), writer); > - FormStringRenderer formStringRenderer = new MacroFormRenderer(UtilProperties.getPropertyValue("widget", getName() + ".formrenderer"), writer, request, response); > + FormStringRenderer formStringRenderer = new MacroFormRenderer(UtilProperties.getPropertyValue("widget", getName() + ".formrenderer"), writer, request, response, contentType); > // TODO: uncomment these lines when the renderers are implemented > //TreeStringRenderer treeStringRenderer = new MacroTreeRenderer(UtilProperties.getPropertyValue("widget", getName() + ".treerenderer"), writer); > //MenuStringRenderer menuStringRenderer = new MacroMenuRenderer(UtilProperties.getPropertyValue("widget", getName() + ".menurenderer"), writer); > > |
For example, you could try the following (untested!) code for CSV exports:
Index: framework/widget/templates/csvFormMacroLibrary.ftl =================================================================== --- framework/widget/templates/csvFormMacroLibrary.ftl (revision 920353) +++ framework/widget/templates/csvFormMacroLibrary.ftl (working copy) @@ -113,7 +113,7 @@ <#macro renderFieldGroupClose style id title></#macro> <#macro renderHyperlinkTitle name title showSelectAll="N"></#macro> -<#macro renderSortField style title linkUrl ajaxEnabled></#macro> +<#macro renderSortField style title linkUrl ajaxEnabled><@renderField title /></#macro> <#macro formatBoundaryComment boundaryType widgetType widgetName></#macro> <#macro makeHiddenFormLinkAnchor linkStyle hiddenFormName event action imgSrc description><@renderField description /></#macro> <#macro makeHyperlinkString linkStyle hiddenFormName event action imgSrc linkUrl targetWindow description confirmation><@renderField description /></#macro> Jacopo On Mar 8, 2010, at 4:45 PM, Jacopo Cappellato wrote: > Hi Erwan, > > could we discuss this a bit? Maybe there is a better solution for this. > > Jacopo > > On Mar 8, 2010, at 4:36 PM, [hidden email] wrote: > >> Author: erwan >> Date: Mon Mar 8 15:36:04 2010 >> New Revision: 920359 >> >> URL: http://svn.apache.org/viewvc?rev=920359&view=rev >> Log: >> When making CSV or PDF exports, and having sort-field as table headers, the descriptions weren't displayed in the exported documents. >> >> Modified: >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFopViewHandler.java >> >> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java?rev=920359&r1=920358&r2=920359&view=diff >> ============================================================================== >> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java (original) >> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java Mon Mar 8 15:36:04 2010 >> @@ -95,6 +95,7 @@ >> protected HttpServletResponse response; >> protected boolean javaScriptEnabled = false; >> protected boolean renderPagination = true; >> + protected String contentType; >> >> public MacroFormRenderer(String macroLibraryPath, Appendable writer, HttpServletRequest request, HttpServletResponse response) throws TemplateException, IOException { >> macroLibrary = FreeMarkerWorker.getTemplate(macroLibraryPath); >> @@ -108,6 +109,11 @@ >> internalEncoder = StringUtil.getEncoder("string"); >> } >> >> + public MacroFormRenderer(String macroLibraryPath, Appendable writer, HttpServletRequest request, HttpServletResponse response, String contentType) throws TemplateException, IOException { >> + this(macroLibraryPath, writer, request, response); >> + this.contentType = contentType; >> + } >> + >> public boolean getRenderPagination() { >> return this.renderPagination; >> } >> @@ -2605,7 +2611,7 @@ >> sr.append(title); >> sr.append("\" />"); >> executeMacro(sr.toString()); >> - } else if (modelFormField.isSortField()) { >> + } else if (modelFormField.isSortField() && !"text/csv".equals(this.getContentType()) && !"application/pdf".equals(this.getContentType())) { >> renderSortField (writer, context, modelFormField, titleText); >> } else if (modelFormField.isRowSubmit()) { >> StringWriter sr = new StringWriter(); >> @@ -2954,4 +2960,12 @@ >> sr.append("\" />"); >> executeMacro(sr.toString()); >> } >> + >> + public void setContentType(String contentType){ >> + this.contentType = contentType; >> + } >> + >> + public String getContentType(){ >> + return this.contentType; >> + } >> } >> >> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java?rev=920359&r1=920358&r2=920359&view=diff >> ============================================================================== >> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java (original) >> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java Mon Mar 8 15:36:04 2010 >> @@ -88,7 +88,7 @@ >> } >> >> ScreenStringRenderer screenStringRenderer = new MacroScreenRenderer(UtilProperties.getPropertyValue("widget", getName() + ".name"), UtilProperties.getPropertyValue("widget", getName() + ".screenrenderer"), writer); >> - FormStringRenderer formStringRenderer = new MacroFormRenderer(UtilProperties.getPropertyValue("widget", getName() + ".formrenderer"), writer, request, response); >> + FormStringRenderer formStringRenderer = new MacroFormRenderer(UtilProperties.getPropertyValue("widget", getName() + ".formrenderer"), writer, request, response, contentType); >> TreeStringRenderer treeStringRenderer = new MacroTreeRenderer(UtilProperties.getPropertyValue("widget", getName() + ".treerenderer"), writer); >> // TODO: uncomment these lines when the renderers are implemented >> //MenuStringRenderer menuStringRenderer = new MacroMenuRenderer(UtilProperties.getPropertyValue("widget", getName() + ".menurenderer"), writer); >> >> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFopViewHandler.java >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFopViewHandler.java?rev=920359&r1=920358&r2=920359&view=diff >> ============================================================================== >> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFopViewHandler.java (original) >> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFopViewHandler.java Mon Mar 8 15:36:04 2010 >> @@ -68,7 +68,7 @@ >> Writer writer = new StringWriter(); >> try { >> ScreenStringRenderer screenStringRenderer = new MacroScreenRenderer(UtilProperties.getPropertyValue("widget", getName() + ".name"), UtilProperties.getPropertyValue("widget", getName() + ".screenrenderer"), writer); >> - FormStringRenderer formStringRenderer = new MacroFormRenderer(UtilProperties.getPropertyValue("widget", getName() + ".formrenderer"), writer, request, response); >> + FormStringRenderer formStringRenderer = new MacroFormRenderer(UtilProperties.getPropertyValue("widget", getName() + ".formrenderer"), writer, request, response, contentType); >> // TODO: uncomment these lines when the renderers are implemented >> //TreeStringRenderer treeStringRenderer = new MacroTreeRenderer(UtilProperties.getPropertyValue("widget", getName() + ".treerenderer"), writer); >> //MenuStringRenderer menuStringRenderer = new MacroMenuRenderer(UtilProperties.getPropertyValue("widget", getName() + ".menurenderer"), writer); >> >> > |
In reply to this post by Jacopo Cappellato-4
Le 08/03/2010 16:45, Jacopo Cappellato a écrit :
> Hi Erwan, > > could we discuss this a bit? Maybe there is a better solution for this. > > Jacopo Hi Jacopo, sure we can ! But without this modification, renderSortField's parameters are empty.. and so is title. -- Erwan de FERRIERES www.nereide.biz |
did you try my patch?
Jacopo On Mar 8, 2010, at 5:13 PM, Erwan de FERRIERES wrote: > Le 08/03/2010 16:45, Jacopo Cappellato a écrit : >> Hi Erwan, >> >> could we discuss this a bit? Maybe there is a better solution for this. >> >> Jacopo > > Hi Jacopo, > > sure we can ! But without this modification, renderSortField's parameters are empty.. and so is title. > > -- > Erwan de FERRIERES > www.nereide.biz |
Le 08/03/2010 18:43, Jacopo Cappellato a écrit :
> did you try my patch? not yet, but after or before my modifications ? -- Erwan de FERRIERES www.nereide.biz |
before
Kind regards Jacopo On Mar 8, 2010, at 6:48 PM, Erwan de FERRIERES wrote: > Le 08/03/2010 18:43, Jacopo Cappellato a écrit : >> did you try my patch? > > not yet, but after or before my modifications ? > > -- > Erwan de FERRIERES > www.nereide.biz |
Le 08/03/2010 18:50, Jacopo Cappellato a écrit :
> before > > Kind regards Hi Jacopo, just tried, and your suggestion is not working. Cheers, -- Erwan de FERRIERES www.nereide.biz |
Ok, I will look into it because I would like to improve the code committed in r920359
Kind regards, Jacopo On Mar 9, 2010, at 12:08 PM, Erwan de FERRIERES wrote: > Le 08/03/2010 18:50, Jacopo Cappellato a écrit : >> before >> >> Kind regards > > Hi Jacopo, > > just tried, and your suggestion is not working. > > Cheers, > > -- > Erwan de FERRIERES > www.nereide.biz |
In reply to this post by Erwan de FERRIERES
Hi Erwan,
I am unable to recreate what you are reporting. Could you please send me more information about how to recreate the error you have fixed? Thanks, Jacopo On Mar 9, 2010, at 12:08 PM, Erwan de FERRIERES wrote: > Le 08/03/2010 18:50, Jacopo Cappellato a écrit : >> before >> >> Kind regards > > Hi Jacopo, > > just tried, and your suggestion is not working. > > Cheers, > > -- > Erwan de FERRIERES > www.nereide.biz |
Le 10/03/2010 12:07, Jacopo Cappellato a écrit :
> Hi Erwan, > > I am unable to recreate what you are reporting. > Could you please send me more information about how to recreate the error you have fixed? > > Thanks, > > Jacopo > Jacopo, I just reproduced your HWM tutorial, and wanted to add field sorting on the product list. This is where I discovered that the table headers weren't displayed in the csv or pdf files. If you need a patch, just ask ! Cheers, -- Erwan de FERRIERES www.nereide.biz |
Hi Erwan,
I have reverted your commit and reimplemented in rev. 921397 in a way that keeps the MacroFormRenderer class independent of the content type (this is an important design pattern that we have to consider). Please have a look and let me know if you find issues with my approach. Kind regards Jacopo On Mar 10, 2010, at 1:52 PM, Erwan de FERRIERES wrote: > Le 10/03/2010 12:07, Jacopo Cappellato a écrit : >> Hi Erwan, >> >> I am unable to recreate what you are reporting. >> Could you please send me more information about how to recreate the error you have fixed? >> >> Thanks, >> >> Jacopo >> > Jacopo, > > I just reproduced your HWM tutorial, and wanted to add field sorting on the product list. > This is where I discovered that the table headers weren't displayed in the csv or pdf files. > > If you need a patch, just ask ! > > Cheers, > > -- > Erwan de FERRIERES > www.nereide.biz |
Free forum by Nabble | Edit this page |