RE: Rendering Bug?
Kirk Daries <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Message-ID | <D09B591872D1D611AF2B0010B5A1AAD07BEB4F@WCSMAIL> |
Hi Jake, Has the "SPAN" tag behaviour changed into Barracuda2.0/XMLC2.2?? E.g. <span id="pageDisplay" class="SmallerTitle">Page (# of ?)</span> The span tag was is used by some javascript/dhtml manipulation After rendering.. it looks like this. <SPAN class="SmallerTitle">Page (# of ?)</SPAN> The ID attribute has been stripped out... even though... it is was never used by any of my Barracuda Models. Is this the default behaviour in the new release? Regards KD -----Original Message----- From: Jacob Kjome [mailto:[email protected]] Sent: 22 June 2003 10:23 To: [email protected] Subject: RE: [Barracuda] Rendering Bug? Hi Kirk, Yes, this threw me for a loop when updating XMLC to work with Xerces2 and the html dom that comes with Xerces2. Unfortunately, a bastardized version of the html dom made it into j2sdk1.4.x which is actually an early version for the html DOM level2 draft which was completely unofficial at the time. The new html dom level2 recommendation has solved this by changing the namespace from org.w3c.dom.html to org.w3c.dom.html2. See... http://www.w3.org/TR/DOM-Level-2-HTML/java-binding.html <http://www.w3.org/TR/DOM-Level-2-HTML/java-binding.html> Xerces2, correctly, contains the official level1 html dom recommendation which does not include HTMLOptionElement#setSelected(boolean). Here is my commit comments for changes to HTMLSelectRenderer.java to account for this... <quote> Updated HTMLSelectRenderer to be in-line with the html dom level1 interfaces which don't include a setSelected(boolean) method in HTMLOptionElement. My comments in that file go into detail about this, so read them if you want more info. No behavioral changes should be seen from this change except that Barracuda will compile in the presence of the official html dom level1 interfaces provided by Xerces2. Updated XMLC at the same time since I just made similar changes to that project to bring XMLC fully (hopefully) in-line with the html dom level1 interfaces. Jake </quote> And here is the relevant comments and code in HMLSelectRenderer.java... <quote> //jkr_20030520.1 - setSelected(boolean) isn't actually part of the //html dom level1 api. Xerces1 included an early version of the //html dom level2 draft interfaces which were released with the //same package as the level1 dom. The level2 dom is now in the //namespace org.w3c.dom.html2. The switch in namespaces was made //sometime between the following releases... // http://www.w3.org/TR/2001/WD-DOM-Level-2-HTML-20011210/java-binding.html <http://www.w3.org/TR/2001/WD-DOM-Level-2-HTML-20011210/java-binding.html> //and // http://www.w3.org/TR/2002/CR-DOM-Level-2-HTML-20020605/java-binding.html <http://www.w3.org/TR/2002/CR-DOM-Level-2-HTML-20020605/java-binding.html> //Xerces2 includes the original level1 //html dom. In order to be compatible with that, we can't use the //setSelected(boolean) method (and, apparently, never should have). // opt.setSelected(lsm.isSelectedIndex(i)); if (lsm.isSelectedIndex(i)) opt.setAttribute("selected", "selected"); else opt.removeAttribute("selected"); </quote> So, the solution is to use the workaround (if you can call it that) that I did above in your own code. Note that there is no current implementation of the html dom level2 spec. Until there is, this is how you should code. Hope that clears things up. Jake At 09:38 PM 6/22/2003 +0200, you wrote: Hi Jake, Getting a weird exception. It's something to do the dom stuff?? Xerces2 or Xmlc. Don't know which one. The funny thing is. It compiles fine. The rest of the application works fine. Just when I hit this particular page it falls over. Here's the code snippet... pageSize = (HTMLSelectElement) xmlcPage.getElementById("pageSize"); . . . . //Process any properties for pageNumber if (pageSize != null) { //If there is no resultset, disabled the combo box. if ((dbResultSet == null) ||(dbResultSet.getTotalPages() == 0)) { pageSize.setDisabled(true); } else { //Get the Browse Sizes for this application StringTokenizer e = new StringTokenizer(requestContext.getApplication().getDefaultBrowsePageSizes(), ","); //Document doc = vc.getElementFactory().getDocument(); //Loop through list, adding option elements while (e.hasMoreElements()) { String size = e.nextToken(); //Use the HTML doc object to create option elements HTMLOptionElement optionElement = (HTMLOptionElement) xmlcPage.createElement("OPTION"); //Set their values optionElement.setValue(size); //Determine if the element needs to be selected if (pageSizeValue != null) { if (size.equals(pageSizeValue.toString())) { optionElement.setSelected(true); } } //Set the element text DOMUtil.setTextInNode(optionElement, size,false); //Add to the select element pageSize.add(optionElement,null); } } } Whadda think? This used to work in the release of Barracuda? Possible runtime conflict with another package?? The offending statement is: optionElement.setSelected(true); java.lang.NoSuchMethodError: org.w3c.dom.html.HTMLOptionElement.setSelected(Z)V at sitawc.barraframework.presentation.buttons.BrowseButtons.processButtonState( BrowseButtons.java:252) at sitawc.barraframework.presentation.buttons.BrowseButtons.processButtonNodes( BrowseButtons.java:78) at sitawc.barraframework.eventListeners.response.privateEvent.RenderBrowsePage_ Listener$RenderBrowsePage_Handler$BrowsePageModel.getItem(RenderBrowsePage_L istener.java:403) at org.enhydra.barracuda.core.comp.AbstractTemplateModel.getItem(AbstractTempla teModel.java:125) at org.enhydra.barracuda.core.comp.renderer.TemplateHelper.getNode(TemplateHelp er.java:307) at org.enhydra.barracuda.core.comp.renderer.TemplateHelper.copyChildNodes(Templ ateHelper.java:131) at org.enhydra.barracuda.core.comp.renderer.TemplateHelper.getNode(TemplateHelp er.java:618) at org.enhydra.barracuda.core.comp.renderer.TemplateHelper.copyChildNodes(Templ ateHelper.java:131) at org.enhydra.barracuda.core.comp.renderer.TemplateHelper.getNode(TemplateHelp er.java:618) at org.enhydra.barracuda.core.comp.renderer.TemplateHelper.copyChildNodes(Templ ateHelper.java:131) at org.enhydra.barracuda.core.comp.renderer.TemplateHelper.render(TemplateHelpe r.java:109) at org.enhydra.barracuda.core.comp.renderer.html.HTMLTemplateRenderer.renderCom ponent(HTMLTemplateRenderer.java:114) at org.enhydra.barracuda.core.comp.BComponent.renderView(BComponent.java:567) at org.enhydra.barracuda.core.comp.BComponent.render(BComponent.java:462) at org.enhydra.barracuda.core.comp.BComponent.render(BComponent.java:480) at org.enhydra.barracuda.core.comp.BComponent.render(BComponent.java:388) at sitawc.barraframework.eventListeners.response.privateEvent.RenderBrowsePage_ Listener$RenderBrowsePage_Handler.handleViewEvent(RenderBrowsePage_Listener. java:224) at org.enhydra.barracuda.core.event.DefaultBaseEventListener.handleEvent(Defaul tBaseEventListener.java:66) at org.enhydra.barracuda.core.event.DefaultEventDispatcher.notifyListeners(Defa ultEventDispatcher.java:415) at org.enhydra.barracuda.core.event.DefaultEventDispatcher.dispatch(DefaultEven tDispatcher.java:185) at org.enhydra.barracuda.core.event.DefaultEventDispatcher.dispatchEvent(Defaul tEventDispatcher.java:122) at org.enhydra.barracuda.core.event.DefaultEventBroker.dispatchEvent(DefaultEve ntBroker.java:494) at org.enhydra.barracuda.core.event.ApplicationGateway.handleDefaultExt(Applica tionGateway.java:404) at org.enhydra.barracuda.core.event.ApplicationGateway.handleDefault(Applicatio nGateway.java:234) at org.enhydra.barracuda.core.event.ApplicationGateway.doGet(ApplicationGateway .java:717) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:256) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180 ) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve. java:171) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:641) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172 ) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java :174) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne ction(Http11Protocol.java:392) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav a:619) at java.lang.Thread.run(Thread.java:534) Thanx Regards KD -----Original Message----- From: Jacob Kjome [ mailto:[email protected] <mailto:[email protected]> ] Sent: 20 June 2003 07:10 To: [email protected] Subject: RE: [Barracuda] Rendering Bug? Hi Kirk, Note that you will need to have xercesImpl.jar (Xerces2) + xml-apis.jar or xmlParserAPIs.jar in your classpath. Actually, put them in one of the common lib directories in Tomcat 3.3. Remove any older xmlc-* jars....especially the xerces 1.4.4 jar. One quick way to see which jars you need in your WEB-INF/lib is to run "ant install" on the Barracuda build and then look at the resulting jars in WEB-INF/lib. You can copy the jars from there. The ones you need are (in alphabetical order)... barracuda-core.jar bcel-5.1.jar gnu-regexp-1.1.4.jar jtidy-r7-xmlc-2.2.jar log4j-1.2.8.jar log4j-sandbox-selector-0.1alpha.jar log4j-sandbox-servlet-0.1alpha.jar plankton.jar xmlc-all-runtime-2.2.jar To use the Localize taskdef, you will also need the following jar in your Ant build classpath... WEB-INF/jars/xmlc-taskdef-2.2.jar and, obviously, barracuda-ant.jar Also, read this: http://www.barracudamvc.org/Barracuda/docs/build_deploy.html <http://www.barracudamvc.org/Barracuda/docs/build_deploy.html> Make sure also to check Barracuda's web.xml and event-gateway.xml to see if there are any changes you might need to take into account. One thing might be the log4j initialization stuff (if you use it) which moved from Barracuda's codebase to the log4j sandbox codebase. Of course, you'll need to use the InitServlet rather than the InitContextListener for Tomcat 3.3. You should really think about updating to the latest Tomcat 4.1.xx where you can take advantage of servlet 2.3. If you have any specific issues with all this, let me know. Jake At 06:54 PM 6/20/2003 +0200, you wrote: Urrrm.... yep... Haven't upgraded yet. I tried about a week ago. Had problems getting the new xmlc release working with Barracuda. Or more to the point.. Getting it working under Tomcat 3.3... :( Will try again tom morning/afternoon... This is def on my todo list. -----Original Message----- From: Jacob Kjome [ mailto:[email protected] <mailto:[email protected]> ] Sent: 20 June 2003 06:44 To: [email protected] Subject: RE: [Barracuda] Rendering Bug? Hi Kirk, What version of Barracuda did you say you were using? Have you tried 1.2.0 or even the latest CVS? I think you will find a lot of bugs have been fixed and some things have been improved. I would try the upgrade and see if it fixes any of your issues. If it does, well, there you go. Don't need to worry about those things anymore. Jake At 05:32 PM 6/20/2003 +0200, you wrote: Hi Christian, Will consider using the custom model approach... Will report if this works or not. Thanx Regards KD -----Original Message----- From: Christian Cryder [ mailto:[email protected] <mailto:[email protected]> ] Sent: 20 June 2003 05:01 To: [email protected] Subject: RE: [Barracuda] Rendering Bug? Hmmm...this is quite odd. I wonder if that particular element is actually getting rendered twice? Might be interesting to stick a debug line in place and then see if the model is getting called multiple times for the same element. Another thing to consider is whether XMLC is somehow mucking with the structure (that's something of a longshot, since <div>s can be nested). One other thing to consider...while the approach you've outlined (returning null to control visibility) _should_ work, I personally prefer a different approach where you use a custom directive to control visibility. For instance, <div id="portlet_CallDesk" class="Dir::IsVisible.GetPage.p_has_access_calldesk_portal_calldesk"> What this requires you to do is implement the process_Directive method in your model: //process any custom directives public boolean processDirective(TemplateDirective td) { if (td.getCommand().equals(IS_VISIBLE)) { ...return true or false... } else { return true; } } THe advantage of this approach is that if you return false, no nodes below this are processed (whereas in the approach where you return null or an invisible component from getItem(), child nodes ARE still processed. So there are obvious performance advantages in taking this approach. Let us know if that helps... Christian ---------------------------------------------- Christian Cryder Internet Architect, ATMReports.com Project Chair, BarracudaMVC - http://barracudamvc.org <http://barracudamvc.org/> ---------------------------------------------- "Coffee? I could quit anytime, just not today" > -----Original Message----- > From: [email protected] > [ mailto:[email protected] <mailto:[email protected]> ]On Behalf Of Kirk Daries > Sent: Friday, June 20, 2003 8:31 AM > To: [email protected] > Subject: [Barracuda] Rendering Bug? > > > Hi Guys, > > I've come across a strange bug when one of my pages is rendered? > > Note the 'Dir::Get_Data.GetPage.p_has_access_calldesk_portal_calldesk' > directive. > This returns a BComponent if a user has rights to view the 'Div'. > It returns null when validation fails. > > Now..onto the bug. > > If validation is successful... processing continues until the next > directive. > Namely, 'Dir::Get_Data.GetPage.p_has_access_calldesk_anonymous_call_log' > This also evaluates based on the users security rights. > However, if I return null, to prevent the node from rendering, Barracuda > still > renders the node? > > Anyone got any clue as to why this is happening? > > Regards > KD > > <div id="portlet_CallDesk" class="portletTable > Dir::Get_Data.GetPage.p_has_access_calldesk_portal_calldesk"> > <div align="center" class="td_4">CallDesk</div> > <div > class="Dir::Get_Data.GetPage.p_has_access_calldesk_anonymous_call_log"> > <span class="td_2"><a class="hlink" > href="/barraframework/GetRequestPage.event?p_application=CallDesk">Log a > Call</a></span> > </div> > > <div > class="Dir::Get_Data.GetPage.p_has_access_calldesk_my_calls_calculations" > style="width: 75%;float:left;"> > <span class="td_2 > Dir::Get_Data.CallDeskEntry.p_mycalls_link">My > Calls</span> > </div> > <div class="Transparent > Dir::Get_Data.GetPage.p_has_access_calldesk_my_calls_calculations"> > <span > class="Dir::Get_Data.CallDeskEntry.p_mycalls_count">###</span> > </div> > </div> > _______________________________________________ > Barracuda mailing list > [email protected] > http://barracudamvc.org/lists/listinfo/barracuda <http://barracudamvc.org/lists/listinfo/barracuda> _______________________________________________ Barracuda mailing list [email protected] http://barracudamvc.org/lists/listinfo/barracuda <http://barracudamvc.org/lists/listinfo/barracuda> _______________________________________________ Barracuda mailing list [email protected] http://barracudamvc.org/lists/listinfo/barracuda <http://barracudamvc.org/lists/listinfo/barracuda>