Help <rich:tree> child
sapy87 Nov 17, 2012 3:42 PMHi, i have created a Simple tree.
how to insert into a MUSIC folder a child "country, classic,rock, etc...."??? or an arraylist?
this is a class:
OPTION TREE |
---|
@ManagedBean public class OptionTree implements Serializable {
private static final long serialVersionUID = 1L;
private OptionTreeNode stationRoot = new OptionTreeNode();
private OptionTreeNode stationNodes = new OptionTreeNode();
public OptionTreeNode getStationNodes() { return stationNodes; }
private String[] kickRadioFeed = { "Music",
"Book",
"Car",
"PC",
"Comics" };
public OptionTree() { initRichFacesTree(); }
private void initRichFacesTree() { stationRoot.setName("root"); stationNodes.addChild(0, stationRoot);
for (int i = 0; i < kickRadioFeed.length; i++) { OptionTreeNode child = new OptionTreeNode(); child.setName(kickRadioFeed[i]); stationRoot.addChild(i, child); } }
} |
Option tree node |
---|
@ManagedBean @SessionScoped public class OptionTreeNode extends TreeNodeImpl { private String name;
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public String toString() { return this.name; }
} |
tree XHTML |
---|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head></h:head> <body> <h:form>
<rich:tree value="#{optionTree.stationNodes}" var="station" toggleType="client" >
<rich:treeNode >
<h:outputText value="stations" />
</rich:treeNode>
</rich:tree> </h:form> </body>
</html> |
Please Help me!!!!!!!