Hi again, I've just seen this post : Re: Display tobago selectable tree http://www.mail-archive.com/users@myfaces.apache.org/msg32004.html
So sorry for disturbing :-). Regards, Zied 2007/9/25, Zied Hamdi <[EMAIL PROTECTED]>: > > Hi, > > I'm in my first example with tc:tree, and I have a problem getting the > selected element (I receive a Set containing a null element: even though the > tree displays correctly (with the correct name) the node I select). > This is my code: > > < tc:box > > xmlns=" http://www.w3.org/1999/xhtml" > > xmlns:f=" http://java.sun.com/jsf/core" > > xmlns:h=" http://java.sun.com/jsf/html" > > xmlns:t=" http://myfaces.apache.org/tomahawk" > > xmlns:tc=" http://myfaces.apache.org/tobago/component" > > xmlns:tx=" http://myfaces.apache.org/tobago/extension" > > label= "#{i18n.category}"> > > < tc:tree > > id ="cateoriesTree" > > value ="#{contractCtrl.categoriesRoot}" > > state ="#{contractCtrl.treeState}" > > showIcons ="true" > > selectable ="single" > > nameReference > ="userObject.embedded.name<http://userobject.embedded.name/> > " > > > </tc:tree > > > </ tc:box> > > > and in my bb I do this: > > *public* String setCategoryCmd() *throws* Throwable { > > Set<DefaultMutableTreeNode> selection = treeState.getSelection(); > > *if* ( selection.size() == 0 || selection.size() > 1 ) > > *return* *null* ; > > ContractCommandExecuter commandExecuter = > (ContractCommandExecuter) getCurrentCommandExecuter(); > > ContractParameters contractParameters = (ContractParameters) > commandExecuter.getCommandParameters(); > > contractParameters.setSelectedCaltegory( (Category) > selection.iterator().next().getUserObject() ); > > *return* commandExecuter.execute(ContractRequests.* > SET_CATEGORY* ); > > } > > > > after Selecting a node and submitting, > > selection.iterator().next() returns null; > > > > Here's how I submit: > > <tc:cell > > > < f:facet name ="layout" > > > < tc:gridLayout columns ="fixed;*" /> > > </ f:facet> > > < tc:link > > id ="category" > > label ="#{i18n.category}" > > action ="#{contractCtrl.loadCategoriesCmd}" > > > < tc:attribute > > value ="categoryPopup" > > name= "renderedPartially" /> > > < f:facet name ="popup" > > > < tc:popup > > id ="categoryPopup" > > height ="600px" > > width ="300px" > > > < tc:panel> > > < f:facet name ="layout" > > > < tc:gridLayout rows ="*;fixed" > /> > > </ f:facet> > > < tc:cell> > > < ui:include src > ="/contract/categories.xhtml" > /> > > </ tc:cell> > > < tc:panel> > > < f:facet name ="layout" > > > < tc:gridLayout > > columns = > "100px;1*;100px" > > marginLeft = > "10px" > > marginRight ="10px" > /> > > </ f:facet> > > < tc:button > > label ="#{i18n.ok}" > > action ="#{ > contractCtrl.setCategoryCmd}" > > > < tc:attribute > > name = > "popupClose" > > value > ="afterSubmit" > /> > > </ tc:button> > > < tc:cell /> > > < tc:button label ="#{ > i18n.cancel}" > > > < tc:attribute > > name = > "popupClose" > > value ="immediate" > /> > > </ tc:button> > > </ tc:panel> > > </ tc:panel> > > </ tc:popup> > > </ f:facet> > > </ tc:link> > > < tc:label value ="#{intervention.category.name}" /> > > </tc:cell > > > > > Any ideas please? > > Regards, > Zied > -- Zied Hamdi zatreex.sourceforge.net