Author: msorokin
Date: 2009-03-23 07:15:35 -0400 (Mon, 23 Mar 2009)
New Revision: 13089
Added:
trunk/test-applications/richfaces-docs/web/src/main/java/org/docs/tree/stations.xml
Modified:
trunk/test-applications/richfaces-docs/web/src/main/java/org/docs/tree/Tree.java
Log:
https://jhttps://jira.jboss.org/jira/browse/RF-6419
added rich:tree snippets
Modified:
trunk/test-applications/richfaces-docs/web/src/main/java/org/docs/tree/Tree.java
===================================================================
---
trunk/test-applications/richfaces-docs/web/src/main/java/org/docs/tree/Tree.java 2009-03-23
09:56:12 UTC (rev 13088)
+++
trunk/test-applications/richfaces-docs/web/src/main/java/org/docs/tree/Tree.java 2009-03-23
11:15:35 UTC (rev 13089)
@@ -1,35 +1,137 @@
package org.docs.tree;
+import javax.faces.context.FacesContext;
+import org.richfaces.*;
+import org.richfaces.component.xml.XmlTreeDataBuilder;
+import org.richfaces.model.TreeNode;
+import org.richfaces.model.TreeNodeImpl;
+import org.xml.sax.InputSource;
+
+
public class Tree {
- String[] nodes = {"asdfa", "asdfasd", "asdf"};
- String[] root = {"root1", "root2", "root3"};
+ private TreeNodeImpl<String> stationRoot = new TreeNodeImpl<String>();
+
+ private TreeNodeImpl<String> stationNodes = new TreeNodeImpl<String>();
+
+ private String[] kickRadioFeed = { "Hall & Oates - Kiss On My List",
+
+ "David Bowie - Let's Dance", "Lyn Collins - Think (About
It)",
+
+ "Kim Carnes - Bette Davis Eyes",
+
+ "KC & the Sunshine Band - Give It Up" };
+ private TreeNode data;
+
+
+
+
- public String[] getRoot() {
- return root;
+
+ public Tree() {
+
+ stationRoot.setData("KickRadio");
+
+ stationNodes.addChild(0, stationRoot);
+
+ for (int i = 0; i < kickRadioFeed.length; i++){
+
+ TreeNodeImpl<String> child = new TreeNodeImpl<String>();
+
+ child.setData(kickRadioFeed[i]);
+
+ stationRoot.addChild(i, child);
+
+ }
+
+
+
+ FacesContext context = FacesContext.getCurrentInstance();
+
+ try {
+ data = XmlTreeDataBuilder.build(new
InputSource(getClass().getResourceAsStream("stations.xml")));
+ }catch (Exception e){}
}
- public void setRoot(String[] root) {
- this.root = root;
+
+
+
+
+
+
+ public TreeNode getData() {
+ return data;
}
- public String[] getNodes() {
- return nodes;
+
+
+
+
+
+
+ public void setData(TreeNode data) {
+ this.data = data;
}
- public void setNodes(String[] nodes) {
- this.nodes = nodes;
+
+
+
+
+
+
+ public TreeNodeImpl<String> getStationRoot() {
+ return stationRoot;
}
+
+
+
+
+
+
+
+ public void setStationRoot(TreeNodeImpl<String> stationRoot) {
+ this.stationRoot = stationRoot;
+ }
+
+
+
+
+
+
+
+ public TreeNodeImpl<String> getStationNodes() {
+ return stationNodes;
+ }
+
+
+
+
+
+
+
+ public void setStationNodes(TreeNodeImpl<String> stationNodes) {
+ this.stationNodes = stationNodes;
+ }
+
+
+
+
+
+
+
+
+
+
}
Added:
trunk/test-applications/richfaces-docs/web/src/main/java/org/docs/tree/stations.xml
===================================================================
--- trunk/test-applications/richfaces-docs/web/src/main/java/org/docs/tree/stations.xml
(rev 0)
+++
trunk/test-applications/richfaces-docs/web/src/main/java/org/docs/tree/stations.xml 2009-03-23
11:15:35 UTC (rev 13089)
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<station name="KickRadio">
+ <feed date="today">
+ <song time="07:00">Hall Oates - Kiss On My
List</song>
+ <song time="07:03">David Bowie - Let's Dance</song>
+ <song time="07:06">Lyn Collins - Think (About
It)</song>
+ <song time="07:10">Kim Carnes - Bette Davis
Eyes</song>
+ <song time="07:15">KC the Sunshine Band - Give It
Up</song>
+ </feed>
+</station>
\ No newline at end of file