5 Replies Latest reply on Sep 19, 2007 1:21 PM by Denis Halupa

    Include as child of UITab

    Denis Halupa Newbie

      Hi there,

      In one of my components I am dynamically creating UITabPanel components as well as UITabs as children of UITabPanel. The problem is that when I add an instance of Include to a children collection of UITab, the content of included page does not gets rendered. The code snippet is bellow. I have to mention that when I add some other component as child of UITab it renders itself without any problem.

      UITab tabDocuments = new HtmlTab();
      tabDocuments.setLabel("Documents");
      tabPanel.getChildren().add(tabDocuments);
      Include include=new Include();
      include.setViewId("/jsp/task-management/package-documents.jspx");
      tabDocuments.getChildren().add(include);
      


      Am I missing something here, please help..

      Kind regards,

      Denis

        • 1. Re: Include as child of UITab
          Denis Halupa Newbie

           

          "dhalupa" wrote:
          Hi there,

          In one of my components I am dynamically creating UITabPanel components as well as UITabs as children of UITabPanel. The problem is that when I add an instance of Include to a children collection of UITab, the content of included page does not gets rendered. The code snippet is bellow. I have to mention that when I add some other component as child of UITab it renders itself without any problem.

          UITab tabDocuments = new HtmlTab();
          tabDocuments.setLabel("Documents");
          tabPanel.getChildren().add(tabDocuments);
          Include include=new Include();
          include.setViewId("/jsp/task-management/package-documents.jspx");
          tabDocuments.getChildren().add(include);
          


          Am I missing something here, please help..

          Kind regards,

          Denis

          Forgot to mention, I am using RC5

          • 2. Re: Include as child of UITab
            Alexander Smirnov Master

            'include' component are not a standalone, but some functionality is included into jsp/facelets tag. As far as, this component can't be created in code.

            • 3. Re: Include as child of UITab
              Denis Halupa Newbie

              Thanks for quick answer.. In that case reference guide should be corrected because it is misleading, page 87

              Kind regards,

              Denis

              • 4. Re: Include as child of UITab
                Richard Fanning Newbie

                Hi Denis,

                I am experiencing the same problem as you did here (trying to dynamically create a tabPanel with a facelets include as it's body. I can get the tab to render but not the tab content.


                Have you find a way how to do this.

                Anyone any suggestions how this can be done?

                Cheers

                Rich


                Here is my code, obviously i will be creating more than one tab.

                 public HtmlTabPanel getTabs() {
                 if(tabs == null){
                 tabs = new HtmlTabPanel();
                 Application application = FacesContext.getCurrentInstance().getApplication();
                 List<UIComponent> children = tabs.getChildren();
                 HtmlTab newTab = (HtmlTab)application.createComponent(HtmlTab.COMPONENT_TYPE);
                 children.add(newTab);
                 newTab.setLabel("Party Search");
                 newTab.setName("Party Search");
                 newTab.setActive(true);
                 UIInclude include=new Include();
                 include.setViewId("/pages/party/partydetails.xhtml");
                 newTab.setData(include);
                 tabs.setSelectedTab("Party Search");
                 }
                 return tabs;
                 }
                


                • 5. Re: Include as child of UITab
                  Denis Halupa Newbie

                  As mentioned above, not possible, there is some logic in ComponentHandler class (did not bother to investigate what kind of logic) which is not invoked if you create component from java. I was lucky that not all of tabs in my tab panel has to be dynamic therefore I have created tabs with include as child in markup and the rest of tabs I am creating from java

                  Kind regards,

                  Denis