Hello
I've a rich:tree
in my JSF like so:
<rich:tree value="#{MyBacking.treeNodes}" var="item"
nodeFace="#{item.type}">
<rich:treeNode type="folder"
<h:outputText value="#{item.folder}" />
</rich:treeNode>
<rich:treeNode type="file"
<h:outputText value="#{item.contfile}" />
</rich:treeNode>
</rich:tree>
and the java runtime error
'#{item.type}' Property 'type' not found on type java.lang.String
But I've looked at the javadoc for org.richfaces.model.TreeNodeImpl
and there's no mention of a method to assign a type to a tree node. How is this done?
EDIT I have modified the code as per the supplied answer. Although it feels right, my tree is now being ignored. The java looks like this:
In my backing bean (MyBacking):
public TreeNodeImpl<LogTreeItem> getTreeNodes() {
TreeNodeImpl<LogTreeItem> rootNode = new TreeNodeImpl<LogTreeItem>();
LogTreeItem rootItem = new LogTreeItem();
rootItem.setType("folder");
rootItem.setName("folderName");
rootNode.setData(rootItem);
return rootNode;
}
item class:
public class LogTreeItem {
private String type;
private String name;
public String getType() {
return type;
}
public void setType(String t) {
type = t;
}
public String getName() {
return name;
}
public void setName(String n) {
name = n;
}
}
JSF snippet thus is now:
<rich:tree value="#{MyBacking.treeNodes}" var="item" nodeFace="#{item.type}">
<rich:treeNode type="folder">
<h:outputText value="#{item.name}" />
</rich:treeNode>
</rich:tree>
All I'm trying to do at this point is get a tree recognised. As I'm only creating a tree with a rootNode, I was expecting a one node tree output, but instead I'm seeing nothing at all. I know I'm close but I just cannot see what tweak would bring it to life.
Thanks a lot