beehive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Krista Baker" <>
Subject RE: tree element access in netui tree tag
Date Mon, 23 May 2005 22:21:34 GMT

There are a few different ways to determine which tree item was

Using expandOnServer trees: (default)
  If you are using the TreeRootElement for the root instead of just a
TreeElement, it has its own getSelectedNode() method.

 In the JPF, add the following to the selectionAction:
	TreeElement selected = myTreeRoot.getSelectedNode();
	//get the name of the item 
	String selectedName = selected.getName();

  If you are using TreeElement, there is a TreeHelpers class which
allows you to find the selected node by adding the following:

	TreeHelpers myTreeHelp = new TreeHelpers();
	TreeElement selected = myTreeHelp.findSelected(myTreeRoot);
	//get the name of the node
	String selectedName = selected.getName();

Note that the above find/get methods for the selected node will return
null if there is no selected item.

If you are trying to use only runAtClient or JSP trees, the param
databinding context will be able to give you the selected node: (this
will also work on an expandOnServer tree)

Example will show the selected node in a <label>:
	<netui:label value="${param.netui_treeSelected}"/>
Also, you can use a divPanel for the tree and clientAction attributes of
the tree item.  An example of this can be found in the test src at: 

Let me know if that helps and if you need more information.  Hopefully
that's at least a good start :)


-----Original Message-----
From: Yongqin Xu 
Sent: Monday, May 23, 2005 2:41 PM
Subject: tree element access in netui tree tag

Hi, everyone:


I am developing an app using netui tree tag. I need to display the
detail content of each

leaf element (a customerized value object) when I click it. I know the

has "action" attribute that let you define a action method in your JPF.
Similarly, TreeElement

class also has "setAction(String)" to let you specify your action
method. But how do I 

efficiently capture  which element inside the action method when I click
that item?


any thought?




View raw message