3 Replies Latest reply: Feb 1, 2013 2:42 AM by santiago_nc RSS

    Avoid refresh content when change showdetailitem in a paneltabbed

    santiago_nc
      Hi:

      I have a PanelTabbed with two tabs. In one I have an Applet and in the other I have a dashboard with panelbox. When I switch focus from one tab to the other the Applet get refreshed. How can I avoid the applet to get refreshed?

      I am working with jeveloper 11.2.3.0.

      This is the code in the jsf page:
      <af:panelTabbed id="pt2">
          <af:showDetailItem text="Tab1" id="sdi1" displayIndex="-1">                                                    
            <af:group id="g3">
              <af:panelDashboard id="pd1" rowHeight="250px" inlineStyle="height:inherit; width:inherit;" columns="2" dimensionsFrom="auto">
                <af:dataFlavor flavorClass="javax.faces.component.UIComponent" discriminant="dashboardBody"/>                                                
              </af:panelDashboard>
            </af:group>      
          </af:showDetailItem>
          <af:showDetailItem text="Tab2" id="sdi2" displayIndex="-1">
              <af:region value="#{bindings.region1taskflowdefinition1.regionModel}" id="r1"/>
          </af:showDetailItem>
      </af:panelTabbed>
      Thanks.
        • 1. Re: Avoid refresh content when change showdetailitem in a paneltabbed
          Frank Nimphius-Oracle
          Hi,

          not sure this can be done. Tabs that are closed actually dismiss the component tree (as far as I know), which means that you implicitly close the Applet instance. Only chance I see is that on tab change, you move the container (JSF component like af:panelGroup) that holds the Applet to another JSF parent (e.g. af:form) and set the container "visible" property to false. This way the component is still available though hidden. When then you navigate back to the Applet containing tab, you do the same in reverse and add the panel group bach as a child of the showdetail item

          A bit hacky, but this is how I would try to make it work

          Frank
          • 2. Re: Avoid refresh content when change showdetailitem in a paneltabbed
            santiago_nc
            Thanks for your help

            I have some issues with this solution.

            First: How can I move the region from the panelgroup to the showDetailItem?

            Second: When I put the property visible to false in the PanelGroup, The applet is not initialized

            This is my code:

            On the JSF:
            <af:panelTabbed id="pt2">
              <af:showDetailItem text="Tab1" id="sdi1" displayIndex="-1">                                                    
                <af:group id="g3">
                  <af:panelDashboard id="pd1" rowHeight="250px" inlineStyle="height:inherit; width:inherit;" columns="2" dimensionsFrom="auto">
                    <af:dataFlavor flavorClass="javax.faces.component.UIComponent" discriminant="dashboardBody"/>                                                
                  </af:panelDashboard>
                </af:group>      
              </af:showDetailItem>
              <af:showDetailItem text="Tab2" id="sdi_f11"
                  disclosureListener="#{dashboardBean.enterOnTabF11}"
                  itemListener="#{dashboardBean.exitTabF11}">                                
              </af:showDetailItem>
            </af:panelTabbed>
            <af:panelGroupLayout id="pgl1" visible="true">
              <af:region value="#{bindings.regionF11taskflowdefinition1.regionModel}" id="reg_f11"/>
            </af:panelGroupLayout>
            On the DashboardBean
                //The user has selected the tab -> Move the Region from PanelGroup to the ShowDetailItem
                public void enterOnTabF11(DisclosureEvent disclosureEvent) {
                    // Add event code here...
                    System.out.println("enterOnTabF11");
                    UIComponent rootParent;
                    RichRegion regionF11 = (RichRegion)JSFUtils.findComponentInRoot("reg_f11");
                    RichShowDetailItem tab = (RichShowDetailItem)JSFUtils.findComponentInRoot("sdi_f11");
                    MoveChildComponentChange moveChange = new MoveChildComponentChange(regionF11, tab);
                    ChangeManager cm = RequestContext.getCurrentInstance().getChangeManager();
                    FacesContext context = FacesContext.getCurrentInstance();
                    rootParent = moveChange.add(context, cm); // add the change
                    moveChange.changeComponent(rootParent);              
                    AdfFacesContext.getCurrentInstance().addPartialTarget(rootParent);   
                }
            
                public void exitTabF11(ItemEvent itemEvent) {
                    // Add event code here...
                    System.out.println("exitTabF11");
                }    
            Edited by: santiago_nc on 31-ene-2013 4:33
            • 3. Re: Avoid refresh content when change showdetailitem in a paneltabbed
              santiago_nc
              Finally We have decided move the region applet to panelSplitter, because the Applet is refreshed in each PPR.
              I dont know if exists the posibility to avoid the PPR for a specific child when his parent has been refreshed.