Here's the action listener for the add child node
command link:
public void createProArgumentationNode(ActionEvent event)
{
ArgumentationNode child = createNode();
ArgumentationNode parent = getCurrentNode();
addEdge(child, parent, true);
/* view updated model data */
focusNode(event, child);
toggleSelectedNode();
}
loadTreeData() gets called twice by the getTreeData()
BEFORE the addition of the new node and once AFTER.
Apparently, the tree model is updated with the previous (old)
data.
Edwin
-----Original Message-----
From: Dennis Byrne [mailto:[EMAIL PROTECTED]
Sent: Friday, July 22, 2005 4:34 PM
To: MyFaces Discussion
Subject: Re: tree3 component reload
Can you post the code for your action listener? I'm curious
to see if loadTreeData() is being called after or before you
updating the tree model.
---- Original message ----
>Date: Fri, 22 Jul 2005 15:40:22 -0400
>From: Edwin Mercado <[EMAIL PROTECTED]>
>Subject: tree3 component reload
>To: [email protected]
>
>Hello all,
>I'm still baffled by the JSF phases. I'm using a tree3
component
>that is a tied to a getTreeData() function to retrieve the
current data
>from the model. Everytime I select a node, the getTreeData()
function is
>called 3 times, retrieving the same data every time.
>
><a:tree3 expandAllInit="true" id="networkTree"
> value="#
{treeBacker.treeData}" var="node"
>varNodeToggler="t"
> clientSideToggle="true">
>...
></a:tree3>
>
> public TreeNode getTreeData() {
> treeData = loadTreeData();
> return treeData;
> }
>
>
>Now, for each tree3 node that has been selected I display
>a command link to add a child node.
>
> <h:commandLink value="#{labels.add_pro} "
> styleClass="document"
> action="UpdateViewAction"
>
>actionListener="#{treeBacker.createProArgumentationNode}">
> <h:graphicImage
value="images/ProNodeIcon.gif"
>border="0" />
> </h:commandLink>
>
>Whenever I click add child node command
>link, the getTreeData() is called 3 times, but with a
little "twist". This
>is
>how it goes:
>
>1st time: getTreeData() gets called and returns the
already displayed
>data
>2nd time: similar steps as in the 1st time.
>====> the actionListener for the add child node command link
gets called.
> The model is updated with the appropriate value.
>3rd time: getTreeData() gets called but this time it
gets the updated
> model value.
>
>Unfortunately, after the 3rd time that getTreeData() got
called with the
>updated
>model value, the tree3 component displays only the previous
stored value.
>Now, if I selected a node THEN the updated value (the added
node) gets
>displayed.
>
>My question is how can I make the tree3 component display
the most recent
>model data?
>
>Thanks
>Edwin
>p.s. I experience the same effect using the tree2 component
instead of the
>tree3.
>
>
Dennis Byrne