myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergio Vieira Rolanski <ser...@strategos.com.br>
Subject Re: No client-side switching for PanelTabbedPane
Date Tue, 11 Sep 2012 16:31:29 GMT
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 <sergio@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 <sergio@strategos.com.br>
>
>> OK, Thanks!!
>>
>>
>> 2012/9/5 Leonardo Uribe <lu4242@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 <sergio@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 <lu4242@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 <mkienenb@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
>>> >> > <sergio@strategos.com.br> wrote:
>>> >> >> Yes, it does work.
>>> >> >>
>>> >> >>
>>> >> >> 2012/9/5 Mike Kienenberger <mkienenb@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.strategos@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>
>>> >> >>>
>>> >>
>>>
>>
>>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message