You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by B�res G�bor <be...@freestart.hu> on 2004/12/27 22:44:44 UTC
using x:tree
hi
i'm playing with <x:tree/>, and have some proplems.
i can build the tree, here is the code:
/* leagues is a list(fetched with an orm tool), contains several league
which is a self made object.
each league has a list of Level object called levels*/
Iterator it = leagues.iterator();
while(it.hasNext()) {
League league = (League)it.next();
DefaultMutableTreeNode node = new
DefaultMutableTreeNode(league.getName());
treeModel.insert(node);
List levels = league.getLevels();
Iterator it2 = levels.iterator();
while(it2.hasNext()) {
Level level =
(Level)it2.next();
node.insert(new
DefaultMutableTreeNode(level.getName()));
}
}
FacesUtils.getServletContext().setAttribute("treeModel", new
DefaultTreeModel(treeModel));
what i want to do is when a user click on a leaf node(a level), i want
to catch the league and level id of that node, so a could register the
choose to database.
i've already implemented TreeSelectionListener, but have no idea what to
do after:
DefaultMutableTreeNode selectNode = (DefaultMutableTreeNode)
event.getNewSelectionPath().getLastPathComponent();
and also how to register the id's on tree.
thanks for any help.
____________________________________________________________________
Miert fizetsz az internetert? Korlatlan, ingyenes internet hozzaferes a FreeStarttol.
Probald ki most! http://www.freestart.hu