Hi, 
Did you ever get this to work what was your solution 


Leyzerzon, Simeon-2 wrote:
> 
> Hi, 
> 
> I'm having the following difficulty and hope someone knowledgeable will be
> able to offer a hand, please:
> 
> Here is my setup (sorry if it's too lengthy, but I wanted to give all
> relevant details in one scoop):
> 
> I have 2 vertical frames with a treeview2 in the left page (tree.jsp) and
> a jsf page in the right one.  The right jsf page (reportTabset2.jsp)
> contains a tabbedPanel element bound to a 'selector2' bean behind the
> page.  Here is the code:
> 
> 
> Tree2.jsp
> ==========
> Has a treeview2 control with the folloing facet on the leaf node:
> 
> <f:facet name="document">
>       <h:panelGroup>
>               <h:commandLink id="report_link" immediate="false"
>                               styleClass="#{t.nodeSelected ? 
> 'documentSelected':'document'}"
>                               action="#{treeBacker2.processSelectAction}">
>                               <t:graphicImage value="../../img/document.png" 
> border="0" />
>                               <h:outputText value="#{node.description}" />
>                               <f:param name="docNum" 
> value="#{node.identifier}" />
>                               </h:commandLink>
>       </h:panelGroup>
> </f:facet>
> 
> reportTabset2.jsp
> =================
> <f:view>
> 
> <h:panelGrid columns="1" styleClass="page" rowClasses="top">
> 
> <t:panelTabbedPane id="tabbedP" bgcolor="#FFFFCC"
> serverSideTabSwitch="false"  width="100%"
> binding="#{treeBacker2.selector2.tabbedPaneRoot}">
> 
> </t:panelTabbedPane>
> 
> </h:panelGrid>
> 
> </f:view> 
> 
> treeBacker2 bean is the backing bean behind the left treeview2 page
> (tree.jsp) as defined in faces-config:
> 
> Faces-config.xml
> ================
> 
>       <managed-bean>
>               <managed-bean-name>treeBacker2</managed-bean-name>
>               <managed-bean-class>
>                       com.csfb.fao.clr.reports.controller.TreeHandler2
>               </managed-bean-class>
>               <managed-bean-scope>session</managed-bean-scope>
>       </managed-bean>
> 
> 
>       <managed-bean>
>               <managed-bean-name>selector2</managed-bean-name>
>               <managed-bean-class>
>                       com.csfb.fao.clr.reports.controller.SelectorHandler2
>               </managed-bean-class>
>               <managed-bean-scope>session</managed-bean-scope>
>       </managed-bean>
> 
> 
> The selector2 bean is created in the constructor of the treeBacker2 like
> this:
> 
> 
> TreeHandler2.java
> ====================
> public TreeHandler2() {
>         treeModel = new TreeModel();
>         selector2 = new SelectorHandler2();
>     }
> 
> The action listener for the click on the tree node leaf is define like so:
> 
> TreeHandler2.java
> =================
> public String processSelectAction() {
>  
>         HtmlPanelTabbedPane root = selector2.getTabbedPaneRoot();
>         
>         HtmlPanelTab tab = (HtmlPanelTab) FacesContext
>         .getCurrentInstance().getApplication().createComponent(
>                 HtmlPanelTab.COMPONENT_TYPE);
>         
>         HtmlPanelTab tab1 = (HtmlPanelTab) FacesContext
>         .getCurrentInstance().getApplication().createComponent(
>                 HtmlPanelTab.COMPONENT_TYPE);
>         
>         tab.setRendered(true);
>         
>         root.getChildren().add(tab);
>         root.getChildren().add(tab1);
>         
>         return "showTabset";
>     }
> 
> 
> Navigation case for "showTabset" outcome is as follows:
>       <navigation-rule>
>               <from-view-id>/jsp/reports/tree2.jsp</from-view-id>
>               <navigation-case>
>                       <from-outcome>showTabset</from-outcome>
>                       <to-view-id>/jsp/reports/reportTabset2.jsp</to-view-id>
>               </navigation-case>
>       </navigation-rule>
> 
> 
> Here is the contents of the selector2 bean:
> 
> SelectorHandler2.java
> ================
> 
> public class SelectorHandler2 implements Serializable {
> 
>     private HtmlPanelTabbedPane tabbedPaneRoot = (HtmlPanelTabbedPane)
> FacesContext
>             .getCurrentInstance().getApplication().createComponent(
>                     HtmlPanelTabbedPane.COMPONENT_TYPE);
>     
>     
>     public SelectorHandler2() {
>         System.out.println("SelectorHandler2 constructor..." +
> tabbedPaneRoot);
>     }
>     
>     
>     /**
>      * @return the tabbedPaneRoot
>      */
>     public HtmlPanelTabbedPane getTabbedPaneRoot() {
>         System.out.println("GETTER of the root" + tabbedPaneRoot);
>         return this.tabbedPaneRoot;
>     }
> 
>     /**
>      * @param tabbedPaneRoot
>      *            the tabbedPaneRoot to set
>      */
>     public void setTabbedPaneRoot(HtmlPanelTabbedPane tabbedPaneRoot) {
>         System.out.println("SETTER of the root" + tabbedPaneRoot);
>         this.tabbedPaneRoot = tabbedPaneRoot;
>     }
> 
> 
> As you can see, I'm trying to have a tabbedPane to be dynamically built in
> the right side of the screen, so that every click on the tree node should
> generate an additional tab in that tabbedPane.  Instead what's happening
> is: initially, only when I click on the tree the first time around, the
> tabbedPane gets appended with 2 tabs, and then when I click on a tree once
> again, the tabbedPane looses all its children and gets displayed empty
> from that point on.  Looks like the tabbedPane get reset on every
> postback, but I don't understand why this is happening.  I've printed some
> stack traces, and it looks like the tabbedPane getter gets called twice,
> and then on a postback a setter gets called and that is when the object
> gets reset to a new one by JSF.  Don't understand why this is happening
> and how I could change the behavior.  Please help! 
> 
> 
> GETTER of the
> [EMAIL PROTECTED]
> 10:07:47,499  INFO TreeHandler2:? - before adding a tab children count: 2
> 10:07:47,499  INFO TreeHandler2:? - tree.getNode().getDescription(): Loan
> Spreads
> 10:07:47,499  INFO TreeHandler2:? - after adding a tab children count: 4
> 10:07:47,499  INFO TreeHandler2:? - is selector null: false
> 10:07:47,499  INFO TreeHandler2:? - clicked report --Exception|LIQ|Loan
> Spreads-- has been successfully passed to selectorHandler
> GETTER of the
> [EMAIL PROTECTED]
> SETTER of the
> [EMAIL PROTECTED]
> 
> Thanks,
> 
> Simeon
> 
> 
> ==============================================================================
> Please access the attached hyperlink for an important electronic
> communications disclaimer: 
> 
> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
> ==============================================================================
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Dynamic-tabbedPanel--generation-via-treeview2-tf2738006.html#a13056453
Sent from the MyFaces - Users mailing list archive at Nabble.com.

Reply via email to