You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "R. Müller" <r....@unicomp-berlin.de> on 2006/02/01 13:12:41 UTC

Tree2 node selection [again]

Hi group,

in my example i have tree2-component with selectable nodes through
nodeToggler-attribute.

<t:tree2 id="clientTree" value="#{foo.treeData}" var="node" 	 
varNodeToggler="t" binding="#{foo.uidata}" >
[...]

So far this works well.

 From another controll (commandButton) i want to edit the current 
selected node, so have to access the selected node.

But i'm wondering, if want to access the current selected node with 
UITreeData.getNode()-method, i always get 'null'.

The only way to get the selected node is during the select-action 
processing phase (calling a action method).

<f:facet name="folder">
<h:commandLink actionListener="#{t.setNodeSelected}"  >			 
<t:updateActionListener property="#{foo.selectedNode}" 				 
value="#{node.identifier}" />
[...]

//
//the only moment to get the selected noted from the uidata-component !
public void selectedNode(String id) {
    // ignoring the parameter	
    selectedNode = uitreedata.getNode();
}


After this the uitreedata.getNode() always returns 'null'.
IMHO this is a bug, because the selection-state is obviously saved 
somewhere (at least in the nodetoggler). And so the uidata should 
represent this.

By the way : how to access the nodetoggler ? There is no binding and no 
way to access this through the UITreeData-Component !?

regards

Ronald








-- 
*********************************************************
*M-Unicomp GmbH
*
*Ronald Müller
*
*Plauener Straße 163-165, Haus 11
*13053 Berlin
*
*fon   : +49 ( 0 ) 30  / 98 69 61 54
*mobil : +49 ( 0 ) 172 / 93 95 00 4
*fax   : +49 ( 0 ) 30  / 98 69 61 55
*email : r.mueller@unicomp-berlin.de
*web   : www.unicomp-berlin.de
********************************************************

RE: Tree2 node selection [again]

Posted by rahmoune patrick <js...@yahoo.fr>.
Hi, 
   
  Here is how I managed this issue. If I remember, it may has been already discussed here.
   
  Assuming you have a binding of your tree2 component in your managed bean,
   
  you can add an actionListener to the commandLink for each facet of your tree
   
  something like 
   
  <h:commandLink immediate="true" actionListener="#{yourBean.setNodeSelected}">
  ...
   
  in the setNodeSelected method
   
  public void setNodeSelected(javax.faces.event.ActionEvent ae)
  //just add 
  tree.setNodeSelected(ae);
   
  And now you should be able to retrieve the selected node
   
  using
   
  tree.getDataModel().getNode();
   
  Hope this help
   
  I welcome any better solution
   
  patrick
   
  
"R. Müller" <r....@unicomp-berlin.de> a écrit :
  Hi group,

in my example i have tree2-component with selectable nodes through
nodeToggler-attribute.

varNodeToggler="t" binding="#{foo.uidata}" >
[...]

So far this works well.

>From another controll (commandButton) i want to edit the current 
selected node, so have to access the selected node.

But i'm wondering, if want to access the current selected node with 
UITreeData.getNode()-method, i always get 'null'.

The only way to get the selected node is during the select-action 
processing phase (calling a action method).



value="#{node.identifier}" />
[...]

//
//the only moment to get the selected noted from the uidata-component !
public void selectedNode(String id) {
// ignoring the parameter 
selectedNode = uitreedata.getNode();
}


After this the uitreedata.getNode() always returns 'null'.
IMHO this is a bug, because the selection-state is obviously saved 
somewhere (at least in the nodetoggler). And so the uidata should 
represent this.

By the way : how to access the nodetoggler ? There is no binding and no 
way to access this through the UITreeData-Component !?

regards

Ronald








-- 
*********************************************************
*M-Unicomp GmbH
*
*Ronald Müller
*
*Plauener Straße 163-165, Haus 11
*13053 Berlin
*
*fon : +49 ( 0 ) 30 / 98 69 61 54
*mobil : +49 ( 0 ) 172 / 93 95 00 4
*fax : +49 ( 0 ) 30 / 98 69 61 55
*email : r.mueller@unicomp-berlin.de
*web : www.unicomp-berlin.de
********************************************************
  


		
---------------------------------
 Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la France et l'international.Téléchargez la version beta.