-
1. Re: TreeNode & selectBooleanCheckbox HOW-to ???
viggo.navarsete Aug 5, 2007 7:28 AM (in response to krasig)Hi Krasig!
Did you solve this problem? I'm also looking for a tree with checkboxes next to each node in the tree.
Best Regards,
Viggo -
2. Re: TreeNode & selectBooleanCheckbox HOW-to ???
krasig Aug 5, 2007 10:09 AM (in response to krasig)Hi Viggo.
No. I can't find solution.
I switched to tomahawk tree2 and everything works.
Regards. -
3. Re: TreeNode & selectBooleanCheckbox HOW-to ???
viggo.navarsete Aug 5, 2007 10:32 AM (in response to krasig)ok, so the tree2 got the "checkbox feature"?! Can I still use the RealFaces and tomahawk together, or will there be some problems then?
-
4. Re: TreeNode & selectBooleanCheckbox HOW-to ???
krasig Aug 5, 2007 11:04 AM (in response to krasig)I use RealFaces and tomahawk and no problems.
Checkboxes is not build on feature in tree2. If you interested i will paste snippet.
Best Regards. -
5. Re: TreeNode & selectBooleanCheckbox HOW-to ???
viggo.navarsete Aug 5, 2007 11:57 AM (in response to krasig)I would really be thankful if you would paste a snippet here yes:)
By the way, I'm using the JSF/RealFaces in a portlet, hope that will work as well. I'm using the JSFPortletBridge. -
6. Re: TreeNode & selectBooleanCheckbox HOW-to ???
krasig Aug 5, 2007 12:22 PM (in response to krasig)Hi Viggo.
I never used portlet anf I don't know how this will work but hope that will be fine.
1. You must extend TreeNodeBase like this:public class ExtendedTreeNode extends TreeNodeBase { private static final long serialVersionUID = 4597634241450394824L; private boolean checked; // ako ima checkBox, default value = false public ExtendedTreeNode( String type, String description, String identifier, boolean p3, boolean isChecked ) { super(type, description, identifier, p3); this.checked = isChecked; } public ExtendedTreeNode() {} public void setChecked(boolean checked) { this.checked = checked; } public boolean isChecked() { return checked; } }
in this way, The node wull have propertie "checked" and in JSF we will have:<t:tree2 id="TreeCheckBox" value="#{modal.areaValuesTree}" var="node" varNodeToggler="t" clientSideToggle="true" showRootNode="false"> <f:facet name="foo-folder"> <h:outputText value="#{node.description}" styleClass="nodeFolder" /> </f:facet> <f:facet name="folder"> <h:panelGroup> <h:selectBooleanCheckbox value="#{node.checked}" /> <h:outputText value="#{node.description}" styleClass="nodeFolder" /> </h:panelGroup> </f:facet> ... <t:tree2>
And that is . Nowwhen submit tree you mus travel over tree to find all checked nodes. I have method for this:public static ArrayList<String> getSelectedTreeNodes( List<ExtendedTreeNode> child) { ArrayList<String> itemID = new ArrayList<String>(); for (int i = 0; i < child.size(); i++) { if (((ExtendedTreeNode) child.get(i)).getChildCount() > 0) { itemID.addAll(getSelectedTreeNodes(((ExtendedTreeNode) child .get(i)).getChildren())); } if (((ExtendedTreeNode) child.get(i)).isChecked() == true) { itemID.add(((ExtendedTreeNode) child.get(i)).getIdentifier()); } } return itemID; }
GOOD LUCK! -
7. Re: TreeNode & selectBooleanCheckbox HOW-to ???
viggo.navarsete Aug 5, 2007 12:37 PM (in response to krasig)Thanks a lot, I will give it a try later tonight:)
-
8. Re: TreeNode & selectBooleanCheckbox HOW-to ???
viggo.navarsete Aug 5, 2007 1:33 PM (in response to krasig)A quick question: Can I use the Tomahawk components with the JSF RI 1.2 implementation?
-
9. Re: TreeNode & selectBooleanCheckbox HOW-to ???
krasig Aug 5, 2007 1:42 PM (in response to krasig)My environment:
Facelets,
JSF 1,2
RichFaces,
Tomahawk
:) -
10. Re: TreeNode & selectBooleanCheckbox HOW-to ???
viggo.navarsete Aug 5, 2007 1:53 PM (in response to krasig)Great :)
Thanks for all your input krasif!! I'm pretty new to JSF development, but I thought I try it, since I've neved tried a component-based web-framework before. -
11. Re: TreeNode & selectBooleanCheckbox HOW-to ???
krasig Aug 5, 2007 1:59 PM (in response to krasig)You are welcome.
-
12. Re: TreeNode & selectBooleanCheckbox HOW-to ???
viggo.navarsete Aug 7, 2007 8:45 AM (in response to krasig)Hi again krasig,
are you using maven to set dependencies to other 3rd party libraries like RichFaces and Tomahawk? If yes, how does your pom.xml look like? I see that ajax4jsf and richFaces have been merged into one project lately, and I would like to take advantage of the new merged project and use the most up-to-date dependencies.
In my current pom.xml the dependencies for JSF 1.2, RichFaces and Tomahawk looks like this:<dependency> <groupId>com.sun.faces.portlet</groupId> <artifactId>jsf-portlet</artifactId> <version>1.2.1</version> </dependency> <dependency> <groupId>org.richfaces</groupId> <artifactId>richfaces</artifactId> <version>3.0.1</version> </dependency> <dependency> <groupId>org.apache.myfaces.tomahawk</groupId> <artifactId>tomahawk</artifactId> <version>1.1.6</version> </dependency>
-
13. Re: TreeNode & selectBooleanCheckbox HOW-to ???
krasig Aug 7, 2007 10:03 AM (in response to krasig)Hi Viggo,
I don'n use maven for dependecies.
Ajax4jsf and RichFaces will be merged in next release. Now i use last stable releases:
RichFaces 3.0.1 and Ajax4jsf 1.1.1 -
14. Re: TreeNode & selectBooleanCheckbox HOW-to ???
viggo.navarsete Aug 11, 2007 1:00 PM (in response to krasig)krasig, a couple more questions:
1. I've added the ExtendedTreeNode class to my project, and added the tree to my page. Now when I deploy my application, I first was missing a library,commons-el. When I added it, I got the following error:
java.lang.IllegalStateException: ExtensionsFilter not correctly configured. JSF mapping missing. JSF pages not covered. Please see: http://myfaces.apache.org/tomahawk/extensionsFilter.html
at org.apache.myfaces.renderkit.html.util.AddResourceFactory.throwExtensionsFilterMissing(AddResourceFactory.java:358)
What is required to configure tomahawk? things in web.xml? other things?
Do you have a working example (war-file) where I could w see everything neededt o use the tree2 with checkboxes, including a backing bean?