This discussion is archived
8 Replies Latest reply: Sep 13, 2013 5:27 AM by 996557 RSS

Disclosure Listener for PanelTabbed

996557 Newbie
Currently Being Moderated

Hi All

<<Jdeveloper 11.1.2.3.>>

I have a paneltabbed component with 5 tabs (show detail item). My scenario is Every-time user clicks on a tab I need to perform same set of tasks (like refreshing the VO to check for new data).

Only If the user selects Tab3 then the logic executed is different.

What is the best of achieving this.

Do I need to write a disclosure listener for every single tab or I can have a same disclosure listener for 4 tabs which does same action and one other disclosure listener for Tab3.

 

Kindly guide me with the correct approach.

 

regards,

bnkr

  • 1. Re: Disclosure Listener for PanelTabbed
    Cvele_new_account Expert
    Currently Being Moderated

    "or I can have a same disclosure listener for 4 tabs which does same action and one other disclosure listener for Tab3."

    - I would do it this way

  • 2. Re: Disclosure Listener for PanelTabbed
    996557 Newbie
    Currently Being Moderated

    I have tried using the same disclosure listener for 4 tabs, but only one tab is invoking it. What could be the reason

  • 3. Re: Disclosure Listener for PanelTabbed
    Cvele_new_account Expert
    Currently Being Moderated

    Please put your panelTabbed code here

  • 4. Re: Disclosure Listener for PanelTabbed
    996557 Newbie
    Currently Being Moderated

    Its something like this

     

    <af:panelTabbed id="pt1">

    <af:showDetailItem text="showDetailItem 1" id="sdi1"

    disclosureListener="#{pageFlowScope.SamplePageBean.disclosureListener1}">

    <af:outputText value="Tab Contents 1" id="ot1"/>

    </af:showDetailItem>

    <af:showDetailItem text="showDetailItem 2" id="sdi2"

    disclosureListener="#{pageFlowScope.SamplePageBean.disclosureListener2}">

    <af:outputText value="Tab Contents 2" id="ot2"/>

    </af:showDetailItem>

    <af:showDetailItem text="showDetailItem 3" id="sdi3"

    disclosureListener="#{pageFlowScope.SamplePageBean.disclosureListener3}">

    <af:outputText value="Tab Contents 3" id="ot3"/>

    </af:showDetailItem>

    </af:panelTabbed>

     

    and the disclosure listener

     

    public void disclosureListenerTab1(DisclosureEvent disclosureEvent) {                 // for all tabs

    if (disclosureEvent.isExpanded() == true) {

    System.out.println("Tab 1 disclosed");

    // TODO: DO NECESSARY BUSINESS LOGIC FOR CURRENT TAB

    }

    }

     

    public void disclosureListenerTab3(DisclosureEvent disclosureEvent) {

    if (disclosureEvent.isExpanded() == true) {

    System.out.println("Tab 3 disclosed");

     

    }

    }

  • 5. Re: Disclosure Listener for PanelTabbed
    Sireesha Pinninti Expert
    Currently Being Moderated

    Hi,

    Here is the sample code with only one disclosure event for all tabs with condition inside to check which tag is disclosed:

    <af:panelTabbed id="pt1">
    <af:showDetailItem text="Tab 1" id="sdi1"
         disclosureListener="#{<Bean>.tabDisclosed}">
        <af:outputText value="Tab 1 Contents" id="ot1"/>
        <af:clientAttribute name="disclosedTab" value="Tab1"/>         
    </af:showDetailItem>
    <af:showDetailItem text="Tab 2" id="sdi2"
         disclosureListener="#{<Bean>.tabDisclosed}">
        <af:outputText value="Tab 2 Contents" id="ot2"/>
        <af:clientAttribute name="disclosedTab" value="Tab2"/>         
    </af:showDetailItem>               
    <af:showDetailItem text="Tab 3" id="sdi3"
         disclosureListener="#{<Bean>.tabDisclosed}">
        <af:outputText value="Tab 3 Contents" id="ot3"/>
        <af:clientAttribute name="disclosedTab" value="Tab3"/>         
    </af:showDetailItem>
    </af:panelTabbed>
    // Bean Code
        public void tabDisclosed(DisclosureEvent disclosureEvent){
            if (disclosureEvent.isExpanded() == true) {           
                if(disclosureEvent.getComponent().getAttributes().get("disclosedTab").equals("Tab3")){
                    //TODO Code when Tab 3 is disclosed               
                }else{
                    //TODO Code for other tabs
                }
            }       
        }
    

    Note that af:clientAttribute is set for each showDetailItem where we pass the value for disclosedTab attribute to identify which tab is disclosed

    Sireesha

  • 6. Re: Disclosure Listener for PanelTabbed
    Subramanian Meyyappan Expert
    Currently Being Moderated

    <af:showDetailItem text="Tab1" id="sdi1">

          <af:setPropertyListener from="t1" to="#{pageFlowScope.tabClicked}"                                           type="disclosure"/>

        </af:showDetailItem>

     

    <af:showDetailItem text="Tab1" id="sdi2">

          <af:setPropertyListener from="t2" to="#{pageFlowScope.tabClicked}"                                           type="disclosure"/>

        </af:showDetailItem>

    grab the to value using el expersion.

    it is somewhat similiar to above approach.

  • 7. Re: Disclosure Listener for PanelTabbed
    Cvele_new_account Expert
    Currently Being Moderated

    I told you:

     

    "or I can have a same disclosure listener for 4 tabs which does same action and one other disclosure listener for Tab3."

    - I would do it this way


    From code you are posted, I do not see you are applied suggested behavior. By the way, take a look at:



       disclosureListener="#{pageFlowScope.SamplePageBean.disclosureListener1}

    Where is the code for disclosureListener1 ?

    In your code, you just have:

     

    disclosureListenerTab1()

  • 8. Re: Disclosure Listener for PanelTabbed
    996557 Newbie
    Currently Being Moderated

    sorry for the confusion, The earlier code I have posted is the sample code, because each of my show detail item has dynamic regions and lot of other code.

    Please read disclosureListener1 as disclosureListenerTab1().

     

    However the issue is now solved. thanks everyone for the help, especially SireeshaPinninti for the right answer

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points