You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Scott McMasters <sc...@gmail.com> on 2010/04/12 18:44:25 UTC

[Trinidad] tree nodes not updating in expanded branch

Hello,

I'm using the tree component with ppr, but if a branch is already expanded
and a trigger is assigned to a select list in the form, the nodes don't
update.  Can someone give me an example how to update the tree nodes
properly?  Each node is a checkbox.

Maybe to explain better, when the user changes the value in the select list
element, the selected nodes in the tree should change.  The values in my
node objects are being updated, but that's not being reflected in the page
if the node is visible.  If the branch is collapsed, I change the select
list value and expand the branch, the changes are reflected in the page.

Thanks,

Scott McMasters

RE: [Trinidad] tree nodes not updating in expanded branch

Posted by "Carlson, John W." <ca...@llnl.gov>.
Yeah, we use IceFaces too, after using ADF (not rich faces) and Trinidad.  However, people seem pretty excited about ADF RichFaces these days, Especially with the data binding/data controls in JDeveloper.  I've actually been doing a struts application, which might get converted over to Faces when I new person comes on board.

John

-----Original Message-----
From: Scott McMasters [mailto:scott.mcmasters@gmail.com] 
Sent: Tuesday, April 20, 2010 11:17 AM
To: MyFaces Discussion
Subject: Re: [Trinidad] tree nodes not updating in expanded branch

Thanks for the fucking help.  I've swapped everything over to icefaces,
which actually works, even in IE8.


On Tue, Apr 13, 2010 at 11:59 AM, Scott McMasters <scott.mcmasters@gmail.com
> wrote:

> I'd really appreciate a response.  No one responded to my emails last week.
>
> Thanks
>
>
>
> On Mon, Apr 12, 2010 at 7:29 PM, Scott McMasters <
> scott.mcmasters@gmail.com> wrote:
>
>> This is an xhtml document which reproduces the problem:
>>
>> <tr:document xmlns:ui="http://*java.sun.com/jsf/facelets"
>>     xmlns:f="http://*java.sun.com/jsf/core"
>>     xmlns:t="http://*myfaces.apache.org/tomahawk"
>>     xmlns:h="http://*java.sun.com/jsf/html"
>>     xmlns:tr="http://*myfaces.apache.org/trinidad">
>>     <f:loadBundle basename="labels" var="labels" />
>>     <tr:form id="titolare_form">
>>
>>         <tr:messages styleClass="jsf_messages" />
>>
>>         <tr:selectOneChoice id="myList" value="#{treeTest.selectedId}"
>>             autoSubmit="true" immediate="true" valuePassThru="true"
>>             valueChangeListener="#{treeTest.change}">
>>             <f:selectItems value="#{treeTest.selectItems}"/>
>>         </tr:selectOneChoice>
>>
>>         <tr:tree var="descritorre" value="#{treeTest.model}"
>>             partialTriggers="myList">
>>             <f:facet name="nodeStamp">
>>                 <tr:selectBooleanCheckbox
>> selected="#{descritorre.selected}"
>>                     text="#{descritorre.desMattone}" />
>>             </f:facet>
>>         </tr:tree>
>>
>>     </tr:form>
>> </tr:document>
>>
>> And this is the Java bean, in session scope:
>>
>> package it.eng.sis.mra.test;
>>
>> import it.eng.sis.mra.beans.jsf.TpDescritorreNode;
>>
>> import java.util.ArrayList;
>> import java.util.List;
>>
>> import javax.faces.context.FacesContext;
>> import javax.faces.event.ValueChangeEvent;
>> import javax.faces.model.SelectItem;
>>
>> import org.apache.myfaces.trinidad.model.ChildPropertyTreeModel;
>> import org.apache.myfaces.trinidad.model.TreeModel;
>>
>> public class TreeTest
>> {
>>     private TreeModel model;
>>     private List<TpDescritorreNode> nodes;
>>     private List selectItems;
>>     private String selectedId;
>>
>>     public void change(ValueChangeEvent vce)
>>     {
>>         System.out.println("here");
>>         boolean select = true;
>>
>>         if(vce.getNewValue().equals("1"))
>>             select = false;
>>
>>         TpDescritorreNode node = nodes.get(0);
>>         node.setSelected(select);
>>
>>         for(TpDescritorreNode n: node.getChildNodes())
>>             n.setSelected(select);
>>
>>         FacesContext.getCurrentInstance().renderResponse();
>>
>>     }
>>
>>     public TreeTest()
>>     {
>>         nodes = new ArrayList<TpDescritorreNode>();
>>         List children = new ArrayList();
>>
>>         TpDescritorreNode node = new TpDescritorreNode();
>>         node.setDesMattone("child 1");
>>         children.add(node);
>>
>>         node = new TpDescritorreNode();
>>         node.setDesMattone("child 2");
>>         children.add(node);
>>
>>         node = new TpDescritorreNode();
>>         node.setDesMattone("child 3");
>>         children.add(node);
>>
>>         node = new TpDescritorreNode();
>>         node.setDesMattone("parent");
>>         node.setChildNodes(children);
>>         nodes.add(node);
>>
>>         model = new ChildPropertyTreeModel(nodes, "childNodes");
>>
>>         selectItems = new ArrayList();
>>         selectItems.add(new SelectItem("1", "one"));
>>         selectItems.add(new SelectItem("2", "two"));
>>
>>     }
>>
>>     public TreeModel getModel()
>>     {
>>         return model;
>>     }
>>
>>     public List getSelectItems()
>>     {
>>         return selectItems;
>>     }
>>
>>     public String getSelectedId()
>>     {
>>         return selectedId;
>>     }
>>
>>     public void setSelectedId(String selectedId)
>>     {
>>         this.selectedId = selectedId;
>>
>>     }
>>
>> }
>>
>>
>>
>> On Mon, Apr 12, 2010 at 6:44 PM, Scott McMasters <
>> scott.mcmasters@gmail.com> wrote:
>>
>>> Hello,
>>>
>>> I'm using the tree component with ppr, but if a branch is already
>>> expanded and a trigger is assigned to a select list in the form, the nodes
>>> don't update.  Can someone give me an example how to update the tree nodes
>>> properly?  Each node is a checkbox.
>>>
>>> Maybe to explain better, when the user changes the value in the select
>>> list element, the selected nodes in the tree should change.  The values in
>>> my node objects are being updated, but that's not being reflected in the
>>> page if the node is visible.  If the branch is collapsed, I change the
>>> select list value and expand the branch, the changes are reflected in the
>>> page.
>>>
>>> Thanks,
>>>
>>> Scott McMasters
>>>
>>>
>>
>

Re: [Trinidad] tree nodes not updating in expanded branch

Posted by Scott McMasters <sc...@gmail.com>.
Thanks for the fucking help.  I've swapped everything over to icefaces,
which actually works, even in IE8.


On Tue, Apr 13, 2010 at 11:59 AM, Scott McMasters <scott.mcmasters@gmail.com
> wrote:

> I'd really appreciate a response.  No one responded to my emails last week.
>
> Thanks
>
>
>
> On Mon, Apr 12, 2010 at 7:29 PM, Scott McMasters <
> scott.mcmasters@gmail.com> wrote:
>
>> This is an xhtml document which reproduces the problem:
>>
>> <tr:document xmlns:ui="http://java.sun.com/jsf/facelets"
>>     xmlns:f="http://java.sun.com/jsf/core"
>>     xmlns:t="http://myfaces.apache.org/tomahawk"
>>     xmlns:h="http://java.sun.com/jsf/html"
>>     xmlns:tr="http://myfaces.apache.org/trinidad">
>>     <f:loadBundle basename="labels" var="labels" />
>>     <tr:form id="titolare_form">
>>
>>         <tr:messages styleClass="jsf_messages" />
>>
>>         <tr:selectOneChoice id="myList" value="#{treeTest.selectedId}"
>>             autoSubmit="true" immediate="true" valuePassThru="true"
>>             valueChangeListener="#{treeTest.change}">
>>             <f:selectItems value="#{treeTest.selectItems}"/>
>>         </tr:selectOneChoice>
>>
>>         <tr:tree var="descritorre" value="#{treeTest.model}"
>>             partialTriggers="myList">
>>             <f:facet name="nodeStamp">
>>                 <tr:selectBooleanCheckbox
>> selected="#{descritorre.selected}"
>>                     text="#{descritorre.desMattone}" />
>>             </f:facet>
>>         </tr:tree>
>>
>>     </tr:form>
>> </tr:document>
>>
>> And this is the Java bean, in session scope:
>>
>> package it.eng.sis.mra.test;
>>
>> import it.eng.sis.mra.beans.jsf.TpDescritorreNode;
>>
>> import java.util.ArrayList;
>> import java.util.List;
>>
>> import javax.faces.context.FacesContext;
>> import javax.faces.event.ValueChangeEvent;
>> import javax.faces.model.SelectItem;
>>
>> import org.apache.myfaces.trinidad.model.ChildPropertyTreeModel;
>> import org.apache.myfaces.trinidad.model.TreeModel;
>>
>> public class TreeTest
>> {
>>     private TreeModel model;
>>     private List<TpDescritorreNode> nodes;
>>     private List selectItems;
>>     private String selectedId;
>>
>>     public void change(ValueChangeEvent vce)
>>     {
>>         System.out.println("here");
>>         boolean select = true;
>>
>>         if(vce.getNewValue().equals("1"))
>>             select = false;
>>
>>         TpDescritorreNode node = nodes.get(0);
>>         node.setSelected(select);
>>
>>         for(TpDescritorreNode n: node.getChildNodes())
>>             n.setSelected(select);
>>
>>         FacesContext.getCurrentInstance().renderResponse();
>>
>>     }
>>
>>     public TreeTest()
>>     {
>>         nodes = new ArrayList<TpDescritorreNode>();
>>         List children = new ArrayList();
>>
>>         TpDescritorreNode node = new TpDescritorreNode();
>>         node.setDesMattone("child 1");
>>         children.add(node);
>>
>>         node = new TpDescritorreNode();
>>         node.setDesMattone("child 2");
>>         children.add(node);
>>
>>         node = new TpDescritorreNode();
>>         node.setDesMattone("child 3");
>>         children.add(node);
>>
>>         node = new TpDescritorreNode();
>>         node.setDesMattone("parent");
>>         node.setChildNodes(children);
>>         nodes.add(node);
>>
>>         model = new ChildPropertyTreeModel(nodes, "childNodes");
>>
>>         selectItems = new ArrayList();
>>         selectItems.add(new SelectItem("1", "one"));
>>         selectItems.add(new SelectItem("2", "two"));
>>
>>     }
>>
>>     public TreeModel getModel()
>>     {
>>         return model;
>>     }
>>
>>     public List getSelectItems()
>>     {
>>         return selectItems;
>>     }
>>
>>     public String getSelectedId()
>>     {
>>         return selectedId;
>>     }
>>
>>     public void setSelectedId(String selectedId)
>>     {
>>         this.selectedId = selectedId;
>>
>>     }
>>
>> }
>>
>>
>>
>> On Mon, Apr 12, 2010 at 6:44 PM, Scott McMasters <
>> scott.mcmasters@gmail.com> wrote:
>>
>>> Hello,
>>>
>>> I'm using the tree component with ppr, but if a branch is already
>>> expanded and a trigger is assigned to a select list in the form, the nodes
>>> don't update.  Can someone give me an example how to update the tree nodes
>>> properly?  Each node is a checkbox.
>>>
>>> Maybe to explain better, when the user changes the value in the select
>>> list element, the selected nodes in the tree should change.  The values in
>>> my node objects are being updated, but that's not being reflected in the
>>> page if the node is visible.  If the branch is collapsed, I change the
>>> select list value and expand the branch, the changes are reflected in the
>>> page.
>>>
>>> Thanks,
>>>
>>> Scott McMasters
>>>
>>>
>>
>

Re: [Trinidad] tree nodes not updating in expanded branch

Posted by Scott McMasters <sc...@gmail.com>.
I'd really appreciate a response.  No one responded to my emails last week.

Thanks


On Mon, Apr 12, 2010 at 7:29 PM, Scott McMasters
<sc...@gmail.com>wrote:

> This is an xhtml document which reproduces the problem:
>
> <tr:document xmlns:ui="http://java.sun.com/jsf/facelets"
>     xmlns:f="http://java.sun.com/jsf/core"
>     xmlns:t="http://myfaces.apache.org/tomahawk"
>     xmlns:h="http://java.sun.com/jsf/html"
>     xmlns:tr="http://myfaces.apache.org/trinidad">
>     <f:loadBundle basename="labels" var="labels" />
>     <tr:form id="titolare_form">
>
>         <tr:messages styleClass="jsf_messages" />
>
>         <tr:selectOneChoice id="myList" value="#{treeTest.selectedId}"
>             autoSubmit="true" immediate="true" valuePassThru="true"
>             valueChangeListener="#{treeTest.change}">
>             <f:selectItems value="#{treeTest.selectItems}"/>
>         </tr:selectOneChoice>
>
>         <tr:tree var="descritorre" value="#{treeTest.model}"
>             partialTriggers="myList">
>             <f:facet name="nodeStamp">
>                 <tr:selectBooleanCheckbox
> selected="#{descritorre.selected}"
>                     text="#{descritorre.desMattone}" />
>             </f:facet>
>         </tr:tree>
>
>     </tr:form>
> </tr:document>
>
> And this is the Java bean, in session scope:
>
> package it.eng.sis.mra.test;
>
> import it.eng.sis.mra.beans.jsf.TpDescritorreNode;
>
> import java.util.ArrayList;
> import java.util.List;
>
> import javax.faces.context.FacesContext;
> import javax.faces.event.ValueChangeEvent;
> import javax.faces.model.SelectItem;
>
> import org.apache.myfaces.trinidad.model.ChildPropertyTreeModel;
> import org.apache.myfaces.trinidad.model.TreeModel;
>
> public class TreeTest
> {
>     private TreeModel model;
>     private List<TpDescritorreNode> nodes;
>     private List selectItems;
>     private String selectedId;
>
>     public void change(ValueChangeEvent vce)
>     {
>         System.out.println("here");
>         boolean select = true;
>
>         if(vce.getNewValue().equals("1"))
>             select = false;
>
>         TpDescritorreNode node = nodes.get(0);
>         node.setSelected(select);
>
>         for(TpDescritorreNode n: node.getChildNodes())
>             n.setSelected(select);
>
>         FacesContext.getCurrentInstance().renderResponse();
>
>     }
>
>     public TreeTest()
>     {
>         nodes = new ArrayList<TpDescritorreNode>();
>         List children = new ArrayList();
>
>         TpDescritorreNode node = new TpDescritorreNode();
>         node.setDesMattone("child 1");
>         children.add(node);
>
>         node = new TpDescritorreNode();
>         node.setDesMattone("child 2");
>         children.add(node);
>
>         node = new TpDescritorreNode();
>         node.setDesMattone("child 3");
>         children.add(node);
>
>         node = new TpDescritorreNode();
>         node.setDesMattone("parent");
>         node.setChildNodes(children);
>         nodes.add(node);
>
>         model = new ChildPropertyTreeModel(nodes, "childNodes");
>
>         selectItems = new ArrayList();
>         selectItems.add(new SelectItem("1", "one"));
>         selectItems.add(new SelectItem("2", "two"));
>
>     }
>
>     public TreeModel getModel()
>     {
>         return model;
>     }
>
>     public List getSelectItems()
>     {
>         return selectItems;
>     }
>
>     public String getSelectedId()
>     {
>         return selectedId;
>     }
>
>     public void setSelectedId(String selectedId)
>     {
>         this.selectedId = selectedId;
>
>     }
>
> }
>
>
>
> On Mon, Apr 12, 2010 at 6:44 PM, Scott McMasters <
> scott.mcmasters@gmail.com> wrote:
>
>> Hello,
>>
>> I'm using the tree component with ppr, but if a branch is already expanded
>> and a trigger is assigned to a select list in the form, the nodes don't
>> update.  Can someone give me an example how to update the tree nodes
>> properly?  Each node is a checkbox.
>>
>> Maybe to explain better, when the user changes the value in the select
>> list element, the selected nodes in the tree should change.  The values in
>> my node objects are being updated, but that's not being reflected in the
>> page if the node is visible.  If the branch is collapsed, I change the
>> select list value and expand the branch, the changes are reflected in the
>> page.
>>
>> Thanks,
>>
>> Scott McMasters
>>
>>
>

Re: [Trinidad] tree nodes not updating in expanded branch

Posted by Scott McMasters <sc...@gmail.com>.
This is an xhtml document which reproduces the problem:

<tr:document xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:t="http://myfaces.apache.org/tomahawk"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:tr="http://myfaces.apache.org/trinidad">
    <f:loadBundle basename="labels" var="labels" />
    <tr:form id="titolare_form">

        <tr:messages styleClass="jsf_messages" />

        <tr:selectOneChoice id="myList" value="#{treeTest.selectedId}"
            autoSubmit="true" immediate="true" valuePassThru="true"
            valueChangeListener="#{treeTest.change}">
            <f:selectItems value="#{treeTest.selectItems}"/>
        </tr:selectOneChoice>

        <tr:tree var="descritorre" value="#{treeTest.model}"
            partialTriggers="myList">
            <f:facet name="nodeStamp">
                <tr:selectBooleanCheckbox selected="#{descritorre.selected}"
                    text="#{descritorre.desMattone}" />
            </f:facet>
        </tr:tree>

    </tr:form>
</tr:document>

And this is the Java bean, in session scope:

package it.eng.sis.mra.test;

import it.eng.sis.mra.beans.jsf.TpDescritorreNode;

import java.util.ArrayList;
import java.util.List;

import javax.faces.context.FacesContext;
import javax.faces.event.ValueChangeEvent;
import javax.faces.model.SelectItem;

import org.apache.myfaces.trinidad.model.ChildPropertyTreeModel;
import org.apache.myfaces.trinidad.model.TreeModel;

public class TreeTest
{
    private TreeModel model;
    private List<TpDescritorreNode> nodes;
    private List selectItems;
    private String selectedId;

    public void change(ValueChangeEvent vce)
    {
        System.out.println("here");
        boolean select = true;

        if(vce.getNewValue().equals("1"))
            select = false;

        TpDescritorreNode node = nodes.get(0);
        node.setSelected(select);

        for(TpDescritorreNode n: node.getChildNodes())
            n.setSelected(select);

        FacesContext.getCurrentInstance().renderResponse();

    }

    public TreeTest()
    {
        nodes = new ArrayList<TpDescritorreNode>();
        List children = new ArrayList();

        TpDescritorreNode node = new TpDescritorreNode();
        node.setDesMattone("child 1");
        children.add(node);

        node = new TpDescritorreNode();
        node.setDesMattone("child 2");
        children.add(node);

        node = new TpDescritorreNode();
        node.setDesMattone("child 3");
        children.add(node);

        node = new TpDescritorreNode();
        node.setDesMattone("parent");
        node.setChildNodes(children);
        nodes.add(node);

        model = new ChildPropertyTreeModel(nodes, "childNodes");

        selectItems = new ArrayList();
        selectItems.add(new SelectItem("1", "one"));
        selectItems.add(new SelectItem("2", "two"));

    }

    public TreeModel getModel()
    {
        return model;
    }

    public List getSelectItems()
    {
        return selectItems;
    }

    public String getSelectedId()
    {
        return selectedId;
    }

    public void setSelectedId(String selectedId)
    {
        this.selectedId = selectedId;
    }

}



On Mon, Apr 12, 2010 at 6:44 PM, Scott McMasters
<sc...@gmail.com>wrote:

> Hello,
>
> I'm using the tree component with ppr, but if a branch is already expanded
> and a trigger is assigned to a select list in the form, the nodes don't
> update.  Can someone give me an example how to update the tree nodes
> properly?  Each node is a checkbox.
>
> Maybe to explain better, when the user changes the value in the select list
> element, the selected nodes in the tree should change.  The values in my
> node objects are being updated, but that's not being reflected in the page
> if the node is visible.  If the branch is collapsed, I change the select
> list value and expand the branch, the changes are reflected in the page.
>
> Thanks,
>
> Scott McMasters
>
>