6 Replies Latest reply on Jun 7, 2013 6:39 PM by Brian Leathem

    problems selecting a node of a tree from code

    antonio gallo Newbie

      Hello I have a tree using a TreeModelRecursiveAdaptor and I want to select a particular node depending on some text to be entered identifying a node in the tree.


      I noticed that unfortunatelly there's no tree direct method to perform this action.


      There's a selection attribute which wants a collection of org.richfaces.model.SequenceRowKey to perform a proper selection.


      The problem is : how to construct these SequenceRowKey sequence?


      I added a listener to my code to understand what is created behind the scenes when a selection is performed and i saw that the framework creates an array of  DeclarativeModelKey objects, one for each descending node of the tree (starting from top) and  each having a modelID and a modelKey.


      The modelKey depends on the position of the node within the children' list and so might be computed while I am not able to understand how to get the modelID.


      I am wondering whether there's a method to perform a selection from code when using a tree with treemodelrecursiveadaptor or someone should create all the sequence looking for information somewhere that might not be available (see the modelID for instance).


      Is there an intelligent way to perform a selection once it's known the node to be selected or not?


      Any help is greatly appreciated.


      Thanks in advance.