1 Reply Latest reply on Sep 4, 2009 4:12 AM by Ilya Shaikovsky

    HOW TO Insert a tab dynamically that has inside a custom for

    Nicolás Carrasco Newbie

      Hello,

      I have a form with a tabPanel that is binded to a backing bean named "treeConfigurationBean".
      I would like to insert a tab dynamically that has inside a custom form defined in a xhtml file. The problem I have is that I cannot include
      ui:include, a4j:include tags dynamically so the tag point to that component.

      At the end of this post are pieces of the escencial files involved in this problem.
      Any help with this would be extremly appreciated. The idea would be to complete the operation addNewTab

      Thanks in advance,
      Nicolas Carrasco



      @Name("treeConfigurationBean")
      @Scope(ScopeType.SESSION)
      public class TreeConfigurationBean implements Serializable{

      ...........................

      private HtmlTabPanel tabPanel;

      public HtmlTabPanel getTabPanel() {
      return tabPanel;
      }

      public void setTabPanel(HtmlTabPanel tabPanel) {
      this.tabPanel = tabPanel;
      }

      void addNewTab ()
      {
      HtmlTab dynamicTab = new HtmlTab();
      nuevoTab.setName("This is a tab generated by code");

      /////// HERE I would like to add the xhtml that contains: <h:outputLabel value="Hello how I can be included dynamically by code" style="color: black" />


      //// how to include
      tabPanel.getChildren().add(dynamicTab);
      }

      }


      /// tab panel form

      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
      xmlns:s="http://jboss.com/products/seam/taglib"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:a4j="http://richfaces.org/a4j">

      <rich:tabPanel id="alarmTabPanel" switchType="ajax" binding="#{treeConfigurationBean.tabPanel}">

      </rich:tabPanel>


      </ui:composition>



      /// custom form that I want to include in the dynamic tab

      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

      <ui:component xmlns="http://www.w3.org/1999/xhtml"
      xmlns:s="http://jboss.com/products/seam/taglib"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:a4j="http://richfaces.org/a4j" >

      <h:outputLabel value="Hello how I can be included dynamically by code" style="color: black" />


      </ui:component>