You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Andreas Niemeyer <an...@gutzmann.com> on 2008/12/02 13:21:22 UTC

Tree2 and selectBooleanCheckbox status processing

Hi,

I need to iterate through the HtmlTree and / or the TreeModelBase to get 
  the expanded nodes and the selections of the nested 
selectBooleanCheckboxes.

Could someone be so kind and give me some pointers?

- how to get each item/node address
- how to get the selection status of the selectBooleanCheckboxes


Right now the expanded nodes stays fine between requests, but then the 
checkbox selections get lost.

I need this to re-create the tree between sessions, so the extracted 
informations will saved persistent and applied again.


Thank you in advance,
Andreas





		<t:tree2 id="serverTree" value="#{backbean.data}" var="node" 
varNodeToggler="t" showRootNode="true" binding="#{backbean.tree}" 
clientSideToggle="false">

			<f:facet name="#{backbean.facetnamebase}">
				<h:panelGroup>
					<t:graphicImage value="/images/yellow-folder-open.png" alt=" " 
rendered="#{t.nodeExpanded}" border="0"/>
                 	<t:graphicImage 
value="/images/yellow-folder-closed.png"  alt=" " 
rendered="#{!t.nodeExpanded}" border="0"/>
					<h:outputText value="#{node.description}" styleClass="nodeFolder" />
					<h:outputText value=" (#{node.childCount})" styleClass="childCount" 
rendered="#{!empty node.children}"/>
				</h:panelGroup>
			</f:facet>

			<f:facet name="#{backbean.facetnamecategory}">
				<h:panelGroup>
					<t:graphicImage value="/images/yellow-folder-open.png"  alt=" " 
rendered="#{t.nodeExpanded}" border="0"/>
                 	<t:graphicImage 
value="/images/yellow-folder-closed.png"  alt=" " 
rendered="#{!t.nodeExpanded}" border="0"/>
					<h:outputText value="#{node.description}" styleClass="nodeFolder" />
					<h:outputText value=" (#{node.childCount})" styleClass="childCount" 
rendered="#{!empty node.children}"/>
				</h:panelGroup>
			</f:facet>

			<f:facet name="#{backbean.facetnamebasicdata}">
				<h:panelGroup>
					<t:graphicImage value="/images/yellow-folder-open.png"  alt=" " 
rendered="#{t.nodeExpanded}" border="0"/>
                 	<t:graphicImage 
value="/images/yellow-folder-closed.png"  alt=" " 
rendered="#{!t.nodeExpanded}" border="0"/>
					<h:outputText value="#{node.description}" styleClass="nodeFolder" />
					<h:outputText value=" (#{node.childCount})" styleClass="childCount" 
rendered="#{!empty node.children}"/>
				</h:panelGroup>
			</f:facet>

			<f:facet name="#{backbean.facetnamebasicview}">
				<h:panelGroup>
					<h:selectBooleanCheckbox title="#{node.identifier}" 
value="#{backbean.selectedIds[node.identifier]}" />
					<h:outputText value="#{node.description} (#{node.identifier})"  />
				</h:panelGroup>
			</f:facet>

		</t:tree2>
	
	  <h:form>
	 	<h:commandButton value="save settings" 
actionListener="#{backbean.saveSettings}"/>
     </h:form>


Re: Tree2 and selectBooleanCheckbox status processing

Posted by Andreas Niemeyer <an...@gutzmann.com>.
Hi,

I got it solved in a more common without iterating through the HTMLTree 
(this seems to be buggy since the node address information is null/ unset)

The checkbox status is saved, a mistake happened by using the 
clientSideToggle first.
The checkbox status is hold about the Hashmap reference in the backing bean.


Regards,
Andreas


Andreas Niemeyer schrieb:
> Hi,
> 
> I need to iterate through the HtmlTree and / or the TreeModelBase to get 
>  the expanded nodes and the selections of the nested 
> selectBooleanCheckboxes.
> 
> Could someone be so kind and give me some pointers?
> 
> - how to get each item/node address
> - how to get the selection status of the selectBooleanCheckboxes
> 
> 
> Right now the expanded nodes stays fine between requests, but then the 
> checkbox selections get lost.
> 
> I need this to re-create the tree between sessions, so the extracted 
> informations will saved persistent and applied again.
> 
> 
> Thank you in advance,
> Andreas
> 
> 
> 
> 
> 
>         <t:tree2 id="serverTree" value="#{backbean.data}" var="node" 
> varNodeToggler="t" showRootNode="true" binding="#{backbean.tree}" 
> clientSideToggle="false">
> 
>             <f:facet name="#{backbean.facetnamebase}">
>                 <h:panelGroup>
>                     <t:graphicImage 
> value="/images/yellow-folder-open.png" alt=" " 
> rendered="#{t.nodeExpanded}" border="0"/>
>                     <t:graphicImage 
> value="/images/yellow-folder-closed.png"  alt=" " 
> rendered="#{!t.nodeExpanded}" border="0"/>
>                     <h:outputText value="#{node.description}" 
> styleClass="nodeFolder" />
>                     <h:outputText value=" (#{node.childCount})" 
> styleClass="childCount" rendered="#{!empty node.children}"/>
>                 </h:panelGroup>
>             </f:facet>
> 
>             <f:facet name="#{backbean.facetnamecategory}">
>                 <h:panelGroup>
>                     <t:graphicImage 
> value="/images/yellow-folder-open.png"  alt=" " 
> rendered="#{t.nodeExpanded}" border="0"/>
>                     <t:graphicImage 
> value="/images/yellow-folder-closed.png"  alt=" " 
> rendered="#{!t.nodeExpanded}" border="0"/>
>                     <h:outputText value="#{node.description}" 
> styleClass="nodeFolder" />
>                     <h:outputText value=" (#{node.childCount})" 
> styleClass="childCount" rendered="#{!empty node.children}"/>
>                 </h:panelGroup>
>             </f:facet>
> 
>             <f:facet name="#{backbean.facetnamebasicdata}">
>                 <h:panelGroup>
>                     <t:graphicImage 
> value="/images/yellow-folder-open.png"  alt=" " 
> rendered="#{t.nodeExpanded}" border="0"/>
>                     <t:graphicImage 
> value="/images/yellow-folder-closed.png"  alt=" " 
> rendered="#{!t.nodeExpanded}" border="0"/>
>                     <h:outputText value="#{node.description}" 
> styleClass="nodeFolder" />
>                     <h:outputText value=" (#{node.childCount})" 
> styleClass="childCount" rendered="#{!empty node.children}"/>
>                 </h:panelGroup>
>             </f:facet>
> 
>             <f:facet name="#{backbean.facetnamebasicview}">
>                 <h:panelGroup>
>                     <h:selectBooleanCheckbox title="#{node.identifier}" 
> value="#{backbean.selectedIds[node.identifier]}" />
>                     <h:outputText value="#{node.description} 
> (#{node.identifier})"  />
>                 </h:panelGroup>
>             </f:facet>
> 
>         </t:tree2>
>     
>       <h:form>
>          <h:commandButton value="save settings" 
> actionListener="#{backbean.saveSettings}"/>
>     </h:form>
> 
>