I need to create all UI components programmatically, and was doing great until I stumbled of the root of the Tree.
Here is the code:
UIViewRoot viewRoot = facesContext.getViewRoot();
UIComponent form1 = viewRoot.findComponent("form1");
Layout layout = new Layout();
layout.setStyle("height:530px; overflow:auto; ");
this.getChildren().add(layout);
LayoutUnit lu = new LayoutUnit();
layout.getChildren().add(lu);
treePanel = new Panel();
treePanel.setHeader("Admissions");
lu.getChildren().add(treePanel);
tree = new Tree();
treePanel.getChildren().add(tree);
DefaultTreeNode node= new DefaultTreeNode("Test", null);
node.addChild(new DefaultTreeNode("Test", root));
tree.setValue(node);
What can I do?
Dynamic widget creation
What is your problem exactly with
?the root of the Tree
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin
I get an exception. I have looked into the Tree, TreeNode code, but I am quite new to JSF/Primefaces so I can't figure it out.
What I would like to do, is add a type of nodes that are capable of displaying themselves.
So, *not* this:
<p:tree value="#{...}" expanded="false" ...>
<p:treeNode type="level0">
<h:outputText value="#{item.courseRevision.tblCourseCategory.name}">
</h:outputText>
</p:treeNode>
...
Instead, I would like to add nodes like Buttons, Labels, etc. to the tree from the server side.
So, I guess it was not the root that I stumbled over, but the nodes ...
What I would like to do, is add a type of nodes that are capable of displaying themselves.
So, *not* this:
<p:tree value="#{...}" expanded="false" ...>
<p:treeNode type="level0">
<h:outputText value="#{item.courseRevision.tblCourseCategory.name}">
</h:outputText>
</p:treeNode>
...
Instead, I would like to add nodes like Buttons, Labels, etc. to the tree from the server side.
So, I guess it was not the root that I stumbled over, but the nodes ...
I think I may have figured it out: I must create a custom renderer ...?leenex wrote:I get an exception. I have looked into the Tree, TreeNode code, but I am quite new to JSF/Primefaces so I can't figure it out.
What I would like to do, is add a type of nodes that are capable of displaying themselves.
So, *not* this:
<p:tree value="#{...}" expanded="false" ...>
<p:treeNode type="level0">
<h:outputText value="#{item.courseRevision.tblCourseCategory.name}">
</h:outputText>
</p:treeNode>
...
Instead, I would like to add nodes like Buttons, Labels, etc. to the tree from the server side.
So, I guess it was not the root that I stumbled over, but the nodes ...
-
- Posts: 11
- Joined: 05 Aug 2011, 12:36
Dear Leenex,
I have a similar need. Can you share any code (with the custom renderer) you have written for this ?
ADV thanx ANCE,
;-p r a b u!
I have a similar need. Can you share any code (with the custom renderer) you have written for this ?
ADV thanx ANCE,
;-p r a b u!
-
- Information
-
Who is online
Users browsing this forum: No registered users and 31 guests