myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Béres Gábor" <ber...@freestart.hu>
Subject using x:tree
Date Mon, 27 Dec 2004 21:44:44 GMT
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

Mime
View raw message