-
1. Re: Dynamic tree loading...
ronanker Jul 15, 2008 5:52 AM (in response to marchewk)we are using a List of BeanNode for first level and each BeanNode contains a List BeanNode (childs)...
each BeanNode also contains an object corresponding to our database element and some params like 'selected' 'loaded' 'expended'...
we're using rich:tree with rich:treeNodeAdaptator and rich:recursiveTreeNodeAdaptator ...
and we have a class:
public class ArbreAdapterHandler implements TreeStateAdvisor, NodeExpandedListener, NodeSelectedListener {
and we configure rich tree with params like thoses (depending on the tree) :
stateAdvisor="#{arbreAdapter}"
changeExpandListener="#{arbreAdapter.processExpansion}"
ajaxSubmitSelection="true"
nodeSelectListener="#{arbreAdapter.processSelection}"
adviseNodeOpened="#{arbreAdapter.adviseNodeOpened}"
adviseNodeSelected="#{arbreAdapter.adviseNodeSelected}"
and finally we're able to do what you described...
this is the first phase of this dev, we're now making an interface TreeLoader for functions loadRoot() and loadChilds(BeanNode) getAdapter()...
to make an handler instanciate the ArbreAdapterHandler... it'll be more generic to be able to use it with different structures. in the handler : new ArbreAdapter(this) and the the adapter uses fuctions of the handler to load data...
#{arbreAdapter... -> #{handler.arbreAdapter...
(note Arbre=Tree)