-
1. Re: rich:tabPanel selectedTab problem
ilya_shaikovsky Sep 25, 2007 6:03 AM (in response to ylazzari)I have
<rich:tabPanel switchType="ajax" id="tab" selectedTab="#{bean.tabName}"> <rich:tab label="test 1" name="tab1" action="#{bean.action}"> <h:form> <ui:include src="/pages/greeting1.xhtml"/> <a4j:commandButton value="next" reRender="tab" action="#{bean.nextTab}"></a4j:commandButton> </h:form> </rich:tab> <rich:tab label="Sample 2" disabled="#{bean.check}" name="tab2" action="#{bean.action}"> <h:form> <ui:include src="/pages/greeting1.xhtml"/> <a4j:commandButton value="prev" reRender="tab" action="#{bean.prevTab}"></a4j:commandButton> </h:form> </rich:tab> </rich:tabPanel>
My buttons are changed the tab programatically. But after I use button - my actions on tabs still calling after next requests. My RF is 3.1.1 20 september build. -
2. Re: rich:tabPanel selectedTab problem
ylazzari Sep 26, 2007 2:58 PM (in response to ylazzari)I stripped down my test case to match what you have. I tried with RF 3.1.1 with a snapshot of September 24th and it still doesn't work for me. I'm deploying my application on Glassfish v2 final release using's Suns RI 1.2 if it makes any difference.
I debugged further and here's what I can tell you. The first time I render the page or refresh it with Ctrl+F5, when I click on an action that brings me to another tab, it works, but then from this point on, all of the tab's content doesn't get decoded on the server anymore on the following postbacks. I'm not sure but it seems it has to do with the state that it saves. For some reason, the "renderedValue" attribute of the UITabPanel gets set to null when the first action is executed which them causes the UITabPanel to not decode any of its children on the following postbacks because it saves null as its value in the state. Removing the "selectedTab" attribute off of the rich:tabPanel tag fixes that problem but I obviously loose the behaviour that I want to implement.
Do you have more ideas as to what is going on? Would there be a way for you to share a test web application in which the behaviour works as expected so I can deploy it on my server and see what happens?
Thank you very much. -
3. Re: rich:tabPanel selectedTab problem
doballve Sep 26, 2007 3:26 PM (in response to ylazzari)Recently I had a similar problem when 'someBean' was a Seam in the PAGE scope. This scope is not available on restore view and selectedTab got initialized to null.. after that, no action coming from any of its tab got processed because the tabPanel component could not detect the tab as rendered... I got past it changing the scope of 'someBean'.. not ideal, but worked.
Maybe a proper fix would be to keep checking for renderedTab if it evaluates to null.. -
4. Re: rich:tabPanel selectedTab problem
ylazzari Sep 26, 2007 3:48 PM (in response to ylazzari)My bean does happen to be a Seam component (SFSB), but it has the conversion scope (default for SFSB) and the property on which I map the selectedTab attribute of the rich:tabPanel tag does keep its value. In the other words, the problem isn't the fact that when the tab panel tries to get the selected tab from my bean it returns null. Thanks for the tip though.
-
5. Re: rich:tabPanel selectedTab problem
ylazzari Sep 26, 2007 3:55 PM (in response to ylazzari)Well, I'll be damned! I just explicitly specified the scope type on my bean to be session and now it works! I think I jumped the gun there. Time to investigate what's going on with my conversation scope. Thanks.
-
6. Re: rich:tabPanel selectedTab problem
matt.drees Sep 29, 2007 5:40 PM (in response to ylazzari)I'm having the same problem, I think. This is what I'm seeing from my debugging:
I have a TabPanel whose value is bound to a conversation-scope Seam component's attribute. During the "restore view" phase, conversational components aren't available, so restoreState sets restoredRenderedValue to null, which causes the processDecodes step to be skipped (in getSwitchedFacetsAndChildren()) for everything contained within the tab panel.
This sounds like similar behavior to what ylazzari is seeing.
Can we open a Jira issue? -
7. Re: rich:tabPanel selectedTab problem
matt.drees Sep 29, 2007 5:41 PM (in response to ylazzari)(I'm using richfaces-3.1.1-CR1, by the way, and Seam 2.0 cvs)
-
8. Re: rich:tabPanel selectedTab problem
maksimkaszynski Oct 1, 2007 7:02 AM (in response to ylazzari)Definetly you can ::)
-
10. Re: rich:tabPanel selectedTab problem
maksimkaszynski Oct 2, 2007 11:11 AM (in response to ylazzari)Thanks
-
11. Re: rich:tabPanel selectedTab problem
ylazzari Oct 2, 2007 1:59 PM (in response to ylazzari)"matt.drees" wrote:
http://jira.jboss.com/jira/browse/RF-1047
Thanks. That's exactly the problem that I have. In the meantime, I resolved it by binding the selectedTab attribute to a session scoped variable and I always make sure that when I open a tab set I reset that value to the first tab. Works fine. It definitely isn't a show stopper but when it's fixed, I'll go back to a conversation scoped attribute. -
12. Re: rich:tabPanel selectedTab problem
matt.drees Oct 6, 2007 3:03 AM (in response to ylazzari)It was too painful for me to try to turn my component into a session component, so I came up with this workaround. Maybe others will find it useful until it's fixed.
//get around http://jira.jboss.com/jira/browse/RF-1047 //TODO: remove when issue fixed @Name("tabPanelWorkaround") public class TabPanelWorkaround { @In Map<String, UIComponent> uiComponent; @Observer("org.jboss.seam.beforePhase") public void fixTabPanel(PhaseEvent event) { if (event.getPhaseId().equals(PhaseId.APPLY_REQUEST_VALUES)) { UITabPanel panel = (UITabPanel) uiComponent.get("registrantTypes:registrantTypeTabPanel"); if (panel != null) { setValue(panel, "restoredRenderedValue", panel.getValue()); } } } private void setValue(Object target, String fieldName, Object value) { Field field = Reflections.getField(target.getClass(), fieldName); field.setAccessible(true); Reflections.setAndWrap(field, target, value); } }
-
13. Re: rich:tabPanel selectedTab problem
nagypalg Oct 8, 2007 4:05 AM (in response to ylazzari)Thanks for the code, it works very nice. Perhaps one thing that was not clear to me at once:
"registrantTypes:registrantTypeTabPanel" should be always replaced with the actual id of the tabPanel in the view. E.g.<rich:tabPanel switchType="ajax" selectedTab="#{bean.selectedTab}" id="richFacesTabPanel">
andUITabPanel panel = (UITabPanel) uiComponent.get("richFacesTabPanel");
So with this workaround you are kinda forced to use the same ID for all your tabPanels (or use a different instance of this bean for each tabPanel), but I think it is OK. I normally have only one tabPanel per page. ;) -
14. Re: rich:tabPanel selectedTab problem
matt.drees Oct 8, 2007 12:26 PM (in response to ylazzari)If you have lots of tabpanels, the best thing probably would be to search through the component tree for components of type UITabPanel instead of using uiComponent.get().