Adrian Mitev wrote:
In my app i pass the objects from the business layer to the presentation
layer and i have a class TreeBuilder that builds a tree from the objects
that come from the business layer.
ok, i think i'll go with this approach, thanks again guys.
coming back to my original problem, getting the actual node object
wasn't so simple after all. I'm unable to get the node object with
just:
TreeModel.getNodeById(selectedNodeId);
It seems that the method is expecting to get a node path, not a unique
identifier to the node. I'm currently assigning a unique business id
as the node identifier?Is there another way of getting the node
object? Or do i need to set the node path as the node identifier when
building the tree?
<t:tree2 var="node" value="#{navigator.treeModel}">
<f:facet name="report">
<t:commandLink value="#{node.description}" action="#{navigator.reportSelected}">
<t:updateActionListener property="#{navigator.selectedNodeId}"
value="#{node.identifier}"/>
</t:commandLink>
</f:facet>
</t:tree2>
public NavigatorBacking {
private TreeModel tree;
private String selectedNodeId;
public void setSelectedNodeId(String id) {
selectedNodeId = id;
}
public String nodeSelected() {
TreeNode node = tree.getNodeById(selectedNodeId); // doesn't work
as expected
return "success";
}
}