File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes rich tabpanel : first rich tab not loaded with focus with first tab Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "rich tabpanel : first rich tab not loaded with focus with first tab" Watch "rich tabpanel : first rich tab not loaded with focus with first tab" New topic
Author

rich tabpanel : first rich tab not loaded with focus with first tab

Brajendra Mathema
Ranch Hand

Joined: Jun 02, 2009
Posts: 39
I have a page with a button say button 1 which opens a rich popup panel, the popup panel has rich tabpanel within it with rich tab, and a4j command button.

Now if i click the second tab in the rich tabpanel and click the a4j command button, the command button does some processing and hides the popup panel.

Afterward when the button i.e button 1 on the page is fired , the popup panel is loaded but the rich tab within the popup panel has the second tab in focus instead of first tab.

I think the focus should be on the first tab. I'm not able to identify the problem.

here is the page code.

<div id="mydiv">
<h:form>
<a4j:commandButton onclick="maskk()" render=":pnl :tt :ttt" action="#{test.testAction}" value="test_action" oncomplete="#{rich:component('popUpPanel1')}.show();return false;"/>
</h:form>
</div>





<div id="mydiv1">
<rich:popupPanel id="popUpPanel1" modal="false" height="300" width="500">
<f:facet name="header">
<hutputText value="Header Test Panel" />
</f:facet>
<f:facet name="controls">
<h:graphicImage alt="X" onclick="#{rich:component('popUpPanel1')}.hide()"/>
</f:facet>
<h:panelGroup id="pnl">
<h:form id="popUpPanelFrm">
<a4j:commandButton value="test" action="#{test.testAct}" oncomplete="#{rich:component('popUpPanel2')}.show();return false;"/>
</h:form>
</h:panelGroup>
</rich:popupPanel>
</div>



<rich:popupPanel id="popUpPanel2" modal="false">
<f:facet name="header">
<hutputText value="Test Only Panel" />
</f:facet>
<f:facet name="controls">
<h:graphicImage alt="X" onclick="#{rich:component('popUpPanel2')}.hide()"/>
</f:facet>

<h:form id="aa">
<a4j:commandButton action="#{test.testAct}" value="btn_popUpPanel2"/>

<rich:tabPanel switchType="ajax" id="nrt" style="font-size: 20px">
<rich:tab header="Notes" id="n">
<h:inputTextarea id="note" value="#{test.note}" style="width: 350px;height: 70px"/>
</rich:tab>
<rich:tab header="Recommendations" id="r">
<h:inputTextarea id="recommendation" value="#{test.recom}" style="width: 350px;height: 70px"/>
</rich:tab>
</rich:tabPanel>
<h:panelGroup id="nrPopUpPanelBtn">

<a4j:commandButton style="margin: 5px 0 0 0px" id="btnSubmit" oncomplete="#{rich:component('popUpPanel2')}.hide();unmaskk();" action="#{test.testNR}" value="Ok"/>
<a4j:commandButton style="margin: 5px 0 0 20px" id="btnCancle" onclick="#{rich:component('popUpPanel2')}.hide();unmaskk();" value="Cancel"/>
</h:panelGroup>
</h:form>
</rich:popupPanel>



Thanks You


Brajendra Mathema
Ranch Hand

Joined: Jun 02, 2009
Posts: 39
any help ?

thankyou
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15647
    
  15

Well, first, popups in RichFaces are not loaded at display time. They are loaded when the page loads, but are hidden. The show() method simply takes the panel and makes it visible as an overlay DIV on the page and the hide() method makes it invisible again.

JSF does not concern itself with focus in any event. You should be able to set an "onshow" attribute for the tab and have the code in that attribute direct focus, but RichFaces won't do any focussing for you.


Customer surveys are for companies who didn't pay proper attention to begin with.
Brajendra Mathema
Ranch Hand

Joined: Jun 02, 2009
Posts: 39
Hi Tim,

Thanks for the reply.

I have one more question.

In above case, if i re-render the main panel with the button click in the popup which also closes the popup panel, should not the button1 click render popup panel again with focus in first tab.

I've found that when the switch type is 'ajax' and the main panel is rerendered , the first tab is in focus, but to go to next tab i need two click.



Thanks
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15647
    
  15

That sounds like a browser issue. The first click is usually just to get the focus in the browser window itself and the second one is the one that actually gets seen by the tab control.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: rich tabpanel : first rich tab not loaded with focus with first tab
 
Similar Threads
How to display richPopupPanel wondow from javascript
Problem inside a richModalPanel
FacesException: f:ajax contains an unknown id - cannot locate it in the context of the component
Action does not work inside rich:popupPanel
sequence of invoking modal windows in jsf