You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Gilles Doffe <Gi...@groupe-asten.fr> on 2005/10/10 09:18:35 UTC

RE tabbedpane onclick

Hi Kelly,

You have to use a listener like this :

public class TabbedPaneListener implements TabChangeListener {

        public void processTabChange(TabChangeEvent event)
                        throws AbortProcessingException {

                // You recover the instance of your tabbedPane
                HtmlPanelTabbedPane yourTabbedPane = 
(HtmlPanelTabbedPane)event.getComponent();

                // Recover instance of your bean with session scope
                Collection list = 
FacesContext.getCurrentInstance().getExternalContext().getSessionMap().values();
                Iterator iter = list.iterator();
                YourBean b = null;
                Object obj;
                while (iter.hasNext()) {
                        obj = iter.next();
                        if (obj.getClass() == YourBean.class) {
                                b = (YourBean)(obj);
                        }
                }
        }

}

Personnaly, I put this class in an other package.

And in your JSF page :

<ext:panelTabbedPane binding="#{yourBean.tabbedPane}">
        <ext:tabChangeListener type=
"com.yourPackage.listener.TabbedPaneListener"/>
        <ext:panelTab>
        ...
        </ext:panelTab>
        <ext:panelTab>
        ...
        </ext:panelTab>
        ...
</ext:panelTabbedPane>


I don't know if this is just what you need.

Bye
Gilles

Kelly Goedert <ke...@gmail.com> a écrit sur 08/10/2005 08:44:55 :

> Hi,
> 
> I´m using a tabbed pane and I would like that when one of the tabs 
> is clicked on, a backing bean method is called. Is that possible? If
> it is, how do I do it?
> 
> Thanks
> 
> Kelly.