Please disable your adblock and script blockers to view this page

Search this blog

Monday 23 June 2014

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

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 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


  • now bind panel tabbed and it's showDetailItem to managed bean, in order to use disclosed property and to get 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

 Cheers Happy Learning :) Sample ADF Application

3 comments :

  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?

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
    2. You also need to use ChangeManager API to notify about property change.

      Delete