You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "Chojnacki, Tomasz" <To...@actano.de> on 2007/08/30 13:36:33 UTC
disabling tree node checkbox for tree2
Hi,
I am newbie to MyFaces and have a slight problem with the tree2
component.
In my JSP I have tree2 component with checkboxes
(selectBooleanCheckbox).
It looks like this:
<t:tree2 id="htmlTree" ...
<f:facet name="project">
<h:panelGroup>
<t:selectBooleanCheckbox id="man" value="#{node.checked}"/>
<t:graphicImage value="/images/project.gif"
rendered="#{t.nodeExpanded}" border="0"/>
...
Now I want to disable dynamically a checkbox for a tree node.
I can do it in a static way - adding an attribute 'disabled="true"' to
<t:selectBooleanCheckbox/> in the JSP.
But I don't know how to do it on the server in the Java code.
I get tree component with this code:
private HtmlTree getHtmlTree() {
FacesContext context =
FacesContext.getCurrentInstance();
UIComponent htmlTree =
context.getViewRoot().findComponent("myForm:htmlTree");
return (HtmlTree) htmlTree;
}
With this I can get any node with getHtmlTree().getNode()
However TreeNode class has no property "setDisabled" or something like
this.
How do I get UIComponent for selectBooleanCheckbox and change it to
disabled, so that it renders then in the same way as "disabled"
attribute in JSP?
Thank you in advance.
Tomek