-
1. Re: Tree programmatically creation problem
nbelaevski Jun 23, 2009 6:08 AM (in response to kanikman)Hi kanikman,
Yes, it should work fine. What's not working exactly? -
2. Re: Tree programmatically creation problem
kanikman Jun 23, 2009 6:53 AM (in response to kanikman)This is my bean code:
htmlTree = new HtmlTree(); htmlTree.setId("MenuTreeId"); htmlTree.setSwitchType("client"); htmlTree.setStyle("min-height:100%; min-width:100%; width:100%"); htmlTree.setReRender("selectedNode"); HtmlTreeNode treeNode = new HtmlTreeNode(); treeNode.setData("One"); HtmlTreeNode treeNode1 = new HtmlTreeNode(); treeNode1.setData("Two"); treeNode.getChildren().add(treeNode1); htmlTree.getChildren().add(treeNode);
and this on my page:<rich:panel> <a4j:form> <rich:tree binding="#{menuTreeBean.htmlTree}"> </rich:tree> </a4j:form> </rich:panel>
The problem is nothing displays. -
3. Re: Tree programmatically creation problem
ilya_shaikovsky Jun 23, 2009 7:27 AM (in response to kanikman)tree requires dataModel to be created. check please available samples from the beginning.
-
4. Re: Tree programmatically creation problem
kanikman Jun 23, 2009 7:57 AM (in response to kanikman)So, in doc is create HtmlTree = new HtmTree(); and there is any words about dataModel and what to do with the dataModel.
Which sample, where and so on. I have write that I did not find any sample with using HtmTree interface. I describe my problem cose I did not find any solution.
Can you point me one sample with HtmlTree interface and where to find it ??? -
5. Re: Tree programmatically creation problem
nbelaevski Jun 23, 2009 8:16 AM (in response to kanikman)Add "value" attribute.
-
6. Re: Tree programmatically creation problem
kanikman Jun 23, 2009 8:56 AM (in response to kanikman)You have seen my code. Can You tell me what should I put in value attribute ? htmlTree not work. I don't have in my bean other variables.
-
7. Re: Tree programmatically creation problem
kanikman Jun 23, 2009 9:31 AM (in response to kanikman)Ok, I give up. I'm going to use tomahawk tree. I've wasted 2 days in order to create programmatically simple tree with own icons for every node.
When I created tree like with TreeNodeImpl it works, but I can't set up any icon for nodes and when I reloaded page all nodes collapsed every time. When I've created HtmlTree nothing displays.
It seems RichFaces tree has more disatvantages than adventages. When you find how to do one thigs other not works and so on.
If other component works like tree I'm going to have fear about my project ;). -
8. Re: Tree programmatically creation problem
nbelaevski Jun 23, 2009 9:42 AM (in response to kanikman)"kanikman" wrote:
You have seen my code. Can You tell me what should I put in value attribute ? htmlTree not work. I don't have in my bean other variables.
Check livedemo example: http://livedemo.exadel.com/richfaces-demo/richfaces/tree.jsf?c=tree&tab=usage -
9. Re: Tree programmatically creation problem
ilya_shaikovsky Jun 23, 2009 9:47 AM (in response to kanikman)You just using the component wrong and want us to make samples on all the cases which could rise in JSF world? If you really spent at least small time for exploring samples you should understand what is the dataModel and what is tree value and so on.
-
10. Re: Tree programmatically creation problem
kanikman Jun 23, 2009 9:57 AM (in response to kanikman)"nbelaevski" wrote:
"kanikman" wrote:
You have seen my code. Can You tell me what should I put in value attribute ? htmlTree not work. I don't have in my bean other variables.
Check livedemo example: http://livedemo.exadel.com/richfaces-demo/richfaces/tree.jsf?c=tree&tab=usage
So can You tell me in what place in this livedemo example tree is created by HtmlTree interface ? :). I have on my disk richfaces demo source code and there is no code with HtmlTree interaface. -
11. Re: Tree programmatically creation problem
ilya_shaikovsky Jun 23, 2009 10:13 AM (in response to kanikman)So you could add binding to the component. Create tree Object as you already tried. Define value with valueExpression pointed to the same dataModel. Add nodes and add their children (because node used only for representation definition for different types of nodes and should not be used to add some static node with data as you tried to use).. and so on. Then set needed attributes to the same objects as on the page.
Creation component from java code does not differs from page definition from the points of working with needed attributes. But your usage is completely differs with the page usage shown at sample. -
12. Re: Tree programmatically creation problem
nbelaevski Jun 23, 2009 1:35 PM (in response to kanikman)"kanikman" wrote:
"nbelaevski" wrote:
"kanikman" wrote:
You have seen my code. Can You tell me what should I put in value attribute ? htmlTree not work. I don't have in my bean other variables.
Check livedemo example: http://livedemo.exadel.com/richfaces-demo/richfaces/tree.jsf?c=tree&tab=usage
So can You tell me in what place in this livedemo example tree is created by HtmlTree interface ? :). I have on my disk richfaces demo source code and there is no code with HtmlTree interaface.
It's created using Facelets tag handlers when the example page is compiled. The idea is to check which attributes are important and set them in Java code.
One more example: if you take javax.faces.component.html.HtmlDataTable and create it programmatically, then you'll just get empty table. Fair enough - no "value" is set - no data is rendered; the same applies to rich:tree component (with the one exception - there are special components to describe tree model declaratively, they replace "value" attribute).