You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by srivalli2006 <ne...@gmail.com> on 2006/11/26 17:28:55 UTC
using Tomahawk with
Hi ,
I am using tomahawk <t:panelTabbedPane/> tag. However I would like an action
event to be fired and would like to refresh my page on clicking a particular
tab(i.e.<t:panelTab />) on the pane.On searching google I found
<t:tabChangeListener/>.But i dont now how to use it.If anyone has idea of
how to use it or any other alternative solution , it would be of great
help.This is an emergency.
Thanks and Regards
Srivalli Neelam
--
View this message in context: http://www.nabble.com/using-Tomahawk-%3Ct%3AtabChangeListener-%3E-with-%3Ct%3ApanelTab-%3E-tf2707427.html#a7548550
Sent from the My Faces - Dev mailing list archive at Nabble.com.
Re: using Tomahawk with
Posted by Mr Arvind Pandey <ar...@yahoo.co.in>.
Hi,
use like this ....
........
...........
........
..........
t:panelTabbedPane styleClass="tabbedpane_css"
align="center" width="90%"
selectedIndex="#{tabbedPaneBean.tabIndex}"
serverSideTabSwitch="true" >
t:tabChangeListener type="com.abc.xyz.TabListener"/>
...........
.........
..........
// TabListener class is as below :
package com.abc.xyz;
public class TabListener implements TabChangeListener{
public TabListener() {
super();
//Write your own code.
}
public void processTabChange(TabChangeEvent
event) throws AbortProcessingException {
//you can use evnt.getNewTabIndex() to remain
//on the same tab after refresh.
........
........
//Now you can get the latest data from DB if
//required.
.........
.......
//Now refresh the page as below :
FacesContext context =
FacesContext.getCurrentInstance();
Application application =
context.getApplication();
//this.refreshPage() ...I have writtent for refreshing
this.refreshPage(context, application,
"/current-page.jsp", "currentPage");
}
}
public void refreshPage(FacesContext facesContext,
Application application,
String viewId, String outcome) {
LifecycleFactory lFactory = (LifecycleFactory)
FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
Lifecycle lifecycle =
lFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
ViewHandler viewHandler =
application.getViewHandler();
// specify what page you want to pretend to "come
from"; normally
// an empty string is ok
UIViewRoot view =
viewHandler.createView(facesContext, viewId);
facesContext.setViewRoot(view);
// specify what outcome value you want to use for
navigation
NavigationHandler navigationHandler =
application.getNavigationHandler();
navigationHandler.handleNavigation(facesContext,
null, outcome);
lifecycle.render(facesContext);
}
Also modify your navigation file i.e. faces-config.xml
from outcome....currentPage......
to view id ...currentPage.jsp....
regards...
Arvind
--- srivalli2006 <ne...@gmail.com> wrote:
>
> Hi ,
>
> I am using tomahawk <t:panelTabbedPane/> tag.
> However I would like an action
> event to be fired and would like to refresh my page
> on clicking a particular
> tab(i.e.<t:panelTab />) on the pane.On searching
> google I found
> <t:tabChangeListener/>.But i dont now how to use
> it.If anyone has idea of
> how to use it or any other alternative solution , it
> would be of great
> help.This is an emergency.
>
> Thanks and Regards
> Srivalli Neelam
> --
> View this message in context:
>
http://www.nabble.com/using-Tomahawk-%3Ct%3AtabChangeListener-%3E-with-%3Ct%3ApanelTab-%3E-tf2707427.html#a7548550
> Sent from the My Faces - Dev mailing list archive at
> Nabble.com.
>
>
__________________________________________________________
Yahoo! India Answers: Share what you know. Learn something new
http://in.answers.yahoo.com/
Re: using Tomahawk with
Posted by Mr Arvind Pandey <ar...@yahoo.co.in>.
Hi,
use like this ....
........
...........
........
..........
<t:panelTabbedPane styleClass="tabbedpane_css"
align="center" width="90%"
selectedIndex="#{tabbedPaneBean.tabIndex}"
serverSideTabSwitch="true">
<t:tabChangeListener type="com.abc.xyz.TabListener"/>
...........
.........
..........
// TabListener class is as below :
package com.abc.xyz;
public class TabListener implements TabChangeListener{
public TabListener() {
super();
//Write your own code.
}
public void processTabChange(TabChangeEvent
event) throws AbortProcessingException {
//you can use evnt.getNewTabIndex() to remain
//on the same tab after refresh.
........
........
//Now you can get the latest data from DB if
//required.
.........
.......
//Now refresh the page as below :
FacesContext context =
FacesContext.getCurrentInstance();
Application application =
context.getApplication();
//this.refreshPage() ...I have writtent for refreshing
this.refreshPage(context, application,
"/current-page.jsp", "currentPage");
}
}
public void refreshPage(FacesContext facesContext,
Application application,
String viewId, String outcome) {
LifecycleFactory lFactory = (LifecycleFactory)
FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
Lifecycle lifecycle =
lFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
ViewHandler viewHandler =
application.getViewHandler();
// specify what page you want to pretend to "come
from"; normally
// an empty string is ok
UIViewRoot view =
viewHandler.createView(facesContext, viewId);
facesContext.setViewRoot(view);
// specify what outcome value you want to use for
navigation
NavigationHandler navigationHandler =
application.getNavigationHandler();
navigationHandler.handleNavigation(facesContext,
null, outcome);
lifecycle.render(facesContext);
}
Also modify your navigation file i.e. faces-config.xml
from outcome....currentPage......
to view id ...currentPage.jsp....
regards...
Arvind
--- srivalli2006 <ne...@gmail.com> wrote:
>
> Hi ,
>
> I am using tomahawk <t:panelTabbedPane/> tag.
> However I would like an action
> event to be fired and would like to refresh my page
> on clicking a particular
> tab(i.e.<t:panelTab />) on the pane.On searching
> google I found
> <t:tabChangeListener/>.But i dont now how to use
> it.If anyone has idea of
> how to use it or any other alternative solution , it
> would be of great
> help.This is an emergency.
>
> Thanks and Regards
> Srivalli Neelam
> --
> View this message in context:
>
http://www.nabble.com/using-Tomahawk-%3Ct%3AtabChangeListener-%3E-with-%3Ct%3ApanelTab-%3E-tf2707427.html#a7548550
> Sent from the My Faces - Dev mailing list archive at
> Nabble.com.
>
>
__________________________________________________________
Yahoo! India Answers: Share what you know. Learn something new
http://in.answers.yahoo.com/