You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Alban Coulange <al...@hotmail.com> on 2005/10/05 10:46:45 UTC

deleting nodes in tree2

Hello,
I would like to know if I was deleting nodes correctly in the tree.
I get the tree : 
*********************

FacesContext facesContext = FacesContext.getCurrentInstance();
		ht = (HtmlTree) facesContext.getViewRoot()
		.findComponent(":validationForm:validation-tree");
		root = (ValidationTreeNode)ht.getValue();
*******************


I get the list of children, 
*************
Iterator it = root.getChildren().iterator();
************
and remove the one I don't need any more via an iterator over that list. 
And then : 
**********
ht.setValue(root); or //ht.setValue(root);
************

But doing this, I got strange problems : 
I get the exception
***************
[org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/sda]] 
Node with id 0:0. Failed to parse 0:0:0
java.lang.IllegalArgumentException: Node with id 0:0. Failed to parse 0:0:0
*************
 or not (it is  not predictible).
Or it looses (I think) the ids and it affects the rest of the page (some <br>
are turned into &alt br &alt if I don't put MY ids)
If I put my ids in the rest of the components, then the ergonomics is not
affected. The last example every time I remove a node.
For the exception above it occurs whenever it wants!

Is there a proper way to use the tree2?
Any help would be very appreciated.
Thanks,
Alban.



Re: deleting nodes in tree2

Posted by Alban Coulange <al...@hotmail.com>.
Well,
I tried both of your solutions, I thought it was working,
but after a while it has re-appeared!!!
I don't know what to do.
Maybe I will change the look of my web page.
If I delete a node it turns "<p>&nbsp</p>" (it is an example) into
"&lt;p&gt;&amp;nbsp&lt;/p&gt;"!! And it is not because I am using &nsbp I tried
with the BR and other stuff.
I am really closed to give up!
Alban.





Re: deleting nodes in tree2

Posted by Christian Froelich <C....@gmx.de>.
Hi,

just some ideas:

  - you could try to use the action attribute of the commandButton
    in combination with the pageNavigation in the faces-config.xml 
    -> perhaps it causes some kind of 'model reload'
  - did you try to delete the whole tree and add a 'new' one with 
    the contains every node but the selected one??

For me the first approach worked quite well.. (in treeTable with t:tree).

Hope it helps,

Christian 



> --- Ursprüngliche Nachricht ---
> Von: alban <al...@hotmail.com>
> An: users@myfaces.apache.org
> Betreff: Re: deleting nodes in tree2
> Datum: Thu, 6 Oct 2005 08:56:07 +0000 (UTC)
> 
> Thanks for your reply.
> How I delete nodes? I have checkboxes at each leaf and each level of my
> tree. 
> If the user submits the form with a button say "Submit" it calls an 
> actionListener, gets the tree2 check all the checkboxes and deletes the
> nodes. 
> This step works fine. After that, it looks like the tree gets lost with
> the 
> ids.
> It seems to be a bug http://issues.apache.org/jira/browse/MYFACES-351 !!!
> So I don't know what to do...
> Alban.
> 
> 

-- 
NEU: Telefon-Flatrate fürs dt. Festnetz! GMX Phone_Flat: 9,99 Euro/Mon.*
Für DSL-Nutzer. Ohne Providerwechsel! http://www.gmx.net/de/go/telefonie

Re: deleting nodes in tree2

Posted by alban <al...@hotmail.com>.
Thanks for your reply.
How I delete nodes? I have checkboxes at each leaf and each level of my tree. 
If the user submits the form with a button say "Submit" it calls an 
actionListener, gets the tree2 check all the checkboxes and deletes the nodes. 
This step works fine. After that, it looks like the tree gets lost with the 
ids.
It seems to be a bug http://issues.apache.org/jira/browse/MYFACES-351 !!!
So I don't know what to do...
Alban.



Re: deleting nodes in tree2

Posted by Christian Froelich <C....@gmx.de>.
Hi,

could you explain HOW you delete the nodes? Do you click on a node,
represented by a commandLink or do you use checkboxes..or..

I had a similar problem changing the treeModel of tree (not tree2).
I implemented my own sorting for a treeTable using t:tree. After
a click on a commandLink which triggers the sorting the renderer rendered
the old treeModel, not the updated one.
The solution was to use the action attribute of the commandLink in
combination with the page navigation.

Regards,

Christian

> --- Ursprüngliche Nachricht ---
> Von: Alban Coulange <al...@hotmail.com>
> An: users@myfaces.apache.org
> Betreff: deleting nodes in tree2
> Datum: Wed, 5 Oct 2005 08:46:45 +0000 (UTC)
> 
> Hello,
> I would like to know if I was deleting nodes correctly in the tree.
> I get the tree : 
> *********************
> 
> FacesContext facesContext = FacesContext.getCurrentInstance();
> 		ht = (HtmlTree) facesContext.getViewRoot()
> 		.findComponent(":validationForm:validation-tree");
> 		root = (ValidationTreeNode)ht.getValue();
> *******************
> 
> 
> I get the list of children, 
> *************
> Iterator it = root.getChildren().iterator();
> ************
> and remove the one I don't need any more via an iterator over that list. 
> And then : 
> **********
> ht.setValue(root); or //ht.setValue(root);
> ************
> 
> But doing this, I got strange problems : 
> I get the exception
> ***************
> [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/sda]] 
> Node with id 0:0. Failed to parse 0:0:0
> java.lang.IllegalArgumentException: Node with id 0:0. Failed to parse
> 0:0:0
> *************
>  or not (it is  not predictible).
> Or it looses (I think) the ids and it affects the rest of the page (some
> <br>
> are turned into &alt br &alt if I don't put MY ids)
> If I put my ids in the rest of the components, then the ergonomics is not
> affected. The last example every time I remove a node.
> For the exception above it occurs whenever it wants!
> 
> Is there a proper way to use the tree2?
> Any help would be very appreciated.
> Thanks,
> Alban.
> 
> 

-- 
Lust, ein paar Euro nebenbei zu verdienen? Ohne Kosten, ohne Risiko!
Satte Provisionen für GMX Partner: http://www.gmx.net/de/go/partner