Changing the content in Tree2
-----------------------------

         Key: MYFACES-679
         URL: http://issues.apache.org/jira/browse/MYFACES-679
     Project: MyFaces
        Type: Bug
  Components: Tomahawk  
    Versions: 1.1.0    
 Environment: OC4J_Extended_10g, SDK 1.4.2_06, Windows 2000
    Reporter: Giuseppe Baglioni


I have a problem with Tree2 in a JSP page when I try to change the content with 
new data.
When I load data for the first time it works fine. 
Then I use a dropdown menu and a button to choose a new set of data to reload 
the Tree2. The JSP page continues to show the old Tree2, but if I click the 
button another time Tree2 shows new data.
I verified that the TreeNode used by Tree2 is loaded with new data also the 
first time I click the button, so it doesn't seem to be a TreeNode problem.

This is the JSP page code using Tree2.

<h:form>
        <h:panelGrid columns="3">
            <h:outputLabel for="year" value="YEAR:" />
            <h:selectOneMenu id="year" value="#{treeTable.year}" 
styleClass="selectOneMenu" required="true" >
                <f:selectItems value="#{treeTable.yearList}" />
            </h:selectOneMenu>
            <h:commandButton action="#{treeTable.Update}" value="Update" />
        </h:panelGrid>
       
    <t:tree2 id="clientTree" value="#{treeTable.treeData}" var="node" 
varNodeToggler="t">
        <f:facet name="caa">
            <h:panelGroup>
                <f:facet name="expand">
                    <t:graphicImage value="images/yellow-folder-open.png" 
rendered="#{t.nodeExpanded}" border="0"/>
                </f:facet>
                <f:facet name="collapse">
                    <t:graphicImage value="images/yellow-folder-closed.png" 
rendered="#{!t.nodeExpanded}" border="0"/>
                </f:facet>
                <h:outputText value="#{node.description}" 
styleClass="standard"/>
            </h:panelGroup>
        </f:facet>
    </t:tree2>     
</h:form>       

and this is the session scope bean code preparing TreeNode object

    TreeNode treeData = null;
    public void Update() throws Exception {
        TreeNodeBase caaNode = null, provNode = null, sedeNode = null;
        String caa;
        int count;
        int level;
        List appoList = this.loadList(year);   // I load appoList with TreeItem 
objects
        for (int i=0; i<appoList.size(); i++) {
                         caa = ((TreeItem) appoList.get(i)).getCaa();
            count = ((TreeItem) appoList.get(i)).getCount().intValue();
            level = ((TreeItem) appoList.get(i)).getLevel();
            if (livello == 0) {
                        treeData = new TreeNodeBase("caa", caa+" - "+count, 
false);
            }
            else if (level == 1) {
               caaNode = new TreeNodeBase("caa", caa+" - "+count, false);
               treeData.getChildren().add(caaNode);
            }
            else if (level == 2) {
               provNode = new TreeNodeBase("caa", caa+" - "+count, false);
               caaNode.getChildren().add(provNode);
            }
            else if (level == 3) {
               sedeNode = new TreeNodeBase("caa", caa+" - "+count, true);
               provNode.getChildren().add(sedeNode);
                         }
                   }    
    }

Thank you in advance,

Giuseppe


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to