Navigating to (open) specific tab in af:panelTabbed programmatically -Oracle ADF

Sharing is Caring

Hello All,
This post is about a development requirement – how to move (navigate or open) to a specific tab in panel tabbed  in Oracle ADF?
Suppose I have to open the second tab of af:panelTabbed on a button click, so see how to do this using ADF Faces

  • Create a Fusion Web application and a page to drop panel tabbed and a button

 

af:panelTabbed

 

  • Now bind panel tabbed and it’s showDetailItem to the managed bean, in order to use the disclosed property and to get the client id

See the code to open (disclose) a specific tab of af:panelTabbed

//Binding of Panel Tabbed
private RichPanelTabbed panelTabBind;

public void setPanelTabBind(RichPanelTabbed panelTabBind) {
this.panelTabBind = panelTabBind;
}

public RichPanelTabbed getPanelTabBind() {
return panelTabBind;
}

/**
 * @Method to disclose (open) specific tab
 * Pass the binding of af:showDetailItem that you want to open
 */
public void setDisclosedFirstTab(RichShowDetailItem tabBind) {
RichPanelTabbed richPanelTabbed = getPanelTabBind();
for (UIComponent child : richPanelTabbed.getChildren()) {
RichShowDetailItem sdi = (RichShowDetailItem) child;
if (sdi.getClientId().equals(tabBind.getClientId())) {
sdi.setDisclosed(true);
} else {
sdi.setDisclosed(false);
}
}
AdfFacesContext.getCurrentInstance().addPartialTarget(panelTabBind);
}

 

  • Now see the code written on button action- here I have checked that which tab is currently disclosed? and based on that I have passed next tab binding to this method

    /**Method to be called on Navigate Button
     * @param actionEvent
     */
    public void naviGateButtonAction(ActionEvent actionEvent) {
        if (firstTabBind.isDisclosed()) {
            setDisclosedFirstTab(secTabBind);
        } else if (secTabBind.isDisclosed()) {
            setDisclosedFirstTab(thirdTabBind);
        } else {
            setDisclosedFirstTab(firstTabBind);
        }
    }

 

  • Now run your page and see navigation in af:panelTabbed

 

Sample ADF Application

Cheers Happy Learning 🙂

Related Posts

An Oracle ACE, Blogger, Reviewer, Technical Lead working on Oracle ADF

0 thoughts on “Navigating to (open) specific tab in af:panelTabbed programmatically -Oracle ADF”

  1. thanks for this post. I have a problem when I enable user customization using MDS, this navigation doesn't work anymore! Do you have any idea why?

Leave a Reply

Your email address will not be published. Required fields are marked *