The migration to facelets is the next step in my schedule. I just wanted to have a working version of the app to give maintance on before I started the next step. Thanks for all the help Leonardo, I will give it a try.
-- Sergio 2012/9/11 Leonardo Uribe <lu4...@gmail.com> > Hi > > In JSP, there is no h:head or h:body tags. The only alternative is try > to use t:documentHead and t:documentBody. In theory, it should work, > but you need to create a custom copy of JSF and include a small change > in UIComponentELTag to call the right Application.createComponent() > variant, to enable event handling in renderer classes. Really the > suggested option is migrate to facelets, because at the end it pays > off. > > regards, > > Leonardo Uribe > > 2012/9/11, Sergio Vieira Rolanski <ser...@strategos.com.br>: > > Yes, we are using JSP. > > > > Changing to facelets right now would not be an option since it would too > > much time consuming. > > > > We already have the entries in faces-config.xml for each component: > > > > <!-- PanelTabbedPane --> > > <component> > > > > <component-type>strategos.faces.html.PanelTabbedPane</component-type> > > > > > <component-class>strategos.faces.html.component.UIPanelTabbedPane</component-class> > > </component> > > > > So, how do I add these resources to the response? Can I use > ResourceHandler > > with JSP? > > > > I got problems with PanelTabbedPane and the InputDate components. The > > calendar from InputDate is not popping up when the "..." button is > clicked > > because the code that open it up is from a separated javascript file that > > is not add to the response. > > > > 2012/9/11 Leonardo Uribe <lu4...@gmail.com> > > > >> Hi > >> > >> Are you using JSP? If that so, please note @Listener and other > >> annotations does not work as expected, because the base tag class was > >> not updated to do that. Instead, you should upgrade your pages to use > >> facelets. (tomahawk skipped jsp compatibility in JSF 2.0 and instead > >> used JSF 2.0 ResourceHandler and facelets). > >> > >> If you create a custom component extending from tomahawk ones, you > >> should remember to add the required entries in faces-config.xml and > >> .taglib.xml (optional), or you can use myfaces-builder-plugin to > >> generate and update those files for you. > >> > >> regards, > >> > >> Leonardo Uribe > >> > >> 2012/9/11, Sergio Vieira Rolanski <ser...@strategos.com.br>: > >> > The method encodeEnd() from HtmlTabbedPaneRenderer class (the default > >> > constructor for > >> > org.apache.myfaces.custom.tabbedpane.HtmlPanelTabbedPane > >> > sets the renderer type) is being call, but the processEvent() method > >> > (which adds the resources) is not. > >> > > >> > Tried to copy the processEvent() method with the annotation to my > >> > UIPanelTabbedPane, the event is not called at all. > >> > > >> > What should trigger this event? Do I need to set something is some XML > >> > file? > >> > > >> > -- > >> > Sergio > >> > > >> > 2012/9/11 Sergio Vieira Rolanski <ser...@strategos.com.br> > >> > > >> >> Hi again, > >> >> > >> >> I tried to do what you said, but I don't have an actual custom > >> >> renderer. > >> >> I > >> >> have these two classes: > >> >> > >> >> public class UIPanelTabbedPane extends > >> >> org.apache.myfaces.custom.tabbedpane.HtmlPanelTabbedPane { > >> >> public static final String COMPONENT_TYPE = > >> >> "strategos.faces.html.PanelTabbedPane"; > >> >> // I have a custom property (something like a custom colspan) > >> >> } > >> >> > >> >> public class PanelTabbedPaneTag extends > >> >> org.apache.myfaces.custom.tabbedpane.HtmlPanelTabbedPaneTag { > >> >> // This one class I use to set the styleClass for the component > >> >> > >> >> @Override > >> >> public String getComponentType() { > >> >> return UIPanelTabbedPane.COMPONENT_TYPE; > >> >> } > >> >> } > >> >> > >> >> Tried to add the annotation in both classes, the more correct one I > >> think > >> >> would be the UIPanelTabbedPane, but none worked. > >> >> > >> >> -- > >> >> Sergio > >> >> > >> >> > >> >> 2012/9/5 Sergio Vieira Rolanski <ser...@strategos.com.br> > >> >> > >> >>> OK, Thanks!! > >> >>> > >> >>> > >> >>> 2012/9/5 Leonardo Uribe <lu4...@gmail.com> > >> >>> > >> >>>> Hi > >> >>>> > >> >>>> You need to specify the annotations in your custom renderer again: > >> >>>> > >> >>>> > >> >>>> > >> > @ResourceDependency(library="oam.custom.tabbedpane",name="defaultStyles.css") > >> >>>> @ListenerFor(systemEventClass=PreRenderViewAddResourceEvent.class) > >> >>>> > >> >>>> By spec, the anotations are not inherited. That should solve the > >> >>>> problem. > >> >>>> > >> >>>> regards, > >> >>>> > >> >>>> Leonardo Uribe > >> >>>> > >> >>>> 2012/9/5 Sergio Vieira Rolanski <ser...@strategos.com.br>: > >> >>>> > Indeed the demo works, that is why I copied some of its web.xml > >> >>>> > configuration. > >> >>>> > > >> >>>> > We have our own Faces library wrapping MyFaces and Tomahawk > >> >>>> components. Our > >> >>>> > components extends MyFaces' and Tomahawk's adding some features > >> >>>> > and > >> >>>> setting > >> >>>> > the styleClass property. > >> >>>> > > >> >>>> > Anyway, I guess the code that handles the resources is not > >> >>>> > recognizing > >> >>>> our > >> >>>> > inherited PanelTab component as a Tomahawk component thus not > >> >>>> > adding > >> >>>> the > >> >>>> > "dynamicTabs.js" to the response, which is weird because the > >> >>>> > MyFaces/Tomahawk 1.1 was doing just fine. > >> >>>> > > >> >>>> > I have workaround the problem by adding <script> with the > >> >>>> "dynamicTabs.js" > >> >>>> > to every response, not my favorite solution. > >> >>>> > > >> >>>> > Is there better way? Or a way to make resource handler to > >> >>>> > recognize > >> >>>> > my > >> >>>> > wrapped PanelTab as Tomahawk one? > >> >>>> > > >> >>>> > 2012/9/5 Leonardo Uribe <lu4...@gmail.com> > >> >>>> > > >> >>>> >> Hi > >> >>>> >> > >> >>>> >> Checking the code it looks ok. Note in Tomahawk 2.0, JSF 2.0 > >> >>>> >> ResourceHandler API was adopted, so you need to use h:head and > >> >>>> >> h:body > >> >>>> >> or tomahawk related components to add the required resource. > >> >>>> >> > >> >>>> >> The related code that adds the resource is: > >> >>>> >> > >> >>>> >> > >> >>>> >> > >> >>>> > >> > @ResourceDependency(library="oam.custom.tabbedpane",name="defaultStyles.css") > >> >>>> >> > @ListenerFor(systemEventClass=PreRenderViewAddResourceEvent.class) > >> >>>> >> public class HtmlTabbedPaneRenderer > >> >>>> >> extends HtmlRenderer implements > >> ComponentSystemEventListener > >> >>>> >> { > >> >>>> >> > >> >>>> >> public void processEvent(ComponentSystemEvent event) > >> >>>> >> { > >> >>>> >> HtmlPanelTabbedPane tabbedPane = > >> >>>> >> (HtmlPanelTabbedPane)event.getComponent(); > >> >>>> >> if( tabbedPane.isClientSide() ) > >> >>>> >> { > >> >>>> >> FacesContext facesContext = > >> >>>> FacesContext.getCurrentInstance(); > >> >>>> >> > >> >>>> TomahawkResourceUtils.addOutputScriptResource(facesContext, > >> >>>> >> "oam.custom.tabbedpane", > >> >>>> >> "dynamicTabs.js"); > >> >>>> >> > >> >>>> >> The demo works without problem. > >> >>>> >> > >> >>>> >> regards, > >> >>>> >> > >> >>>> >> Leonardo Uribe > >> >>>> >> > >> >>>> >> 2012/9/5 Mike Kienenberger <mkien...@gmail.com>: > >> >>>> >> > Please open an issue in our issue tracker with this > >> >>>> >> > information. > >> >>>> >> > > >> >>>> >> > If you feel up to up, feel free to provide a patch as well as > >> that > >> >>>> >> > will make getting it fixed happen faster. > >> >>>> >> > > >> >>>> >> > > >> >>>> >> > On Wed, Sep 5, 2012 at 12:13 PM, Sergio Vieira Rolanski > >> >>>> >> > <ser...@strategos.com.br> wrote: > >> >>>> >> >> Yes, it does work. > >> >>>> >> >> > >> >>>> >> >> > >> >>>> >> >> 2012/9/5 Mike Kienenberger <mkien...@gmail.com> > >> >>>> >> >> > >> >>>> >> >>> If you manually specify the dynamicTabs.js script on your > >> >>>> >> >>> page, > >> >>>> does it > >> >>>> >> >>> work? > >> >>>> >> >>> > >> >>>> >> >>> On Wed, Sep 5, 2012 at 9:07 AM, Sergio Vieira Rolanski > >> >>>> >> >>> <sergio.strate...@gmail.com> wrote: > >> >>>> >> >>> > I just upgraded MyFaces/Tomahawk to version 2.0. Got it > 98% > >> >>>> working, > >> >>>> >> one > >> >>>> >> >>> of > >> >>>> >> >>> > the things that is giving me problems is that > >> >>>> >> >>> > PanelTabbedPane > >> >>>> >> component > >> >>>> >> >>> is > >> >>>> >> >>> > not doing client-side tab switching. Looking at the > request > >> >>>> >> >>> > and > >> >>>> the > >> >>>> >> >>> > generated HTML, noticed MyFaces is not adding the > >> >>>> "dynamicTabs.js" > >> >>>> >> to the > >> >>>> >> >>> > response. > >> >>>> >> >>> > > >> >>>> >> >>> > My configuration for web.xml: (which I copied from the > >> >>>> >> >>> > tomahawk > >> >>>> >> example > >> >>>> >> >>> WAR > >> >>>> >> >>> > file) > >> >>>> >> >>> > > >> >>>> >> >>> > <context-param> > >> >>>> >> >>> > <description>Default adicionado para evitar > >> >>>> >> >>> > mensagem > >> >>>> >> >>> > no > >> >>>> >> >>> > log</description> > >> >>>> >> >>> > > >> >>>> >> >>> > >> >>>> <param-name>org.apache.myfaces.CHECK_EXTENSIONS_FILTER</param-name> > >> >>>> >> >>> > <param-value>true</param-value> > >> >>>> >> >>> > </context-param> > >> >>>> >> >>> > <context-param> > >> >>>> >> >>> > <description>Default adicionado para evitar > >> >>>> >> >>> > mensagem > >> >>>> >> >>> > no > >> >>>> >> >>> > log</description> > >> >>>> >> >>> > > >> >>>> >> <param-name>org.apache.myfaces.ADD_RESOURCE_CLASS</param-name> > >> >>>> >> >>> > > >> >>>> >> >>> > > >> >>>> >> >>> > >> >>>> >> > >> >>>> > >> > <param-value>org.apache.myfaces.renderkit.html.util.DefaultAddResource</param-value> > >> >>>> >> >>> > </context-param> > >> >>>> >> >>> > <context-param> > >> >>>> >> >>> > <description>Default adicionado para evitar > >> >>>> >> >>> > mensagem > >> >>>> >> >>> > no > >> >>>> >> >>> > log</description> > >> >>>> >> >>> > > >> >>>> >> > <param-name>org.apache.myfaces.RESOURCE_VIRTUAL_PATH</param-name> > >> >>>> >> >>> > > >> >>>> <param-value>/faces/myFacesExtensionResource</param-value> > >> >>>> >> >>> > </context-param> > >> >>>> >> >>> > > >> >>>> >> >>> > <!-- Servlet padrĂ£o do MyFaces --> > >> >>>> >> >>> > <servlet> > >> >>>> >> >>> > <servlet-name>FacesServlet</servlet-name> > >> >>>> >> >>> > > >> >>>> >> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> > >> >>>> >> >>> > <load-on-startup>1</load-on-startup> > >> >>>> >> >>> > </servlet> > >> >>>> >> >>> > > >> >>>> >> >>> > <servlet-mapping> > >> >>>> >> >>> > <servlet-name>FacesServlet</servlet-name> > >> >>>> >> >>> > <url-pattern>*.jsf</url-pattern> > >> >>>> >> >>> > </servlet-mapping> > >> >>>> >> >>> > > >> >>>> >> >>> > <servlet-mapping> > >> >>>> >> >>> > <servlet-name>FacesServlet</servlet-name> > >> >>>> >> >>> > <url-pattern>/faces/*</url-pattern> > >> >>>> >> >>> > </servlet-mapping> > >> >>>> >> >>> > > >> >>>> >> >>> > <!-- 5. MyFaces --> > >> >>>> >> >>> > <filter> > >> >>>> >> >>> > <filter-name>MyFacesFilter</filter-name> > >> >>>> >> >>> > > >> >>>> >> >>> > > >> >>>> >> >>> > >> >>>> >> > >> >>>> > >> > <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class> > >> >>>> >> >>> > </filter> > >> >>>> >> >>> > > >> >>>> >> >>> > <filter-mapping> > >> >>>> >> >>> > <filter-name>MyFacesFilter</filter-name> > >> >>>> >> >>> > <url-pattern>*.jsf</url-pattern> > >> >>>> >> >>> > </filter-mapping> > >> >>>> >> >>> > > >> >>>> >> >>> > <filter-mapping> > >> >>>> >> >>> > <filter-name>MyFacesFilter</filter-name> > >> >>>> >> >>> > <url-pattern>/faces/*</url-pattern> > >> >>>> >> >>> > </filter-mapping> > >> >>>> >> >>> > >> >>>> >> > >> >>>> > >> >>> > >> >>> > >> >> > >> > > >> > > >