-
1. Re: need a bit more help getting tree to work as intended
meghiddo Jun 7, 2009 7:44 PM (in response to meghiddo)I was looking at it and it seems something like
<rich:recursiveTreeNodesAdaptor roots="#{treeBean.ids}" var="item" nodes="item.name" />
would work, but it just renders a blank space.
If I just use
<rich:recursiveTreeNodesAdaptor roots="#{treeBean.ids}" />
it also is a blank page, so maybe I was wrong about being able to use xml in a java list as the data source? -
2. Re: need a bit more help getting tree to work as intended
meghiddo Jun 7, 2009 7:44 PM (in response to meghiddo)I meant of course
<rich:recursiveTreeNodesAdaptor roots="#{treeBean.ids}" var="item" nodes="#{item.name}" /> -
3. Re: need a bit more help getting tree to work as intended
meghiddo Jun 7, 2009 9:56 PM (in response to meghiddo)well this doesnt look good...
worked on this all day with no luck and no replies either -
4. Re: need a bit more help getting tree to work as intended
meghiddo Jun 8, 2009 11:50 AM (in response to meghiddo)nothing? so I should take that as I am completely off here?
I am not even on teh right track then? -
5. Re: need a bit more help getting tree to work as intended
nbelaevski Jun 8, 2009 12:00 PM (in response to meghiddo)"Meghiddo" wrote:
I meant of course
<rich:recursiveTreeNodesAdaptor roots="#{treeBean.ids}" var="item" nodes="#{item.name}" />
This should work. -
6. Re: need a bit more help getting tree to work as intended
meghiddo Jun 8, 2009 2:08 PM (in response to meghiddo)hmm I wonder what the heck Im doing wrong then?
-
7. Re: need a bit more help getting tree to work as intended
meghiddo Jun 8, 2009 3:53 PM (in response to meghiddo)well there were definitely some things I needed to change. But still having problems, can you tell me what this means:
I was able to load my list ids with the following value:[<?xml version="1.0" encoding="UTF-8"?> <deviceCollection> <device> <deviceId>exampleDevice1</deviceId> <name>Example Device 1</name> </device> <device> <deviceId>WSN-Module-8F3A-D247-4B99</deviceId> <name>WSN CRio Device</name> </device> </deviceCollection>]
Then I bind the list ids to my tree like so:
<rich:recursiveTreeNodesAdaptor roots="#{recTreeBean.ids}" />
However it gives me a tree with one node, and that node is one very long String that looks like this:
<?xml version="1.0" encoding="UTF-8"?> exampleDevice1 Example Device 1 WSN-Module-8F3A-D247-4B99 WSN CRio Device
So it seems that I am definitely getting the data into my ids variable, but it is not being recognized as xml, but just converting this xml into one long string.
Am I correct on that? So before I add this data to my ids list, I need to parse it so it is recognized as xml right? Is that what I am needing to do or am I still off?
I use simpleXml for my parsing and such, but I am still learning how to use it.
So if Im right I need to use simplexml to parse this data into xml, then put that xml into the ids list, right?
If someone can help me do this it would be great, but also if someone can just confirn that this is what needs to be done it would be nice too -
8. Re: need a bit more help getting tree to work as intended
meghiddo Jun 8, 2009 3:57 PM (in response to meghiddo)Ok I looked at it and I was getting my responseBody as a String, not a s astream, so that is why it was doing that.
So here is where I am.
I have an InputStream that is holding my xml. I cant add this to a list because a list will not accept an inputStream.
So I need to get this InputStream into some useable form which I can bind to the tree.
ANy sugestions? -
9. Re: need a bit more help getting tree to work as intended
meghiddo Jun 8, 2009 4:07 PM (in response to meghiddo)maybe this?
private TreeNode data; .... FacesContext context = FacesContext.getCurrentInstance(); try { data = XmlTreeDataBuilder.build(new InputSource(responseBody)); } catch (SAXException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }
and that should set the TreeNode data. I mean i already know that responseBody is a stream that is holding my xml, so this should bind that to data right? -
10. Re: need a bit more help getting tree to work as intended
meghiddo Jun 8, 2009 4:14 PM (in response to meghiddo)bah of course not.
no that just gives me a one branch tree with this branch:
org.richfaces.model.TreeNodeImpl@e391c4
any sugestions of how to fix this>
I think it comes down to that i have a stream or string or whatever else I can convert it to that is holding my xml data. But it does not recognize it as xml.