2 Replies Latest reply on Jan 19, 2009 11:41 PM by henry katz

    Cannot change server-type rich:tab

    henry katz Newbie

      Hi,

      I have the following facelet:

       <rich:tabPanel id="l3tabpanel" switchType="server"
       activeTabClass="tertiaryTab-activeTab"
       inactiveTabClass="tertiaryTab-inactiveTab"
       selectedTab="#{navigationBackingBean.nav.tabs[1].tabs[0].selectedTabName}"
       contentClass="sub_tertiary_nav_container">
       <rich:tab id="obligorAccountData" name="#{navigationBackingBean.nav.tabs[1].tabs[0].tabs[0].name}"
       label="#{resourceKeys.nav_tertiary_od}"
       rendered="#{navigationBackingBean.obligorViewEntitled}">
       <c:if test="${sessionScope.navigationBackingBean.nav.tabs[1].tabs[0].isSelectedTab[0]}">
       <c:choose>
       <c:when test="${sessionScope.sessionInfoBackingBean.obligorInformationView}">
       <ui:include src="/content/obligorInfo-content.xhtml"/>
       </c:when>
       <c:otherwise>
       <ui:include src="/content/obligorEdit-content.xhtml"/>
       </c:otherwise>
       </c:choose>
       </c:if>
       </rich:tab>
       <rich:tab id="statementData" name="#{navigationBackingBean.nav.tabs[1].tabs[0].tabs[1].name}"
       label="#{resourceKeys.nav_tertiary_sd}"
       rendered="#{navigationBackingBean.statementViewEntitled}">
       <c:if test="${sessionScope.navigationBackingBean.nav.tabs[1].tabs[0].isSelectedTab[1]}">
       <c:choose>
       <c:when test="${requestScope.StatementEditBackingBean.editState == 'New' || requestScope.StatementEditBackingBean.editState == 'Edit'}">
       <ui:include src="/businessAnalysis-statementEdit.xhtml" />
       </c:when>
       <c:otherwise>
       <ui:include src="/content/businessAnalysis-obligor-creditFactorData-content.xhtml"/>
       </c:otherwise>
       </c:choose>
       </c:if>
       </rich:tab>
       <rich:tab name="" disabled="true" styleClass="extendRichTab"/>
      


      which I am testing a click path using the following JSFUnit code:

       private String StmtDataTab = "obligorNavigationForm:statementData";
       private String tabPanel = "l3tabpanel";
       private String stmtViewSelect = "statementViewList";
       private String orgData = "Organization Data";
      
       jsfSession = new JSFSession(wcSpec);
       client = jsfSession.getJSFClientSession();
       ajaxClient = new RichFacesClient(this.client);
       server = jsfSession.getJSFServerSession();
      
       HtmlTabPanel tabpanel = (HtmlTabPanel)server.findComponent(tabPanel);
       String selPanel = (String)tabpanel.getSelectedTab();
       assertEquals(orgData, selPanel);
       HtmlTab panel = (HtmlTab)server.findComponent(StmtDataTab);
       assertNotNull(panel);
       ajaxClient.clickTab(StmtDataTab);
       HtmlSelect stmtSelect = (HtmlSelect)client.getElement(stmtViewSelect);
       int numOptions = stmtSelect.getOptionSize();
      


      Yet stmtSelect is always null and the attempt to click on the tab (using server switch type) does not change the underlying content.

      This is richfaces 3.2.2 with JSFUnit 1.0.0.GA-SNAPSHOT.

      How do I change server side tabs?

      Thanks,
      Henry

        • 1. Re: Cannot change server-type rich:tab
          Stan Silvert Master

          Without seeing the HTML, it's hard to tell what might be happening. This is all that RichFacesClient does:

          public void clickTab(String tabComponentID)
           throws IOException
           {
           ClickableElement tab = (ClickableElement)jsfClient.getElement(tabComponentID + "_shifted");
           tab.click();
           }


          So in your html page you need to look for an id that ends with "obligorNavigationForm:statementData_shifted".

          I assume that that indeed got clicked. Then take a look at what was returned by calling JSFClientSession.getPageAsText(). That might give you a clue as to what was returned.

          Stan

          • 2. Re: Cannot change server-type rich:tab
            henry katz Newbie

            Stan,

            I bypassed the clickTab() approach which I also noticed was hitting the "_shifted" component for I was invoking ClientIDs methods to find the clientId that should have changed once I clicked on the tab but failed to find it. This seemed quicker than descending into the JSF viewtree within the IDE variable window. I'll try the getPageAsText() or the getContentPage() method to see what if anything actually changes once clicked.

            Thanks,
            Henry