Administrator
|
It seems (I say "it seems" because I reverted just before, it could be another revision ahead, but I doubt) that 978944-978954 set
of revision introduced some issues... At least with the link element in screen widget, for instance using <link name="holdButton" target="changeOrderStatus" text="${uiLabelMap.CommonHold}" style="buttontext"> <parameter param-name="orderId"/> <parameter param-name="statusId" value="ORDER_HOLD"/> <parameter param-name="partyId"/> <parameter param-name="listCollapsed" value="true"/> <parameter param-name="detailCollapsed" value="false"/> </link> I got this error: (sorry I prefered to put all the relevant log, as it may help) _________________________________________________________________ Expected collection or sequence. parameterList evaluated instead to freemarker.template.SimpleScalar on line 117, column 8 in component://widget/templates/htmlScreenMacroLibrary.ftl. The problematic instruction: ---------- ==> list parameterList as parameter [on line 117, column 1 in component://widget/templates/htmlScreenMacroLibrary.ftl] in user-directive renderLink [on line 1, column 1 in Wed Jul 28 13:17:11 CEST 2010] ---------- Java backtrace for programmers: ---------- freemarker.template.TemplateException: Expected collection or sequence. parameterList evaluated instead to freemarker.template.SimpleScalar on line 117, column 8 in component://widget/templates/htmlScreenMacr oLibrary.ftl. at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:135) at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:190) at freemarker.core.Environment.visit(Environment.java:416) at freemarker.core.IteratorBlock.accept(IteratorBlock.java:102) at freemarker.core.Environment.visit(Environment.java:209) at freemarker.core.MixedContent.accept(MixedContent.java:92) at freemarker.core.Environment.visit(Environment.java:209) at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79) at freemarker.core.Environment.visit(Environment.java:209) at freemarker.core.MixedContent.accept(MixedContent.java:92) at freemarker.core.Environment.visit(Environment.java:209) at freemarker.core.Macro$Context.runMacro(Macro.java:168) at freemarker.core.Environment.visit(Environment.java:602) at freemarker.core.UnifiedCall.accept(UnifiedCall.java:106) at freemarker.core.Environment.visit(Environment.java:209) at freemarker.core.Environment.include(Environment.java:1482) at org.ofbiz.widget.screen.MacroScreenRenderer.executeMacro(MacroScreenRenderer.java:97) at org.ofbiz.widget.screen.MacroScreenRenderer.executeMacro(MacroScreenRenderer.java:124) at org.ofbiz.widget.screen.MacroScreenRenderer.renderLink(MacroScreenRenderer.java:278) at org.ofbiz.widget.screen.ModelScreenWidget$Link.renderWidgetString(ModelScreenWidget.java:1390) at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) at org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) at org.ofbiz.widget.screen.MacroScreenRenderer.renderScreenletSubWidget(MacroScreenRenderer.java:633) at org.ofbiz.widget.screen.ModelScreenWidget$Screenlet.renderWidgetString(ModelScreenWidget.java:370) at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) at org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) at org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) at org.ofbiz.widget.screen.ModelScreenWidget$IncludeScreen.renderWidgetString(ModelScreenWidget.java:540) at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) at org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) at org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) at org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) at org.ofbiz.widget.screen.ModelScreenWidget$DecoratorSection.renderWidgetString(ModelScreenWidget.java:670) at org.ofbiz.widget.screen.ModelScreenWidget$SectionsRenderer.render(ModelScreenWidget.java:126) at org.ofbiz.widget.screen.ModelScreenWidget$DecoratorSectionInclude.renderWidgetString(ModelScreenWidget.java:703) at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) at org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) at org.ofbiz.widget.screen.ModelScreenWidget$DecoratorSection.renderWidgetString(ModelScreenWidget.java:670) at org.ofbiz.widget.screen.ModelScreenWidget$SectionsRenderer.render(ModelScreenWidget.java:126) at org.ofbiz.widget.screen.ModelScreenWidget$DecoratorSectionInclude.renderWidgetString(ModelScreenWidget.java:703) at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) at org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) at org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) at org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) at org.ofbiz.widget.screen.ModelScreenWidget$IncludeScreen.renderWidgetString(ModelScreenWidget.java:540) at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) at org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) at org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) at org.ofbiz.widget.screen.ModelScreenWidget$DecoratorScreen.renderWidgetString(ModelScreenWidget.java:637) at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) at org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) at org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) at org.ofbiz.widget.screen.ModelScreenWidget$DecoratorScreen.renderWidgetString(ModelScreenWidget.java:637) at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) at org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) at org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) at org.ofbiz.widget.screen.ScreenRenderer.render(ScreenRenderer.java:135) at org.ofbiz.widget.screen.ScreenRenderer.render(ScreenRenderer.java:97) at org.ofbiz.widget.screen.MacroScreenViewHandler.render(MacroScreenViewHandler.java:104) at org.ofbiz.webapp.control.RequestHandler.renderView(RequestHandler.java:839) at org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:559) at org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:227) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:271) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:555) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:619) _________________________________________________________________ Reverting to r978939, and using the same calling link, this error dissapears. Also one of my client, who is using trunk, decided to stay at r965923 (not sure why yet he uses this peculiar revision) because "he crossed issues" (I still don't know which issues he spoke about, he told me "many") Also I was surprised that by using a url-mode="plain" I got no poping XSS security error message (it's only in the log). Has anyone changed this behaviour or is it normal? If it's normal I will change that! Thanks Jacques |
Thanks Jacques, until I figure out a solution I've reverted the changes to that method in r980238.
Regards Scott On 28/07/2010, at 11:38 PM, Jacques Le Roux wrote: > It seems (I say "it seems" because I reverted just before, it could be another revision ahead, but I doubt) that 978944-978954 set of revision introduced some issues... > At least with the link element in screen widget, for instance using > <link name="holdButton" target="changeOrderStatus" text="${uiLabelMap.CommonHold}" style="buttontext"> > <parameter param-name="orderId"/> > <parameter param-name="statusId" value="ORDER_HOLD"/> > <parameter param-name="partyId"/> > <parameter param-name="listCollapsed" value="true"/> > <parameter param-name="detailCollapsed" value="false"/> > </link> > I got this error: (sorry I prefered to put all the relevant log, as it may help) > _________________________________________________________________ > Expected collection or sequence. parameterList evaluated instead to freemarker.template.SimpleScalar on line 117, column 8 in component://widget/templates/htmlScreenMacroLibrary.ftl. > The problematic instruction: > ---------- > ==> list parameterList as parameter [on line 117, column 1 in component://widget/templates/htmlScreenMacroLibrary.ftl] > in user-directive renderLink [on line 1, column 1 in Wed Jul 28 13:17:11 CEST 2010] > ---------- > > Java backtrace for programmers: > ---------- > freemarker.template.TemplateException: Expected collection or sequence. parameterList evaluated instead to freemarker.template.SimpleScalar on line 117, column 8 in component://widget/templates/htmlScreenMacr > oLibrary.ftl. > at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:135) > at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:190) > at freemarker.core.Environment.visit(Environment.java:416) > at freemarker.core.IteratorBlock.accept(IteratorBlock.java:102) > at freemarker.core.Environment.visit(Environment.java:209) > at freemarker.core.MixedContent.accept(MixedContent.java:92) > at freemarker.core.Environment.visit(Environment.java:209) > at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79) > at freemarker.core.Environment.visit(Environment.java:209) > at freemarker.core.MixedContent.accept(MixedContent.java:92) > at freemarker.core.Environment.visit(Environment.java:209) > at freemarker.core.Macro$Context.runMacro(Macro.java:168) > at freemarker.core.Environment.visit(Environment.java:602) > at freemarker.core.UnifiedCall.accept(UnifiedCall.java:106) > at freemarker.core.Environment.visit(Environment.java:209) > at freemarker.core.Environment.include(Environment.java:1482) > at org.ofbiz.widget.screen.MacroScreenRenderer.executeMacro(MacroScreenRenderer.java:97) > at org.ofbiz.widget.screen.MacroScreenRenderer.executeMacro(MacroScreenRenderer.java:124) > at org.ofbiz.widget.screen.MacroScreenRenderer.renderLink(MacroScreenRenderer.java:278) > at org.ofbiz.widget.screen.ModelScreenWidget$Link.renderWidgetString(ModelScreenWidget.java:1390) > at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) > at org.ofbiz.widget.screen.MacroScreenRenderer.renderScreenletSubWidget(MacroScreenRenderer.java:633) > at org.ofbiz.widget.screen.ModelScreenWidget$Screenlet.renderWidgetString(ModelScreenWidget.java:370) > at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) > at org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) > at org.ofbiz.widget.screen.ModelScreenWidget$IncludeScreen.renderWidgetString(ModelScreenWidget.java:540) > at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) > at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) > at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) > at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at org.ofbiz.widget.screen.ModelScreenWidget$DecoratorSection.renderWidgetString(ModelScreenWidget.java:670) > at org.ofbiz.widget.screen.ModelScreenWidget$SectionsRenderer.render(ModelScreenWidget.java:126) > at org.ofbiz.widget.screen.ModelScreenWidget$DecoratorSectionInclude.renderWidgetString(ModelScreenWidget.java:703) > at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) > at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at org.ofbiz.widget.screen.ModelScreenWidget$DecoratorSection.renderWidgetString(ModelScreenWidget.java:670) > at org.ofbiz.widget.screen.ModelScreenWidget$SectionsRenderer.render(ModelScreenWidget.java:126) > at org.ofbiz.widget.screen.ModelScreenWidget$DecoratorSectionInclude.renderWidgetString(ModelScreenWidget.java:703) > at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) > at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) > at org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) > at org.ofbiz.widget.screen.ModelScreenWidget$IncludeScreen.renderWidgetString(ModelScreenWidget.java:540) > at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) > at org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) > at org.ofbiz.widget.screen.ModelScreenWidget$DecoratorScreen.renderWidgetString(ModelScreenWidget.java:637) > at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) > at org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) > at org.ofbiz.widget.screen.ModelScreenWidget$DecoratorScreen.renderWidgetString(ModelScreenWidget.java:637) > at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) > at org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) > at org.ofbiz.widget.screen.ScreenRenderer.render(ScreenRenderer.java:135) > at org.ofbiz.widget.screen.ScreenRenderer.render(ScreenRenderer.java:97) > at org.ofbiz.widget.screen.MacroScreenViewHandler.render(MacroScreenViewHandler.java:104) > at org.ofbiz.webapp.control.RequestHandler.renderView(RequestHandler.java:839) > at org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:559) > at org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:227) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) > at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) > at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) > at org.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:271) > at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) > at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) > at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) > at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) > at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) > at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) > at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) > at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:555) > at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) > at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) > at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) > at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) > at java.lang.Thread.run(Thread.java:619) > _________________________________________________________________ > > Reverting to r978939, and using the same calling link, this error dissapears. Also one of my client, who is using trunk, decided to stay at r965923 (not sure why yet he uses this peculiar revision) because "he crossed issues" (I still don't know which issues he spoke about, he told me "many") > > Also I was surprised that by using a url-mode="plain" I got no poping XSS security error message (it's only in the log). Has anyone changed this behaviour or is it normal? If it's normal I will change that! > > Thanks > > Jacques > smime.p7s (3K) Download Attachment |
Administrator
|
Thanks Scott,
Jacques PS: Sorry no time for OE-QuoteFix ;) From: "Scott Gray" <[hidden email]> Thanks Jacques, until I figure out a solution I've reverted the changes to that method in r980238. Regards Scott On 28/07/2010, at 11:38 PM, Jacques Le Roux wrote: > It seems (I say "it seems" because I reverted just before, it could be another revision ahead, but I doubt) that 978944-978954 > set of revision introduced some issues... > At least with the link element in screen widget, for instance using > <link name="holdButton" target="changeOrderStatus" text="${uiLabelMap.CommonHold}" style="buttontext"> > <parameter param-name="orderId"/> > <parameter param-name="statusId" value="ORDER_HOLD"/> > <parameter param-name="partyId"/> > <parameter param-name="listCollapsed" value="true"/> > <parameter param-name="detailCollapsed" value="false"/> > </link> > I got this error: (sorry I prefered to put all the relevant log, as it may help) > _________________________________________________________________ > Expected collection or sequence. parameterList evaluated instead to freemarker.template.SimpleScalar on line 117, column 8 in > component://widget/templates/htmlScreenMacroLibrary.ftl. > The problematic instruction: > ---------- > ==> list parameterList as parameter [on line 117, column 1 in component://widget/templates/htmlScreenMacroLibrary.ftl] > in user-directive renderLink [on line 1, column 1 in Wed Jul 28 13:17:11 CEST 2010] > ---------- > > Java backtrace for programmers: > ---------- > freemarker.template.TemplateException: Expected collection or sequence. parameterList evaluated instead to > freemarker.template.SimpleScalar on line 117, column 8 in component://widget/templates/htmlScreenMacr > oLibrary.ftl. > at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:135) > at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:190) > at freemarker.core.Environment.visit(Environment.java:416) > at freemarker.core.IteratorBlock.accept(IteratorBlock.java:102) > at freemarker.core.Environment.visit(Environment.java:209) > at freemarker.core.MixedContent.accept(MixedContent.java:92) > at freemarker.core.Environment.visit(Environment.java:209) > at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79) > at freemarker.core.Environment.visit(Environment.java:209) > at freemarker.core.MixedContent.accept(MixedContent.java:92) > at freemarker.core.Environment.visit(Environment.java:209) > at freemarker.core.Macro$Context.runMacro(Macro.java:168) > at freemarker.core.Environment.visit(Environment.java:602) > at freemarker.core.UnifiedCall.accept(UnifiedCall.java:106) > at freemarker.core.Environment.visit(Environment.java:209) > at freemarker.core.Environment.include(Environment.java:1482) > at org.ofbiz.widget.screen.MacroScreenRenderer.executeMacro(MacroScreenRenderer.java:97) > at org.ofbiz.widget.screen.MacroScreenRenderer.executeMacro(MacroScreenRenderer.java:124) > at org.ofbiz.widget.screen.MacroScreenRenderer.renderLink(MacroScreenRenderer.java:278) > at org.ofbiz.widget.screen.ModelScreenWidget$Link.renderWidgetString(ModelScreenWidget.java:1390) > at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) > at org.ofbiz.widget.screen.MacroScreenRenderer.renderScreenletSubWidget(MacroScreenRenderer.java:633) > at org.ofbiz.widget.screen.ModelScreenWidget$Screenlet.renderWidgetString(ModelScreenWidget.java:370) > at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) > at org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) > at org.ofbiz.widget.screen.ModelScreenWidget$IncludeScreen.renderWidgetString(ModelScreenWidget.java:540) > at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) > at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) > at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) > at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at org.ofbiz.widget.screen.ModelScreenWidget$DecoratorSection.renderWidgetString(ModelScreenWidget.java:670) > at org.ofbiz.widget.screen.ModelScreenWidget$SectionsRenderer.render(ModelScreenWidget.java:126) > at org.ofbiz.widget.screen.ModelScreenWidget$DecoratorSectionInclude.renderWidgetString(ModelScreenWidget.java:703) > at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) > at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at org.ofbiz.widget.screen.ModelScreenWidget$DecoratorSection.renderWidgetString(ModelScreenWidget.java:670) > at org.ofbiz.widget.screen.ModelScreenWidget$SectionsRenderer.render(ModelScreenWidget.java:126) > at org.ofbiz.widget.screen.ModelScreenWidget$DecoratorSectionInclude.renderWidgetString(ModelScreenWidget.java:703) > at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) > at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) > at org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) > at org.ofbiz.widget.screen.ModelScreenWidget$IncludeScreen.renderWidgetString(ModelScreenWidget.java:540) > at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) > at org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) > at org.ofbiz.widget.screen.ModelScreenWidget$DecoratorScreen.renderWidgetString(ModelScreenWidget.java:637) > at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) > at org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) > at org.ofbiz.widget.screen.ModelScreenWidget$DecoratorScreen.renderWidgetString(ModelScreenWidget.java:637) > at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) > at org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) > at org.ofbiz.widget.screen.ScreenRenderer.render(ScreenRenderer.java:135) > at org.ofbiz.widget.screen.ScreenRenderer.render(ScreenRenderer.java:97) > at org.ofbiz.widget.screen.MacroScreenViewHandler.render(MacroScreenViewHandler.java:104) > at org.ofbiz.webapp.control.RequestHandler.renderView(RequestHandler.java:839) > at org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:559) > at org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:227) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) > at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) > at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) > at org.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:271) > at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) > at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) > at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) > at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) > at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) > at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) > at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) > at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:555) > at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) > at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) > at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) > at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) > at java.lang.Thread.run(Thread.java:619) > _________________________________________________________________ > > Reverting to r978939, and using the same calling link, this error dissapears. Also one of my client, who is using trunk, decided > to stay at r965923 (not sure why yet he uses this peculiar revision) because "he crossed issues" (I still don't know which issues > he spoke about, he told me "many") > > Also I was surprised that by using a url-mode="plain" I got no poping XSS security error message (it's only in the log). Has > anyone changed this behaviour or is it normal? If it's normal I will change that! > > Thanks > > Jacques > |
In reply to this post by Jacques Le Roux
Adrian,
can you have a look at this and the previous 2 commits, they cause a error in the help screens to not display properly. the following error is shown: Error executing macro: renderContentBegin required parameter: enableEditValue is not specified. The problematic instruction: ---------- ==> macro renderContentBegin [on line 46, column 1 in component://widget/templates/htmlScreenMacroLibrary.ftl] in user-directive renderContentBegin [on line 1, column 1 in Fri Jul 30 14:44:26 ICT 2010] ---------- Java backtrace for programmers: ---------- freemarker.template.TemplateException: Error executing macro: renderContentBegin required parameter: enableEditValue is not specified. at freemarker.core.Macro$Context.sanityCheck(Macro.java:207) at freemarker.core.Macro$Context.runMacro(Macro.java:165) at freemarker.core.Environment.visit(Environment.java:602) at freemarker.core.UnifiedCall.accept(UnifiedCall.java:106) at freemarker.core.Environment.visit(Environment.java:209) at freemarker.core.Environment.include(Environment.java:1482) at org.ofbiz.widget.screen.MacroScreenRenderer.executeMacro(MacroScreenRenderer.java:97) at org.ofbiz.widget.screen.MacroScreenRenderer.executeMacro(MacroScreenRenderer.java:124) at org.ofbiz.widget.screen.MacroScreenRenderer.renderContentBegin(MacroScreenRenderer.java:334) at org.ofbiz.widget.screen.ModelScreenWidget$Content.renderWidgetString(ModelScreenWidget.java:1154) at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) at org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) at org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) at org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) at org.ofbiz.widget.screen.ModelScreenWidget$IncludeScreen.renderWidgetString(ModelScreenWidget.java:540) at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) at org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) at org.ofbiz.widget.screen.MacroScreenRenderer.renderScreenletSubWidget(MacroScreenRenderer.java:633) at org.ofbiz.widget.screen.ModelScreenWidget$Screenlet.renderWidgetString(ModelScreenWidget.java:370) at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) at org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) at org.ofbiz.widget.screen.ModelScreenWidget$DecoratorSection.renderWidgetString(ModelScreenWidget.java:670) at org.ofbiz.widget.screen.ModelScreenWidget$SectionsRenderer.render(ModelScreenWidget.java:126) at org.ofbiz.widget.screen.ModelScreenWidget$DecoratorSectionInclude.renderWidgetString(ModelScreenWidget.java:703) at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) at org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) at org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) at org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) at org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) at org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) at org.ofbiz.widget.screen.ModelScreenWidget$DecoratorScreen.renderWidgetString(ModelScreenWidget.java:637) at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) at org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) at org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) at org.ofbiz.widget.screen.ModelScreenWidget$IncludeScreen.renderWidgetString(ModelScreenWidget.java:540) at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) at org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) at org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) at org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) at org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:202) at org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) at org.ofbiz.widget.screen.ScreenRenderer.render(ScreenRenderer.java:135) at org.ofbiz.widget.screen.ScreenRenderer.render(ScreenRenderer.java:97) at org.ofbiz.widget.screen.MacroScreenViewHandler.render(MacroScreenViewHandler.java:104) at org.ofbiz.webapp.control.RequestHandler.renderView(RequestHandler.java:839) at org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:559) at org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:227) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:271) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:555) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:619) On Sun, 2010-07-25 at 00:36 +0000, [hidden email] wrote: > Author: lektran > Date: Sun Jul 25 00:36:13 2010 > New Revision: 978954 > > URL: http://svn.apache.org/viewvc?rev=978954&view=rev > Log: > Converted all render* methods to use executeMacro(Writer, String, Map) instead of executeMacro(Writer, String). Removes over 100 lines of StringWriter usage, makes the code easier to read and also fixes the bug that Jacques committed a workaround for in r978893 > > Modified: > ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java > > Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java?rev=978954&r1=978953&r2=978954&view=diff > ============================================================================== > --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java (original) > +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java Sun Jul 25 00:36:13 2010 > @@ -139,11 +139,11 @@ public class MacroScreenRenderer impleme > } > > public void renderScreenBegin(Appendable writer, Map<String, Object> context) throws IOException { > - executeMacro(writer, "<@renderScreenBegin/>"); > + executeMacro(writer, "renderScreenBegin", null); > } > > public void renderScreenEnd(Appendable writer, Map<String, Object> context) throws IOException { > - executeMacro(writer, "<@renderScreenEnd/>"); > + executeMacro(writer, "renderScreenEnd", null); > } > > public void renderSectionBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.Section section) throws IOException { > @@ -151,24 +151,23 @@ public class MacroScreenRenderer impleme > this.widgetCommentsEnabled = ModelWidget.widgetBoundaryCommentsEnabled(context); > } > if (this.widgetCommentsEnabled) { > - StringWriter sr = new StringWriter(); > - sr.append("<@renderSectionBegin "); > - sr.append("boundaryComment=\"Begin "); > - sr.append(section.isMainSection ? "Screen " : "Section Widget "); > - sr.append(section.getBoundaryCommentName()); > - sr.append("\"/>"); > - executeMacro(writer, sr.toString()); > + Map<String, Object> parameters = FastMap.newInstance(); > + StringBuilder sb = new StringBuilder("Begin "); > + sb.append(section.isMainSection ? "Screen " : "Section Widget "); > + sb.append(section.getBoundaryCommentName()); > + parameters.put("boundaryComment", sb.toString()); > + executeMacro(writer, "renderSectionBegin", parameters); > } > } > public void renderSectionEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.Section section) throws IOException { > if (this.widgetCommentsEnabled) { > - StringWriter sr = new StringWriter(); > - sr.append("<@renderSectionEnd "); > - sr.append("boundaryComment=\"End "); > - sr.append(section.isMainSection ? "Screen " : "Section Widget "); > - sr.append(section.getBoundaryCommentName()); > - sr.append("\"/>"); > - executeMacro(writer, sr.toString()); > + Map<String, Object> parameters = FastMap.newInstance(); > + StringBuilder sb = new StringBuilder(); > + sb.append("End "); > + sb.append(section.isMainSection ? "Screen " : "Section Widget "); > + sb.append(section.getBoundaryCommentName()); > + parameters.put("boundaryComment", sb.toString()); > + executeMacro(writer, "renderSectionEnd", parameters); > } > } > > @@ -186,88 +185,64 @@ public class MacroScreenRenderer impleme > RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_"); > autoUpdateLink = rh.makeLink(request, response, autoUpdateTarget); > } > - StringWriter sr = new StringWriter(); > - sr.append("<@renderContainerBegin "); > - sr.append("id=\""); > - sr.append(containerId); > - sr.append("\" style=\""); > - sr.append(container.getStyle(context)); > - sr.append("\" autoUpdateLink=\""); > - sr.append(autoUpdateLink); > - sr.append("\" autoUpdateInterval=\""); > - sr.append(container.getAutoUpdateInterval()); > - sr.append("\" />"); > - executeMacro(writer, sr.toString()); > + Map<String, Object> parameters = FastMap.newInstance(); > + parameters.put("id", containerId); > + parameters.put("style", container.getStyle(context)); > + parameters.put("autoUpdateLink", autoUpdateLink); > + parameters.put("autoUpdateInterval", container.getAutoUpdateInterval()); > + executeMacro(writer, "renderContainerBegin", parameters); > } > > public void renderContainerEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.Container container) throws IOException { > - StringWriter sr = new StringWriter(); > - sr.append("<@renderContainerEnd/>"); > - executeMacro(writer, sr.toString()); > + executeMacro(writer, "renderContainerEnd", null); > } > > public void renderLabel(Appendable writer, Map<String, Object> context, ModelScreenWidget.Label label) throws IOException { > - String labelText = label.getText(context); > - StringWriter sr = new StringWriter(); > - sr.append("<@renderLabel "); > - sr.append("text=\""); > - sr.append(labelText); > - sr.append("\" id=\""); > - sr.append(label.getId(context)); > - sr.append("\" style=\""); > - sr.append(label.getStyle(context)); > - sr.append("\" />"); > - executeMacro(writer, sr.toString()); > + Map<String, Object> parameters = FastMap.newInstance(); > + parameters.put("text", label.getText(context)); > + parameters.put("id", label.getId(context)); > + parameters.put("style", label.getStyle(context)); > + executeMacro(writer, "renderLabel", parameters); > } > > public void renderHorizontalSeparator(Appendable writer, Map<String, Object> context, ModelScreenWidget.HorizontalSeparator separator) throws IOException { > - StringWriter sr = new StringWriter(); > - sr.append("<@renderHorizontalSeparator "); > - sr.append("id=\""); > - sr.append(separator.getId(context)); > - sr.append("\" style=\""); > - sr.append(separator.getStyle(context)); > - sr.append("\" />"); > - executeMacro(writer, sr.toString()); > + Map<String, Object> parameters = FastMap.newInstance(); > + parameters.put("id", separator.getId(context)); > + parameters.put("style", separator.getStyle(context)); > + executeMacro(writer, "renderHorizontalSeparator", parameters); > } > > public void renderLink(Appendable writer, Map<String, Object> context, ModelScreenWidget.Link link) throws IOException { > HttpServletResponse response = (HttpServletResponse) context.get("response"); > HttpServletRequest request = (HttpServletRequest) context.get("request"); > > - String targetWindow = link.getTargetWindow(context); > String target = link.getTarget(context); > > - String uniqueItemName = link.getModelScreen().getName() + "_LF_" + UtilMisc.<String>addToBigDecimalInMap(context, "screenUniqueItemIndex", BigDecimal.ONE); > > String linkType = WidgetWorker.determineAutoLinkType(link.getLinkType(), target, link.getUrlMode(), request); > - String linkUrl = ""; > String actionUrl = ""; > - StringBuilder parameters=new StringBuilder(); > + StringBuilder targetParameters = new StringBuilder(); > if ("hidden-form".equals(linkType)) { > StringBuilder sb = new StringBuilder(); > WidgetWorker.buildHyperlinkUrl(sb, target, link.getUrlMode(), null, link.getPrefix(context), > link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context); > actionUrl = sb.toString(); > - parameters.append("["); > + targetParameters.append("["); > for (Map.Entry<String, String> parameter: link.getParameterMap(context).entrySet()) { > - if (parameters.length() >1) { > - parameters.append(","); > + if (targetParameters.length() >1) { > + targetParameters.append(","); > } > - parameters.append("{'name':'"); > - parameters.append(parameter.getKey()); > - parameters.append("'"); > - parameters.append(",'value':'"); > - parameters.append(parameter.getValue()); > - parameters.append("'}"); > - } > - parameters.append("]"); > + targetParameters.append("{'name':'"); > + targetParameters.append(parameter.getKey()); > + targetParameters.append("'"); > + targetParameters.append(",'value':'"); > + targetParameters.append(parameter.getValue()); > + targetParameters.append("'}"); > + } > + targetParameters.append("]"); > > } > - String id = link.getId(context); > - String style = link.getStyle(context); > - String name = link.getName(context); > - String text = link.getText(context); > + String linkUrl = ""; > if (UtilValidate.isNotEmpty(target)) { > if (!"hidden-form".equals(linkType)) { > StringBuilder sb = new StringBuilder(); > @@ -283,46 +258,30 @@ public class MacroScreenRenderer impleme > renderImage(sw, context, img); > imgStr = sw.toString(); > } > - StringWriter sr = new StringWriter(); > - sr.append("<@renderLink "); > - sr.append("parameterList="); > - sr.append(parameters.length()==0?"\"\"":parameters.toString()); > - sr.append(" targetWindow=\""); > - sr.append(targetWindow); > - sr.append("\" target=\""); > - sr.append(target); > - sr.append("\" uniqueItemName=\""); > - sr.append(uniqueItemName); > - sr.append("\" linkType=\""); > - sr.append(linkType); > - sr.append("\" actionUrl=\""); > - sr.append(actionUrl); > - sr.append("\" id=\""); > - sr.append(id); > - sr.append("\" style=\""); > - sr.append(style); > - sr.append("\" name=\""); > - sr.append(name); > - sr.append("\" linkUrl=\""); > - sr.append(linkUrl); > - sr.append("\" text=\""); > - sr.append(text); > - sr.append("\" imgStr=\""); > - sr.append(imgStr.replaceAll("\"", "\\\\\"")); > - sr.append("\" />"); > - executeMacro(writer, sr.toString()); > + > + Map<String, Object> parameters = FastMap.newInstance(); > + parameters.put("parameterList", targetParameters.toString()); > + parameters.put("targetWindow", link.getTargetWindow(context)); > + parameters.put("target", target); > + > + String uniqueItemName = link.getModelScreen().getName() + "_LF_" + UtilMisc.<String>addToBigDecimalInMap(context, "screenUniqueItemIndex", BigDecimal.ONE); > + parameters.put("uniqueItemName", uniqueItemName); > + > + parameters.put("linkType", linkType); > + parameters.put("actionUrl", actionUrl); > + parameters.put("id", link.getId(context)); > + parameters.put("style", link.getStyle(context)); > + parameters.put("name", link.getName(context)); > + parameters.put("linkUrl", linkUrl); > + parameters.put("text", link.getText(context)); > + parameters.put("imgStr", imgStr); > + executeMacro(writer, "renderLink", parameters); > } > > public void renderImage(Appendable writer, Map<String, Object> context, ModelScreenWidget.Image image) throws IOException { > if (image == null) > return ; > String src = image.getSrc(context); > - String id = image.getId(context); > - String style = image.getStyle(context); > - String wid = image.getWidth(context); > - String hgt = image.getHeight(context); > - String border = image.getBorder(context); > - String alt = image.getAlt(context); > > String urlMode = image.getUrlMode(); > boolean fullPath = false; > @@ -349,46 +308,30 @@ public class MacroScreenRenderer impleme > } else { > urlString = src; > } > - StringWriter sr = new StringWriter(); > - sr.append("<@renderImage "); > - sr.append("src=\""); > - sr.append(src); > - sr.append("\" id=\""); > - sr.append(id); > - sr.append("\" style=\""); > - sr.append(style); > - sr.append("\" wid=\""); > - sr.append(wid); > - sr.append("\" hgt=\""); > - sr.append(hgt); > - sr.append("\" border=\""); > - sr.append(border); > - sr.append("\" alt=\""); > - sr.append(alt); > - sr.append("\" urlString=\""); > - sr.append(urlString); > - sr.append("\" />"); > - executeMacro(writer, sr.toString()); > + Map<String, Object> parameters = FastMap.newInstance(); > + parameters.put("src", src); > + parameters.put("id", image.getId(context)); > + parameters.put("style", image.getStyle(context)); > + parameters.put("wid", image.getWidth(context)); > + parameters.put("hgt", image.getHeight(context)); > + parameters.put("border", image.getBorder(context)); > + parameters.put("alt", image.getAlt(context)); > + parameters.put("urlString", urlString); > + executeMacro(writer, "renderImage", parameters); > } > > public void renderContentBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException { > String editRequest = content.getEditRequest(context); > - String editContainerStyle = content.getEditContainerStyle(context); > String enableEditName = content.getEnableEditName(context); > String enableEditValue = (String)context.get(enableEditName); > > if (Debug.verboseOn()) Debug.logVerbose("directEditRequest:" + editRequest, module); > > - StringWriter sr = new StringWriter(); > - sr.append("<@renderContentBegin "); > - sr.append("editRequest=\""); > - sr.append(editRequest); > - sr.append("\" enableEditValue=\""); > - sr.append(enableEditValue); > - sr.append("\" editContainerStyle=\""); > - sr.append(editContainerStyle); > - sr.append("\" />"); > - executeMacro(writer, sr.toString()); > + Map<String, Object> parameters = FastMap.newInstance(); > + parameters.put("editRequest", editRequest); > + parameters.put("enableEditValue", enableEditValue); > + parameters.put("editContainerStyle", content.getEditContainerStyle(context)); > + executeMacro(writer, "renderContentBegin", parameters); > } > > public void renderContentBody(Appendable writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException { > @@ -459,7 +402,6 @@ public class MacroScreenRenderer impleme > String expandedContentId = content.getContentId(context); > String editMode = "Edit"; > String editRequest = content.getEditRequest(context); > - String editContainerStyle = content.getEditContainerStyle(context); > String enableEditName = content.getEnableEditName(context); > String enableEditValue = (String)context.get(enableEditName); > String urlString = ""; > @@ -479,29 +421,19 @@ public class MacroScreenRenderer impleme > urlString = rh.makeLink(request, response, editRequest, false, false, false); > } > > - StringWriter sr = new StringWriter(); > - sr.append("<@renderContentEnd "); > - sr.append("urlString=\""); > - sr.append(urlString); > - sr.append("\" editMode=\""); > - sr.append(editMode); > - sr.append("\" editContainerStyle=\""); > - sr.append(editContainerStyle); > - sr.append("\" editRequest=\""); > - sr.append(editRequest); > - sr.append("\" enableEditValue=\""); > - sr.append(enableEditValue); > - sr.append("\" />"); > - executeMacro(writer, sr.toString()); > + Map<String, Object> parameters = FastMap.newInstance(); > + parameters.put("urlString", urlString); > + parameters.put("editMode", editMode); > + parameters.put("editContainerStyle", content.getEditContainerStyle(context)); > + parameters.put("editRequest", editRequest); > + parameters.put("enableEditValue", enableEditValue); > + executeMacro(writer, "renderContentEnd", parameters); > } > } > > public void renderContentFrame(Appendable writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException { > String dataResourceId = content.getDataResourceId(context); > String urlString = "/ViewSimpleContent?dataResourceId=" + dataResourceId; > - String width = content.getWidth(); > - String height = content.getHeight(); > - String border = content.getBorder(); > String fullUrlString = ""; > HttpServletRequest request = (HttpServletRequest) context.get("request"); > HttpServletResponse response = (HttpServletResponse) context.get("response"); > @@ -510,36 +442,24 @@ public class MacroScreenRenderer impleme > RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_"); > fullUrlString = rh.makeLink(request, response, urlString, true, false, false); > } > - StringWriter sr = new StringWriter(); > - sr.append("<@renderContentFrame "); > - sr.append("fullUrl=\""); > - sr.append(fullUrlString); > - sr.append("\" width=\""); > - sr.append(width); > - sr.append("\" height=\""); > - sr.append(height); > - sr.append("\" border=\""); > - sr.append(border); > - sr.append("\" />"); > - executeMacro(writer, sr.toString()); > + > + Map<String, Object> parameters = FastMap.newInstance(); > + parameters.put("fullUrl", fullUrlString); > + parameters.put("width", content.getWidth()); > + parameters.put("height", content.getHeight()); > + parameters.put("border", content.getBorder()); > + executeMacro(writer, "renderContentFrame", parameters); > } > > public void renderSubContentBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.SubContent content) throws IOException { > - String editRequest = content.getEditRequest(context); > - String editContainerStyle = content.getEditContainerStyle(context); > String enableEditName = content.getEnableEditName(context); > String enableEditValue = (String)context.get(enableEditName); > > - StringWriter sr = new StringWriter(); > - sr.append("<@renderSubContentBegin "); > - sr.append(" editContainerStyle=\""); > - sr.append(editContainerStyle); > - sr.append("\" editRequest=\""); > - sr.append(editRequest); > - sr.append("\" enableEditValue=\""); > - sr.append(enableEditValue); > - sr.append("\" />"); > - executeMacro(writer, sr.toString()); > + Map<String, Object> parameters = FastMap.newInstance(); > + parameters.put("editContainerStyle", content.getEditContainerStyle(context)); > + parameters.put("editRequest", content.getEditRequest(context)); > + parameters.put("enableEditValue", enableEditValue); > + executeMacro(writer, "renderSubContentBegin", parameters); > } > > public void renderSubContentBody(Appendable writer, Map<String, Object> context, ModelScreenWidget.SubContent content) throws IOException { > @@ -593,7 +513,6 @@ public class MacroScreenRenderer impleme > public void renderSubContentEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.SubContent content) throws IOException { > String editMode = "Edit"; > String editRequest = content.getEditRequest(context); > - String editContainerStyle = content.getEditContainerStyle(context); > String enableEditName = content.getEnableEditName(context); > String enableEditValue = (String)context.get(enableEditName); > String expandedContentId = content.getContentId(context); > @@ -618,20 +537,13 @@ public class MacroScreenRenderer impleme > } > } > > - StringWriter sr = new StringWriter(); > - sr.append("<@renderSubContentEnd "); > - sr.append("urlString=\""); > - sr.append(urlString); > - sr.append("\" editMode=\""); > - sr.append(editMode); > - sr.append("\" editContainerStyle=\""); > - sr.append(editContainerStyle); > - sr.append("\" editRequest=\""); > - sr.append(editRequest); > - sr.append("\" enableEditValue=\""); > - sr.append(enableEditValue); > - sr.append("\" />"); > - executeMacro(writer, sr.toString()); > + Map<String, Object> parameters = FastMap.newInstance(); > + parameters.put("urlString", urlString); > + parameters.put("editMode", editMode); > + parameters.put("editContainerStyle", content.getEditContainerStyle(context)); > + parameters.put("editRequest", editRequest); > + parameters.put("enableEditValue", enableEditValue); > + executeMacro(writer, "renderSubContentEnd", parameters); > } > > > @@ -652,7 +564,6 @@ public class MacroScreenRenderer impleme > String expandToolTip = ""; > String collapseToolTip = ""; > String fullUrlString = ""; > - boolean padded = screenlet.padded(); > String menuString = ""; > boolean showMore = false; > if (UtilValidate.isNotEmpty(title) || navMenu != null || navForm != null || collapsible) { > @@ -687,36 +598,21 @@ public class MacroScreenRenderer impleme > } > } > > - StringWriter sr = new StringWriter(); > - sr.append("<@renderScreenletBegin "); > - sr.append("id=\""); > - sr.append(screenlet.getId(context)); > - sr.append("\" title=\""); > - sr.append(title); > - sr.append("\" collapsible="); > - sr.append(Boolean.toString(collapsible)); > - sr.append(" saveCollapsed="); > - sr.append(Boolean.toString(screenlet.saveCollapsed())); > - sr.append(" collapsibleAreaId=\""); > - sr.append(collapsibleAreaId); > - sr.append("\" expandToolTip=\""); > - sr.append(expandToolTip); > - sr.append("\" collapseToolTip=\""); > - sr.append(collapseToolTip); > - sr.append("\" fullUrlString=\""); > - sr.append(fullUrlString); > - sr.append("\" padded="); > - sr.append(Boolean.toString(padded)); > - sr.append(" menuString=\""); > - sr.append(menuString.replaceAll("\"", "\\\\\"")); > - sr.append("\" showMore="); > - sr.append(Boolean.toString(showMore)); > - sr.append(" collapsed="); > - sr.append(Boolean.toString(collapsed)); > - sr.append(" javaScriptEnabled="); > - sr.append(Boolean.toString(javaScriptEnabled)); > - sr.append(" />"); > - executeMacro(writer, sr.toString()); > + Map<String, Object> parameters = FastMap.newInstance(); > + parameters.put("id", screenlet.getId(context)); > + parameters.put("title", title); > + parameters.put("collapsible", collapsible); > + parameters.put("saveCollapsed", screenlet.saveCollapsed()); > + parameters.put("collapsibleAreaId", collapsibleAreaId); > + parameters.put("expandToolTip", expandToolTip); > + parameters.put("collapseToolTip", collapseToolTip); > + parameters.put("fullUrlString", fullUrlString); > + parameters.put("padded", screenlet.padded()); > + parameters.put("menuString", menuString); > + parameters.put("showMore", showMore); > + parameters.put("collapsed", collapsed); > + parameters.put("javaScriptEnabled", javaScriptEnabled); > + executeMacro(writer, "renderScreenletBegin", parameters); > } > > public void renderScreenletSubWidget(Appendable writer, Map<String, Object> context, ModelScreenWidget subWidget, ModelScreenWidget.Screenlet screenlet) throws GeneralException, IOException { > @@ -738,9 +634,7 @@ public class MacroScreenRenderer impleme > } > } > public void renderScreenletEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.Screenlet screenlet) throws IOException { > - StringWriter sr = new StringWriter(); > - sr.append("<@renderScreenletEnd/>"); > - executeMacro(writer, sr.toString()); > + executeMacro(writer, "renderScreenletEnd", null); > } > > protected void renderScreenletPaginateMenu(Appendable writer, Map<String, Object> context, ModelScreenWidget.Form form) throws IOException { > @@ -763,7 +657,6 @@ public class MacroScreenRenderer impleme > int viewSize = modelForm.getViewSize(context); > int listSize = modelForm.getListSize(context); > > - int lowIndex = modelForm.getLowIndex(context); > int highIndex = modelForm.getHighIndex(context); > int actualPageSize = modelForm.getActualPageSize(context); > > @@ -824,73 +717,47 @@ public class MacroScreenRenderer impleme > // The current screenlet title bar navigation syling requires rendering > // these links in reverse order > // Last button > - String paginateLastStyle = modelForm.getPaginateLastStyle(); > - String paginateLastLabel = modelForm.getPaginateLastLabel(context); > String lastLinkUrl = ""; > if (highIndex < listSize) { > int page = (listSize / viewSize); > linkText = prepLinkText + page + anchor; > lastLinkUrl = rh.makeLink(request, response, linkText); > } > - String paginateNextStyle = modelForm.getPaginateNextStyle(); > - String paginateNextLabel = modelForm.getPaginateNextLabel(context); > String nextLinkUrl = ""; > if (highIndex < listSize) { > linkText = prepLinkText + (viewIndex + 1) + anchor; > // - make the link > nextLinkUrl = rh.makeLink(request, response, linkText); > } > - String paginatePreviousStyle = modelForm.getPaginatePreviousStyle(); > - String paginatePreviousLabel = modelForm.getPaginatePreviousLabel(context); > String previousLinkUrl = ""; > if (viewIndex > 0) { > linkText = prepLinkText + (viewIndex - 1) + anchor; > previousLinkUrl = rh.makeLink(request, response, linkText); > } > - String paginateFirstStyle = modelForm.getPaginateFirstStyle(); > - String paginateFirstLabel = modelForm.getPaginateFirstLabel(context); > String firstLinkUrl = ""; > if (viewIndex > 0) { > linkText = prepLinkText + 0 + anchor; > firstLinkUrl = rh.makeLink(request, response, linkText); > } > > - StringWriter sr = new StringWriter(); > - sr.append("<@renderScreenletPaginateMenu "); > - sr.append("lowIndex=\""); > - sr.append(Integer.toString(lowIndex)); > - sr.append("\" actualPageSize=\""); > - sr.append(Integer.toString(actualPageSize)); > - sr.append("\" ofLabel=\""); > - sr.append(ofLabel); > - sr.append("\" listSize=\""); > - sr.append(Integer.toString(listSize)); > - sr.append("\" paginateLastStyle=\""); > - sr.append(paginateLastStyle); > - sr.append("\" lastLinkUrl=\""); > - sr.append(lastLinkUrl); > - sr.append("\" paginateLastLabel=\""); > - sr.append(paginateLastLabel); > - sr.append("\" paginateNextStyle=\""); > - sr.append(paginateNextStyle); > - sr.append("\" nextLinkUrl=\""); > - sr.append(nextLinkUrl); > - sr.append("\" paginateNextLabel=\""); > - sr.append(paginateNextLabel); > - sr.append("\" paginatePreviousStyle=\""); > - sr.append(paginatePreviousStyle); > - sr.append("\" paginatePreviousLabel=\""); > - sr.append(paginatePreviousLabel); > - sr.append("\" previousLinkUrl=\""); > - sr.append(previousLinkUrl); > - sr.append("\" paginateFirstStyle=\""); > - sr.append(paginateFirstStyle); > - sr.append("\" paginateFirstLabel=\""); > - sr.append(paginateFirstLabel); > - sr.append("\" firstLinkUrl=\""); > - sr.append(firstLinkUrl); > - sr.append("\" />"); > - executeMacro(writer, sr.toString()); > + Map<String, Object> parameters = FastMap.newInstance(); > + parameters.put("lowIndex", modelForm.getLowIndex(context)); > + parameters.put("actualPageSize", actualPageSize); > + parameters.put("ofLabel", ofLabel); > + parameters.put("listSize", listSize); > + parameters.put("paginateLastStyle", modelForm.getPaginateLastStyle()); > + parameters.put("lastLinkUrl", lastLinkUrl); > + parameters.put("paginateLastLabel", modelForm.getPaginateLastLabel(context)); > + parameters.put("paginateNextStyle", modelForm.getPaginateNextStyle()); > + parameters.put("nextLinkUrl", nextLinkUrl); > + parameters.put("paginateNextLabel", modelForm.getPaginateNextLabel(context)); > + parameters.put("paginatePreviousStyle", modelForm.getPaginatePreviousStyle()); > + parameters.put("paginatePreviousLabel", modelForm.getPaginatePreviousLabel(context)); > + parameters.put("previousLinkUrl", previousLinkUrl); > + parameters.put("paginateFirstStyle", modelForm.getPaginateFirstStyle()); > + parameters.put("paginateFirstLabel", modelForm.getPaginateFirstLabel(context)); > + parameters.put("firstLinkUrl", firstLinkUrl); > + executeMacro(writer, "renderScreenletPaginateMenu", parameters); > } > > } > > -- Ofbiz on twitter: http://twitter.com/apache_ofbiz Myself on twitter: http://twitter.com/hansbak Antwebsystems.com: Quality services for competitive rates. |
I think Scott is aware of those problems and he reverted it. Check the commit logs.
-Adrian --- On Fri, 7/30/10, Hans Bakker <[hidden email]> wrote: > From: Hans Bakker <[hidden email]> > Subject: Re: svn commit: r978954 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java > To: [hidden email] > Date: Friday, July 30, 2010, 12:47 AM > Adrian, > > can you have a look at this and the previous 2 > commits, they cause a > error in the help screens to not display properly. > > the following error is shown: > > Error executing macro: renderContentBegin required > parameter: > enableEditValue is not specified. The problematic > instruction: > ---------- ==> macro renderContentBegin [on line 46, > column 1 in > component://widget/templates/htmlScreenMacroLibrary.ftl] > in > user-directive renderContentBegin [on line 1, column 1 in > Fri Jul 30 > 14:44:26 ICT 2010] ---------- Java backtrace for > programmers: ---------- > freemarker.template.TemplateException: Error executing > macro: > renderContentBegin required parameter: enableEditValue is > not specified. > at > freemarker.core.Macro$Context.sanityCheck(Macro.java:207) > at > freemarker.core.Macro$Context.runMacro(Macro.java:165) at > freemarker.core.Environment.visit(Environment.java:602) at > freemarker.core.UnifiedCall.accept(UnifiedCall.java:106) > at > freemarker.core.Environment.visit(Environment.java:209) at > freemarker.core.Environment.include(Environment.java:1482) > at > org.ofbiz.widget.screen.MacroScreenRenderer.executeMacro(MacroScreenRenderer.java:97) > at > org.ofbiz.widget.screen.MacroScreenRenderer.executeMacro(MacroScreenRenderer.java:124) > at > org.ofbiz.widget.screen.MacroScreenRenderer.renderContentBegin(MacroScreenRenderer.java:334) > at > org.ofbiz.widget.screen.ModelScreenWidget$Content.renderWidgetString(ModelScreenWidget.java:1154) > at > org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at > org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) > at > org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at > org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) > at > org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) > at > org.ofbiz.widget.screen.ModelScreenWidget$IncludeScreen.renderWidgetString(ModelScreenWidget.java:540) > at > org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at > org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) > at > org.ofbiz.widget.screen.MacroScreenRenderer.renderScreenletSubWidget(MacroScreenRenderer.java:633) > at > org.ofbiz.widget.screen.ModelScreenWidget$Screenlet.renderWidgetString(ModelScreenWidget.java:370) > at > org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at > org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) > at > org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at > org.ofbiz.widget.screen.ModelScreenWidget$DecoratorSection.renderWidgetString(ModelScreenWidget.java:670) > at > org.ofbiz.widget.screen.ModelScreenWidget$SectionsRenderer.render(ModelScreenWidget.java:126) > at > org.ofbiz.widget.screen.ModelScreenWidget$DecoratorSectionInclude.renderWidgetString(ModelScreenWidget.java:703) > at > org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at > org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) > at > org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at > org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) > at > org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at > org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) > at > org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at > org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) > at > org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) > at > org.ofbiz.widget.screen.ModelScreenWidget$DecoratorScreen.renderWidgetString(ModelScreenWidget.java:637) > at > org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at > org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) > at > org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) > at > org.ofbiz.widget.screen.ModelScreenWidget$IncludeScreen.renderWidgetString(ModelScreenWidget.java:540) > at > org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at > org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) > at > org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at > org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) > at > org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > at > org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:202) > at > org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) > at > org.ofbiz.widget.screen.ScreenRenderer.render(ScreenRenderer.java:135) > at > org.ofbiz.widget.screen.ScreenRenderer.render(ScreenRenderer.java:97) > at > org.ofbiz.widget.screen.MacroScreenViewHandler.render(MacroScreenViewHandler.java:104) > at > org.ofbiz.webapp.control.RequestHandler.renderView(RequestHandler.java:839) > at > org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:559) > at > org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:227) > at > javax.servlet.http.HttpServlet.service(HttpServlet.java:617) > at > javax.servlet.http.HttpServlet.service(HttpServlet.java:717) > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) > at > org.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:271) > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) > at > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) > at > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) > at > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) > at > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) > at > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) > at > org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:555) > at > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) > at > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) > at > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) > at > org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) > at java.lang.Thread.run(Thread.java:619) > > > > On Sun, 2010-07-25 at 00:36 +0000, [hidden email] > wrote: > > Author: lektran > > Date: Sun Jul 25 00:36:13 2010 > > New Revision: 978954 > > > > URL: http://svn.apache.org/viewvc?rev=978954&view=rev > > Log: > > Converted all render* methods to use > executeMacro(Writer, String, Map) instead of > executeMacro(Writer, String). Removes over 100 lines > of StringWriter usage, makes the code easier to read and > also fixes the bug that Jacques committed a workaround for > in r978893 > > > > Modified: > > >    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java > > > > Modified: > ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java > > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java?rev=978954&r1=978953&r2=978954&view=diff > > > ============================================================================== > > --- > ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java > (original) > > +++ > ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java > Sun Jul 25 00:36:13 2010 > > @@ -139,11 +139,11 @@ public class MacroScreenRenderer > impleme > >   } > > > >   public void > renderScreenBegin(Appendable writer, Map<String, > Object> context) throws IOException { > > -    executeMacro(writer, > "<@renderScreenBegin/>"); > > +    executeMacro(writer, > "renderScreenBegin", null); > >   } > > > >   public void > renderScreenEnd(Appendable writer, Map<String, Object> > context) throws IOException { > > -    executeMacro(writer, > "<@renderScreenEnd/>"); > > +    executeMacro(writer, > "renderScreenEnd", null); > >   } > > > >   public void > renderSectionBegin(Appendable writer, Map<String, > Object> context, ModelScreenWidget.Section section) > throws IOException { > > @@ -151,24 +151,23 @@ public class MacroScreenRenderer > impleme > >       > this.widgetCommentsEnabled = > ModelWidget.widgetBoundaryCommentsEnabled(context); > >     } > >     if > (this.widgetCommentsEnabled) { > > -      > StringWriter sr = new StringWriter(); > > -      > sr.append("<@renderSectionBegin "); > > -      > sr.append("boundaryComment=\"Begin "); > > -      > sr.append(section.isMainSection ? "Screen " : "Section > Widget "); > > -      > sr.append(section.getBoundaryCommentName()); > > -      > sr.append("\"/>"); > > -      > executeMacro(writer, sr.toString()); > > +      > Map<String, Object> parameters = > FastMap.newInstance(); > > +      > StringBuilder sb = new StringBuilder("Begin "); > > +      > sb.append(section.isMainSection ? "Screen " : "Section > Widget "); > > +      > sb.append(section.getBoundaryCommentName()); > > +      > parameters.put("boundaryComment", sb.toString()); > > +      > executeMacro(writer, "renderSectionBegin", parameters); > >     } > >   } > >   public void > renderSectionEnd(Appendable writer, Map<String, > Object> context, ModelScreenWidget.Section section) > throws IOException { > >     if > (this.widgetCommentsEnabled) { > > -      > StringWriter sr = new StringWriter(); > > -      > sr.append("<@renderSectionEnd "); > > -      > sr.append("boundaryComment=\"End "); > > -      > sr.append(section.isMainSection ? "Screen " : "Section > Widget "); > > -      > sr.append(section.getBoundaryCommentName()); > > -      > sr.append("\"/>"); > > -      > executeMacro(writer, sr.toString()); > > +      > Map<String, Object> parameters = > FastMap.newInstance(); > > +      > StringBuilder sb = new StringBuilder(); > > +      > sb.append("End "); > > +      > sb.append(section.isMainSection ? "Screen " : "Section > Widget "); > > +      > sb.append(section.getBoundaryCommentName()); > > +      > parameters.put("boundaryComment", sb.toString()); > > +      > executeMacro(writer, "renderSectionEnd", parameters); > >     } > >   } > > > > @@ -186,88 +185,64 @@ public class MacroScreenRenderer > impleme > >       > RequestHandler rh = (RequestHandler) > ctx.getAttribute("_REQUEST_HANDLER_"); > >       > autoUpdateLink = rh.makeLink(request, response, > autoUpdateTarget); > >     } > > -    StringWriter sr = new > StringWriter(); > > -    > sr.append("<@renderContainerBegin "); > > -    sr.append("id=\""); > > -    sr.append(containerId); > > -    sr.append("\" > style=\""); > > -    > sr.append(container.getStyle(context)); > > -    sr.append("\" > autoUpdateLink=\""); > > -    > sr.append(autoUpdateLink); > > -    sr.append("\" > autoUpdateInterval=\""); > > -    > sr.append(container.getAutoUpdateInterval()); > > -    sr.append("\" />"); > > -    executeMacro(writer, > sr.toString()); > > +    Map<String, Object> > parameters = FastMap.newInstance(); > > +    parameters.put("id", > containerId); > > +    parameters.put("style", > container.getStyle(context)); > > +    > parameters.put("autoUpdateLink", autoUpdateLink); > > +    > parameters.put("autoUpdateInterval", > container.getAutoUpdateInterval()); > > +    executeMacro(writer, > "renderContainerBegin", parameters); > >   } > > > >   public void > renderContainerEnd(Appendable writer, Map<String, > Object> context, ModelScreenWidget.Container container) > throws IOException { > > -    StringWriter sr = new > StringWriter(); > > -    > sr.append("<@renderContainerEnd/>"); > > -    executeMacro(writer, > sr.toString()); > > +    executeMacro(writer, > "renderContainerEnd", null); > >   } > > > >   public void renderLabel(Appendable > writer, Map<String, Object> context, > ModelScreenWidget.Label label) throws IOException { > > -    String labelText = > label.getText(context); > > -    StringWriter sr = new > StringWriter(); > > -    > sr.append("<@renderLabel "); > > -    sr.append("text=\""); > > -    sr.append(labelText); > > -    sr.append("\" id=\""); > > -    > sr.append(label.getId(context)); > > -    sr.append("\" > style=\""); > > -    > sr.append(label.getStyle(context)); > > -    sr.append("\" />"); > > -    executeMacro(writer, > sr.toString()); > > +    Map<String, Object> > parameters = FastMap.newInstance(); > > +    parameters.put("text", > label.getText(context)); > > +    parameters.put("id", > label.getId(context)); > > +    parameters.put("style", > label.getStyle(context)); > > +    executeMacro(writer, > "renderLabel", parameters); > >   } > > > >   public void > renderHorizontalSeparator(Appendable writer, Map<String, > Object> context, ModelScreenWidget.HorizontalSeparator > separator) throws IOException { > > -    StringWriter sr = new > StringWriter(); > > -    > sr.append("<@renderHorizontalSeparator "); > > -    sr.append("id=\""); > > -    > sr.append(separator.getId(context)); > > -    sr.append("\" > style=\""); > > -    > sr.append(separator.getStyle(context)); > > -    sr.append("\" />"); > > -    executeMacro(writer, > sr.toString()); > > +    Map<String, Object> > parameters = FastMap.newInstance(); > > +    parameters.put("id", > separator.getId(context)); > > +    parameters.put("style", > separator.getStyle(context)); > > +    executeMacro(writer, > "renderHorizontalSeparator", parameters); > >   } > > > >   public void renderLink(Appendable > writer, Map<String, Object> context, > ModelScreenWidget.Link link) throws IOException { > >     HttpServletResponse > response = (HttpServletResponse) context.get("response"); > >     HttpServletRequest > request = (HttpServletRequest) context.get("request"); > > > > -    String targetWindow = > link.getTargetWindow(context); > >     String target = > link.getTarget(context); > > > > -    String uniqueItemName = > link.getModelScreen().getName() + "_LF_" + > UtilMisc.<String>addToBigDecimalInMap(context, > "screenUniqueItemIndex", BigDecimal.ONE); > > > >     String linkType = > WidgetWorker.determineAutoLinkType(link.getLinkType(), > target, link.getUrlMode(), request); > > -    String linkUrl = ""; > >     String actionUrl = > ""; > > -    StringBuilder > parameters=new StringBuilder(); > > +    StringBuilder > targetParameters = new StringBuilder(); > >     if > ("hidden-form".equals(linkType)) { > >       > StringBuilder sb = new StringBuilder(); > >       > WidgetWorker.buildHyperlinkUrl(sb, target, > link.getUrlMode(), null, link.getPrefix(context), > >        >    link.getFullPath(), link.getSecure(), > link.getEncode(), request, response, context); > >       > actionUrl = sb.toString(); > > -      > parameters.append("["); > > +      > targetParameters.append("["); > >       for > (Map.Entry<String, String> parameter: > link.getParameterMap(context).entrySet()) { > > -       >  if (parameters.length() >1) { > > -       >    parameters.append(","); > > +       >  if (targetParameters.length() >1) { > > +       >    targetParameters.append(","); > >        >  } > > -       >  parameters.append("{'name':'"); > > -       >  parameters.append(parameter.getKey()); > > -       >  parameters.append("'"); > > -       >  parameters.append(",'value':'"); > > -       >  parameters.append(parameter.getValue()); > > -       >  parameters.append("'}"); > > -      } > > -      > parameters.append("]"); > > +       >  targetParameters.append("{'name':'"); > > +       >  targetParameters.append(parameter.getKey()); > > +       >  targetParameters.append("'"); > > +       >  targetParameters.append(",'value':'"); > > +       >  targetParameters.append(parameter.getValue()); > > +       >  targetParameters.append("'}"); > > +      } > > +      > targetParameters.append("]"); > > > >     } > > -    String id = > link.getId(context); > > -    String style = > link.getStyle(context); > > -    String name = > link.getName(context); > > -    String text = > link.getText(context); > > +    String linkUrl = ""; > >     if > (UtilValidate.isNotEmpty(target)) { > >       if > (!"hidden-form".equals(linkType)) { > >        >  StringBuilder sb = new StringBuilder(); > > @@ -283,46 +258,30 @@ public class MacroScreenRenderer > impleme > >       > renderImage(sw, context, img); > >       imgStr > = sw.toString(); > >     } > > -    StringWriter sr = new > StringWriter(); > > -    > sr.append("<@renderLink "); > > -    > sr.append("parameterList="); > > -    > sr.append(parameters.length()==0?"\"\"":parameters.toString()); > > -    sr.append(" > targetWindow=\""); > > -    sr.append(targetWindow); > > -    sr.append("\" > target=\""); > > -    sr.append(target); > > -    sr.append("\" > uniqueItemName=\""); > > -    > sr.append(uniqueItemName); > > -    sr.append("\" > linkType=\""); > > -    sr.append(linkType); > > -    sr.append("\" > actionUrl=\""); > > -    sr.append(actionUrl); > > -    sr.append("\" id=\""); > > -    sr.append(id); > > -    sr.append("\" > style=\""); > > -    sr.append(style); > > -    sr.append("\" name=\""); > > -    sr.append(name); > > -    sr.append("\" > linkUrl=\""); > > -    sr.append(linkUrl); > > -    sr.append("\" text=\""); > > -    sr.append(text); > > -    sr.append("\" > imgStr=\""); > > -    > sr.append(imgStr.replaceAll("\"", "\\\\\"")); > > -    sr.append("\" />"); > > -    executeMacro(writer, > sr.toString()); > > + > > +    Map<String, Object> > parameters = FastMap.newInstance(); > > +    > parameters.put("parameterList", > targetParameters.toString()); > > +    > parameters.put("targetWindow", > link.getTargetWindow(context)); > > +    parameters.put("target", > target); > > + > > +    String uniqueItemName = > link.getModelScreen().getName() + "_LF_" + > UtilMisc.<String>addToBigDecimalInMap(context, > "screenUniqueItemIndex", BigDecimal.ONE); > > +    > parameters.put("uniqueItemName", uniqueItemName); > > + > > +    > parameters.put("linkType", linkType); > > +    > parameters.put("actionUrl", actionUrl); > > +    parameters.put("id", > link.getId(context)); > > +    parameters.put("style", > link.getStyle(context)); > > +    parameters.put("name", > link.getName(context)); > > +    parameters.put("linkUrl", > linkUrl); > > +    parameters.put("text", > link.getText(context)); > > +    parameters.put("imgStr", > imgStr); > > +    executeMacro(writer, > "renderLink", parameters); > >   } > > > >   public void renderImage(Appendable > writer, Map<String, Object> context, > ModelScreenWidget.Image image) throws IOException { > >     if (image == null) > >       return > ; > >     String src = > image.getSrc(context); > > -    String id = > image.getId(context); > > -    String style = > image.getStyle(context); > > -    String wid = > image.getWidth(context); > > -    String hgt = > image.getHeight(context); > > -    String border = > image.getBorder(context); > > -    String alt = > image.getAlt(context); > > > >     String urlMode = > image.getUrlMode(); > >     boolean fullPath = > false; > > @@ -349,46 +308,30 @@ public class MacroScreenRenderer > impleme > >     } else { > >       > urlString = src; > >     } > > -    StringWriter sr = new > StringWriter(); > > -    > sr.append("<@renderImage "); > > -    sr.append("src=\""); > > -    sr.append(src); > > -    sr.append("\" id=\""); > > -    sr.append(id); > > -    sr.append("\" > style=\""); > > -    sr.append(style); > > -    sr.append("\" wid=\""); > > -    sr.append(wid); > > -    sr.append("\" hgt=\""); > > -    sr.append(hgt); > > -    sr.append("\" > border=\""); > > -    sr.append(border); > > -    sr.append("\" alt=\""); > > -    sr.append(alt); > > -    sr.append("\" > urlString=\""); > > -    sr.append(urlString); > > -    sr.append("\" />"); > > -    executeMacro(writer, > sr.toString()); > > +    Map<String, Object> > parameters = FastMap.newInstance(); > > +    parameters.put("src", > src); > > +    parameters.put("id", > image.getId(context)); > > +    parameters.put("style", > image.getStyle(context)); > > +    parameters.put("wid", > image.getWidth(context)); > > +    parameters.put("hgt", > image.getHeight(context)); > > +    parameters.put("border", > image.getBorder(context)); > > +    parameters.put("alt", > image.getAlt(context)); > > +    > parameters.put("urlString", urlString); > > +    executeMacro(writer, > "renderImage", parameters); > >   } > > > >   public void > renderContentBegin(Appendable writer, Map<String, > Object> context, ModelScreenWidget.Content content) > throws IOException { > >       String > editRequest = content.getEditRequest(context); > > -      String > editContainerStyle = > content.getEditContainerStyle(context); > >       String > enableEditName = content.getEnableEditName(context); > >       String > enableEditValue = (String)context.get(enableEditName); > > > >       if > (Debug.verboseOn()) Debug.logVerbose("directEditRequest:" + > editRequest, module); > > > > -      StringWriter > sr = new StringWriter(); > > -   >    sr.append("<@renderContentBegin "); > > -   >    sr.append("editRequest=\""); > > -   >    sr.append(editRequest); > > -      sr.append("\" > enableEditValue=\""); > > -   >    sr.append(enableEditValue); > > -      sr.append("\" > editContainerStyle=\""); > > -   >    sr.append(editContainerStyle); > > -      sr.append("\" > />"); > > -   >    executeMacro(writer, sr.toString()); > > +      Map<String, > Object> parameters = FastMap.newInstance(); > > +   >    parameters.put("editRequest", > editRequest); > > +   >    parameters.put("enableEditValue", > enableEditValue); > > +   >    parameters.put("editContainerStyle", > content.getEditContainerStyle(context)); > > +   >    executeMacro(writer, "renderContentBegin", > parameters); > >   } > > > >   public void > renderContentBody(Appendable writer, Map<String, > Object> context, ModelScreenWidget.Content content) > throws IOException { > > @@ -459,7 +402,6 @@ public class MacroScreenRenderer > impleme > >     String > expandedContentId = content.getContentId(context); > >     String editMode = > "Edit"; > >     String editRequest = > content.getEditRequest(context); > > -    String editContainerStyle > = content.getEditContainerStyle(context); > >     String > enableEditName = content.getEnableEditName(context); > >     String > enableEditValue = (String)context.get(enableEditName); > >     String urlString = > ""; > > @@ -479,29 +421,19 @@ public class MacroScreenRenderer > impleme > >        >  urlString = rh.makeLink(request, response, > editRequest, false, false, false); > >       } > > > > -      > StringWriter sr = new StringWriter(); > > -      > sr.append("<@renderContentEnd "); > > -      > sr.append("urlString=\""); > > -      > sr.append(urlString); > > -      > sr.append("\" editMode=\""); > > -      > sr.append(editMode); > > -      > sr.append("\" editContainerStyle=\""); > > -      > sr.append(editContainerStyle); > > -      > sr.append("\" editRequest=\""); > > -      > sr.append(editRequest); > > -      > sr.append("\" enableEditValue=\""); > > -      > sr.append(enableEditValue); > > -      > sr.append("\" />"); > > -      > executeMacro(writer, sr.toString()); > > +      > Map<String, Object> parameters = > FastMap.newInstance(); > > +      > parameters.put("urlString", urlString); > > +      > parameters.put("editMode", editMode); > > +      > parameters.put("editContainerStyle", > content.getEditContainerStyle(context)); > > +      > parameters.put("editRequest", editRequest); > > +      > parameters.put("enableEditValue", enableEditValue); > > +      > executeMacro(writer, "renderContentEnd", parameters); > >     } > >   } > > > >   public void > renderContentFrame(Appendable writer, Map<String, > Object> context, ModelScreenWidget.Content content) > throws IOException { > >     String > dataResourceId = content.getDataResourceId(context); > >     String urlString = > "/ViewSimpleContent?dataResourceId=" + dataResourceId; > > -    String width = > content.getWidth(); > > -    String height = > content.getHeight(); > > -    String border = > content.getBorder(); > >     String fullUrlString > = ""; > >     HttpServletRequest > request = (HttpServletRequest) context.get("request"); > >     HttpServletResponse > response = (HttpServletResponse) context.get("response"); > > @@ -510,36 +442,24 @@ public class MacroScreenRenderer > impleme > >       > RequestHandler rh = (RequestHandler) > ctx.getAttribute("_REQUEST_HANDLER_"); > >       > fullUrlString = rh.makeLink(request, response, urlString, > true, false, false); > >     } > > -    StringWriter sr = new > StringWriter(); > > -    > sr.append("<@renderContentFrame "); > > -    sr.append("fullUrl=\""); > > -    > sr.append(fullUrlString); > > -    sr.append("\" > width=\""); > > -    sr.append(width); > > -    sr.append("\" > height=\""); > > -    sr.append(height); > > -    sr.append("\" > border=\""); > > -    sr.append(border); > > -    sr.append("\" />"); > > -    executeMacro(writer, > sr.toString()); > > + > > +    Map<String, Object> > parameters = FastMap.newInstance(); > > +    parameters.put("fullUrl", > fullUrlString); > > +    parameters.put("width", > content.getWidth()); > > +    parameters.put("height", > content.getHeight()); > > +    parameters.put("border", > content.getBorder()); > > +    executeMacro(writer, > "renderContentFrame", parameters); > >   } > > > >   public void > renderSubContentBegin(Appendable writer, Map<String, > Object> context, ModelScreenWidget.SubContent content) > throws IOException { > > -      String > editRequest = content.getEditRequest(context); > > -      String > editContainerStyle = > content.getEditContainerStyle(context); > >       String > enableEditName = content.getEnableEditName(context); > >       String > enableEditValue = (String)context.get(enableEditName); > > > > -      StringWriter > sr = new StringWriter(); > > -   >    sr.append("<@renderSubContentBegin "); > > -      sr.append(" > editContainerStyle=\""); > > -   >    sr.append(editContainerStyle); > > -      sr.append("\" > editRequest=\""); > > -   >    sr.append(editRequest); > > -      sr.append("\" > enableEditValue=\""); > > -   >    sr.append(enableEditValue); > > -      sr.append("\" > />"); > > -   >    executeMacro(writer, sr.toString()); > > +      Map<String, > Object> parameters = FastMap.newInstance(); > > +   >    parameters.put("editContainerStyle", > content.getEditContainerStyle(context)); > > +   >    parameters.put("editRequest", > content.getEditRequest(context)); > > +   >    parameters.put("enableEditValue", > enableEditValue); > > +   >    executeMacro(writer, > "renderSubContentBegin", parameters); > >   } > > > >   public void > renderSubContentBody(Appendable writer, Map<String, > Object> context, ModelScreenWidget.SubContent content) > throws IOException { > > @@ -593,7 +513,6 @@ public class MacroScreenRenderer > impleme > >   public void > renderSubContentEnd(Appendable writer, Map<String, > Object> context, ModelScreenWidget.SubContent content) > throws IOException { > >       String > editMode = "Edit"; > >       String > editRequest = content.getEditRequest(context); > > -      String > editContainerStyle = > content.getEditContainerStyle(context); > >       String > enableEditName = content.getEnableEditName(context); > >       String > enableEditValue = (String)context.get(enableEditName); > >       String > expandedContentId = content.getContentId(context); > > @@ -618,20 +537,13 @@ public class MacroScreenRenderer > impleme > >      >    } > >       } > > > > -      StringWriter > sr = new StringWriter(); > > -   >    sr.append("<@renderSubContentEnd "); > > -   >    sr.append("urlString=\""); > > -   >    sr.append(urlString); > > -      sr.append("\" > editMode=\""); > > -   >    sr.append(editMode); > > -      sr.append("\" > editContainerStyle=\""); > > -   >    sr.append(editContainerStyle); > > -      sr.append("\" > editRequest=\""); > > -   >    sr.append(editRequest); > > -      sr.append("\" > enableEditValue=\""); > > -   >    sr.append(enableEditValue); > > -      sr.append("\" > />"); > > -   >    executeMacro(writer, sr.toString()); > > +      Map<String, > Object> parameters = FastMap.newInstance(); > > +   >    parameters.put("urlString", urlString); > > +   >    parameters.put("editMode", editMode); > > +   >    parameters.put("editContainerStyle", > content.getEditContainerStyle(context)); > > +   >    parameters.put("editRequest", > editRequest); > > +   >    parameters.put("enableEditValue", > enableEditValue); > > +   >    executeMacro(writer, > "renderSubContentEnd", parameters); > >   } > > > > > > @@ -652,7 +564,6 @@ public class MacroScreenRenderer > impleme > >     String expandToolTip > = ""; > >     String > collapseToolTip = ""; > >     String fullUrlString > = ""; > > -    boolean padded = > screenlet.padded(); > >     String menuString = > ""; > >     boolean showMore = > false; > >     if > (UtilValidate.isNotEmpty(title) || navMenu != null || > navForm != null || collapsible) { > > @@ -687,36 +598,21 @@ public class MacroScreenRenderer > impleme > >       } > >     } > > > > -    StringWriter sr = new > StringWriter(); > > -    > sr.append("<@renderScreenletBegin "); > > -    sr.append("id=\""); > > -    > sr.append(screenlet.getId(context)); > > -    sr.append("\" > title=\""); > > -    sr.append(title); > > -    sr.append("\" > collapsible="); > > -    > sr.append(Boolean.toString(collapsible)); > > -    sr.append(" > saveCollapsed="); > > -    > sr.append(Boolean.toString(screenlet.saveCollapsed())); > > -    sr.append(" > collapsibleAreaId=\""); > > -    > sr.append(collapsibleAreaId); > > -    sr.append("\" > expandToolTip=\""); > > -    > sr.append(expandToolTip); > > -    sr.append("\" > collapseToolTip=\""); > > -    > sr.append(collapseToolTip); > > -    sr.append("\" > fullUrlString=\""); > > -    > sr.append(fullUrlString); > > -    sr.append("\" padded="); > > -    > sr.append(Boolean.toString(padded)); > > -    sr.append(" > menuString=\""); > > -    > sr.append(menuString.replaceAll("\"", "\\\\\"")); > > -    sr.append("\" > showMore="); > > -    > sr.append(Boolean.toString(showMore)); > > -    sr.append(" > collapsed="); > > -    > sr.append(Boolean.toString(collapsed)); > > -    sr.append(" > javaScriptEnabled="); > > -    > sr.append(Boolean.toString(javaScriptEnabled)); > > -    sr.append(" />"); > > -    executeMacro(writer, > sr.toString()); > > +    Map<String, Object> > parameters = FastMap.newInstance(); > > +    parameters.put("id", > screenlet.getId(context)); > > +    parameters.put("title", > title); > > +    > parameters.put("collapsible", collapsible); > > +    > parameters.put("saveCollapsed", screenlet.saveCollapsed()); > > +    > parameters.put("collapsibleAreaId", collapsibleAreaId); > > +    > parameters.put("expandToolTip", expandToolTip); > > +    > parameters.put("collapseToolTip", collapseToolTip); > > +    > parameters.put("fullUrlString", fullUrlString); > > +    parameters.put("padded", > screenlet.padded()); > > +    > parameters.put("menuString", menuString); > > +    > parameters.put("showMore", showMore); > > +    > parameters.put("collapsed", collapsed); > > +    > parameters.put("javaScriptEnabled", javaScriptEnabled); > > +    executeMacro(writer, > "renderScreenletBegin", parameters); > >   } > > > >   public void > renderScreenletSubWidget(Appendable writer, Map<String, > Object> context, ModelScreenWidget subWidget, > ModelScreenWidget.Screenlet screenlet) throws > GeneralException, IOException { > > @@ -738,9 +634,7 @@ public class MacroScreenRenderer > impleme > >     } > >   } > >   public void > renderScreenletEnd(Appendable writer, Map<String, > Object> context, ModelScreenWidget.Screenlet screenlet) > throws IOException { > > -    StringWriter sr = new > StringWriter(); > > -    > sr.append("<@renderScreenletEnd/>"); > > -    executeMacro(writer, > sr.toString()); > > +    executeMacro(writer, > "renderScreenletEnd", null); > >   } > > > >   protected void > renderScreenletPaginateMenu(Appendable writer, > Map<String, Object> context, ModelScreenWidget.Form > form) throws IOException { > > @@ -763,7 +657,6 @@ public class MacroScreenRenderer > impleme > >     int viewSize = > modelForm.getViewSize(context); > >     int listSize = > modelForm.getListSize(context); > > > > -    int lowIndex = > modelForm.getLowIndex(context); > >     int highIndex = > modelForm.getHighIndex(context); > >     int actualPageSize = > modelForm.getActualPageSize(context); > > > > @@ -824,73 +717,47 @@ public class MacroScreenRenderer > impleme > >     // The current > screenlet title bar navigation syling requires rendering > >     // these links in > reverse order > >     // Last button > > -    String paginateLastStyle > = modelForm.getPaginateLastStyle(); > > -    String paginateLastLabel > = modelForm.getPaginateLastLabel(context); > >     String lastLinkUrl = > ""; > >     if (highIndex < > listSize) { > >       int > page = (listSize / viewSize); > >       > linkText = prepLinkText + page + anchor; > >       > lastLinkUrl = rh.makeLink(request, response, linkText); > >     } > > -    String paginateNextStyle > = modelForm.getPaginateNextStyle(); > > -    String paginateNextLabel > = modelForm.getPaginateNextLabel(context); > >     String nextLinkUrl = > ""; > >     if (highIndex < > listSize) { > >       > linkText = prepLinkText + (viewIndex + 1) + anchor; > >       // - > make the link > >       > nextLinkUrl = rh.makeLink(request, response, linkText); > >     } > > -    String > paginatePreviousStyle = > modelForm.getPaginatePreviousStyle(); > > -    String > paginatePreviousLabel = > modelForm.getPaginatePreviousLabel(context); > >     String > previousLinkUrl = ""; > >     if (viewIndex > > 0) { > >       > linkText = prepLinkText + (viewIndex - 1) + anchor; > >       > previousLinkUrl = rh.makeLink(request, response, linkText); > >     } > > -    String paginateFirstStyle > = modelForm.getPaginateFirstStyle(); > > -    String paginateFirstLabel > = modelForm.getPaginateFirstLabel(context); > >     String firstLinkUrl > = ""; > >     if (viewIndex > > 0) { > >       > linkText = prepLinkText + 0 + anchor; > >       > firstLinkUrl = rh.makeLink(request, response, linkText); > >     } > > > > -    StringWriter sr = new > StringWriter(); > > -    > sr.append("<@renderScreenletPaginateMenu "); > > -    > sr.append("lowIndex=\""); > > -    > sr.append(Integer.toString(lowIndex)); > > -    sr.append("\" > actualPageSize=\""); > > -    > sr.append(Integer.toString(actualPageSize)); > > -    sr.append("\" > ofLabel=\""); > > -    sr.append(ofLabel); > > -    sr.append("\" > listSize=\""); > > -    > sr.append(Integer.toString(listSize)); > > -    sr.append("\" > paginateLastStyle=\""); > > -    > sr.append(paginateLastStyle); > > -    sr.append("\" > lastLinkUrl=\""); > > -    sr.append(lastLinkUrl); > > -    sr.append("\" > paginateLastLabel=\""); > > -    > sr.append(paginateLastLabel); > > -    sr.append("\" > paginateNextStyle=\""); > > -    > sr.append(paginateNextStyle); > > -    sr.append("\" > nextLinkUrl=\""); > > -    sr.append(nextLinkUrl); > > -    sr.append("\" > paginateNextLabel=\""); > > -    > sr.append(paginateNextLabel); > > -    sr.append("\" > paginatePreviousStyle=\""); > > -    > sr.append(paginatePreviousStyle); > > -    sr.append("\" > paginatePreviousLabel=\""); > > -    > sr.append(paginatePreviousLabel); > > -    sr.append("\" > previousLinkUrl=\""); > > -    > sr.append(previousLinkUrl); > > -    sr.append("\" > paginateFirstStyle=\""); > > -    > sr.append(paginateFirstStyle); > > -    sr.append("\" > paginateFirstLabel=\""); > > -    > sr.append(paginateFirstLabel); > > -    sr.append("\" > firstLinkUrl=\""); > > -    sr.append(firstLinkUrl); > > -    sr.append("\" />"); > > -    executeMacro(writer, > sr.toString()); > > +    Map<String, Object> > parameters = FastMap.newInstance(); > > +    > parameters.put("lowIndex", modelForm.getLowIndex(context)); > > +    > parameters.put("actualPageSize", actualPageSize); > > +    parameters.put("ofLabel", > ofLabel); > > +    > parameters.put("listSize", listSize); > > +    > parameters.put("paginateLastStyle", > modelForm.getPaginateLastStyle()); > > +    > parameters.put("lastLinkUrl", lastLinkUrl); > > +    > parameters.put("paginateLastLabel", > modelForm.getPaginateLastLabel(context)); > > +    > parameters.put("paginateNextStyle", > modelForm.getPaginateNextStyle()); > > +    > parameters.put("nextLinkUrl", nextLinkUrl); > > +    > parameters.put("paginateNextLabel", > modelForm.getPaginateNextLabel(context)); > > +    > parameters.put("paginatePreviousStyle", > modelForm.getPaginatePreviousStyle()); > > +    > parameters.put("paginatePreviousLabel", > modelForm.getPaginatePreviousLabel(context)); > > +    > parameters.put("previousLinkUrl", previousLinkUrl); > > +    > parameters.put("paginateFirstStyle", > modelForm.getPaginateFirstStyle()); > > +    > parameters.put("paginateFirstLabel", > modelForm.getPaginateFirstLabel(context)); > > +    > parameters.put("firstLinkUrl", firstLinkUrl); > > +    executeMacro(writer, > "renderScreenletPaginateMenu", parameters); > >   } > > > > } > > > > > > -- > Ofbiz on twitter: http://twitter.com/apache_ofbiz > Myself on twitter: http://twitter.com/hansbak > Antwebsystems.com: Quality services for competitive rates. > > |
the current trunk has the same problem.
On Fri, 2010-07-30 at 00:51 -0700, Adrian Crum wrote: > I think Scott is aware of those problems and he reverted it. Check the commit logs. > > -Adrian > > --- On Fri, 7/30/10, Hans Bakker <[hidden email]> wrote: > > > From: Hans Bakker <[hidden email]> > > Subject: Re: svn commit: r978954 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java > > To: [hidden email] > > Date: Friday, July 30, 2010, 12:47 AM > > Adrian, > > > > can you have a look at this and the previous 2 > > commits, they cause a > > error in the help screens to not display properly. > > > > the following error is shown: > > > > Error executing macro: renderContentBegin required > > parameter: > > enableEditValue is not specified. The problematic > > instruction: > > ---------- ==> macro renderContentBegin [on line 46, > > column 1 in > > component://widget/templates/htmlScreenMacroLibrary.ftl] > > in > > user-directive renderContentBegin [on line 1, column 1 in > > Fri Jul 30 > > 14:44:26 ICT 2010] ---------- Java backtrace for > > programmers: ---------- > > freemarker.template.TemplateException: Error executing > > macro: > > renderContentBegin required parameter: enableEditValue is > > not specified. > > at > > freemarker.core.Macro$Context.sanityCheck(Macro.java:207) > > at > > freemarker.core.Macro$Context.runMacro(Macro.java:165) at > > freemarker.core.Environment.visit(Environment.java:602) at > > freemarker.core.UnifiedCall.accept(UnifiedCall.java:106) > > at > > freemarker.core.Environment.visit(Environment.java:209) at > > freemarker.core.Environment.include(Environment.java:1482) > > at > > org.ofbiz.widget.screen.MacroScreenRenderer.executeMacro(MacroScreenRenderer.java:97) > > at > > org.ofbiz.widget.screen.MacroScreenRenderer.executeMacro(MacroScreenRenderer.java:124) > > at > > org.ofbiz.widget.screen.MacroScreenRenderer.renderContentBegin(MacroScreenRenderer.java:334) > > at > > org.ofbiz.widget.screen.ModelScreenWidget$Content.renderWidgetString(ModelScreenWidget.java:1154) > > at > > org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > > at > > org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) > > at > > org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > > at > > org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) > > at > > org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) > > at > > org.ofbiz.widget.screen.ModelScreenWidget$IncludeScreen.renderWidgetString(ModelScreenWidget.java:540) > > at > > org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > > at > > org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) > > at > > org.ofbiz.widget.screen.MacroScreenRenderer.renderScreenletSubWidget(MacroScreenRenderer.java:633) > > at > > org.ofbiz.widget.screen.ModelScreenWidget$Screenlet.renderWidgetString(ModelScreenWidget.java:370) > > at > > org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > > at > > org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) > > at > > org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > > at > > org.ofbiz.widget.screen.ModelScreenWidget$DecoratorSection.renderWidgetString(ModelScreenWidget.java:670) > > at > > org.ofbiz.widget.screen.ModelScreenWidget$SectionsRenderer.render(ModelScreenWidget.java:126) > > at > > org.ofbiz.widget.screen.ModelScreenWidget$DecoratorSectionInclude.renderWidgetString(ModelScreenWidget.java:703) > > at > > org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > > at > > org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) > > at > > org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > > at > > org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) > > at > > org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > > at > > org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) > > at > > org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > > at > > org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) > > at > > org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) > > at > > org.ofbiz.widget.screen.ModelScreenWidget$DecoratorScreen.renderWidgetString(ModelScreenWidget.java:637) > > at > > org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > > at > > org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) > > at > > org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) > > at > > org.ofbiz.widget.screen.ModelScreenWidget$IncludeScreen.renderWidgetString(ModelScreenWidget.java:540) > > at > > org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > > at > > org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) > > at > > org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > > at > > org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) > > at > > org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) > > at > > org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:202) > > at > > org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) > > at > > org.ofbiz.widget.screen.ScreenRenderer.render(ScreenRenderer.java:135) > > at > > org.ofbiz.widget.screen.ScreenRenderer.render(ScreenRenderer.java:97) > > at > > org.ofbiz.widget.screen.MacroScreenViewHandler.render(MacroScreenViewHandler.java:104) > > at > > org.ofbiz.webapp.control.RequestHandler.renderView(RequestHandler.java:839) > > at > > org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:559) > > at > > org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:227) > > at > > javax.servlet.http.HttpServlet.service(HttpServlet.java:617) > > at > > javax.servlet.http.HttpServlet.service(HttpServlet.java:717) > > at > > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) > > at > > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) > > at > > org.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:271) > > at > > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) > > at > > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) > > at > > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) > > at > > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) > > at > > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) > > at > > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) > > at > > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) > > at > > org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:555) > > at > > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) > > at > > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) > > at > > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) > > at > > org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) > > at java.lang.Thread.run(Thread.java:619) > > > > > > > > On Sun, 2010-07-25 at 00:36 +0000, [hidden email] > > wrote: > > > Author: lektran > > > Date: Sun Jul 25 00:36:13 2010 > > > New Revision: 978954 > > > > > > URL: http://svn.apache.org/viewvc?rev=978954&view=rev > > > Log: > > > Converted all render* methods to use > > executeMacro(Writer, String, Map) instead of > > executeMacro(Writer, String). Removes over 100 lines > > of StringWriter usage, makes the code easier to read and > > also fixes the bug that Jacques committed a workaround for > > in r978893 > > > > > > Modified: > > > > > ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java > > > > > > Modified: > > ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java > > > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java?rev=978954&r1=978953&r2=978954&view=diff > > > > > ============================================================================== > > > --- > > ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java > > (original) > > > +++ > > ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java > > Sun Jul 25 00:36:13 2010 > > > @@ -139,11 +139,11 @@ public class MacroScreenRenderer > > impleme > > > } > > > > > > public void > > renderScreenBegin(Appendable writer, Map<String, > > Object> context) throws IOException { > > > - executeMacro(writer, > > "<@renderScreenBegin/>"); > > > + executeMacro(writer, > > "renderScreenBegin", null); > > > } > > > > > > public void > > renderScreenEnd(Appendable writer, Map<String, Object> > > context) throws IOException { > > > - executeMacro(writer, > > "<@renderScreenEnd/>"); > > > + executeMacro(writer, > > "renderScreenEnd", null); > > > } > > > > > > public void > > renderSectionBegin(Appendable writer, Map<String, > > Object> context, ModelScreenWidget.Section section) > > throws IOException { > > > @@ -151,24 +151,23 @@ public class MacroScreenRenderer > > impleme > > > > > this.widgetCommentsEnabled = > > ModelWidget.widgetBoundaryCommentsEnabled(context); > > > } > > > if > > (this.widgetCommentsEnabled) { > > > - > > StringWriter sr = new StringWriter(); > > > - > > sr.append("<@renderSectionBegin "); > > > - > > sr.append("boundaryComment=\"Begin "); > > > - > > sr.append(section.isMainSection ? "Screen " : "Section > > Widget "); > > > - > > sr.append(section.getBoundaryCommentName()); > > > - > > sr.append("\"/>"); > > > - > > executeMacro(writer, sr.toString()); > > > + > > Map<String, Object> parameters = > > FastMap.newInstance(); > > > + > > StringBuilder sb = new StringBuilder("Begin "); > > > + > > sb.append(section.isMainSection ? "Screen " : "Section > > Widget "); > > > + > > sb.append(section.getBoundaryCommentName()); > > > + > > parameters.put("boundaryComment", sb.toString()); > > > + > > executeMacro(writer, "renderSectionBegin", parameters); > > > } > > > } > > > public void > > renderSectionEnd(Appendable writer, Map<String, > > Object> context, ModelScreenWidget.Section section) > > throws IOException { > > > if > > (this.widgetCommentsEnabled) { > > > - > > StringWriter sr = new StringWriter(); > > > - > > sr.append("<@renderSectionEnd "); > > > - > > sr.append("boundaryComment=\"End "); > > > - > > sr.append(section.isMainSection ? "Screen " : "Section > > Widget "); > > > - > > sr.append(section.getBoundaryCommentName()); > > > - > > sr.append("\"/>"); > > > - > > executeMacro(writer, sr.toString()); > > > + > > Map<String, Object> parameters = > > FastMap.newInstance(); > > > + > > StringBuilder sb = new StringBuilder(); > > > + > > sb.append("End "); > > > + > > sb.append(section.isMainSection ? "Screen " : "Section > > Widget "); > > > + > > sb.append(section.getBoundaryCommentName()); > > > + > > parameters.put("boundaryComment", sb.toString()); > > > + > > executeMacro(writer, "renderSectionEnd", parameters); > > > } > > > } > > > > > > @@ -186,88 +185,64 @@ public class MacroScreenRenderer > > impleme > > > > > RequestHandler rh = (RequestHandler) > > ctx.getAttribute("_REQUEST_HANDLER_"); > > > > > autoUpdateLink = rh.makeLink(request, response, > > autoUpdateTarget); > > > } > > > - StringWriter sr = new > > StringWriter(); > > > - > > sr.append("<@renderContainerBegin "); > > > - sr.append("id=\""); > > > - sr.append(containerId); > > > - sr.append("\" > > style=\""); > > > - > > sr.append(container.getStyle(context)); > > > - sr.append("\" > > autoUpdateLink=\""); > > > - > > sr.append(autoUpdateLink); > > > - sr.append("\" > > autoUpdateInterval=\""); > > > - > > sr.append(container.getAutoUpdateInterval()); > > > - sr.append("\" />"); > > > - executeMacro(writer, > > sr.toString()); > > > + Map<String, Object> > > parameters = FastMap.newInstance(); > > > + parameters.put("id", > > containerId); > > > + parameters.put("style", > > container.getStyle(context)); > > > + > > parameters.put("autoUpdateLink", autoUpdateLink); > > > + > > parameters.put("autoUpdateInterval", > > container.getAutoUpdateInterval()); > > > + executeMacro(writer, > > "renderContainerBegin", parameters); > > > } > > > > > > public void > > renderContainerEnd(Appendable writer, Map<String, > > Object> context, ModelScreenWidget.Container container) > > throws IOException { > > > - StringWriter sr = new > > StringWriter(); > > > - > > sr.append("<@renderContainerEnd/>"); > > > - executeMacro(writer, > > sr.toString()); > > > + executeMacro(writer, > > "renderContainerEnd", null); > > > } > > > > > > public void renderLabel(Appendable > > writer, Map<String, Object> context, > > ModelScreenWidget.Label label) throws IOException { > > > - String labelText = > > label.getText(context); > > > - StringWriter sr = new > > StringWriter(); > > > - > > sr.append("<@renderLabel "); > > > - sr.append("text=\""); > > > - sr.append(labelText); > > > - sr.append("\" id=\""); > > > - > > sr.append(label.getId(context)); > > > - sr.append("\" > > style=\""); > > > - > > sr.append(label.getStyle(context)); > > > - sr.append("\" />"); > > > - executeMacro(writer, > > sr.toString()); > > > + Map<String, Object> > > parameters = FastMap.newInstance(); > > > + parameters.put("text", > > label.getText(context)); > > > + parameters.put("id", > > label.getId(context)); > > > + parameters.put("style", > > label.getStyle(context)); > > > + executeMacro(writer, > > "renderLabel", parameters); > > > } > > > > > > public void > > renderHorizontalSeparator(Appendable writer, Map<String, > > Object> context, ModelScreenWidget.HorizontalSeparator > > separator) throws IOException { > > > - StringWriter sr = new > > StringWriter(); > > > - > > sr.append("<@renderHorizontalSeparator "); > > > - sr.append("id=\""); > > > - > > sr.append(separator.getId(context)); > > > - sr.append("\" > > style=\""); > > > - > > sr.append(separator.getStyle(context)); > > > - sr.append("\" />"); > > > - executeMacro(writer, > > sr.toString()); > > > + Map<String, Object> > > parameters = FastMap.newInstance(); > > > + parameters.put("id", > > separator.getId(context)); > > > + parameters.put("style", > > separator.getStyle(context)); > > > + executeMacro(writer, > > "renderHorizontalSeparator", parameters); > > > } > > > > > > public void renderLink(Appendable > > writer, Map<String, Object> context, > > ModelScreenWidget.Link link) throws IOException { > > > HttpServletResponse > > response = (HttpServletResponse) context.get("response"); > > > HttpServletRequest > > request = (HttpServletRequest) context.get("request"); > > > > > > - String targetWindow = > > link.getTargetWindow(context); > > > String target = > > link.getTarget(context); > > > > > > - String uniqueItemName = > > link.getModelScreen().getName() + "_LF_" + > > UtilMisc.<String>addToBigDecimalInMap(context, > > "screenUniqueItemIndex", BigDecimal.ONE); > > > > > > String linkType = > > WidgetWorker.determineAutoLinkType(link.getLinkType(), > > target, link.getUrlMode(), request); > > > - String linkUrl = ""; > > > String actionUrl = > > ""; > > > - StringBuilder > > parameters=new StringBuilder(); > > > + StringBuilder > > targetParameters = new StringBuilder(); > > > if > > ("hidden-form".equals(linkType)) { > > > > > StringBuilder sb = new StringBuilder(); > > > > > WidgetWorker.buildHyperlinkUrl(sb, target, > > link.getUrlMode(), null, link.getPrefix(context), > > > > > link.getFullPath(), link.getSecure(), > > link.getEncode(), request, response, context); > > > > > actionUrl = sb.toString(); > > > - > > parameters.append("["); > > > + > > targetParameters.append("["); > > > for > > (Map.Entry<String, String> parameter: > > link.getParameterMap(context).entrySet()) { > > > - > > if (parameters.length() >1) { > > > - > > parameters.append(","); > > > + > > if (targetParameters.length() >1) { > > > + > > targetParameters.append(","); > > > > > } > > > - > > parameters.append("{'name':'"); > > > - > > parameters.append(parameter.getKey()); > > > - > > parameters.append("'"); > > > - > > parameters.append(",'value':'"); > > > - > > parameters.append(parameter.getValue()); > > > - > > parameters.append("'}"); > > > - } > > > - > > parameters.append("]"); > > > + > > targetParameters.append("{'name':'"); > > > + > > targetParameters.append(parameter.getKey()); > > > + > > targetParameters.append("'"); > > > + > > targetParameters.append(",'value':'"); > > > + > > targetParameters.append(parameter.getValue()); > > > + > > targetParameters.append("'}"); > > > + } > > > + > > targetParameters.append("]"); > > > > > > } > > > - String id = > > link.getId(context); > > > - String style = > > link.getStyle(context); > > > - String name = > > link.getName(context); > > > - String text = > > link.getText(context); > > > + String linkUrl = ""; > > > if > > (UtilValidate.isNotEmpty(target)) { > > > if > > (!"hidden-form".equals(linkType)) { > > > > > StringBuilder sb = new StringBuilder(); > > > @@ -283,46 +258,30 @@ public class MacroScreenRenderer > > impleme > > > > > renderImage(sw, context, img); > > > imgStr > > = sw.toString(); > > > } > > > - StringWriter sr = new > > StringWriter(); > > > - > > sr.append("<@renderLink "); > > > - > > sr.append("parameterList="); > > > - > > sr.append(parameters.length()==0?"\"\"":parameters.toString()); > > > - sr.append(" > > targetWindow=\""); > > > - sr.append(targetWindow); > > > - sr.append("\" > > target=\""); > > > - sr.append(target); > > > - sr.append("\" > > uniqueItemName=\""); > > > - > > sr.append(uniqueItemName); > > > - sr.append("\" > > linkType=\""); > > > - sr.append(linkType); > > > - sr.append("\" > > actionUrl=\""); > > > - sr.append(actionUrl); > > > - sr.append("\" id=\""); > > > - sr.append(id); > > > - sr.append("\" > > style=\""); > > > - sr.append(style); > > > - sr.append("\" name=\""); > > > - sr.append(name); > > > - sr.append("\" > > linkUrl=\""); > > > - sr.append(linkUrl); > > > - sr.append("\" text=\""); > > > - sr.append(text); > > > - sr.append("\" > > imgStr=\""); > > > - > > sr.append(imgStr.replaceAll("\"", "\\\\\"")); > > > - sr.append("\" />"); > > > - executeMacro(writer, > > sr.toString()); > > > + > > > + Map<String, Object> > > parameters = FastMap.newInstance(); > > > + > > parameters.put("parameterList", > > targetParameters.toString()); > > > + > > parameters.put("targetWindow", > > link.getTargetWindow(context)); > > > + parameters.put("target", > > target); > > > + > > > + String uniqueItemName = > > link.getModelScreen().getName() + "_LF_" + > > UtilMisc.<String>addToBigDecimalInMap(context, > > "screenUniqueItemIndex", BigDecimal.ONE); > > > + > > parameters.put("uniqueItemName", uniqueItemName); > > > + > > > + > > parameters.put("linkType", linkType); > > > + > > parameters.put("actionUrl", actionUrl); > > > + parameters.put("id", > > link.getId(context)); > > > + parameters.put("style", > > link.getStyle(context)); > > > + parameters.put("name", > > link.getName(context)); > > > + parameters.put("linkUrl", > > linkUrl); > > > + parameters.put("text", > > link.getText(context)); > > > + parameters.put("imgStr", > > imgStr); > > > + executeMacro(writer, > > "renderLink", parameters); > > > } > > > > > > public void renderImage(Appendable > > writer, Map<String, Object> context, > > ModelScreenWidget.Image image) throws IOException { > > > if (image == null) > > > return > > ; > > > String src = > > image.getSrc(context); > > > - String id = > > image.getId(context); > > > - String style = > > image.getStyle(context); > > > - String wid = > > image.getWidth(context); > > > - String hgt = > > image.getHeight(context); > > > - String border = > > image.getBorder(context); > > > - String alt = > > image.getAlt(context); > > > > > > String urlMode = > > image.getUrlMode(); > > > boolean fullPath = > > false; > > > @@ -349,46 +308,30 @@ public class MacroScreenRenderer > > impleme > > > } else { > > > > > urlString = src; > > > } > > > - StringWriter sr = new > > StringWriter(); > > > - > > sr.append("<@renderImage "); > > > - sr.append("src=\""); > > > - sr.append(src); > > > - sr.append("\" id=\""); > > > - sr.append(id); > > > - sr.append("\" > > style=\""); > > > - sr.append(style); > > > - sr.append("\" wid=\""); > > > - sr.append(wid); > > > - sr.append("\" hgt=\""); > > > - sr.append(hgt); > > > - sr.append("\" > > border=\""); > > > - sr.append(border); > > > - sr.append("\" alt=\""); > > > - sr.append(alt); > > > - sr.append("\" > > urlString=\""); > > > - sr.append(urlString); > > > - sr.append("\" />"); > > > - executeMacro(writer, > > sr.toString()); > > > + Map<String, Object> > > parameters = FastMap.newInstance(); > > > + parameters.put("src", > > src); > > > + parameters.put("id", > > image.getId(context)); > > > + parameters.put("style", > > image.getStyle(context)); > > > + parameters.put("wid", > > image.getWidth(context)); > > > + parameters.put("hgt", > > image.getHeight(context)); > > > + parameters.put("border", > > image.getBorder(context)); > > > + parameters.put("alt", > > image.getAlt(context)); > > > + > > parameters.put("urlString", urlString); > > > + executeMacro(writer, > > "renderImage", parameters); > > > } > > > > > > public void > > renderContentBegin(Appendable writer, Map<String, > > Object> context, ModelScreenWidget.Content content) > > throws IOException { > > > String > > editRequest = content.getEditRequest(context); > > > - String > > editContainerStyle = > > content.getEditContainerStyle(context); > > > String > > enableEditName = content.getEnableEditName(context); > > > String > > enableEditValue = (String)context.get(enableEditName); > > > > > > if > > (Debug.verboseOn()) Debug.logVerbose("directEditRequest:" + > > editRequest, module); > > > > > > - StringWriter > > sr = new StringWriter(); > > > - > > sr.append("<@renderContentBegin "); > > > - > > sr.append("editRequest=\""); > > > - > > sr.append(editRequest); > > > - sr.append("\" > > enableEditValue=\""); > > > - > > sr.append(enableEditValue); > > > - sr.append("\" > > editContainerStyle=\""); > > > - > > sr.append(editContainerStyle); > > > - sr.append("\" > > />"); > > > - > > executeMacro(writer, sr.toString()); > > > + Map<String, > > Object> parameters = FastMap.newInstance(); > > > + > > parameters.put("editRequest", > > editRequest); > > > + > > parameters.put("enableEditValue", > > enableEditValue); > > > + > > parameters.put("editContainerStyle", > > content.getEditContainerStyle(context)); > > > + > > executeMacro(writer, "renderContentBegin", > > parameters); > > > } > > > > > > public void > > renderContentBody(Appendable writer, Map<String, > > Object> context, ModelScreenWidget.Content content) > > throws IOException { > > > @@ -459,7 +402,6 @@ public class MacroScreenRenderer > > impleme > > > String > > expandedContentId = content.getContentId(context); > > > String editMode = > > "Edit"; > > > String editRequest = > > content.getEditRequest(context); > > > - String editContainerStyle > > = content.getEditContainerStyle(context); > > > String > > enableEditName = content.getEnableEditName(context); > > > String > > enableEditValue = (String)context.get(enableEditName); > > > String urlString = > > ""; > > > @@ -479,29 +421,19 @@ public class MacroScreenRenderer > > impleme > > > > > urlString = rh.makeLink(request, response, > > editRequest, false, false, false); > > > } > > > > > > - > > StringWriter sr = new StringWriter(); > > > - > > sr.append("<@renderContentEnd "); > > > - > > sr.append("urlString=\""); > > > - > > sr.append(urlString); > > > - > > sr.append("\" editMode=\""); > > > - > > sr.append(editMode); > > > - > > sr.append("\" editContainerStyle=\""); > > > - > > sr.append(editContainerStyle); > > > - > > sr.append("\" editRequest=\""); > > > - > > sr.append(editRequest); > > > - > > sr.append("\" enableEditValue=\""); > > > - > > sr.append(enableEditValue); > > > - > > sr.append("\" />"); > > > - > > executeMacro(writer, sr.toString()); > > > + > > Map<String, Object> parameters = > > FastMap.newInstance(); > > > + > > parameters.put("urlString", urlString); > > > + > > parameters.put("editMode", editMode); > > > + > > parameters.put("editContainerStyle", > > content.getEditContainerStyle(context)); > > > + > > parameters.put("editRequest", editRequest); > > > + > > parameters.put("enableEditValue", enableEditValue); > > > + > > executeMacro(writer, "renderContentEnd", parameters); > > > } > > > } > > > > > > public void > > renderContentFrame(Appendable writer, Map<String, > > Object> context, ModelScreenWidget.Content content) > > throws IOException { > > > String > > dataResourceId = content.getDataResourceId(context); > > > String urlString = > > "/ViewSimpleContent?dataResourceId=" + dataResourceId; > > > - String width = > > content.getWidth(); > > > - String height = > > content.getHeight(); > > > - String border = > > content.getBorder(); > > > String fullUrlString > > = ""; > > > HttpServletRequest > > request = (HttpServletRequest) context.get("request"); > > > HttpServletResponse > > response = (HttpServletResponse) context.get("response"); > > > @@ -510,36 +442,24 @@ public class MacroScreenRenderer > > impleme > > > > > RequestHandler rh = (RequestHandler) > > ctx.getAttribute("_REQUEST_HANDLER_"); > > > > > fullUrlString = rh.makeLink(request, response, urlString, > > true, false, false); > > > } > > > - StringWriter sr = new > > StringWriter(); > > > - > > sr.append("<@renderContentFrame "); > > > - sr.append("fullUrl=\""); > > > - > > sr.append(fullUrlString); > > > - sr.append("\" > > width=\""); > > > - sr.append(width); > > > - sr.append("\" > > height=\""); > > > - sr.append(height); > > > - sr.append("\" > > border=\""); > > > - sr.append(border); > > > - sr.append("\" />"); > > > - executeMacro(writer, > > sr.toString()); > > > + > > > + Map<String, Object> > > parameters = FastMap.newInstance(); > > > + parameters.put("fullUrl", > > fullUrlString); > > > + parameters.put("width", > > content.getWidth()); > > > + parameters.put("height", > > content.getHeight()); > > > + parameters.put("border", > > content.getBorder()); > > > + executeMacro(writer, > > "renderContentFrame", parameters); > > > } > > > > > > public void > > renderSubContentBegin(Appendable writer, Map<String, > > Object> context, ModelScreenWidget.SubContent content) > > throws IOException { > > > - String > > editRequest = content.getEditRequest(context); > > > - String > > editContainerStyle = > > content.getEditContainerStyle(context); > > > String > > enableEditName = content.getEnableEditName(context); > > > String > > enableEditValue = (String)context.get(enableEditName); > > > > > > - StringWriter > > sr = new StringWriter(); > > > - > > sr.append("<@renderSubContentBegin "); > > > - sr.append(" > > editContainerStyle=\""); > > > - > > sr.append(editContainerStyle); > > > - sr.append("\" > > editRequest=\""); > > > - > > sr.append(editRequest); > > > - sr.append("\" > > enableEditValue=\""); > > > - > > sr.append(enableEditValue); > > > - sr.append("\" > > />"); > > > - > > executeMacro(writer, sr.toString()); > > > + Map<String, > > Object> parameters = FastMap.newInstance(); > > > + > > parameters.put("editContainerStyle", > > content.getEditContainerStyle(context)); > > > + > > parameters.put("editRequest", > > content.getEditRequest(context)); > > > + > > parameters.put("enableEditValue", > > enableEditValue); > > > + > > executeMacro(writer, > > "renderSubContentBegin", parameters); > > > } > > > > > > public void > > renderSubContentBody(Appendable writer, Map<String, > > Object> context, ModelScreenWidget.SubContent content) > > throws IOException { > > > @@ -593,7 +513,6 @@ public class MacroScreenRenderer > > impleme > > > public void > > renderSubContentEnd(Appendable writer, Map<String, > > Object> context, ModelScreenWidget.SubContent content) > > throws IOException { > > > String > > editMode = "Edit"; > > > String > > editRequest = content.getEditRequest(context); > > > - String > > editContainerStyle = > > content.getEditContainerStyle(context); > > > String > > enableEditName = content.getEnableEditName(context); > > > String > > enableEditValue = (String)context.get(enableEditName); > > > String > > expandedContentId = content.getContentId(context); > > > @@ -618,20 +537,13 @@ public class MacroScreenRenderer > > impleme > > > > > } > > > } > > > > > > - StringWriter > > sr = new StringWriter(); > > > - > > sr.append("<@renderSubContentEnd "); > > > - > > sr.append("urlString=\""); > > > - > > sr.append(urlString); > > > - sr.append("\" > > editMode=\""); > > > - > > sr.append(editMode); > > > - sr.append("\" > > editContainerStyle=\""); > > > - > > sr.append(editContainerStyle); > > > - sr.append("\" > > editRequest=\""); > > > - > > sr.append(editRequest); > > > - sr.append("\" > > enableEditValue=\""); > > > - > > sr.append(enableEditValue); > > > - sr.append("\" > > />"); > > > - > > executeMacro(writer, sr.toString()); > > > + Map<String, > > Object> parameters = FastMap.newInstance(); > > > + > > parameters.put("urlString", urlString); > > > + > > parameters.put("editMode", editMode); > > > + > > parameters.put("editContainerStyle", > > content.getEditContainerStyle(context)); > > > + > > parameters.put("editRequest", > > editRequest); > > > + > > parameters.put("enableEditValue", > > enableEditValue); > > > + > > executeMacro(writer, > > "renderSubContentEnd", parameters); > > > } > > > > > > > > > @@ -652,7 +564,6 @@ public class MacroScreenRenderer > > impleme > > > String expandToolTip > > = ""; > > > String > > collapseToolTip = ""; > > > String fullUrlString > > = ""; > > > - boolean padded = > > screenlet.padded(); > > > String menuString = > > ""; > > > boolean showMore = > > false; > > > if > > (UtilValidate.isNotEmpty(title) || navMenu != null || > > navForm != null || collapsible) { > > > @@ -687,36 +598,21 @@ public class MacroScreenRenderer > > impleme > > > } > > > } > > > > > > - StringWriter sr = new > > StringWriter(); > > > - > > sr.append("<@renderScreenletBegin "); > > > - sr.append("id=\""); > > > - > > sr.append(screenlet.getId(context)); > > > - sr.append("\" > > title=\""); > > > - sr.append(title); > > > - sr.append("\" > > collapsible="); > > > - > > sr.append(Boolean.toString(collapsible)); > > > - sr.append(" > > saveCollapsed="); > > > - > > sr.append(Boolean.toString(screenlet.saveCollapsed())); > > > - sr.append(" > > collapsibleAreaId=\""); > > > - > > sr.append(collapsibleAreaId); > > > - sr.append("\" > > expandToolTip=\""); > > > - > > sr.append(expandToolTip); > > > - sr.append("\" > > collapseToolTip=\""); > > > - > > sr.append(collapseToolTip); > > > - sr.append("\" > > fullUrlString=\""); > > > - > > sr.append(fullUrlString); > > > - sr.append("\" padded="); > > > - > > sr.append(Boolean.toString(padded)); > > > - sr.append(" > > menuString=\""); > > > - > > sr.append(menuString.replaceAll("\"", "\\\\\"")); > > > - sr.append("\" > > showMore="); > > > - > > sr.append(Boolean.toString(showMore)); > > > - sr.append(" > > collapsed="); > > > - > > sr.append(Boolean.toString(collapsed)); > > > - sr.append(" > > javaScriptEnabled="); > > > - > > sr.append(Boolean.toString(javaScriptEnabled)); > > > - sr.append(" />"); > > > - executeMacro(writer, > > sr.toString()); > > > + Map<String, Object> > > parameters = FastMap.newInstance(); > > > + parameters.put("id", > > screenlet.getId(context)); > > > + parameters.put("title", > > title); > > > + > > parameters.put("collapsible", collapsible); > > > + > > parameters.put("saveCollapsed", screenlet.saveCollapsed()); > > > + > > parameters.put("collapsibleAreaId", collapsibleAreaId); > > > + > > parameters.put("expandToolTip", expandToolTip); > > > + > > parameters.put("collapseToolTip", collapseToolTip); > > > + > > parameters.put("fullUrlString", fullUrlString); > > > + parameters.put("padded", > > screenlet.padded()); > > > + > > parameters.put("menuString", menuString); > > > + > > parameters.put("showMore", showMore); > > > + > > parameters.put("collapsed", collapsed); > > > + > > parameters.put("javaScriptEnabled", javaScriptEnabled); > > > + executeMacro(writer, > > "renderScreenletBegin", parameters); > > > } > > > > > > public void > > renderScreenletSubWidget(Appendable writer, Map<String, > > Object> context, ModelScreenWidget subWidget, > > ModelScreenWidget.Screenlet screenlet) throws > > GeneralException, IOException { > > > @@ -738,9 +634,7 @@ public class MacroScreenRenderer > > impleme > > > } > > > } > > > public void > > renderScreenletEnd(Appendable writer, Map<String, > > Object> context, ModelScreenWidget.Screenlet screenlet) > > throws IOException { > > > - StringWriter sr = new > > StringWriter(); > > > - > > sr.append("<@renderScreenletEnd/>"); > > > - executeMacro(writer, > > sr.toString()); > > > + executeMacro(writer, > > "renderScreenletEnd", null); > > > } > > > > > > protected void > > renderScreenletPaginateMenu(Appendable writer, > > Map<String, Object> context, ModelScreenWidget.Form > > form) throws IOException { > > > @@ -763,7 +657,6 @@ public class MacroScreenRenderer > > impleme > > > int viewSize = > > modelForm.getViewSize(context); > > > int listSize = > > modelForm.getListSize(context); > > > > > > - int lowIndex = > > modelForm.getLowIndex(context); > > > int highIndex = > > modelForm.getHighIndex(context); > > > int actualPageSize = > > modelForm.getActualPageSize(context); > > > > > > @@ -824,73 +717,47 @@ public class MacroScreenRenderer > > impleme > > > // The current > > screenlet title bar navigation syling requires rendering > > > // these links in > > reverse order > > > // Last button > > > - String paginateLastStyle > > = modelForm.getPaginateLastStyle(); > > > - String paginateLastLabel > > = modelForm.getPaginateLastLabel(context); > > > String lastLinkUrl = > > ""; > > > if (highIndex < > > listSize) { > > > int > > page = (listSize / viewSize); > > > > > linkText = prepLinkText + page + anchor; > > > > > lastLinkUrl = rh.makeLink(request, response, linkText); > > > } > > > - String paginateNextStyle > > = modelForm.getPaginateNextStyle(); > > > - String paginateNextLabel > > = modelForm.getPaginateNextLabel(context); > > > String nextLinkUrl = > > ""; > > > if (highIndex < > > listSize) { > > > > > linkText = prepLinkText + (viewIndex + 1) + anchor; > > > // - > > make the link > > > > > nextLinkUrl = rh.makeLink(request, response, linkText); > > > } > > > - String > > paginatePreviousStyle = > > modelForm.getPaginatePreviousStyle(); > > > - String > > paginatePreviousLabel = > > modelForm.getPaginatePreviousLabel(context); > > > String > > previousLinkUrl = ""; > > > if (viewIndex > > > 0) { > > > > > linkText = prepLinkText + (viewIndex - 1) + anchor; > > > > > previousLinkUrl = rh.makeLink(request, response, linkText); > > > } > > > - String paginateFirstStyle > > = modelForm.getPaginateFirstStyle(); > > > - String paginateFirstLabel > > = modelForm.getPaginateFirstLabel(context); > > > String firstLinkUrl > > = ""; > > > if (viewIndex > > > 0) { > > > > > linkText = prepLinkText + 0 + anchor; > > > > > firstLinkUrl = rh.makeLink(request, response, linkText); > > > } > > > > > > - StringWriter sr = new > > StringWriter(); > > > - > > sr.append("<@renderScreenletPaginateMenu "); > > > - > > sr.append("lowIndex=\""); > > > - > > sr.append(Integer.toString(lowIndex)); > > > - sr.append("\" > > actualPageSize=\""); > > > - > > sr.append(Integer.toString(actualPageSize)); > > > - sr.append("\" > > ofLabel=\""); > > > - sr.append(ofLabel); > > > - sr.append("\" > > listSize=\""); > > > - > > sr.append(Integer.toString(listSize)); > > > - sr.append("\" > > paginateLastStyle=\""); > > > - > > sr.append(paginateLastStyle); > > > - sr.append("\" > > lastLinkUrl=\""); > > > - sr.append(lastLinkUrl); > > > - sr.append("\" > > paginateLastLabel=\""); > > > - > > sr.append(paginateLastLabel); > > > - sr.append("\" > > paginateNextStyle=\""); > > > - > > sr.append(paginateNextStyle); > > > - sr.append("\" > > nextLinkUrl=\""); > > > - sr.append(nextLinkUrl); > > > - sr.append("\" > > paginateNextLabel=\""); > > > - > > sr.append(paginateNextLabel); > > > - sr.append("\" > > paginatePreviousStyle=\""); > > > - > > sr.append(paginatePreviousStyle); > > > - sr.append("\" > > paginatePreviousLabel=\""); > > > - > > sr.append(paginatePreviousLabel); > > > - sr.append("\" > > previousLinkUrl=\""); > > > - > > sr.append(previousLinkUrl); > > > - sr.append("\" > > paginateFirstStyle=\""); > > > - > > sr.append(paginateFirstStyle); > > > - sr.append("\" > > paginateFirstLabel=\""); > > > - > > sr.append(paginateFirstLabel); > > > - sr.append("\" > > firstLinkUrl=\""); > > > - sr.append(firstLinkUrl); > > > - sr.append("\" />"); > > > - executeMacro(writer, > > sr.toString()); > > > + Map<String, Object> > > parameters = FastMap.newInstance(); > > > + > > parameters.put("lowIndex", modelForm.getLowIndex(context)); > > > + > > parameters.put("actualPageSize", actualPageSize); > > > + parameters.put("ofLabel", > > ofLabel); > > > + > > parameters.put("listSize", listSize); > > > + > > parameters.put("paginateLastStyle", > > modelForm.getPaginateLastStyle()); > > > + > > parameters.put("lastLinkUrl", lastLinkUrl); > > > + > > parameters.put("paginateLastLabel", > > modelForm.getPaginateLastLabel(context)); > > > + > > parameters.put("paginateNextStyle", > > modelForm.getPaginateNextStyle()); > > > + > > parameters.put("nextLinkUrl", nextLinkUrl); > > > + > > parameters.put("paginateNextLabel", > > modelForm.getPaginateNextLabel(context)); > > > + > > parameters.put("paginatePreviousStyle", > > modelForm.getPaginatePreviousStyle()); > > > + > > parameters.put("paginatePreviousLabel", > > modelForm.getPaginatePreviousLabel(context)); > > > + > > parameters.put("previousLinkUrl", previousLinkUrl); > > > + > > parameters.put("paginateFirstStyle", > > modelForm.getPaginateFirstStyle()); > > > + > > parameters.put("paginateFirstLabel", > > modelForm.getPaginateFirstLabel(context)); > > > + > > parameters.put("firstLinkUrl", firstLinkUrl); > > > + executeMacro(writer, > > "renderScreenletPaginateMenu", parameters); > > > } > > > > > > } > > > > > > > > > > -- > > Ofbiz on twitter: http://twitter.com/apache_ofbiz > > Myself on twitter: http://twitter.com/hansbak > > Antwebsystems.com: Quality services for competitive rates. > > > > > > > -- Ofbiz on twitter: http://twitter.com/apache_ofbiz Myself on twitter: http://twitter.com/hansbak Antwebsystems.com: Quality services for competitive rates. |
Administrator
|
In reply to this post by Adrian Crum-2
No this is not the same problem. I stumbled upon this one yesterday evening while trying to help on the Setup Component.
The other I found in links used in screen, this one Scott reverted. Jacques From: "Adrian Crum" <[hidden email]> >I think Scott is aware of those problems and he reverted it. Check the commit logs. > > -Adrian > > --- On Fri, 7/30/10, Hans Bakker <[hidden email]> wrote: > >> From: Hans Bakker <[hidden email]> >> Subject: Re: svn commit: r978954 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java >> To: [hidden email] >> Date: Friday, July 30, 2010, 12:47 AM >> Adrian, >> >> can you have a look at this and the previous 2 >> commits, they cause a >> error in the help screens to not display properly. >> >> the following error is shown: >> >> Error executing macro: renderContentBegin required >> parameter: >> enableEditValue is not specified. The problematic >> instruction: >> ---------- ==> macro renderContentBegin [on line 46, >> column 1 in >> component://widget/templates/htmlScreenMacroLibrary.ftl] >> in >> user-directive renderContentBegin [on line 1, column 1 in >> Fri Jul 30 >> 14:44:26 ICT 2010] ---------- Java backtrace for >> programmers: ---------- >> freemarker.template.TemplateException: Error executing >> macro: >> renderContentBegin required parameter: enableEditValue is >> not specified. >> at >> freemarker.core.Macro$Context.sanityCheck(Macro.java:207) >> at >> freemarker.core.Macro$Context.runMacro(Macro.java:165) at >> freemarker.core.Environment.visit(Environment.java:602) at >> freemarker.core.UnifiedCall.accept(UnifiedCall.java:106) >> at >> freemarker.core.Environment.visit(Environment.java:209) at >> freemarker.core.Environment.include(Environment.java:1482) >> at >> org.ofbiz.widget.screen.MacroScreenRenderer.executeMacro(MacroScreenRenderer.java:97) >> at >> org.ofbiz.widget.screen.MacroScreenRenderer.executeMacro(MacroScreenRenderer.java:124) >> at >> org.ofbiz.widget.screen.MacroScreenRenderer.renderContentBegin(MacroScreenRenderer.java:334) >> at >> org.ofbiz.widget.screen.ModelScreenWidget$Content.renderWidgetString(ModelScreenWidget.java:1154) >> at >> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >> at >> org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) >> at >> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >> at >> org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) >> at >> org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) >> at >> org.ofbiz.widget.screen.ModelScreenWidget$IncludeScreen.renderWidgetString(ModelScreenWidget.java:540) >> at >> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >> at >> org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) >> at >> org.ofbiz.widget.screen.MacroScreenRenderer.renderScreenletSubWidget(MacroScreenRenderer.java:633) >> at >> org.ofbiz.widget.screen.ModelScreenWidget$Screenlet.renderWidgetString(ModelScreenWidget.java:370) >> at >> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >> at >> org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) >> at >> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >> at >> org.ofbiz.widget.screen.ModelScreenWidget$DecoratorSection.renderWidgetString(ModelScreenWidget.java:670) >> at >> org.ofbiz.widget.screen.ModelScreenWidget$SectionsRenderer.render(ModelScreenWidget.java:126) >> at >> org.ofbiz.widget.screen.ModelScreenWidget$DecoratorSectionInclude.renderWidgetString(ModelScreenWidget.java:703) >> at >> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >> at >> org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) >> at >> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >> at >> org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) >> at >> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >> at >> org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) >> at >> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >> at >> org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) >> at >> org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) >> at >> org.ofbiz.widget.screen.ModelScreenWidget$DecoratorScreen.renderWidgetString(ModelScreenWidget.java:637) >> at >> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >> at >> org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) >> at >> org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) >> at >> org.ofbiz.widget.screen.ModelScreenWidget$IncludeScreen.renderWidgetString(ModelScreenWidget.java:540) >> at >> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >> at >> org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) >> at >> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >> at >> org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) >> at >> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >> at >> org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:202) >> at >> org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) >> at >> org.ofbiz.widget.screen.ScreenRenderer.render(ScreenRenderer.java:135) >> at >> org.ofbiz.widget.screen.ScreenRenderer.render(ScreenRenderer.java:97) >> at >> org.ofbiz.widget.screen.MacroScreenViewHandler.render(MacroScreenViewHandler.java:104) >> at >> org.ofbiz.webapp.control.RequestHandler.renderView(RequestHandler.java:839) >> at >> org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:559) >> at >> org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:227) >> at >> javax.servlet.http.HttpServlet.service(HttpServlet.java:617) >> at >> javax.servlet.http.HttpServlet.service(HttpServlet.java:717) >> at >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) >> at >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) >> at >> org.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:271) >> at >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) >> at >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) >> at >> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) >> at >> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) >> at >> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) >> at >> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) >> at >> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) >> at >> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:555) >> at >> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) >> at >> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) >> at >> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) >> at >> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) >> at java.lang.Thread.run(Thread.java:619) >> >> >> >> On Sun, 2010-07-25 at 00:36 +0000, [hidden email] >> wrote: >> > Author: lektran >> > Date: Sun Jul 25 00:36:13 2010 >> > New Revision: 978954 >> > >> > URL: http://svn.apache.org/viewvc?rev=978954&view=rev >> > Log: >> > Converted all render* methods to use >> executeMacro(Writer, String, Map) instead of >> executeMacro(Writer, String). Removes over 100 lines >> of StringWriter usage, makes the code easier to read and >> also fixes the bug that Jacques committed a workaround for >> in r978893 >> > >> > Modified: >> > >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java >> > >> > Modified: >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java >> > URL: >> > http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java?rev=978954&r1=978953&r2=978954&view=diff >> > >> ============================================================================== >> > --- >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java >> (original) >> > +++ >> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java >> Sun Jul 25 00:36:13 2010 >> > @@ -139,11 +139,11 @@ public class MacroScreenRenderer >> impleme >> > } >> > >> > public void >> renderScreenBegin(Appendable writer, Map<String, >> Object> context) throws IOException { >> > - executeMacro(writer, >> "<@renderScreenBegin/>"); >> > + executeMacro(writer, >> "renderScreenBegin", null); >> > } >> > >> > public void >> renderScreenEnd(Appendable writer, Map<String, Object> >> context) throws IOException { >> > - executeMacro(writer, >> "<@renderScreenEnd/>"); >> > + executeMacro(writer, >> "renderScreenEnd", null); >> > } >> > >> > public void >> renderSectionBegin(Appendable writer, Map<String, >> Object> context, ModelScreenWidget.Section section) >> throws IOException { >> > @@ -151,24 +151,23 @@ public class MacroScreenRenderer >> impleme >> > >> this.widgetCommentsEnabled = >> ModelWidget.widgetBoundaryCommentsEnabled(context); >> > } >> > if >> (this.widgetCommentsEnabled) { >> > - >> StringWriter sr = new StringWriter(); >> > - >> sr.append("<@renderSectionBegin "); >> > - >> sr.append("boundaryComment=\"Begin "); >> > - >> sr.append(section.isMainSection ? "Screen " : "Section >> Widget "); >> > - >> sr.append(section.getBoundaryCommentName()); >> > - >> sr.append("\"/>"); >> > - >> executeMacro(writer, sr.toString()); >> > + >> Map<String, Object> parameters = >> FastMap.newInstance(); >> > + >> StringBuilder sb = new StringBuilder("Begin "); >> > + >> sb.append(section.isMainSection ? "Screen " : "Section >> Widget "); >> > + >> sb.append(section.getBoundaryCommentName()); >> > + >> parameters.put("boundaryComment", sb.toString()); >> > + >> executeMacro(writer, "renderSectionBegin", parameters); >> > } >> > } >> > public void >> renderSectionEnd(Appendable writer, Map<String, >> Object> context, ModelScreenWidget.Section section) >> throws IOException { >> > if >> (this.widgetCommentsEnabled) { >> > - >> StringWriter sr = new StringWriter(); >> > - >> sr.append("<@renderSectionEnd "); >> > - >> sr.append("boundaryComment=\"End "); >> > - >> sr.append(section.isMainSection ? "Screen " : "Section >> Widget "); >> > - >> sr.append(section.getBoundaryCommentName()); >> > - >> sr.append("\"/>"); >> > - >> executeMacro(writer, sr.toString()); >> > + >> Map<String, Object> parameters = >> FastMap.newInstance(); >> > + >> StringBuilder sb = new StringBuilder(); >> > + >> sb.append("End "); >> > + >> sb.append(section.isMainSection ? "Screen " : "Section >> Widget "); >> > + >> sb.append(section.getBoundaryCommentName()); >> > + >> parameters.put("boundaryComment", sb.toString()); >> > + >> executeMacro(writer, "renderSectionEnd", parameters); >> > } >> > } >> > >> > @@ -186,88 +185,64 @@ public class MacroScreenRenderer >> impleme >> > >> RequestHandler rh = (RequestHandler) >> ctx.getAttribute("_REQUEST_HANDLER_"); >> > >> autoUpdateLink = rh.makeLink(request, response, >> autoUpdateTarget); >> > } >> > - StringWriter sr = new >> StringWriter(); >> > - >> sr.append("<@renderContainerBegin "); >> > - sr.append("id=\""); >> > - sr.append(containerId); >> > - sr.append("\" >> style=\""); >> > - >> sr.append(container.getStyle(context)); >> > - sr.append("\" >> autoUpdateLink=\""); >> > - >> sr.append(autoUpdateLink); >> > - sr.append("\" >> autoUpdateInterval=\""); >> > - >> sr.append(container.getAutoUpdateInterval()); >> > - sr.append("\" />"); >> > - executeMacro(writer, >> sr.toString()); >> > + Map<String, Object> >> parameters = FastMap.newInstance(); >> > + parameters.put("id", >> containerId); >> > + parameters.put("style", >> container.getStyle(context)); >> > + >> parameters.put("autoUpdateLink", autoUpdateLink); >> > + >> parameters.put("autoUpdateInterval", >> container.getAutoUpdateInterval()); >> > + executeMacro(writer, >> "renderContainerBegin", parameters); >> > } >> > >> > public void >> renderContainerEnd(Appendable writer, Map<String, >> Object> context, ModelScreenWidget.Container container) >> throws IOException { >> > - StringWriter sr = new >> StringWriter(); >> > - >> sr.append("<@renderContainerEnd/>"); >> > - executeMacro(writer, >> sr.toString()); >> > + executeMacro(writer, >> "renderContainerEnd", null); >> > } >> > >> > public void renderLabel(Appendable >> writer, Map<String, Object> context, >> ModelScreenWidget.Label label) throws IOException { >> > - String labelText = >> label.getText(context); >> > - StringWriter sr = new >> StringWriter(); >> > - >> sr.append("<@renderLabel "); >> > - sr.append("text=\""); >> > - sr.append(labelText); >> > - sr.append("\" id=\""); >> > - >> sr.append(label.getId(context)); >> > - sr.append("\" >> style=\""); >> > - >> sr.append(label.getStyle(context)); >> > - sr.append("\" />"); >> > - executeMacro(writer, >> sr.toString()); >> > + Map<String, Object> >> parameters = FastMap.newInstance(); >> > + parameters.put("text", >> label.getText(context)); >> > + parameters.put("id", >> label.getId(context)); >> > + parameters.put("style", >> label.getStyle(context)); >> > + executeMacro(writer, >> "renderLabel", parameters); >> > } >> > >> > public void >> renderHorizontalSeparator(Appendable writer, Map<String, >> Object> context, ModelScreenWidget.HorizontalSeparator >> separator) throws IOException { >> > - StringWriter sr = new >> StringWriter(); >> > - >> sr.append("<@renderHorizontalSeparator "); >> > - sr.append("id=\""); >> > - >> sr.append(separator.getId(context)); >> > - sr.append("\" >> style=\""); >> > - >> sr.append(separator.getStyle(context)); >> > - sr.append("\" />"); >> > - executeMacro(writer, >> sr.toString()); >> > + Map<String, Object> >> parameters = FastMap.newInstance(); >> > + parameters.put("id", >> separator.getId(context)); >> > + parameters.put("style", >> separator.getStyle(context)); >> > + executeMacro(writer, >> "renderHorizontalSeparator", parameters); >> > } >> > >> > public void renderLink(Appendable >> writer, Map<String, Object> context, >> ModelScreenWidget.Link link) throws IOException { >> > HttpServletResponse >> response = (HttpServletResponse) context.get("response"); >> > HttpServletRequest >> request = (HttpServletRequest) context.get("request"); >> > >> > - String targetWindow = >> link.getTargetWindow(context); >> > String target = >> link.getTarget(context); >> > >> > - String uniqueItemName = >> link.getModelScreen().getName() + "_LF_" + >> UtilMisc.<String>addToBigDecimalInMap(context, >> "screenUniqueItemIndex", BigDecimal.ONE); >> > >> > String linkType = >> WidgetWorker.determineAutoLinkType(link.getLinkType(), >> target, link.getUrlMode(), request); >> > - String linkUrl = ""; >> > String actionUrl = >> ""; >> > - StringBuilder >> parameters=new StringBuilder(); >> > + StringBuilder >> targetParameters = new StringBuilder(); >> > if >> ("hidden-form".equals(linkType)) { >> > >> StringBuilder sb = new StringBuilder(); >> > >> WidgetWorker.buildHyperlinkUrl(sb, target, >> link.getUrlMode(), null, link.getPrefix(context), >> > >> link.getFullPath(), link.getSecure(), >> link.getEncode(), request, response, context); >> > >> actionUrl = sb.toString(); >> > - >> parameters.append("["); >> > + >> targetParameters.append("["); >> > for >> (Map.Entry<String, String> parameter: >> link.getParameterMap(context).entrySet()) { >> > - >> if (parameters.length() >1) { >> > - >> parameters.append(","); >> > + >> if (targetParameters.length() >1) { >> > + >> targetParameters.append(","); >> > >> } >> > - >> parameters.append("{'name':'"); >> > - >> parameters.append(parameter.getKey()); >> > - >> parameters.append("'"); >> > - >> parameters.append(",'value':'"); >> > - >> parameters.append(parameter.getValue()); >> > - >> parameters.append("'}"); >> > - } >> > - >> parameters.append("]"); >> > + >> targetParameters.append("{'name':'"); >> > + >> targetParameters.append(parameter.getKey()); >> > + >> targetParameters.append("'"); >> > + >> targetParameters.append(",'value':'"); >> > + >> targetParameters.append(parameter.getValue()); >> > + >> targetParameters.append("'}"); >> > + } >> > + >> targetParameters.append("]"); >> > >> > } >> > - String id = >> link.getId(context); >> > - String style = >> link.getStyle(context); >> > - String name = >> link.getName(context); >> > - String text = >> link.getText(context); >> > + String linkUrl = ""; >> > if >> (UtilValidate.isNotEmpty(target)) { >> > if >> (!"hidden-form".equals(linkType)) { >> > >> StringBuilder sb = new StringBuilder(); >> > @@ -283,46 +258,30 @@ public class MacroScreenRenderer >> impleme >> > >> renderImage(sw, context, img); >> > imgStr >> = sw.toString(); >> > } >> > - StringWriter sr = new >> StringWriter(); >> > - >> sr.append("<@renderLink "); >> > - >> sr.append("parameterList="); >> > - >> sr.append(parameters.length()==0?"\"\"":parameters.toString()); >> > - sr.append(" >> targetWindow=\""); >> > - sr.append(targetWindow); >> > - sr.append("\" >> target=\""); >> > - sr.append(target); >> > - sr.append("\" >> uniqueItemName=\""); >> > - >> sr.append(uniqueItemName); >> > - sr.append("\" >> linkType=\""); >> > - sr.append(linkType); >> > - sr.append("\" >> actionUrl=\""); >> > - sr.append(actionUrl); >> > - sr.append("\" id=\""); >> > - sr.append(id); >> > - sr.append("\" >> style=\""); >> > - sr.append(style); >> > - sr.append("\" name=\""); >> > - sr.append(name); >> > - sr.append("\" >> linkUrl=\""); >> > - sr.append(linkUrl); >> > - sr.append("\" text=\""); >> > - sr.append(text); >> > - sr.append("\" >> imgStr=\""); >> > - >> sr.append(imgStr.replaceAll("\"", "\\\\\"")); >> > - sr.append("\" />"); >> > - executeMacro(writer, >> sr.toString()); >> > + >> > + Map<String, Object> >> parameters = FastMap.newInstance(); >> > + >> parameters.put("parameterList", >> targetParameters.toString()); >> > + >> parameters.put("targetWindow", >> link.getTargetWindow(context)); >> > + parameters.put("target", >> target); >> > + >> > + String uniqueItemName = >> link.getModelScreen().getName() + "_LF_" + >> UtilMisc.<String>addToBigDecimalInMap(context, >> "screenUniqueItemIndex", BigDecimal.ONE); >> > + >> parameters.put("uniqueItemName", uniqueItemName); >> > + >> > + >> parameters.put("linkType", linkType); >> > + >> parameters.put("actionUrl", actionUrl); >> > + parameters.put("id", >> link.getId(context)); >> > + parameters.put("style", >> link.getStyle(context)); >> > + parameters.put("name", >> link.getName(context)); >> > + parameters.put("linkUrl", >> linkUrl); >> > + parameters.put("text", >> link.getText(context)); >> > + parameters.put("imgStr", >> imgStr); >> > + executeMacro(writer, >> "renderLink", parameters); >> > } >> > >> > public void renderImage(Appendable >> writer, Map<String, Object> context, >> ModelScreenWidget.Image image) throws IOException { >> > if (image == null) >> > return >> ; >> > String src = >> image.getSrc(context); >> > - String id = >> image.getId(context); >> > - String style = >> image.getStyle(context); >> > - String wid = >> image.getWidth(context); >> > - String hgt = >> image.getHeight(context); >> > - String border = >> image.getBorder(context); >> > - String alt = >> image.getAlt(context); >> > >> > String urlMode = >> image.getUrlMode(); >> > boolean fullPath = >> false; >> > @@ -349,46 +308,30 @@ public class MacroScreenRenderer >> impleme >> > } else { >> > >> urlString = src; >> > } >> > - StringWriter sr = new >> StringWriter(); >> > - >> sr.append("<@renderImage "); >> > - sr.append("src=\""); >> > - sr.append(src); >> > - sr.append("\" id=\""); >> > - sr.append(id); >> > - sr.append("\" >> style=\""); >> > - sr.append(style); >> > - sr.append("\" wid=\""); >> > - sr.append(wid); >> > - sr.append("\" hgt=\""); >> > - sr.append(hgt); >> > - sr.append("\" >> border=\""); >> > - sr.append(border); >> > - sr.append("\" alt=\""); >> > - sr.append(alt); >> > - sr.append("\" >> urlString=\""); >> > - sr.append(urlString); >> > - sr.append("\" />"); >> > - executeMacro(writer, >> sr.toString()); >> > + Map<String, Object> >> parameters = FastMap.newInstance(); >> > + parameters.put("src", >> src); >> > + parameters.put("id", >> image.getId(context)); >> > + parameters.put("style", >> image.getStyle(context)); >> > + parameters.put("wid", >> image.getWidth(context)); >> > + parameters.put("hgt", >> image.getHeight(context)); >> > + parameters.put("border", >> image.getBorder(context)); >> > + parameters.put("alt", >> image.getAlt(context)); >> > + >> parameters.put("urlString", urlString); >> > + executeMacro(writer, >> "renderImage", parameters); >> > } >> > >> > public void >> renderContentBegin(Appendable writer, Map<String, >> Object> context, ModelScreenWidget.Content content) >> throws IOException { >> > String >> editRequest = content.getEditRequest(context); >> > - String >> editContainerStyle = >> content.getEditContainerStyle(context); >> > String >> enableEditName = content.getEnableEditName(context); >> > String >> enableEditValue = (String)context.get(enableEditName); >> > >> > if >> (Debug.verboseOn()) Debug.logVerbose("directEditRequest:" + >> editRequest, module); >> > >> > - StringWriter >> sr = new StringWriter(); >> > - >> sr.append("<@renderContentBegin "); >> > - >> sr.append("editRequest=\""); >> > - >> sr.append(editRequest); >> > - sr.append("\" >> enableEditValue=\""); >> > - >> sr.append(enableEditValue); >> > - sr.append("\" >> editContainerStyle=\""); >> > - >> sr.append(editContainerStyle); >> > - sr.append("\" >> />"); >> > - >> executeMacro(writer, sr.toString()); >> > + Map<String, >> Object> parameters = FastMap.newInstance(); >> > + >> parameters.put("editRequest", >> editRequest); >> > + >> parameters.put("enableEditValue", >> enableEditValue); >> > + >> parameters.put("editContainerStyle", >> content.getEditContainerStyle(context)); >> > + >> executeMacro(writer, "renderContentBegin", >> parameters); >> > } >> > >> > public void >> renderContentBody(Appendable writer, Map<String, >> Object> context, ModelScreenWidget.Content content) >> throws IOException { >> > @@ -459,7 +402,6 @@ public class MacroScreenRenderer >> impleme >> > String >> expandedContentId = content.getContentId(context); >> > String editMode = >> "Edit"; >> > String editRequest = >> content.getEditRequest(context); >> > - String editContainerStyle >> = content.getEditContainerStyle(context); >> > String >> enableEditName = content.getEnableEditName(context); >> > String >> enableEditValue = (String)context.get(enableEditName); >> > String urlString = >> ""; >> > @@ -479,29 +421,19 @@ public class MacroScreenRenderer >> impleme >> > >> urlString = rh.makeLink(request, response, >> editRequest, false, false, false); >> > } >> > >> > - >> StringWriter sr = new StringWriter(); >> > - >> sr.append("<@renderContentEnd "); >> > - >> sr.append("urlString=\""); >> > - >> sr.append(urlString); >> > - >> sr.append("\" editMode=\""); >> > - >> sr.append(editMode); >> > - >> sr.append("\" editContainerStyle=\""); >> > - >> sr.append(editContainerStyle); >> > - >> sr.append("\" editRequest=\""); >> > - >> sr.append(editRequest); >> > - >> sr.append("\" enableEditValue=\""); >> > - >> sr.append(enableEditValue); >> > - >> sr.append("\" />"); >> > - >> executeMacro(writer, sr.toString()); >> > + >> Map<String, Object> parameters = >> FastMap.newInstance(); >> > + >> parameters.put("urlString", urlString); >> > + >> parameters.put("editMode", editMode); >> > + >> parameters.put("editContainerStyle", >> content.getEditContainerStyle(context)); >> > + >> parameters.put("editRequest", editRequest); >> > + >> parameters.put("enableEditValue", enableEditValue); >> > + >> executeMacro(writer, "renderContentEnd", parameters); >> > } >> > } >> > >> > public void >> renderContentFrame(Appendable writer, Map<String, >> Object> context, ModelScreenWidget.Content content) >> throws IOException { >> > String >> dataResourceId = content.getDataResourceId(context); >> > String urlString = >> "/ViewSimpleContent?dataResourceId=" + dataResourceId; >> > - String width = >> content.getWidth(); >> > - String height = >> content.getHeight(); >> > - String border = >> content.getBorder(); >> > String fullUrlString >> = ""; >> > HttpServletRequest >> request = (HttpServletRequest) context.get("request"); >> > HttpServletResponse >> response = (HttpServletResponse) context.get("response"); >> > @@ -510,36 +442,24 @@ public class MacroScreenRenderer >> impleme >> > >> RequestHandler rh = (RequestHandler) >> ctx.getAttribute("_REQUEST_HANDLER_"); >> > >> fullUrlString = rh.makeLink(request, response, urlString, >> true, false, false); >> > } >> > - StringWriter sr = new >> StringWriter(); >> > - >> sr.append("<@renderContentFrame "); >> > - sr.append("fullUrl=\""); >> > - >> sr.append(fullUrlString); >> > - sr.append("\" >> width=\""); >> > - sr.append(width); >> > - sr.append("\" >> height=\""); >> > - sr.append(height); >> > - sr.append("\" >> border=\""); >> > - sr.append(border); >> > - sr.append("\" />"); >> > - executeMacro(writer, >> sr.toString()); >> > + >> > + Map<String, Object> >> parameters = FastMap.newInstance(); >> > + parameters.put("fullUrl", >> fullUrlString); >> > + parameters.put("width", >> content.getWidth()); >> > + parameters.put("height", >> content.getHeight()); >> > + parameters.put("border", >> content.getBorder()); >> > + executeMacro(writer, >> "renderContentFrame", parameters); >> > } >> > >> > public void >> renderSubContentBegin(Appendable writer, Map<String, >> Object> context, ModelScreenWidget.SubContent content) >> throws IOException { >> > - String >> editRequest = content.getEditRequest(context); >> > - String >> editContainerStyle = >> content.getEditContainerStyle(context); >> > String >> enableEditName = content.getEnableEditName(context); >> > String >> enableEditValue = (String)context.get(enableEditName); >> > >> > - StringWriter >> sr = new StringWriter(); >> > - >> sr.append("<@renderSubContentBegin "); >> > - sr.append(" >> editContainerStyle=\""); >> > - >> sr.append(editContainerStyle); >> > - sr.append("\" >> editRequest=\""); >> > - >> sr.append(editRequest); >> > - sr.append("\" >> enableEditValue=\""); >> > - >> sr.append(enableEditValue); >> > - sr.append("\" >> />"); >> > - >> executeMacro(writer, sr.toString()); >> > + Map<String, >> Object> parameters = FastMap.newInstance(); >> > + >> parameters.put("editContainerStyle", >> content.getEditContainerStyle(context)); >> > + >> parameters.put("editRequest", >> content.getEditRequest(context)); >> > + >> parameters.put("enableEditValue", >> enableEditValue); >> > + >> executeMacro(writer, >> "renderSubContentBegin", parameters); >> > } >> > >> > public void >> renderSubContentBody(Appendable writer, Map<String, >> Object> context, ModelScreenWidget.SubContent content) >> throws IOException { >> > @@ -593,7 +513,6 @@ public class MacroScreenRenderer >> impleme >> > public void >> renderSubContentEnd(Appendable writer, Map<String, >> Object> context, ModelScreenWidget.SubContent content) >> throws IOException { >> > String >> editMode = "Edit"; >> > String >> editRequest = content.getEditRequest(context); >> > - String >> editContainerStyle = >> content.getEditContainerStyle(context); >> > String >> enableEditName = content.getEnableEditName(context); >> > String >> enableEditValue = (String)context.get(enableEditName); >> > String >> expandedContentId = content.getContentId(context); >> > @@ -618,20 +537,13 @@ public class MacroScreenRenderer >> impleme >> > >> } >> > } >> > >> > - StringWriter >> sr = new StringWriter(); >> > - >> sr.append("<@renderSubContentEnd "); >> > - >> sr.append("urlString=\""); >> > - >> sr.append(urlString); >> > - sr.append("\" >> editMode=\""); >> > - >> sr.append(editMode); >> > - sr.append("\" >> editContainerStyle=\""); >> > - >> sr.append(editContainerStyle); >> > - sr.append("\" >> editRequest=\""); >> > - >> sr.append(editRequest); >> > - sr.append("\" >> enableEditValue=\""); >> > - >> sr.append(enableEditValue); >> > - sr.append("\" >> />"); >> > - >> executeMacro(writer, sr.toString()); >> > + Map<String, >> Object> parameters = FastMap.newInstance(); >> > + >> parameters.put("urlString", urlString); >> > + >> parameters.put("editMode", editMode); >> > + >> parameters.put("editContainerStyle", >> content.getEditContainerStyle(context)); >> > + >> parameters.put("editRequest", >> editRequest); >> > + >> parameters.put("enableEditValue", >> enableEditValue); >> > + >> executeMacro(writer, >> "renderSubContentEnd", parameters); >> > } >> > >> > >> > @@ -652,7 +564,6 @@ public class MacroScreenRenderer >> impleme >> > String expandToolTip >> = ""; >> > String >> collapseToolTip = ""; >> > String fullUrlString >> = ""; >> > - boolean padded = >> screenlet.padded(); >> > String menuString = >> ""; >> > boolean showMore = >> false; >> > if >> (UtilValidate.isNotEmpty(title) || navMenu != null || >> navForm != null || collapsible) { >> > @@ -687,36 +598,21 @@ public class MacroScreenRenderer >> impleme >> > } >> > } >> > >> > - StringWriter sr = new >> StringWriter(); >> > - >> sr.append("<@renderScreenletBegin "); >> > - sr.append("id=\""); >> > - >> sr.append(screenlet.getId(context)); >> > - sr.append("\" >> title=\""); >> > - sr.append(title); >> > - sr.append("\" >> collapsible="); >> > - >> sr.append(Boolean.toString(collapsible)); >> > - sr.append(" >> saveCollapsed="); >> > - >> sr.append(Boolean.toString(screenlet.saveCollapsed())); >> > - sr.append(" >> collapsibleAreaId=\""); >> > - >> sr.append(collapsibleAreaId); >> > - sr.append("\" >> expandToolTip=\""); >> > - >> sr.append(expandToolTip); >> > - sr.append("\" >> collapseToolTip=\""); >> > - >> sr.append(collapseToolTip); >> > - sr.append("\" >> fullUrlString=\""); >> > - >> sr.append(fullUrlString); >> > - sr.append("\" padded="); >> > - >> sr.append(Boolean.toString(padded)); >> > - sr.append(" >> menuString=\""); >> > - >> sr.append(menuString.replaceAll("\"", "\\\\\"")); >> > - sr.append("\" >> showMore="); >> > - >> sr.append(Boolean.toString(showMore)); >> > - sr.append(" >> collapsed="); >> > - >> sr.append(Boolean.toString(collapsed)); >> > - sr.append(" >> javaScriptEnabled="); >> > - >> sr.append(Boolean.toString(javaScriptEnabled)); >> > - sr.append(" />"); >> > - executeMacro(writer, >> sr.toString()); >> > + Map<String, Object> >> parameters = FastMap.newInstance(); >> > + parameters.put("id", >> screenlet.getId(context)); >> > + parameters.put("title", >> title); >> > + >> parameters.put("collapsible", collapsible); >> > + >> parameters.put("saveCollapsed", screenlet.saveCollapsed()); >> > + >> parameters.put("collapsibleAreaId", collapsibleAreaId); >> > + >> parameters.put("expandToolTip", expandToolTip); >> > + >> parameters.put("collapseToolTip", collapseToolTip); >> > + >> parameters.put("fullUrlString", fullUrlString); >> > + parameters.put("padded", >> screenlet.padded()); >> > + >> parameters.put("menuString", menuString); >> > + >> parameters.put("showMore", showMore); >> > + >> parameters.put("collapsed", collapsed); >> > + >> parameters.put("javaScriptEnabled", javaScriptEnabled); >> > + executeMacro(writer, >> "renderScreenletBegin", parameters); >> > } >> > >> > public void >> renderScreenletSubWidget(Appendable writer, Map<String, >> Object> context, ModelScreenWidget subWidget, >> ModelScreenWidget.Screenlet screenlet) throws >> GeneralException, IOException { >> > @@ -738,9 +634,7 @@ public class MacroScreenRenderer >> impleme >> > } >> > } >> > public void >> renderScreenletEnd(Appendable writer, Map<String, >> Object> context, ModelScreenWidget.Screenlet screenlet) >> throws IOException { >> > - StringWriter sr = new >> StringWriter(); >> > - >> sr.append("<@renderScreenletEnd/>"); >> > - executeMacro(writer, >> sr.toString()); >> > + executeMacro(writer, >> "renderScreenletEnd", null); >> > } >> > >> > protected void >> renderScreenletPaginateMenu(Appendable writer, >> Map<String, Object> context, ModelScreenWidget.Form >> form) throws IOException { >> > @@ -763,7 +657,6 @@ public class MacroScreenRenderer >> impleme >> > int viewSize = >> modelForm.getViewSize(context); >> > int listSize = >> modelForm.getListSize(context); >> > >> > - int lowIndex = >> modelForm.getLowIndex(context); >> > int highIndex = >> modelForm.getHighIndex(context); >> > int actualPageSize = >> modelForm.getActualPageSize(context); >> > >> > @@ -824,73 +717,47 @@ public class MacroScreenRenderer >> impleme >> > // The current >> screenlet title bar navigation syling requires rendering >> > // these links in >> reverse order >> > // Last button >> > - String paginateLastStyle >> = modelForm.getPaginateLastStyle(); >> > - String paginateLastLabel >> = modelForm.getPaginateLastLabel(context); >> > String lastLinkUrl = >> ""; >> > if (highIndex < >> listSize) { >> > int >> page = (listSize / viewSize); >> > >> linkText = prepLinkText + page + anchor; >> > >> lastLinkUrl = rh.makeLink(request, response, linkText); >> > } >> > - String paginateNextStyle >> = modelForm.getPaginateNextStyle(); >> > - String paginateNextLabel >> = modelForm.getPaginateNextLabel(context); >> > String nextLinkUrl = >> ""; >> > if (highIndex < >> listSize) { >> > >> linkText = prepLinkText + (viewIndex + 1) + anchor; >> > // - >> make the link >> > >> nextLinkUrl = rh.makeLink(request, response, linkText); >> > } >> > - String >> paginatePreviousStyle = >> modelForm.getPaginatePreviousStyle(); >> > - String >> paginatePreviousLabel = >> modelForm.getPaginatePreviousLabel(context); >> > String >> previousLinkUrl = ""; >> > if (viewIndex > >> 0) { >> > >> linkText = prepLinkText + (viewIndex - 1) + anchor; >> > >> previousLinkUrl = rh.makeLink(request, response, linkText); >> > } >> > - String paginateFirstStyle >> = modelForm.getPaginateFirstStyle(); >> > - String paginateFirstLabel >> = modelForm.getPaginateFirstLabel(context); >> > String firstLinkUrl >> = ""; >> > if (viewIndex > >> 0) { >> > >> linkText = prepLinkText + 0 + anchor; >> > >> firstLinkUrl = rh.makeLink(request, response, linkText); >> > } >> > >> > - StringWriter sr = new >> StringWriter(); >> > - >> sr.append("<@renderScreenletPaginateMenu "); >> > - >> sr.append("lowIndex=\""); >> > - >> sr.append(Integer.toString(lowIndex)); >> > - sr.append("\" >> actualPageSize=\""); >> > - >> sr.append(Integer.toString(actualPageSize)); >> > - sr.append("\" >> ofLabel=\""); >> > - sr.append(ofLabel); >> > - sr.append("\" >> listSize=\""); >> > - >> sr.append(Integer.toString(listSize)); >> > - sr.append("\" >> paginateLastStyle=\""); >> > - >> sr.append(paginateLastStyle); >> > - sr.append("\" >> lastLinkUrl=\""); >> > - sr.append(lastLinkUrl); >> > - sr.append("\" >> paginateLastLabel=\""); >> > - >> sr.append(paginateLastLabel); >> > - sr.append("\" >> paginateNextStyle=\""); >> > - >> sr.append(paginateNextStyle); >> > - sr.append("\" >> nextLinkUrl=\""); >> > - sr.append(nextLinkUrl); >> > - sr.append("\" >> paginateNextLabel=\""); >> > - >> sr.append(paginateNextLabel); >> > - sr.append("\" >> paginatePreviousStyle=\""); >> > - >> sr.append(paginatePreviousStyle); >> > - sr.append("\" >> paginatePreviousLabel=\""); >> > - >> sr.append(paginatePreviousLabel); >> > - sr.append("\" >> previousLinkUrl=\""); >> > - >> sr.append(previousLinkUrl); >> > - sr.append("\" >> paginateFirstStyle=\""); >> > - >> sr.append(paginateFirstStyle); >> > - sr.append("\" >> paginateFirstLabel=\""); >> > - >> sr.append(paginateFirstLabel); >> > - sr.append("\" >> firstLinkUrl=\""); >> > - sr.append(firstLinkUrl); >> > - sr.append("\" />"); >> > - executeMacro(writer, >> sr.toString()); >> > + Map<String, Object> >> parameters = FastMap.newInstance(); >> > + >> parameters.put("lowIndex", modelForm.getLowIndex(context)); >> > + >> parameters.put("actualPageSize", actualPageSize); >> > + parameters.put("ofLabel", >> ofLabel); >> > + >> parameters.put("listSize", listSize); >> > + >> parameters.put("paginateLastStyle", >> modelForm.getPaginateLastStyle()); >> > + >> parameters.put("lastLinkUrl", lastLinkUrl); >> > + >> parameters.put("paginateLastLabel", >> modelForm.getPaginateLastLabel(context)); >> > + >> parameters.put("paginateNextStyle", >> modelForm.getPaginateNextStyle()); >> > + >> parameters.put("nextLinkUrl", nextLinkUrl); >> > + >> parameters.put("paginateNextLabel", >> modelForm.getPaginateNextLabel(context)); >> > + >> parameters.put("paginatePreviousStyle", >> modelForm.getPaginatePreviousStyle()); >> > + >> parameters.put("paginatePreviousLabel", >> modelForm.getPaginatePreviousLabel(context)); >> > + >> parameters.put("previousLinkUrl", previousLinkUrl); >> > + >> parameters.put("paginateFirstStyle", >> modelForm.getPaginateFirstStyle()); >> > + >> parameters.put("paginateFirstLabel", >> modelForm.getPaginateFirstLabel(context)); >> > + >> parameters.put("firstLinkUrl", firstLinkUrl); >> > + executeMacro(writer, >> "renderScreenletPaginateMenu", parameters); >> > } >> > >> > } >> > >> > >> >> -- >> Ofbiz on twitter: http://twitter.com/apache_ofbiz >> Myself on twitter: http://twitter.com/hansbak >> Antwebsystems.com: Quality services for competitive rates. >> >> > > > > |
Sorry for the trouble, I've since found a solution for what I was trying to achieve and I'll have it all fixed up shortly.
Regards Scott On 30/07/2010, at 8:13 PM, Jacques Le Roux wrote: > No this is not the same problem. I stumbled upon this one yesterday evening while trying to help on the Setup Component. > The other I found in links used in screen, this one Scott reverted. > > Jacques > > From: "Adrian Crum" <[hidden email]> >> I think Scott is aware of those problems and he reverted it. Check the commit logs. >> >> -Adrian >> >> --- On Fri, 7/30/10, Hans Bakker <[hidden email]> wrote: >> >>> From: Hans Bakker <[hidden email]> >>> Subject: Re: svn commit: r978954 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java >>> To: [hidden email] >>> Date: Friday, July 30, 2010, 12:47 AM >>> Adrian, >>> >>> can you have a look at this and the previous 2 >>> commits, they cause a >>> error in the help screens to not display properly. >>> >>> the following error is shown: >>> >>> Error executing macro: renderContentBegin required >>> parameter: >>> enableEditValue is not specified. The problematic >>> instruction: >>> ---------- ==> macro renderContentBegin [on line 46, >>> column 1 in >>> component://widget/templates/htmlScreenMacroLibrary.ftl] >>> in >>> user-directive renderContentBegin [on line 1, column 1 in >>> Fri Jul 30 >>> 14:44:26 ICT 2010] ---------- Java backtrace for >>> programmers: ---------- >>> freemarker.template.TemplateException: Error executing >>> macro: >>> renderContentBegin required parameter: enableEditValue is >>> not specified. >>> at >>> freemarker.core.Macro$Context.sanityCheck(Macro.java:207) >>> at >>> freemarker.core.Macro$Context.runMacro(Macro.java:165) at >>> freemarker.core.Environment.visit(Environment.java:602) at >>> freemarker.core.UnifiedCall.accept(UnifiedCall.java:106) >>> at >>> freemarker.core.Environment.visit(Environment.java:209) at >>> freemarker.core.Environment.include(Environment.java:1482) >>> at >>> org.ofbiz.widget.screen.MacroScreenRenderer.executeMacro(MacroScreenRenderer.java:97) >>> at >>> org.ofbiz.widget.screen.MacroScreenRenderer.executeMacro(MacroScreenRenderer.java:124) >>> at >>> org.ofbiz.widget.screen.MacroScreenRenderer.renderContentBegin(MacroScreenRenderer.java:334) >>> at >>> org.ofbiz.widget.screen.ModelScreenWidget$Content.renderWidgetString(ModelScreenWidget.java:1154) >>> at >>> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >>> at >>> org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) >>> at >>> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >>> at >>> org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) >>> at >>> org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) >>> at >>> org.ofbiz.widget.screen.ModelScreenWidget$IncludeScreen.renderWidgetString(ModelScreenWidget.java:540) >>> at >>> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >>> at >>> org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) >>> at >>> org.ofbiz.widget.screen.MacroScreenRenderer.renderScreenletSubWidget(MacroScreenRenderer.java:633) >>> at >>> org.ofbiz.widget.screen.ModelScreenWidget$Screenlet.renderWidgetString(ModelScreenWidget.java:370) >>> at >>> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >>> at >>> org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) >>> at >>> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >>> at >>> org.ofbiz.widget.screen.ModelScreenWidget$DecoratorSection.renderWidgetString(ModelScreenWidget.java:670) >>> at >>> org.ofbiz.widget.screen.ModelScreenWidget$SectionsRenderer.render(ModelScreenWidget.java:126) >>> at >>> org.ofbiz.widget.screen.ModelScreenWidget$DecoratorSectionInclude.renderWidgetString(ModelScreenWidget.java:703) >>> at >>> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >>> at >>> org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) >>> at >>> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >>> at >>> org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) >>> at >>> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >>> at >>> org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) >>> at >>> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >>> at >>> org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) >>> at >>> org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) >>> at >>> org.ofbiz.widget.screen.ModelScreenWidget$DecoratorScreen.renderWidgetString(ModelScreenWidget.java:637) >>> at >>> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >>> at >>> org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) >>> at >>> org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) >>> at >>> org.ofbiz.widget.screen.ModelScreenWidget$IncludeScreen.renderWidgetString(ModelScreenWidget.java:540) >>> at >>> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >>> at >>> org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) >>> at >>> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >>> at >>> org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) >>> at >>> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >>> at >>> org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:202) >>> at >>> org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) >>> at >>> org.ofbiz.widget.screen.ScreenRenderer.render(ScreenRenderer.java:135) >>> at >>> org.ofbiz.widget.screen.ScreenRenderer.render(ScreenRenderer.java:97) >>> at >>> org.ofbiz.widget.screen.MacroScreenViewHandler.render(MacroScreenViewHandler.java:104) >>> at >>> org.ofbiz.webapp.control.RequestHandler.renderView(RequestHandler.java:839) >>> at >>> org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:559) >>> at >>> org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:227) >>> at >>> javax.servlet.http.HttpServlet.service(HttpServlet.java:617) >>> at >>> javax.servlet.http.HttpServlet.service(HttpServlet.java:717) >>> at >>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) >>> at >>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) >>> at >>> org.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:271) >>> at >>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) >>> at >>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) >>> at >>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) >>> at >>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) >>> at >>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) >>> at >>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) >>> at >>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) >>> at >>> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:555) >>> at >>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) >>> at >>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) >>> at >>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) >>> at >>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) >>> at java.lang.Thread.run(Thread.java:619) >>> >>> >>> >>> On Sun, 2010-07-25 at 00:36 +0000, [hidden email] >>> wrote: >>> > Author: lektran >>> > Date: Sun Jul 25 00:36:13 2010 >>> > New Revision: 978954 >>> > >>> > URL: http://svn.apache.org/viewvc?rev=978954&view=rev >>> > Log: >>> > Converted all render* methods to use >>> executeMacro(Writer, String, Map) instead of >>> executeMacro(Writer, String). Removes over 100 lines >>> of StringWriter usage, makes the code easier to read and >>> also fixes the bug that Jacques committed a workaround for >>> in r978893 >>> > >>> > Modified: >>> > >>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java >>> > >>> > Modified: >>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java >>> > URL: > http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java?rev=978954&r1=978953&r2=978954&view=diff >>> > >>> ============================================================================== >>> > --- >>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java >>> (original) >>> > +++ >>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java >>> Sun Jul 25 00:36:13 2010 >>> > @@ -139,11 +139,11 @@ public class MacroScreenRenderer >>> impleme >>> > } >>> > >>> > public void >>> renderScreenBegin(Appendable writer, Map<String, >>> Object> context) throws IOException { >>> > - executeMacro(writer, >>> "<@renderScreenBegin/>"); >>> > + executeMacro(writer, >>> "renderScreenBegin", null); >>> > } >>> > >>> > public void >>> renderScreenEnd(Appendable writer, Map<String, Object> >>> context) throws IOException { >>> > - executeMacro(writer, >>> "<@renderScreenEnd/>"); >>> > + executeMacro(writer, >>> "renderScreenEnd", null); >>> > } >>> > >>> > public void >>> renderSectionBegin(Appendable writer, Map<String, >>> Object> context, ModelScreenWidget.Section section) >>> throws IOException { >>> > @@ -151,24 +151,23 @@ public class MacroScreenRenderer >>> impleme >>> > >>> this.widgetCommentsEnabled = >>> ModelWidget.widgetBoundaryCommentsEnabled(context); >>> > } >>> > if >>> (this.widgetCommentsEnabled) { >>> > - >>> StringWriter sr = new StringWriter(); >>> > - >>> sr.append("<@renderSectionBegin "); >>> > - >>> sr.append("boundaryComment=\"Begin "); >>> > - >>> sr.append(section.isMainSection ? "Screen " : "Section >>> Widget "); >>> > - >>> sr.append(section.getBoundaryCommentName()); >>> > - >>> sr.append("\"/>"); >>> > - >>> executeMacro(writer, sr.toString()); >>> > + >>> Map<String, Object> parameters = >>> FastMap.newInstance(); >>> > + >>> StringBuilder sb = new StringBuilder("Begin "); >>> > + >>> sb.append(section.isMainSection ? "Screen " : "Section >>> Widget "); >>> > + >>> sb.append(section.getBoundaryCommentName()); >>> > + >>> parameters.put("boundaryComment", sb.toString()); >>> > + >>> executeMacro(writer, "renderSectionBegin", parameters); >>> > } >>> > } >>> > public void >>> renderSectionEnd(Appendable writer, Map<String, >>> Object> context, ModelScreenWidget.Section section) >>> throws IOException { >>> > if >>> (this.widgetCommentsEnabled) { >>> > - >>> StringWriter sr = new StringWriter(); >>> > - >>> sr.append("<@renderSectionEnd "); >>> > - >>> sr.append("boundaryComment=\"End "); >>> > - >>> sr.append(section.isMainSection ? "Screen " : "Section >>> Widget "); >>> > - >>> sr.append(section.getBoundaryCommentName()); >>> > - >>> sr.append("\"/>"); >>> > - >>> executeMacro(writer, sr.toString()); >>> > + >>> Map<String, Object> parameters = >>> FastMap.newInstance(); >>> > + >>> StringBuilder sb = new StringBuilder(); >>> > + >>> sb.append("End "); >>> > + >>> sb.append(section.isMainSection ? "Screen " : "Section >>> Widget "); >>> > + >>> sb.append(section.getBoundaryCommentName()); >>> > + >>> parameters.put("boundaryComment", sb.toString()); >>> > + >>> executeMacro(writer, "renderSectionEnd", parameters); >>> > } >>> > } >>> > >>> > @@ -186,88 +185,64 @@ public class MacroScreenRenderer >>> impleme >>> > >>> RequestHandler rh = (RequestHandler) >>> ctx.getAttribute("_REQUEST_HANDLER_"); >>> > >>> autoUpdateLink = rh.makeLink(request, response, >>> autoUpdateTarget); >>> > } >>> > - StringWriter sr = new >>> StringWriter(); >>> > - >>> sr.append("<@renderContainerBegin "); >>> > - sr.append("id=\""); >>> > - sr.append(containerId); >>> > - sr.append("\" >>> style=\""); >>> > - >>> sr.append(container.getStyle(context)); >>> > - sr.append("\" >>> autoUpdateLink=\""); >>> > - >>> sr.append(autoUpdateLink); >>> > - sr.append("\" >>> autoUpdateInterval=\""); >>> > - >>> sr.append(container.getAutoUpdateInterval()); >>> > - sr.append("\" />"); >>> > - executeMacro(writer, >>> sr.toString()); >>> > + Map<String, Object> >>> parameters = FastMap.newInstance(); >>> > + parameters.put("id", >>> containerId); >>> > + parameters.put("style", >>> container.getStyle(context)); >>> > + >>> parameters.put("autoUpdateLink", autoUpdateLink); >>> > + >>> parameters.put("autoUpdateInterval", >>> container.getAutoUpdateInterval()); >>> > + executeMacro(writer, >>> "renderContainerBegin", parameters); >>> > } >>> > >>> > public void >>> renderContainerEnd(Appendable writer, Map<String, >>> Object> context, ModelScreenWidget.Container container) >>> throws IOException { >>> > - StringWriter sr = new >>> StringWriter(); >>> > - >>> sr.append("<@renderContainerEnd/>"); >>> > - executeMacro(writer, >>> sr.toString()); >>> > + executeMacro(writer, >>> "renderContainerEnd", null); >>> > } >>> > >>> > public void renderLabel(Appendable >>> writer, Map<String, Object> context, >>> ModelScreenWidget.Label label) throws IOException { >>> > - String labelText = >>> label.getText(context); >>> > - StringWriter sr = new >>> StringWriter(); >>> > - >>> sr.append("<@renderLabel "); >>> > - sr.append("text=\""); >>> > - sr.append(labelText); >>> > - sr.append("\" id=\""); >>> > - >>> sr.append(label.getId(context)); >>> > - sr.append("\" >>> style=\""); >>> > - >>> sr.append(label.getStyle(context)); >>> > - sr.append("\" />"); >>> > - executeMacro(writer, >>> sr.toString()); >>> > + Map<String, Object> >>> parameters = FastMap.newInstance(); >>> > + parameters.put("text", >>> label.getText(context)); >>> > + parameters.put("id", >>> label.getId(context)); >>> > + parameters.put("style", >>> label.getStyle(context)); >>> > + executeMacro(writer, >>> "renderLabel", parameters); >>> > } >>> > >>> > public void >>> renderHorizontalSeparator(Appendable writer, Map<String, >>> Object> context, ModelScreenWidget.HorizontalSeparator >>> separator) throws IOException { >>> > - StringWriter sr = new >>> StringWriter(); >>> > - >>> sr.append("<@renderHorizontalSeparator "); >>> > - sr.append("id=\""); >>> > - >>> sr.append(separator.getId(context)); >>> > - sr.append("\" >>> style=\""); >>> > - >>> sr.append(separator.getStyle(context)); >>> > - sr.append("\" />"); >>> > - executeMacro(writer, >>> sr.toString()); >>> > + Map<String, Object> >>> parameters = FastMap.newInstance(); >>> > + parameters.put("id", >>> separator.getId(context)); >>> > + parameters.put("style", >>> separator.getStyle(context)); >>> > + executeMacro(writer, >>> "renderHorizontalSeparator", parameters); >>> > } >>> > >>> > public void renderLink(Appendable >>> writer, Map<String, Object> context, >>> ModelScreenWidget.Link link) throws IOException { >>> > HttpServletResponse >>> response = (HttpServletResponse) context.get("response"); >>> > HttpServletRequest >>> request = (HttpServletRequest) context.get("request"); >>> > >>> > - String targetWindow = >>> link.getTargetWindow(context); >>> > String target = >>> link.getTarget(context); >>> > >>> > - String uniqueItemName = >>> link.getModelScreen().getName() + "_LF_" + >>> UtilMisc.<String>addToBigDecimalInMap(context, >>> "screenUniqueItemIndex", BigDecimal.ONE); >>> > >>> > String linkType = >>> WidgetWorker.determineAutoLinkType(link.getLinkType(), >>> target, link.getUrlMode(), request); >>> > - String linkUrl = ""; >>> > String actionUrl = >>> ""; >>> > - StringBuilder >>> parameters=new StringBuilder(); >>> > + StringBuilder >>> targetParameters = new StringBuilder(); >>> > if >>> ("hidden-form".equals(linkType)) { >>> > >>> StringBuilder sb = new StringBuilder(); >>> > >>> WidgetWorker.buildHyperlinkUrl(sb, target, >>> link.getUrlMode(), null, link.getPrefix(context), >>> > >>> link.getFullPath(), link.getSecure(), >>> link.getEncode(), request, response, context); >>> > >>> actionUrl = sb.toString(); >>> > - >>> parameters.append("["); >>> > + >>> targetParameters.append("["); >>> > for >>> (Map.Entry<String, String> parameter: >>> link.getParameterMap(context).entrySet()) { >>> > - >>> if (parameters.length() >1) { >>> > - >>> parameters.append(","); >>> > + >>> if (targetParameters.length() >1) { >>> > + >>> targetParameters.append(","); >>> > >>> } >>> > - >>> parameters.append("{'name':'"); >>> > - >>> parameters.append(parameter.getKey()); >>> > - >>> parameters.append("'"); >>> > - >>> parameters.append(",'value':'"); >>> > - >>> parameters.append(parameter.getValue()); >>> > - >>> parameters.append("'}"); >>> > - } >>> > - >>> parameters.append("]"); >>> > + >>> targetParameters.append("{'name':'"); >>> > + >>> targetParameters.append(parameter.getKey()); >>> > + >>> targetParameters.append("'"); >>> > + >>> targetParameters.append(",'value':'"); >>> > + >>> targetParameters.append(parameter.getValue()); >>> > + >>> targetParameters.append("'}"); >>> > + } >>> > + >>> targetParameters.append("]"); >>> > >>> > } >>> > - String id = >>> link.getId(context); >>> > - String style = >>> link.getStyle(context); >>> > - String name = >>> link.getName(context); >>> > - String text = >>> link.getText(context); >>> > + String linkUrl = ""; >>> > if >>> (UtilValidate.isNotEmpty(target)) { >>> > if >>> (!"hidden-form".equals(linkType)) { >>> > >>> StringBuilder sb = new StringBuilder(); >>> > @@ -283,46 +258,30 @@ public class MacroScreenRenderer >>> impleme >>> > >>> renderImage(sw, context, img); >>> > imgStr >>> = sw.toString(); >>> > } >>> > - StringWriter sr = new >>> StringWriter(); >>> > - >>> sr.append("<@renderLink "); >>> > - >>> sr.append("parameterList="); >>> > - >>> sr.append(parameters.length()==0?"\"\"":parameters.toString()); >>> > - sr.append(" >>> targetWindow=\""); >>> > - sr.append(targetWindow); >>> > - sr.append("\" >>> target=\""); >>> > - sr.append(target); >>> > - sr.append("\" >>> uniqueItemName=\""); >>> > - >>> sr.append(uniqueItemName); >>> > - sr.append("\" >>> linkType=\""); >>> > - sr.append(linkType); >>> > - sr.append("\" >>> actionUrl=\""); >>> > - sr.append(actionUrl); >>> > - sr.append("\" id=\""); >>> > - sr.append(id); >>> > - sr.append("\" >>> style=\""); >>> > - sr.append(style); >>> > - sr.append("\" name=\""); >>> > - sr.append(name); >>> > - sr.append("\" >>> linkUrl=\""); >>> > - sr.append(linkUrl); >>> > - sr.append("\" text=\""); >>> > - sr.append(text); >>> > - sr.append("\" >>> imgStr=\""); >>> > - >>> sr.append(imgStr.replaceAll("\"", "\\\\\"")); >>> > - sr.append("\" />"); >>> > - executeMacro(writer, >>> sr.toString()); >>> > + >>> > + Map<String, Object> >>> parameters = FastMap.newInstance(); >>> > + >>> parameters.put("parameterList", >>> targetParameters.toString()); >>> > + >>> parameters.put("targetWindow", >>> link.getTargetWindow(context)); >>> > + parameters.put("target", >>> target); >>> > + >>> > + String uniqueItemName = >>> link.getModelScreen().getName() + "_LF_" + >>> UtilMisc.<String>addToBigDecimalInMap(context, >>> "screenUniqueItemIndex", BigDecimal.ONE); >>> > + >>> parameters.put("uniqueItemName", uniqueItemName); >>> > + >>> > + >>> parameters.put("linkType", linkType); >>> > + >>> parameters.put("actionUrl", actionUrl); >>> > + parameters.put("id", >>> link.getId(context)); >>> > + parameters.put("style", >>> link.getStyle(context)); >>> > + parameters.put("name", >>> link.getName(context)); >>> > + parameters.put("linkUrl", >>> linkUrl); >>> > + parameters.put("text", >>> link.getText(context)); >>> > + parameters.put("imgStr", >>> imgStr); >>> > + executeMacro(writer, >>> "renderLink", parameters); >>> > } >>> > >>> > public void renderImage(Appendable >>> writer, Map<String, Object> context, >>> ModelScreenWidget.Image image) throws IOException { >>> > if (image == null) >>> > return >>> ; >>> > String src = >>> image.getSrc(context); >>> > - String id = >>> image.getId(context); >>> > - String style = >>> image.getStyle(context); >>> > - String wid = >>> image.getWidth(context); >>> > - String hgt = >>> image.getHeight(context); >>> > - String border = >>> image.getBorder(context); >>> > - String alt = >>> image.getAlt(context); >>> > >>> > String urlMode = >>> image.getUrlMode(); >>> > boolean fullPath = >>> false; >>> > @@ -349,46 +308,30 @@ public class MacroScreenRenderer >>> impleme >>> > } else { >>> > >>> urlString = src; >>> > } >>> > - StringWriter sr = new >>> StringWriter(); >>> > - >>> sr.append("<@renderImage "); >>> > - sr.append("src=\""); >>> > - sr.append(src); >>> > - sr.append("\" id=\""); >>> > - sr.append(id); >>> > - sr.append("\" >>> style=\""); >>> > - sr.append(style); >>> > - sr.append("\" wid=\""); >>> > - sr.append(wid); >>> > - sr.append("\" hgt=\""); >>> > - sr.append(hgt); >>> > - sr.append("\" >>> border=\""); >>> > - sr.append(border); >>> > - sr.append("\" alt=\""); >>> > - sr.append(alt); >>> > - sr.append("\" >>> urlString=\""); >>> > - sr.append(urlString); >>> > - sr.append("\" />"); >>> > - executeMacro(writer, >>> sr.toString()); >>> > + Map<String, Object> >>> parameters = FastMap.newInstance(); >>> > + parameters.put("src", >>> src); >>> > + parameters.put("id", >>> image.getId(context)); >>> > + parameters.put("style", >>> image.getStyle(context)); >>> > + parameters.put("wid", >>> image.getWidth(context)); >>> > + parameters.put("hgt", >>> image.getHeight(context)); >>> > + parameters.put("border", >>> image.getBorder(context)); >>> > + parameters.put("alt", >>> image.getAlt(context)); >>> > + >>> parameters.put("urlString", urlString); >>> > + executeMacro(writer, >>> "renderImage", parameters); >>> > } >>> > >>> > public void >>> renderContentBegin(Appendable writer, Map<String, >>> Object> context, ModelScreenWidget.Content content) >>> throws IOException { >>> > String >>> editRequest = content.getEditRequest(context); >>> > - String >>> editContainerStyle = >>> content.getEditContainerStyle(context); >>> > String >>> enableEditName = content.getEnableEditName(context); >>> > String >>> enableEditValue = (String)context.get(enableEditName); >>> > >>> > if >>> (Debug.verboseOn()) Debug.logVerbose("directEditRequest:" + >>> editRequest, module); >>> > >>> > - StringWriter >>> sr = new StringWriter(); >>> > - >>> sr.append("<@renderContentBegin "); >>> > - >>> sr.append("editRequest=\""); >>> > - >>> sr.append(editRequest); >>> > - sr.append("\" >>> enableEditValue=\""); >>> > - >>> sr.append(enableEditValue); >>> > - sr.append("\" >>> editContainerStyle=\""); >>> > - >>> sr.append(editContainerStyle); >>> > - sr.append("\" >>> />"); >>> > - >>> executeMacro(writer, sr.toString()); >>> > + Map<String, >>> Object> parameters = FastMap.newInstance(); >>> > + >>> parameters.put("editRequest", >>> editRequest); >>> > + >>> parameters.put("enableEditValue", >>> enableEditValue); >>> > + >>> parameters.put("editContainerStyle", >>> content.getEditContainerStyle(context)); >>> > + >>> executeMacro(writer, "renderContentBegin", >>> parameters); >>> > } >>> > >>> > public void >>> renderContentBody(Appendable writer, Map<String, >>> Object> context, ModelScreenWidget.Content content) >>> throws IOException { >>> > @@ -459,7 +402,6 @@ public class MacroScreenRenderer >>> impleme >>> > String >>> expandedContentId = content.getContentId(context); >>> > String editMode = >>> "Edit"; >>> > String editRequest = >>> content.getEditRequest(context); >>> > - String editContainerStyle >>> = content.getEditContainerStyle(context); >>> > String >>> enableEditName = content.getEnableEditName(context); >>> > String >>> enableEditValue = (String)context.get(enableEditName); >>> > String urlString = >>> ""; >>> > @@ -479,29 +421,19 @@ public class MacroScreenRenderer >>> impleme >>> > >>> urlString = rh.makeLink(request, response, >>> editRequest, false, false, false); >>> > } >>> > >>> > - >>> StringWriter sr = new StringWriter(); >>> > - >>> sr.append("<@renderContentEnd "); >>> > - >>> sr.append("urlString=\""); >>> > - >>> sr.append(urlString); >>> > - >>> sr.append("\" editMode=\""); >>> > - >>> sr.append(editMode); >>> > - >>> sr.append("\" editContainerStyle=\""); >>> > - >>> sr.append(editContainerStyle); >>> > - >>> sr.append("\" editRequest=\""); >>> > - >>> sr.append(editRequest); >>> > - >>> sr.append("\" enableEditValue=\""); >>> > - >>> sr.append(enableEditValue); >>> > - >>> sr.append("\" />"); >>> > - >>> executeMacro(writer, sr.toString()); >>> > + >>> Map<String, Object> parameters = >>> FastMap.newInstance(); >>> > + >>> parameters.put("urlString", urlString); >>> > + >>> parameters.put("editMode", editMode); >>> > + >>> parameters.put("editContainerStyle", >>> content.getEditContainerStyle(context)); >>> > + >>> parameters.put("editRequest", editRequest); >>> > + >>> parameters.put("enableEditValue", enableEditValue); >>> > + >>> executeMacro(writer, "renderContentEnd", parameters); >>> > } >>> > } >>> > >>> > public void >>> renderContentFrame(Appendable writer, Map<String, >>> Object> context, ModelScreenWidget.Content content) >>> throws IOException { >>> > String >>> dataResourceId = content.getDataResourceId(context); >>> > String urlString = >>> "/ViewSimpleContent?dataResourceId=" + dataResourceId; >>> > - String width = >>> content.getWidth(); >>> > - String height = >>> content.getHeight(); >>> > - String border = >>> content.getBorder(); >>> > String fullUrlString >>> = ""; >>> > HttpServletRequest >>> request = (HttpServletRequest) context.get("request"); >>> > HttpServletResponse >>> response = (HttpServletResponse) context.get("response"); >>> > @@ -510,36 +442,24 @@ public class MacroScreenRenderer >>> impleme >>> > >>> RequestHandler rh = (RequestHandler) >>> ctx.getAttribute("_REQUEST_HANDLER_"); >>> > >>> fullUrlString = rh.makeLink(request, response, urlString, >>> true, false, false); >>> > } >>> > - StringWriter sr = new >>> StringWriter(); >>> > - >>> sr.append("<@renderContentFrame "); >>> > - sr.append("fullUrl=\""); >>> > - >>> sr.append(fullUrlString); >>> > - sr.append("\" >>> width=\""); >>> > - sr.append(width); >>> > - sr.append("\" >>> height=\""); >>> > - sr.append(height); >>> > - sr.append("\" >>> border=\""); >>> > - sr.append(border); >>> > - sr.append("\" />"); >>> > - executeMacro(writer, >>> sr.toString()); >>> > + >>> > + Map<String, Object> >>> parameters = FastMap.newInstance(); >>> > + parameters.put("fullUrl", >>> fullUrlString); >>> > + parameters.put("width", >>> content.getWidth()); >>> > + parameters.put("height", >>> content.getHeight()); >>> > + parameters.put("border", >>> content.getBorder()); >>> > + executeMacro(writer, >>> "renderContentFrame", parameters); >>> > } >>> > >>> > public void >>> renderSubContentBegin(Appendable writer, Map<String, >>> Object> context, ModelScreenWidget.SubContent content) >>> throws IOException { >>> > - String >>> editRequest = content.getEditRequest(context); >>> > - String >>> editContainerStyle = >>> content.getEditContainerStyle(context); >>> > String >>> enableEditName = content.getEnableEditName(context); >>> > String >>> enableEditValue = (String)context.get(enableEditName); >>> > >>> > - StringWriter >>> sr = new StringWriter(); >>> > - >>> sr.append("<@renderSubContentBegin "); >>> > - sr.append(" >>> editContainerStyle=\""); >>> > - >>> sr.append(editContainerStyle); >>> > - sr.append("\" >>> editRequest=\""); >>> > - >>> sr.append(editRequest); >>> > - sr.append("\" >>> enableEditValue=\""); >>> > - >>> sr.append(enableEditValue); >>> > - sr.append("\" >>> />"); >>> > - >>> executeMacro(writer, sr.toString()); >>> > + Map<String, >>> Object> parameters = FastMap.newInstance(); >>> > + >>> parameters.put("editContainerStyle", >>> content.getEditContainerStyle(context)); >>> > + >>> parameters.put("editRequest", >>> content.getEditRequest(context)); >>> > + >>> parameters.put("enableEditValue", >>> enableEditValue); >>> > + >>> executeMacro(writer, >>> "renderSubContentBegin", parameters); >>> > } >>> > >>> > public void >>> renderSubContentBody(Appendable writer, Map<String, >>> Object> context, ModelScreenWidget.SubContent content) >>> throws IOException { >>> > @@ -593,7 +513,6 @@ public class MacroScreenRenderer >>> impleme >>> > public void >>> renderSubContentEnd(Appendable writer, Map<String, >>> Object> context, ModelScreenWidget.SubContent content) >>> throws IOException { >>> > String >>> editMode = "Edit"; >>> > String >>> editRequest = content.getEditRequest(context); >>> > - String >>> editContainerStyle = >>> content.getEditContainerStyle(context); >>> > String >>> enableEditName = content.getEnableEditName(context); >>> > String >>> enableEditValue = (String)context.get(enableEditName); >>> > String >>> expandedContentId = content.getContentId(context); >>> > @@ -618,20 +537,13 @@ public class MacroScreenRenderer >>> impleme >>> > >>> } >>> > } >>> > >>> > - StringWriter >>> sr = new StringWriter(); >>> > - >>> sr.append("<@renderSubContentEnd "); >>> > - >>> sr.append("urlString=\""); >>> > - >>> sr.append(urlString); >>> > - sr.append("\" >>> editMode=\""); >>> > - >>> sr.append(editMode); >>> > - sr.append("\" >>> editContainerStyle=\""); >>> > - >>> sr.append(editContainerStyle); >>> > - sr.append("\" >>> editRequest=\""); >>> > - >>> sr.append(editRequest); >>> > - sr.append("\" >>> enableEditValue=\""); >>> > - >>> sr.append(enableEditValue); >>> > - sr.append("\" >>> />"); >>> > - >>> executeMacro(writer, sr.toString()); >>> > + Map<String, >>> Object> parameters = FastMap.newInstance(); >>> > + >>> parameters.put("urlString", urlString); >>> > + >>> parameters.put("editMode", editMode); >>> > + >>> parameters.put("editContainerStyle", >>> content.getEditContainerStyle(context)); >>> > + >>> parameters.put("editRequest", >>> editRequest); >>> > + >>> parameters.put("enableEditValue", >>> enableEditValue); >>> > + >>> executeMacro(writer, >>> "renderSubContentEnd", parameters); >>> > } >>> > >>> > >>> > @@ -652,7 +564,6 @@ public class MacroScreenRenderer >>> impleme >>> > String expandToolTip >>> = ""; >>> > String >>> collapseToolTip = ""; >>> > String fullUrlString >>> = ""; >>> > - boolean padded = >>> screenlet.padded(); >>> > String menuString = >>> ""; >>> > boolean showMore = >>> false; >>> > if >>> (UtilValidate.isNotEmpty(title) || navMenu != null || >>> navForm != null || collapsible) { >>> > @@ -687,36 +598,21 @@ public class MacroScreenRenderer >>> impleme >>> > } >>> > } >>> > >>> > - StringWriter sr = new >>> StringWriter(); >>> > - >>> sr.append("<@renderScreenletBegin "); >>> > - sr.append("id=\""); >>> > - >>> sr.append(screenlet.getId(context)); >>> > - sr.append("\" >>> title=\""); >>> > - sr.append(title); >>> > - sr.append("\" >>> collapsible="); >>> > - >>> sr.append(Boolean.toString(collapsible)); >>> > - sr.append(" >>> saveCollapsed="); >>> > - >>> sr.append(Boolean.toString(screenlet.saveCollapsed())); >>> > - sr.append(" >>> collapsibleAreaId=\""); >>> > - >>> sr.append(collapsibleAreaId); >>> > - sr.append("\" >>> expandToolTip=\""); >>> > - >>> sr.append(expandToolTip); >>> > - sr.append("\" >>> collapseToolTip=\""); >>> > - >>> sr.append(collapseToolTip); >>> > - sr.append("\" >>> fullUrlString=\""); >>> > - >>> sr.append(fullUrlString); >>> > - sr.append("\" padded="); >>> > - >>> sr.append(Boolean.toString(padded)); >>> > - sr.append(" >>> menuString=\""); >>> > - >>> sr.append(menuString.replaceAll("\"", "\\\\\"")); >>> > - sr.append("\" >>> showMore="); >>> > - >>> sr.append(Boolean.toString(showMore)); >>> > - sr.append(" >>> collapsed="); >>> > - >>> sr.append(Boolean.toString(collapsed)); >>> > - sr.append(" >>> javaScriptEnabled="); >>> > - >>> sr.append(Boolean.toString(javaScriptEnabled)); >>> > - sr.append(" />"); >>> > - executeMacro(writer, >>> sr.toString()); >>> > + Map<String, Object> >>> parameters = FastMap.newInstance(); >>> > + parameters.put("id", >>> screenlet.getId(context)); >>> > + parameters.put("title", >>> title); >>> > + >>> parameters.put("collapsible", collapsible); >>> > + >>> parameters.put("saveCollapsed", screenlet.saveCollapsed()); >>> > + >>> parameters.put("collapsibleAreaId", collapsibleAreaId); >>> > + >>> parameters.put("expandToolTip", expandToolTip); >>> > + >>> parameters.put("collapseToolTip", collapseToolTip); >>> > + >>> parameters.put("fullUrlString", fullUrlString); >>> > + parameters.put("padded", >>> screenlet.padded()); >>> > + >>> parameters.put("menuString", menuString); >>> > + >>> parameters.put("showMore", showMore); >>> > + >>> parameters.put("collapsed", collapsed); >>> > + >>> parameters.put("javaScriptEnabled", javaScriptEnabled); >>> > + executeMacro(writer, >>> "renderScreenletBegin", parameters); >>> > } >>> > >>> > public void >>> renderScreenletSubWidget(Appendable writer, Map<String, >>> Object> context, ModelScreenWidget subWidget, >>> ModelScreenWidget.Screenlet screenlet) throws >>> GeneralException, IOException { >>> > @@ -738,9 +634,7 @@ public class MacroScreenRenderer >>> impleme >>> > } >>> > } >>> > public void >>> renderScreenletEnd(Appendable writer, Map<String, >>> Object> context, ModelScreenWidget.Screenlet screenlet) >>> throws IOException { >>> > - StringWriter sr = new >>> StringWriter(); >>> > - >>> sr.append("<@renderScreenletEnd/>"); >>> > - executeMacro(writer, >>> sr.toString()); >>> > + executeMacro(writer, >>> "renderScreenletEnd", null); >>> > } >>> > >>> > protected void >>> renderScreenletPaginateMenu(Appendable writer, >>> Map<String, Object> context, ModelScreenWidget.Form >>> form) throws IOException { >>> > @@ -763,7 +657,6 @@ public class MacroScreenRenderer >>> impleme >>> > int viewSize = >>> modelForm.getViewSize(context); >>> > int listSize = >>> modelForm.getListSize(context); >>> > >>> > - int lowIndex = >>> modelForm.getLowIndex(context); >>> > int highIndex = >>> modelForm.getHighIndex(context); >>> > int actualPageSize = >>> modelForm.getActualPageSize(context); >>> > >>> > @@ -824,73 +717,47 @@ public class MacroScreenRenderer >>> impleme >>> > // The current >>> screenlet title bar navigation syling requires rendering >>> > // these links in >>> reverse order >>> > // Last button >>> > - String paginateLastStyle >>> = modelForm.getPaginateLastStyle(); >>> > - String paginateLastLabel >>> = modelForm.getPaginateLastLabel(context); >>> > String lastLinkUrl = >>> ""; >>> > if (highIndex < >>> listSize) { >>> > int >>> page = (listSize / viewSize); >>> > >>> linkText = prepLinkText + page + anchor; >>> > >>> lastLinkUrl = rh.makeLink(request, response, linkText); >>> > } >>> > - String paginateNextStyle >>> = modelForm.getPaginateNextStyle(); >>> > - String paginateNextLabel >>> = modelForm.getPaginateNextLabel(context); >>> > String nextLinkUrl = >>> ""; >>> > if (highIndex < >>> listSize) { >>> > >>> linkText = prepLinkText + (viewIndex + 1) + anchor; >>> > // - >>> make the link >>> > >>> nextLinkUrl = rh.makeLink(request, response, linkText); >>> > } >>> > - String >>> paginatePreviousStyle = >>> modelForm.getPaginatePreviousStyle(); >>> > - String >>> paginatePreviousLabel = >>> modelForm.getPaginatePreviousLabel(context); >>> > String >>> previousLinkUrl = ""; >>> > if (viewIndex > >>> 0) { >>> > >>> linkText = prepLinkText + (viewIndex - 1) + anchor; >>> > >>> previousLinkUrl = rh.makeLink(request, response, linkText); >>> > } >>> > - String paginateFirstStyle >>> = modelForm.getPaginateFirstStyle(); >>> > - String paginateFirstLabel >>> = modelForm.getPaginateFirstLabel(context); >>> > String firstLinkUrl >>> = ""; >>> > if (viewIndex > >>> 0) { >>> > >>> linkText = prepLinkText + 0 + anchor; >>> > >>> firstLinkUrl = rh.makeLink(request, response, linkText); >>> > } >>> > >>> > - StringWriter sr = new >>> StringWriter(); >>> > - >>> sr.append("<@renderScreenletPaginateMenu "); >>> > - >>> sr.append("lowIndex=\""); >>> > - >>> sr.append(Integer.toString(lowIndex)); >>> > - sr.append("\" >>> actualPageSize=\""); >>> > - >>> sr.append(Integer.toString(actualPageSize)); >>> > - sr.append("\" >>> ofLabel=\""); >>> > - sr.append(ofLabel); >>> > - sr.append("\" >>> listSize=\""); >>> > - >>> sr.append(Integer.toString(listSize)); >>> > - sr.append("\" >>> paginateLastStyle=\""); >>> > - >>> sr.append(paginateLastStyle); >>> > - sr.append("\" >>> lastLinkUrl=\""); >>> > - sr.append(lastLinkUrl); >>> > - sr.append("\" >>> paginateLastLabel=\""); >>> > - >>> sr.append(paginateLastLabel); >>> > - sr.append("\" >>> paginateNextStyle=\""); >>> > - >>> sr.append(paginateNextStyle); >>> > - sr.append("\" >>> nextLinkUrl=\""); >>> > - sr.append(nextLinkUrl); >>> > - sr.append("\" >>> paginateNextLabel=\""); >>> > - >>> sr.append(paginateNextLabel); >>> > - sr.append("\" >>> paginatePreviousStyle=\""); >>> > - >>> sr.append(paginatePreviousStyle); >>> > - sr.append("\" >>> paginatePreviousLabel=\""); >>> > - >>> sr.append(paginatePreviousLabel); >>> > - sr.append("\" >>> previousLinkUrl=\""); >>> > - >>> sr.append(previousLinkUrl); >>> > - sr.append("\" >>> paginateFirstStyle=\""); >>> > - >>> sr.append(paginateFirstStyle); >>> > - sr.append("\" >>> paginateFirstLabel=\""); >>> > - >>> sr.append(paginateFirstLabel); >>> > - sr.append("\" >>> firstLinkUrl=\""); >>> > - sr.append(firstLinkUrl); >>> > - sr.append("\" />"); >>> > - executeMacro(writer, >>> sr.toString()); >>> > + Map<String, Object> >>> parameters = FastMap.newInstance(); >>> > + >>> parameters.put("lowIndex", modelForm.getLowIndex(context)); >>> > + >>> parameters.put("actualPageSize", actualPageSize); >>> > + parameters.put("ofLabel", >>> ofLabel); >>> > + >>> parameters.put("listSize", listSize); >>> > + >>> parameters.put("paginateLastStyle", >>> modelForm.getPaginateLastStyle()); >>> > + >>> parameters.put("lastLinkUrl", lastLinkUrl); >>> > + >>> parameters.put("paginateLastLabel", >>> modelForm.getPaginateLastLabel(context)); >>> > + >>> parameters.put("paginateNextStyle", >>> modelForm.getPaginateNextStyle()); >>> > + >>> parameters.put("nextLinkUrl", nextLinkUrl); >>> > + >>> parameters.put("paginateNextLabel", >>> modelForm.getPaginateNextLabel(context)); >>> > + >>> parameters.put("paginatePreviousStyle", >>> modelForm.getPaginatePreviousStyle()); >>> > + >>> parameters.put("paginatePreviousLabel", >>> modelForm.getPaginatePreviousLabel(context)); >>> > + >>> parameters.put("previousLinkUrl", previousLinkUrl); >>> > + >>> parameters.put("paginateFirstStyle", >>> modelForm.getPaginateFirstStyle()); >>> > + >>> parameters.put("paginateFirstLabel", >>> modelForm.getPaginateFirstLabel(context)); >>> > + >>> parameters.put("firstLinkUrl", firstLinkUrl); >>> > + executeMacro(writer, >>> "renderScreenletPaginateMenu", parameters); >>> > } >>> > >>> > } >>> > >>> > >>> >>> -- >>> Ofbiz on twitter: http://twitter.com/apache_ofbiz >>> Myself on twitter: http://twitter.com/hansbak >>> Antwebsystems.com: Quality services for competitive rates. >>> >>> >> >> >> > > smime.p7s (3K) Download Attachment |
The problem was slightly different so I fixed it on it's own in r980687, I'll continue to test with my other changes and commit them later.
Regards Scott On 30/07/2010, at 8:18 PM, Scott Gray wrote: > Sorry for the trouble, I've since found a solution for what I was trying to achieve and I'll have it all fixed up shortly. > > Regards > Scott > > On 30/07/2010, at 8:13 PM, Jacques Le Roux wrote: > >> No this is not the same problem. I stumbled upon this one yesterday evening while trying to help on the Setup Component. >> The other I found in links used in screen, this one Scott reverted. >> >> Jacques >> >> From: "Adrian Crum" <[hidden email]> >>> I think Scott is aware of those problems and he reverted it. Check the commit logs. >>> >>> -Adrian >>> >>> --- On Fri, 7/30/10, Hans Bakker <[hidden email]> wrote: >>> >>>> From: Hans Bakker <[hidden email]> >>>> Subject: Re: svn commit: r978954 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java >>>> To: [hidden email] >>>> Date: Friday, July 30, 2010, 12:47 AM >>>> Adrian, >>>> >>>> can you have a look at this and the previous 2 >>>> commits, they cause a >>>> error in the help screens to not display properly. >>>> >>>> the following error is shown: >>>> >>>> Error executing macro: renderContentBegin required >>>> parameter: >>>> enableEditValue is not specified. The problematic >>>> instruction: >>>> ---------- ==> macro renderContentBegin [on line 46, >>>> column 1 in >>>> component://widget/templates/htmlScreenMacroLibrary.ftl] >>>> in >>>> user-directive renderContentBegin [on line 1, column 1 in >>>> Fri Jul 30 >>>> 14:44:26 ICT 2010] ---------- Java backtrace for >>>> programmers: ---------- >>>> freemarker.template.TemplateException: Error executing >>>> macro: >>>> renderContentBegin required parameter: enableEditValue is >>>> not specified. >>>> at >>>> freemarker.core.Macro$Context.sanityCheck(Macro.java:207) >>>> at >>>> freemarker.core.Macro$Context.runMacro(Macro.java:165) at >>>> freemarker.core.Environment.visit(Environment.java:602) at >>>> freemarker.core.UnifiedCall.accept(UnifiedCall.java:106) >>>> at >>>> freemarker.core.Environment.visit(Environment.java:209) at >>>> freemarker.core.Environment.include(Environment.java:1482) >>>> at >>>> org.ofbiz.widget.screen.MacroScreenRenderer.executeMacro(MacroScreenRenderer.java:97) >>>> at >>>> org.ofbiz.widget.screen.MacroScreenRenderer.executeMacro(MacroScreenRenderer.java:124) >>>> at >>>> org.ofbiz.widget.screen.MacroScreenRenderer.renderContentBegin(MacroScreenRenderer.java:334) >>>> at >>>> org.ofbiz.widget.screen.ModelScreenWidget$Content.renderWidgetString(ModelScreenWidget.java:1154) >>>> at >>>> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >>>> at >>>> org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) >>>> at >>>> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >>>> at >>>> org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) >>>> at >>>> org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) >>>> at >>>> org.ofbiz.widget.screen.ModelScreenWidget$IncludeScreen.renderWidgetString(ModelScreenWidget.java:540) >>>> at >>>> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >>>> at >>>> org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) >>>> at >>>> org.ofbiz.widget.screen.MacroScreenRenderer.renderScreenletSubWidget(MacroScreenRenderer.java:633) >>>> at >>>> org.ofbiz.widget.screen.ModelScreenWidget$Screenlet.renderWidgetString(ModelScreenWidget.java:370) >>>> at >>>> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >>>> at >>>> org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) >>>> at >>>> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >>>> at >>>> org.ofbiz.widget.screen.ModelScreenWidget$DecoratorSection.renderWidgetString(ModelScreenWidget.java:670) >>>> at >>>> org.ofbiz.widget.screen.ModelScreenWidget$SectionsRenderer.render(ModelScreenWidget.java:126) >>>> at >>>> org.ofbiz.widget.screen.ModelScreenWidget$DecoratorSectionInclude.renderWidgetString(ModelScreenWidget.java:703) >>>> at >>>> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >>>> at >>>> org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) >>>> at >>>> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >>>> at >>>> org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) >>>> at >>>> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >>>> at >>>> org.ofbiz.widget.screen.ModelScreenWidget$Container.renderWidgetString(ModelScreenWidget.java:257) >>>> at >>>> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >>>> at >>>> org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) >>>> at >>>> org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) >>>> at >>>> org.ofbiz.widget.screen.ModelScreenWidget$DecoratorScreen.renderWidgetString(ModelScreenWidget.java:637) >>>> at >>>> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >>>> at >>>> org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) >>>> at >>>> org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) >>>> at >>>> org.ofbiz.widget.screen.ModelScreenWidget$IncludeScreen.renderWidgetString(ModelScreenWidget.java:540) >>>> at >>>> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >>>> at >>>> org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) >>>> at >>>> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >>>> at >>>> org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:188) >>>> at >>>> org.ofbiz.widget.screen.ModelScreenWidget.renderSubWidgetsString(ModelScreenWidget.java:101) >>>> at >>>> org.ofbiz.widget.screen.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:202) >>>> at >>>> org.ofbiz.widget.screen.ModelScreen.renderScreenString(ModelScreen.java:392) >>>> at >>>> org.ofbiz.widget.screen.ScreenRenderer.render(ScreenRenderer.java:135) >>>> at >>>> org.ofbiz.widget.screen.ScreenRenderer.render(ScreenRenderer.java:97) >>>> at >>>> org.ofbiz.widget.screen.MacroScreenViewHandler.render(MacroScreenViewHandler.java:104) >>>> at >>>> org.ofbiz.webapp.control.RequestHandler.renderView(RequestHandler.java:839) >>>> at >>>> org.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:559) >>>> at >>>> org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:227) >>>> at >>>> javax.servlet.http.HttpServlet.service(HttpServlet.java:617) >>>> at >>>> javax.servlet.http.HttpServlet.service(HttpServlet.java:717) >>>> at >>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) >>>> at >>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) >>>> at >>>> org.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:271) >>>> at >>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) >>>> at >>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) >>>> at >>>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) >>>> at >>>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) >>>> at >>>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) >>>> at >>>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) >>>> at >>>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) >>>> at >>>> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:555) >>>> at >>>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) >>>> at >>>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) >>>> at >>>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) >>>> at >>>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) >>>> at java.lang.Thread.run(Thread.java:619) >>>> >>>> >>>> >>>> On Sun, 2010-07-25 at 00:36 +0000, [hidden email] >>>> wrote: >>>>> Author: lektran >>>>> Date: Sun Jul 25 00:36:13 2010 >>>>> New Revision: 978954 >>>>> >>>>> URL: http://svn.apache.org/viewvc?rev=978954&view=rev >>>>> Log: >>>>> Converted all render* methods to use >>>> executeMacro(Writer, String, Map) instead of >>>> executeMacro(Writer, String). Removes over 100 lines >>>> of StringWriter usage, makes the code easier to read and >>>> also fixes the bug that Jacques committed a workaround for >>>> in r978893 >>>>> >>>>> Modified: >>>>> >>>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java >>>>> >>>>> Modified: >>>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java >>>>> URL: > http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java?rev=978954&r1=978953&r2=978954&view=diff >>>>> >>>> ============================================================================== >>>>> --- >>>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java >>>> (original) >>>>> +++ >>>> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java >>>> Sun Jul 25 00:36:13 2010 >>>>> @@ -139,11 +139,11 @@ public class MacroScreenRenderer >>>> impleme >>>>> } >>>>> >>>>> public void >>>> renderScreenBegin(Appendable writer, Map<String, >>>> Object> context) throws IOException { >>>>> - executeMacro(writer, >>>> "<@renderScreenBegin/>"); >>>>> + executeMacro(writer, >>>> "renderScreenBegin", null); >>>>> } >>>>> >>>>> public void >>>> renderScreenEnd(Appendable writer, Map<String, Object> >>>> context) throws IOException { >>>>> - executeMacro(writer, >>>> "<@renderScreenEnd/>"); >>>>> + executeMacro(writer, >>>> "renderScreenEnd", null); >>>>> } >>>>> >>>>> public void >>>> renderSectionBegin(Appendable writer, Map<String, >>>> Object> context, ModelScreenWidget.Section section) >>>> throws IOException { >>>>> @@ -151,24 +151,23 @@ public class MacroScreenRenderer >>>> impleme >>>>> >>>> this.widgetCommentsEnabled = >>>> ModelWidget.widgetBoundaryCommentsEnabled(context); >>>>> } >>>>> if >>>> (this.widgetCommentsEnabled) { >>>>> - >>>> StringWriter sr = new StringWriter(); >>>>> - >>>> sr.append("<@renderSectionBegin "); >>>>> - >>>> sr.append("boundaryComment=\"Begin "); >>>>> - >>>> sr.append(section.isMainSection ? "Screen " : "Section >>>> Widget "); >>>>> - >>>> sr.append(section.getBoundaryCommentName()); >>>>> - >>>> sr.append("\"/>"); >>>>> - >>>> executeMacro(writer, sr.toString()); >>>>> + >>>> Map<String, Object> parameters = >>>> FastMap.newInstance(); >>>>> + >>>> StringBuilder sb = new StringBuilder("Begin "); >>>>> + >>>> sb.append(section.isMainSection ? "Screen " : "Section >>>> Widget "); >>>>> + >>>> sb.append(section.getBoundaryCommentName()); >>>>> + >>>> parameters.put("boundaryComment", sb.toString()); >>>>> + >>>> executeMacro(writer, "renderSectionBegin", parameters); >>>>> } >>>>> } >>>>> public void >>>> renderSectionEnd(Appendable writer, Map<String, >>>> Object> context, ModelScreenWidget.Section section) >>>> throws IOException { >>>>> if >>>> (this.widgetCommentsEnabled) { >>>>> - >>>> StringWriter sr = new StringWriter(); >>>>> - >>>> sr.append("<@renderSectionEnd "); >>>>> - >>>> sr.append("boundaryComment=\"End "); >>>>> - >>>> sr.append(section.isMainSection ? "Screen " : "Section >>>> Widget "); >>>>> - >>>> sr.append(section.getBoundaryCommentName()); >>>>> - >>>> sr.append("\"/>"); >>>>> - >>>> executeMacro(writer, sr.toString()); >>>>> + >>>> Map<String, Object> parameters = >>>> FastMap.newInstance(); >>>>> + >>>> StringBuilder sb = new StringBuilder(); >>>>> + >>>> sb.append("End "); >>>>> + >>>> sb.append(section.isMainSection ? "Screen " : "Section >>>> Widget "); >>>>> + >>>> sb.append(section.getBoundaryCommentName()); >>>>> + >>>> parameters.put("boundaryComment", sb.toString()); >>>>> + >>>> executeMacro(writer, "renderSectionEnd", parameters); >>>>> } >>>>> } >>>>> >>>>> @@ -186,88 +185,64 @@ public class MacroScreenRenderer >>>> impleme >>>>> >>>> RequestHandler rh = (RequestHandler) >>>> ctx.getAttribute("_REQUEST_HANDLER_"); >>>>> >>>> autoUpdateLink = rh.makeLink(request, response, >>>> autoUpdateTarget); >>>>> } >>>>> - StringWriter sr = new >>>> StringWriter(); >>>>> - >>>> sr.append("<@renderContainerBegin "); >>>>> - sr.append("id=\""); >>>>> - sr.append(containerId); >>>>> - sr.append("\" >>>> style=\""); >>>>> - >>>> sr.append(container.getStyle(context)); >>>>> - sr.append("\" >>>> autoUpdateLink=\""); >>>>> - >>>> sr.append(autoUpdateLink); >>>>> - sr.append("\" >>>> autoUpdateInterval=\""); >>>>> - >>>> sr.append(container.getAutoUpdateInterval()); >>>>> - sr.append("\" />"); >>>>> - executeMacro(writer, >>>> sr.toString()); >>>>> + Map<String, Object> >>>> parameters = FastMap.newInstance(); >>>>> + parameters.put("id", >>>> containerId); >>>>> + parameters.put("style", >>>> container.getStyle(context)); >>>>> + >>>> parameters.put("autoUpdateLink", autoUpdateLink); >>>>> + >>>> parameters.put("autoUpdateInterval", >>>> container.getAutoUpdateInterval()); >>>>> + executeMacro(writer, >>>> "renderContainerBegin", parameters); >>>>> } >>>>> >>>>> public void >>>> renderContainerEnd(Appendable writer, Map<String, >>>> Object> context, ModelScreenWidget.Container container) >>>> throws IOException { >>>>> - StringWriter sr = new >>>> StringWriter(); >>>>> - >>>> sr.append("<@renderContainerEnd/>"); >>>>> - executeMacro(writer, >>>> sr.toString()); >>>>> + executeMacro(writer, >>>> "renderContainerEnd", null); >>>>> } >>>>> >>>>> public void renderLabel(Appendable >>>> writer, Map<String, Object> context, >>>> ModelScreenWidget.Label label) throws IOException { >>>>> - String labelText = >>>> label.getText(context); >>>>> - StringWriter sr = new >>>> StringWriter(); >>>>> - >>>> sr.append("<@renderLabel "); >>>>> - sr.append("text=\""); >>>>> - sr.append(labelText); >>>>> - sr.append("\" id=\""); >>>>> - >>>> sr.append(label.getId(context)); >>>>> - sr.append("\" >>>> style=\""); >>>>> - >>>> sr.append(label.getStyle(context)); >>>>> - sr.append("\" />"); >>>>> - executeMacro(writer, >>>> sr.toString()); >>>>> + Map<String, Object> >>>> parameters = FastMap.newInstance(); >>>>> + parameters.put("text", >>>> label.getText(context)); >>>>> + parameters.put("id", >>>> label.getId(context)); >>>>> + parameters.put("style", >>>> label.getStyle(context)); >>>>> + executeMacro(writer, >>>> "renderLabel", parameters); >>>>> } >>>>> >>>>> public void >>>> renderHorizontalSeparator(Appendable writer, Map<String, >>>> Object> context, ModelScreenWidget.HorizontalSeparator >>>> separator) throws IOException { >>>>> - StringWriter sr = new >>>> StringWriter(); >>>>> - >>>> sr.append("<@renderHorizontalSeparator "); >>>>> - sr.append("id=\""); >>>>> - >>>> sr.append(separator.getId(context)); >>>>> - sr.append("\" >>>> style=\""); >>>>> - >>>> sr.append(separator.getStyle(context)); >>>>> - sr.append("\" />"); >>>>> - executeMacro(writer, >>>> sr.toString()); >>>>> + Map<String, Object> >>>> parameters = FastMap.newInstance(); >>>>> + parameters.put("id", >>>> separator.getId(context)); >>>>> + parameters.put("style", >>>> separator.getStyle(context)); >>>>> + executeMacro(writer, >>>> "renderHorizontalSeparator", parameters); >>>>> } >>>>> >>>>> public void renderLink(Appendable >>>> writer, Map<String, Object> context, >>>> ModelScreenWidget.Link link) throws IOException { >>>>> HttpServletResponse >>>> response = (HttpServletResponse) context.get("response"); >>>>> HttpServletRequest >>>> request = (HttpServletRequest) context.get("request"); >>>>> >>>>> - String targetWindow = >>>> link.getTargetWindow(context); >>>>> String target = >>>> link.getTarget(context); >>>>> >>>>> - String uniqueItemName = >>>> link.getModelScreen().getName() + "_LF_" + >>>> UtilMisc.<String>addToBigDecimalInMap(context, >>>> "screenUniqueItemIndex", BigDecimal.ONE); >>>>> >>>>> String linkType = >>>> WidgetWorker.determineAutoLinkType(link.getLinkType(), >>>> target, link.getUrlMode(), request); >>>>> - String linkUrl = ""; >>>>> String actionUrl = >>>> ""; >>>>> - StringBuilder >>>> parameters=new StringBuilder(); >>>>> + StringBuilder >>>> targetParameters = new StringBuilder(); >>>>> if >>>> ("hidden-form".equals(linkType)) { >>>>> >>>> StringBuilder sb = new StringBuilder(); >>>>> >>>> WidgetWorker.buildHyperlinkUrl(sb, target, >>>> link.getUrlMode(), null, link.getPrefix(context), >>>>> >>>> link.getFullPath(), link.getSecure(), >>>> link.getEncode(), request, response, context); >>>>> >>>> actionUrl = sb.toString(); >>>>> - >>>> parameters.append("["); >>>>> + >>>> targetParameters.append("["); >>>>> for >>>> (Map.Entry<String, String> parameter: >>>> link.getParameterMap(context).entrySet()) { >>>>> - >>>> if (parameters.length() >1) { >>>>> - >>>> parameters.append(","); >>>>> + >>>> if (targetParameters.length() >1) { >>>>> + >>>> targetParameters.append(","); >>>>> >>>> } >>>>> - >>>> parameters.append("{'name':'"); >>>>> - >>>> parameters.append(parameter.getKey()); >>>>> - >>>> parameters.append("'"); >>>>> - >>>> parameters.append(",'value':'"); >>>>> - >>>> parameters.append(parameter.getValue()); >>>>> - >>>> parameters.append("'}"); >>>>> - } >>>>> - >>>> parameters.append("]"); >>>>> + >>>> targetParameters.append("{'name':'"); >>>>> + >>>> targetParameters.append(parameter.getKey()); >>>>> + >>>> targetParameters.append("'"); >>>>> + >>>> targetParameters.append(",'value':'"); >>>>> + >>>> targetParameters.append(parameter.getValue()); >>>>> + >>>> targetParameters.append("'}"); >>>>> + } >>>>> + >>>> targetParameters.append("]"); >>>>> >>>>> } >>>>> - String id = >>>> link.getId(context); >>>>> - String style = >>>> link.getStyle(context); >>>>> - String name = >>>> link.getName(context); >>>>> - String text = >>>> link.getText(context); >>>>> + String linkUrl = ""; >>>>> if >>>> (UtilValidate.isNotEmpty(target)) { >>>>> if >>>> (!"hidden-form".equals(linkType)) { >>>>> >>>> StringBuilder sb = new StringBuilder(); >>>>> @@ -283,46 +258,30 @@ public class MacroScreenRenderer >>>> impleme >>>>> >>>> renderImage(sw, context, img); >>>>> imgStr >>>> = sw.toString(); >>>>> } >>>>> - StringWriter sr = new >>>> StringWriter(); >>>>> - >>>> sr.append("<@renderLink "); >>>>> - >>>> sr.append("parameterList="); >>>>> - >>>> sr.append(parameters.length()==0?"\"\"":parameters.toString()); >>>>> - sr.append(" >>>> targetWindow=\""); >>>>> - sr.append(targetWindow); >>>>> - sr.append("\" >>>> target=\""); >>>>> - sr.append(target); >>>>> - sr.append("\" >>>> uniqueItemName=\""); >>>>> - >>>> sr.append(uniqueItemName); >>>>> - sr.append("\" >>>> linkType=\""); >>>>> - sr.append(linkType); >>>>> - sr.append("\" >>>> actionUrl=\""); >>>>> - sr.append(actionUrl); >>>>> - sr.append("\" id=\""); >>>>> - sr.append(id); >>>>> - sr.append("\" >>>> style=\""); >>>>> - sr.append(style); >>>>> - sr.append("\" name=\""); >>>>> - sr.append(name); >>>>> - sr.append("\" >>>> linkUrl=\""); >>>>> - sr.append(linkUrl); >>>>> - sr.append("\" text=\""); >>>>> - sr.append(text); >>>>> - sr.append("\" >>>> imgStr=\""); >>>>> - >>>> sr.append(imgStr.replaceAll("\"", "\\\\\"")); >>>>> - sr.append("\" />"); >>>>> - executeMacro(writer, >>>> sr.toString()); >>>>> + >>>>> + Map<String, Object> >>>> parameters = FastMap.newInstance(); >>>>> + >>>> parameters.put("parameterList", >>>> targetParameters.toString()); >>>>> + >>>> parameters.put("targetWindow", >>>> link.getTargetWindow(context)); >>>>> + parameters.put("target", >>>> target); >>>>> + >>>>> + String uniqueItemName = >>>> link.getModelScreen().getName() + "_LF_" + >>>> UtilMisc.<String>addToBigDecimalInMap(context, >>>> "screenUniqueItemIndex", BigDecimal.ONE); >>>>> + >>>> parameters.put("uniqueItemName", uniqueItemName); >>>>> + >>>>> + >>>> parameters.put("linkType", linkType); >>>>> + >>>> parameters.put("actionUrl", actionUrl); >>>>> + parameters.put("id", >>>> link.getId(context)); >>>>> + parameters.put("style", >>>> link.getStyle(context)); >>>>> + parameters.put("name", >>>> link.getName(context)); >>>>> + parameters.put("linkUrl", >>>> linkUrl); >>>>> + parameters.put("text", >>>> link.getText(context)); >>>>> + parameters.put("imgStr", >>>> imgStr); >>>>> + executeMacro(writer, >>>> "renderLink", parameters); >>>>> } >>>>> >>>>> public void renderImage(Appendable >>>> writer, Map<String, Object> context, >>>> ModelScreenWidget.Image image) throws IOException { >>>>> if (image == null) >>>>> return >>>> ; >>>>> String src = >>>> image.getSrc(context); >>>>> - String id = >>>> image.getId(context); >>>>> - String style = >>>> image.getStyle(context); >>>>> - String wid = >>>> image.getWidth(context); >>>>> - String hgt = >>>> image.getHeight(context); >>>>> - String border = >>>> image.getBorder(context); >>>>> - String alt = >>>> image.getAlt(context); >>>>> >>>>> String urlMode = >>>> image.getUrlMode(); >>>>> boolean fullPath = >>>> false; >>>>> @@ -349,46 +308,30 @@ public class MacroScreenRenderer >>>> impleme >>>>> } else { >>>>> >>>> urlString = src; >>>>> } >>>>> - StringWriter sr = new >>>> StringWriter(); >>>>> - >>>> sr.append("<@renderImage "); >>>>> - sr.append("src=\""); >>>>> - sr.append(src); >>>>> - sr.append("\" id=\""); >>>>> - sr.append(id); >>>>> - sr.append("\" >>>> style=\""); >>>>> - sr.append(style); >>>>> - sr.append("\" wid=\""); >>>>> - sr.append(wid); >>>>> - sr.append("\" hgt=\""); >>>>> - sr.append(hgt); >>>>> - sr.append("\" >>>> border=\""); >>>>> - sr.append(border); >>>>> - sr.append("\" alt=\""); >>>>> - sr.append(alt); >>>>> - sr.append("\" >>>> urlString=\""); >>>>> - sr.append(urlString); >>>>> - sr.append("\" />"); >>>>> - executeMacro(writer, >>>> sr.toString()); >>>>> + Map<String, Object> >>>> parameters = FastMap.newInstance(); >>>>> + parameters.put("src", >>>> src); >>>>> + parameters.put("id", >>>> image.getId(context)); >>>>> + parameters.put("style", >>>> image.getStyle(context)); >>>>> + parameters.put("wid", >>>> image.getWidth(context)); >>>>> + parameters.put("hgt", >>>> image.getHeight(context)); >>>>> + parameters.put("border", >>>> image.getBorder(context)); >>>>> + parameters.put("alt", >>>> image.getAlt(context)); >>>>> + >>>> parameters.put("urlString", urlString); >>>>> + executeMacro(writer, >>>> "renderImage", parameters); >>>>> } >>>>> >>>>> public void >>>> renderContentBegin(Appendable writer, Map<String, >>>> Object> context, ModelScreenWidget.Content content) >>>> throws IOException { >>>>> String >>>> editRequest = content.getEditRequest(context); >>>>> - String >>>> editContainerStyle = >>>> content.getEditContainerStyle(context); >>>>> String >>>> enableEditName = content.getEnableEditName(context); >>>>> String >>>> enableEditValue = (String)context.get(enableEditName); >>>>> >>>>> if >>>> (Debug.verboseOn()) Debug.logVerbose("directEditRequest:" + >>>> editRequest, module); >>>>> >>>>> - StringWriter >>>> sr = new StringWriter(); >>>>> - >>>> sr.append("<@renderContentBegin "); >>>>> - >>>> sr.append("editRequest=\""); >>>>> - >>>> sr.append(editRequest); >>>>> - sr.append("\" >>>> enableEditValue=\""); >>>>> - >>>> sr.append(enableEditValue); >>>>> - sr.append("\" >>>> editContainerStyle=\""); >>>>> - >>>> sr.append(editContainerStyle); >>>>> - sr.append("\" >>>> />"); >>>>> - >>>> executeMacro(writer, sr.toString()); >>>>> + Map<String, >>>> Object> parameters = FastMap.newInstance(); >>>>> + >>>> parameters.put("editRequest", >>>> editRequest); >>>>> + >>>> parameters.put("enableEditValue", >>>> enableEditValue); >>>>> + >>>> parameters.put("editContainerStyle", >>>> content.getEditContainerStyle(context)); >>>>> + >>>> executeMacro(writer, "renderContentBegin", >>>> parameters); >>>>> } >>>>> >>>>> public void >>>> renderContentBody(Appendable writer, Map<String, >>>> Object> context, ModelScreenWidget.Content content) >>>> throws IOException { >>>>> @@ -459,7 +402,6 @@ public class MacroScreenRenderer >>>> impleme >>>>> String >>>> expandedContentId = content.getContentId(context); >>>>> String editMode = >>>> "Edit"; >>>>> String editRequest = >>>> content.getEditRequest(context); >>>>> - String editContainerStyle >>>> = content.getEditContainerStyle(context); >>>>> String >>>> enableEditName = content.getEnableEditName(context); >>>>> String >>>> enableEditValue = (String)context.get(enableEditName); >>>>> String urlString = >>>> ""; >>>>> @@ -479,29 +421,19 @@ public class MacroScreenRenderer >>>> impleme >>>>> >>>> urlString = rh.makeLink(request, response, >>>> editRequest, false, false, false); >>>>> } >>>>> >>>>> - >>>> StringWriter sr = new StringWriter(); >>>>> - >>>> sr.append("<@renderContentEnd "); >>>>> - >>>> sr.append("urlString=\""); >>>>> - >>>> sr.append(urlString); >>>>> - >>>> sr.append("\" editMode=\""); >>>>> - >>>> sr.append(editMode); >>>>> - >>>> sr.append("\" editContainerStyle=\""); >>>>> - >>>> sr.append(editContainerStyle); >>>>> - >>>> sr.append("\" editRequest=\""); >>>>> - >>>> sr.append(editRequest); >>>>> - >>>> sr.append("\" enableEditValue=\""); >>>>> - >>>> sr.append(enableEditValue); >>>>> - >>>> sr.append("\" />"); >>>>> - >>>> executeMacro(writer, sr.toString()); >>>>> + >>>> Map<String, Object> parameters = >>>> FastMap.newInstance(); >>>>> + >>>> parameters.put("urlString", urlString); >>>>> + >>>> parameters.put("editMode", editMode); >>>>> + >>>> parameters.put("editContainerStyle", >>>> content.getEditContainerStyle(context)); >>>>> + >>>> parameters.put("editRequest", editRequest); >>>>> + >>>> parameters.put("enableEditValue", enableEditValue); >>>>> + >>>> executeMacro(writer, "renderContentEnd", parameters); >>>>> } >>>>> } >>>>> >>>>> public void >>>> renderContentFrame(Appendable writer, Map<String, >>>> Object> context, ModelScreenWidget.Content content) >>>> throws IOException { >>>>> String >>>> dataResourceId = content.getDataResourceId(context); >>>>> String urlString = >>>> "/ViewSimpleContent?dataResourceId=" + dataResourceId; >>>>> - String width = >>>> content.getWidth(); >>>>> - String height = >>>> content.getHeight(); >>>>> - String border = >>>> content.getBorder(); >>>>> String fullUrlString >>>> = ""; >>>>> HttpServletRequest >>>> request = (HttpServletRequest) context.get("request"); >>>>> HttpServletResponse >>>> response = (HttpServletResponse) context.get("response"); >>>>> @@ -510,36 +442,24 @@ public class MacroScreenRenderer >>>> impleme >>>>> >>>> RequestHandler rh = (RequestHandler) >>>> ctx.getAttribute("_REQUEST_HANDLER_"); >>>>> >>>> fullUrlString = rh.makeLink(request, response, urlString, >>>> true, false, false); >>>>> } >>>>> - StringWriter sr = new >>>> StringWriter(); >>>>> - >>>> sr.append("<@renderContentFrame "); >>>>> - sr.append("fullUrl=\""); >>>>> - >>>> sr.append(fullUrlString); >>>>> - sr.append("\" >>>> width=\""); >>>>> - sr.append(width); >>>>> - sr.append("\" >>>> height=\""); >>>>> - sr.append(height); >>>>> - sr.append("\" >>>> border=\""); >>>>> - sr.append(border); >>>>> - sr.append("\" />"); >>>>> - executeMacro(writer, >>>> sr.toString()); >>>>> + >>>>> + Map<String, Object> >>>> parameters = FastMap.newInstance(); >>>>> + parameters.put("fullUrl", >>>> fullUrlString); >>>>> + parameters.put("width", >>>> content.getWidth()); >>>>> + parameters.put("height", >>>> content.getHeight()); >>>>> + parameters.put("border", >>>> content.getBorder()); >>>>> + executeMacro(writer, >>>> "renderContentFrame", parameters); >>>>> } >>>>> >>>>> public void >>>> renderSubContentBegin(Appendable writer, Map<String, >>>> Object> context, ModelScreenWidget.SubContent content) >>>> throws IOException { >>>>> - String >>>> editRequest = content.getEditRequest(context); >>>>> - String >>>> editContainerStyle = >>>> content.getEditContainerStyle(context); >>>>> String >>>> enableEditName = content.getEnableEditName(context); >>>>> String >>>> enableEditValue = (String)context.get(enableEditName); >>>>> >>>>> - StringWriter >>>> sr = new StringWriter(); >>>>> - >>>> sr.append("<@renderSubContentBegin "); >>>>> - sr.append(" >>>> editContainerStyle=\""); >>>>> - >>>> sr.append(editContainerStyle); >>>>> - sr.append("\" >>>> editRequest=\""); >>>>> - >>>> sr.append(editRequest); >>>>> - sr.append("\" >>>> enableEditValue=\""); >>>>> - >>>> sr.append(enableEditValue); >>>>> - sr.append("\" >>>> />"); >>>>> - >>>> executeMacro(writer, sr.toString()); >>>>> + Map<String, >>>> Object> parameters = FastMap.newInstance(); >>>>> + >>>> parameters.put("editContainerStyle", >>>> content.getEditContainerStyle(context)); >>>>> + >>>> parameters.put("editRequest", >>>> content.getEditRequest(context)); >>>>> + >>>> parameters.put("enableEditValue", >>>> enableEditValue); >>>>> + >>>> executeMacro(writer, >>>> "renderSubContentBegin", parameters); >>>>> } >>>>> >>>>> public void >>>> renderSubContentBody(Appendable writer, Map<String, >>>> Object> context, ModelScreenWidget.SubContent content) >>>> throws IOException { >>>>> @@ -593,7 +513,6 @@ public class MacroScreenRenderer >>>> impleme >>>>> public void >>>> renderSubContentEnd(Appendable writer, Map<String, >>>> Object> context, ModelScreenWidget.SubContent content) >>>> throws IOException { >>>>> String >>>> editMode = "Edit"; >>>>> String >>>> editRequest = content.getEditRequest(context); >>>>> - String >>>> editContainerStyle = >>>> content.getEditContainerStyle(context); >>>>> String >>>> enableEditName = content.getEnableEditName(context); >>>>> String >>>> enableEditValue = (String)context.get(enableEditName); >>>>> String >>>> expandedContentId = content.getContentId(context); >>>>> @@ -618,20 +537,13 @@ public class MacroScreenRenderer >>>> impleme >>>>> >>>> } >>>>> } >>>>> >>>>> - StringWriter >>>> sr = new StringWriter(); >>>>> - >>>> sr.append("<@renderSubContentEnd "); >>>>> - >>>> sr.append("urlString=\""); >>>>> - >>>> sr.append(urlString); >>>>> - sr.append("\" >>>> editMode=\""); >>>>> - >>>> sr.append(editMode); >>>>> - sr.append("\" >>>> editContainerStyle=\""); >>>>> - >>>> sr.append(editContainerStyle); >>>>> - sr.append("\" >>>> editRequest=\""); >>>>> - >>>> sr.append(editRequest); >>>>> - sr.append("\" >>>> enableEditValue=\""); >>>>> - >>>> sr.append(enableEditValue); >>>>> - sr.append("\" >>>> />"); >>>>> - >>>> executeMacro(writer, sr.toString()); >>>>> + Map<String, >>>> Object> parameters = FastMap.newInstance(); >>>>> + >>>> parameters.put("urlString", urlString); >>>>> + >>>> parameters.put("editMode", editMode); >>>>> + >>>> parameters.put("editContainerStyle", >>>> content.getEditContainerStyle(context)); >>>>> + >>>> parameters.put("editRequest", >>>> editRequest); >>>>> + >>>> parameters.put("enableEditValue", >>>> enableEditValue); >>>>> + >>>> executeMacro(writer, >>>> "renderSubContentEnd", parameters); >>>>> } >>>>> >>>>> >>>>> @@ -652,7 +564,6 @@ public class MacroScreenRenderer >>>> impleme >>>>> String expandToolTip >>>> = ""; >>>>> String >>>> collapseToolTip = ""; >>>>> String fullUrlString >>>> = ""; >>>>> - boolean padded = >>>> screenlet.padded(); >>>>> String menuString = >>>> ""; >>>>> boolean showMore = >>>> false; >>>>> if >>>> (UtilValidate.isNotEmpty(title) || navMenu != null || >>>> navForm != null || collapsible) { >>>>> @@ -687,36 +598,21 @@ public class MacroScreenRenderer >>>> impleme >>>>> } >>>>> } >>>>> >>>>> - StringWriter sr = new >>>> StringWriter(); >>>>> - >>>> sr.append("<@renderScreenletBegin "); >>>>> - sr.append("id=\""); >>>>> - >>>> sr.append(screenlet.getId(context)); >>>>> - sr.append("\" >>>> title=\""); >>>>> - sr.append(title); >>>>> - sr.append("\" >>>> collapsible="); >>>>> - >>>> sr.append(Boolean.toString(collapsible)); >>>>> - sr.append(" >>>> saveCollapsed="); >>>>> - >>>> sr.append(Boolean.toString(screenlet.saveCollapsed())); >>>>> - sr.append(" >>>> collapsibleAreaId=\""); >>>>> - >>>> sr.append(collapsibleAreaId); >>>>> - sr.append("\" >>>> expandToolTip=\""); >>>>> - >>>> sr.append(expandToolTip); >>>>> - sr.append("\" >>>> collapseToolTip=\""); >>>>> - >>>> sr.append(collapseToolTip); >>>>> - sr.append("\" >>>> fullUrlString=\""); >>>>> - >>>> sr.append(fullUrlString); >>>>> - sr.append("\" padded="); >>>>> - >>>> sr.append(Boolean.toString(padded)); >>>>> - sr.append(" >>>> menuString=\""); >>>>> - >>>> sr.append(menuString.replaceAll("\"", "\\\\\"")); >>>>> - sr.append("\" >>>> showMore="); >>>>> - >>>> sr.append(Boolean.toString(showMore)); >>>>> - sr.append(" >>>> collapsed="); >>>>> - >>>> sr.append(Boolean.toString(collapsed)); >>>>> - sr.append(" >>>> javaScriptEnabled="); >>>>> - >>>> sr.append(Boolean.toString(javaScriptEnabled)); >>>>> - sr.append(" />"); >>>>> - executeMacro(writer, >>>> sr.toString()); >>>>> + Map<String, Object> >>>> parameters = FastMap.newInstance(); >>>>> + parameters.put("id", >>>> screenlet.getId(context)); >>>>> + parameters.put("title", >>>> title); >>>>> + >>>> parameters.put("collapsible", collapsible); >>>>> + >>>> parameters.put("saveCollapsed", screenlet.saveCollapsed()); >>>>> + >>>> parameters.put("collapsibleAreaId", collapsibleAreaId); >>>>> + >>>> parameters.put("expandToolTip", expandToolTip); >>>>> + >>>> parameters.put("collapseToolTip", collapseToolTip); >>>>> + >>>> parameters.put("fullUrlString", fullUrlString); >>>>> + parameters.put("padded", >>>> screenlet.padded()); >>>>> + >>>> parameters.put("menuString", menuString); >>>>> + >>>> parameters.put("showMore", showMore); >>>>> + >>>> parameters.put("collapsed", collapsed); >>>>> + >>>> parameters.put("javaScriptEnabled", javaScriptEnabled); >>>>> + executeMacro(writer, >>>> "renderScreenletBegin", parameters); >>>>> } >>>>> >>>>> public void >>>> renderScreenletSubWidget(Appendable writer, Map<String, >>>> Object> context, ModelScreenWidget subWidget, >>>> ModelScreenWidget.Screenlet screenlet) throws >>>> GeneralException, IOException { >>>>> @@ -738,9 +634,7 @@ public class MacroScreenRenderer >>>> impleme >>>>> } >>>>> } >>>>> public void >>>> renderScreenletEnd(Appendable writer, Map<String, >>>> Object> context, ModelScreenWidget.Screenlet screenlet) >>>> throws IOException { >>>>> - StringWriter sr = new >>>> StringWriter(); >>>>> - >>>> sr.append("<@renderScreenletEnd/>"); >>>>> - executeMacro(writer, >>>> sr.toString()); >>>>> + executeMacro(writer, >>>> "renderScreenletEnd", null); >>>>> } >>>>> >>>>> protected void >>>> renderScreenletPaginateMenu(Appendable writer, >>>> Map<String, Object> context, ModelScreenWidget.Form >>>> form) throws IOException { >>>>> @@ -763,7 +657,6 @@ public class MacroScreenRenderer >>>> impleme >>>>> int viewSize = >>>> modelForm.getViewSize(context); >>>>> int listSize = >>>> modelForm.getListSize(context); >>>>> >>>>> - int lowIndex = >>>> modelForm.getLowIndex(context); >>>>> int highIndex = >>>> modelForm.getHighIndex(context); >>>>> int actualPageSize = >>>> modelForm.getActualPageSize(context); >>>>> >>>>> @@ -824,73 +717,47 @@ public class MacroScreenRenderer >>>> impleme >>>>> // The current >>>> screenlet title bar navigation syling requires rendering >>>>> // these links in >>>> reverse order >>>>> // Last button >>>>> - String paginateLastStyle >>>> = modelForm.getPaginateLastStyle(); >>>>> - String paginateLastLabel >>>> = modelForm.getPaginateLastLabel(context); >>>>> String lastLinkUrl = >>>> ""; >>>>> if (highIndex < >>>> listSize) { >>>>> int >>>> page = (listSize / viewSize); >>>>> >>>> linkText = prepLinkText + page + anchor; >>>>> >>>> lastLinkUrl = rh.makeLink(request, response, linkText); >>>>> } >>>>> - String paginateNextStyle >>>> = modelForm.getPaginateNextStyle(); >>>>> - String paginateNextLabel >>>> = modelForm.getPaginateNextLabel(context); >>>>> String nextLinkUrl = >>>> ""; >>>>> if (highIndex < >>>> listSize) { >>>>> >>>> linkText = prepLinkText + (viewIndex + 1) + anchor; >>>>> // - >>>> make the link >>>>> >>>> nextLinkUrl = rh.makeLink(request, response, linkText); >>>>> } >>>>> - String >>>> paginatePreviousStyle = >>>> modelForm.getPaginatePreviousStyle(); >>>>> - String >>>> paginatePreviousLabel = >>>> modelForm.getPaginatePreviousLabel(context); >>>>> String >>>> previousLinkUrl = ""; >>>>> if (viewIndex > >>>> 0) { >>>>> >>>> linkText = prepLinkText + (viewIndex - 1) + anchor; >>>>> >>>> previousLinkUrl = rh.makeLink(request, response, linkText); >>>>> } >>>>> - String paginateFirstStyle >>>> = modelForm.getPaginateFirstStyle(); >>>>> - String paginateFirstLabel >>>> = modelForm.getPaginateFirstLabel(context); >>>>> String firstLinkUrl >>>> = ""; >>>>> if (viewIndex > >>>> 0) { >>>>> >>>> linkText = prepLinkText + 0 + anchor; >>>>> >>>> firstLinkUrl = rh.makeLink(request, response, linkText); >>>>> } >>>>> >>>>> - StringWriter sr = new >>>> StringWriter(); >>>>> - >>>> sr.append("<@renderScreenletPaginateMenu "); >>>>> - >>>> sr.append("lowIndex=\""); >>>>> - >>>> sr.append(Integer.toString(lowIndex)); >>>>> - sr.append("\" >>>> actualPageSize=\""); >>>>> - >>>> sr.append(Integer.toString(actualPageSize)); >>>>> - sr.append("\" >>>> ofLabel=\""); >>>>> - sr.append(ofLabel); >>>>> - sr.append("\" >>>> listSize=\""); >>>>> - >>>> sr.append(Integer.toString(listSize)); >>>>> - sr.append("\" >>>> paginateLastStyle=\""); >>>>> - >>>> sr.append(paginateLastStyle); >>>>> - sr.append("\" >>>> lastLinkUrl=\""); >>>>> - sr.append(lastLinkUrl); >>>>> - sr.append("\" >>>> paginateLastLabel=\""); >>>>> - >>>> sr.append(paginateLastLabel); >>>>> - sr.append("\" >>>> paginateNextStyle=\""); >>>>> - >>>> sr.append(paginateNextStyle); >>>>> - sr.append("\" >>>> nextLinkUrl=\""); >>>>> - sr.append(nextLinkUrl); >>>>> - sr.append("\" >>>> paginateNextLabel=\""); >>>>> - >>>> sr.append(paginateNextLabel); >>>>> - sr.append("\" >>>> paginatePreviousStyle=\""); >>>>> - >>>> sr.append(paginatePreviousStyle); >>>>> - sr.append("\" >>>> paginatePreviousLabel=\""); >>>>> - >>>> sr.append(paginatePreviousLabel); >>>>> - sr.append("\" >>>> previousLinkUrl=\""); >>>>> - >>>> sr.append(previousLinkUrl); >>>>> - sr.append("\" >>>> paginateFirstStyle=\""); >>>>> - >>>> sr.append(paginateFirstStyle); >>>>> - sr.append("\" >>>> paginateFirstLabel=\""); >>>>> - >>>> sr.append(paginateFirstLabel); >>>>> - sr.append("\" >>>> firstLinkUrl=\""); >>>>> - sr.append(firstLinkUrl); >>>>> - sr.append("\" />"); >>>>> - executeMacro(writer, >>>> sr.toString()); >>>>> + Map<String, Object> >>>> parameters = FastMap.newInstance(); >>>>> + >>>> parameters.put("lowIndex", modelForm.getLowIndex(context)); >>>>> + >>>> parameters.put("actualPageSize", actualPageSize); >>>>> + parameters.put("ofLabel", >>>> ofLabel); >>>>> + >>>> parameters.put("listSize", listSize); >>>>> + >>>> parameters.put("paginateLastStyle", >>>> modelForm.getPaginateLastStyle()); >>>>> + >>>> parameters.put("lastLinkUrl", lastLinkUrl); >>>>> + >>>> parameters.put("paginateLastLabel", >>>> modelForm.getPaginateLastLabel(context)); >>>>> + >>>> parameters.put("paginateNextStyle", >>>> modelForm.getPaginateNextStyle()); >>>>> + >>>> parameters.put("nextLinkUrl", nextLinkUrl); >>>>> + >>>> parameters.put("paginateNextLabel", >>>> modelForm.getPaginateNextLabel(context)); >>>>> + >>>> parameters.put("paginatePreviousStyle", >>>> modelForm.getPaginatePreviousStyle()); >>>>> + >>>> parameters.put("paginatePreviousLabel", >>>> modelForm.getPaginatePreviousLabel(context)); >>>>> + >>>> parameters.put("previousLinkUrl", previousLinkUrl); >>>>> + >>>> parameters.put("paginateFirstStyle", >>>> modelForm.getPaginateFirstStyle()); >>>>> + >>>> parameters.put("paginateFirstLabel", >>>> modelForm.getPaginateFirstLabel(context)); >>>>> + >>>> parameters.put("firstLinkUrl", firstLinkUrl); >>>>> + executeMacro(writer, >>>> "renderScreenletPaginateMenu", parameters); >>>>> } >>>>> >>>>> } >>>>> >>>>> >>>> >>>> -- >>>> Ofbiz on twitter: http://twitter.com/apache_ofbiz >>>> Myself on twitter: http://twitter.com/hansbak >>>> Antwebsystems.com: Quality services for competitive rates. >>>> >>>> >>> >>> >>> >> >> > smime.p7s (3K) Download Attachment |
Free forum by Nabble | Edit this page |