beehive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yongqin Xu" <>
Subject RE: tree element access in netui tree tag
Date Tue, 24 May 2005 17:03:09 GMT
There is a fourth way to get currently selected tree node.
In TreeElement API, there is a method called "void
I will override the method in TreeElement subclass to deal with
selected node. 

In this way, I don't have to scan through from tree root node every time
when a node is select. It will be more efficient especially for large
tree I believe.

-----Original Message-----
From: Krista Baker 
Sent: Monday, May 23, 2005 4:22 PM
To: Beehive Users
Subject: RE: tree element access in netui tree tag


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