Author: nbelaevski
Date: 2010-10-31 13:06:53 -0400 (Sun, 31 Oct 2010)
New Revision: 19802
Modified:
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeBean.java
trunk/examples/iteration-demo/src/main/resources/org/richfaces/demo/plants.xml
trunk/examples/iteration-demo/src/main/webapp/tree.xhtml
Log:
https://jira.jboss.org/browse/RF-9315
Modified: trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeBean.java
===================================================================
---
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeBean.java 2010-10-31
17:05:52 UTC (rev 19801)
+++
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeBean.java 2010-10-31
17:06:53 UTC (rev 19802)
@@ -25,8 +25,10 @@
import java.util.List;
import javax.annotation.PostConstruct;
+import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
+import javax.faces.context.FacesContext;
import javax.swing.tree.TreeNode;
import org.richfaces.component.SwitchType;
@@ -49,6 +51,8 @@
private SwitchType toggleMode = SwitchType.DEFAULT;
+ private Object nodeData;
+
@PostConstruct
public void init() {
try {
@@ -75,4 +79,17 @@
public void setToggleMode(SwitchType switchType) {
this.toggleMode = switchType;
}
+
+ public Object getNodeData() {
+ return nodeData;
+ }
+
+ public void setNodeData(Object nodeData) {
+ this.nodeData = nodeData;
+ }
+
+ public void clickNode() {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ facesContext.addMessage(null, new FacesMessage("Clicked node: " +
getNodeData()));
+ }
}
Modified: trunk/examples/iteration-demo/src/main/resources/org/richfaces/demo/plants.xml
===================================================================
---
trunk/examples/iteration-demo/src/main/resources/org/richfaces/demo/plants.xml 2010-10-31
17:05:52 UTC (rev 19801)
+++
trunk/examples/iteration-demo/src/main/resources/org/richfaces/demo/plants.xml 2010-10-31
17:06:53 UTC (rev 19802)
@@ -3,7 +3,7 @@
<!-- Taken from
http://www.xmlfiles.com/examples/ -->
<CATALOG>
- <PLANT>
+ <PLANT>1
<COMMON>Bloodroot</COMMON>
<BOTANICAL>Sanguinaria canadensis</BOTANICAL>
<ZONE>4</ZONE>
@@ -11,7 +11,7 @@
<PRICE>$2.44</PRICE>
<AVAILABILITY>031599</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>2
<COMMON>Columbine</COMMON>
<BOTANICAL>Aquilegia canadensis</BOTANICAL>
<ZONE>3</ZONE>
@@ -19,7 +19,7 @@
<PRICE>$9.37</PRICE>
<AVAILABILITY>030699</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>3
<COMMON>Marsh Marigold</COMMON>
<BOTANICAL>Caltha palustris</BOTANICAL>
<ZONE>4</ZONE>
@@ -27,7 +27,7 @@
<PRICE>$6.81</PRICE>
<AVAILABILITY>051799</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>4
<COMMON>Cowslip</COMMON>
<BOTANICAL>Caltha palustris</BOTANICAL>
<ZONE>4</ZONE>
@@ -35,7 +35,7 @@
<PRICE>$9.90</PRICE>
<AVAILABILITY>030699</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>5
<COMMON>Dutchman's-Breeches</COMMON>
<BOTANICAL>Diecentra cucullaria</BOTANICAL>
<ZONE>3</ZONE>
@@ -43,7 +43,7 @@
<PRICE>$6.44</PRICE>
<AVAILABILITY>012099</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>6
<COMMON>Ginger, Wild</COMMON>
<BOTANICAL>Asarum canadense</BOTANICAL>
<ZONE>3</ZONE>
@@ -51,7 +51,7 @@
<PRICE>$9.03</PRICE>
<AVAILABILITY>041899</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>7
<COMMON>Hepatica</COMMON>
<BOTANICAL>Hepatica americana</BOTANICAL>
<ZONE>4</ZONE>
@@ -59,7 +59,7 @@
<PRICE>$4.45</PRICE>
<AVAILABILITY>012699</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>8
<COMMON>Liverleaf</COMMON>
<BOTANICAL>Hepatica americana</BOTANICAL>
<ZONE>4</ZONE>
@@ -67,7 +67,7 @@
<PRICE>$3.99</PRICE>
<AVAILABILITY>010299</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>9
<COMMON>Jack-In-The-Pulpit</COMMON>
<BOTANICAL>Arisaema triphyllum</BOTANICAL>
<ZONE>4</ZONE>
@@ -75,7 +75,7 @@
<PRICE>$3.23</PRICE>
<AVAILABILITY>020199</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>10
<COMMON>Mayapple</COMMON>
<BOTANICAL>Podophyllum peltatum</BOTANICAL>
<ZONE>3</ZONE>
@@ -83,7 +83,7 @@
<PRICE>$2.98</PRICE>
<AVAILABILITY>060599</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>11
<COMMON>Phlox, Woodland</COMMON>
<BOTANICAL>Phlox divaricata</BOTANICAL>
<ZONE>3</ZONE>
@@ -91,7 +91,7 @@
<PRICE>$2.80</PRICE>
<AVAILABILITY>012299</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>12
<COMMON>Phlox, Blue</COMMON>
<BOTANICAL>Phlox divaricata</BOTANICAL>
<ZONE>3</ZONE>
@@ -99,7 +99,7 @@
<PRICE>$5.59</PRICE>
<AVAILABILITY>021699</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>13
<COMMON>Spring-Beauty</COMMON>
<BOTANICAL>Claytonia Virginica</BOTANICAL>
<ZONE>7</ZONE>
@@ -107,7 +107,7 @@
<PRICE>$6.59</PRICE>
<AVAILABILITY>020199</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>14
<COMMON>Trillium</COMMON>
<BOTANICAL>Trillium grandiflorum</BOTANICAL>
<ZONE>5</ZONE>
@@ -115,7 +115,7 @@
<PRICE>$3.90</PRICE>
<AVAILABILITY>042999</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>15
<COMMON>Wake Robin</COMMON>
<BOTANICAL>Trillium grandiflorum</BOTANICAL>
<ZONE>5</ZONE>
@@ -123,7 +123,7 @@
<PRICE>$3.20</PRICE>
<AVAILABILITY>022199</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>16
<COMMON>Violet, Dog-Tooth</COMMON>
<BOTANICAL>Erythronium americanum</BOTANICAL>
<ZONE>4</ZONE>
@@ -131,7 +131,7 @@
<PRICE>$9.04</PRICE>
<AVAILABILITY>020199</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>17
<COMMON>Trout Lily</COMMON>
<BOTANICAL>Erythronium americanum</BOTANICAL>
<ZONE>4</ZONE>
@@ -139,7 +139,7 @@
<PRICE>$6.94</PRICE>
<AVAILABILITY>032499</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>18
<COMMON>Adder's-Tongue</COMMON>
<BOTANICAL>Erythronium americanum</BOTANICAL>
<ZONE>4</ZONE>
@@ -147,7 +147,7 @@
<PRICE>$9.58</PRICE>
<AVAILABILITY>041399</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>19
<COMMON>Anemone</COMMON>
<BOTANICAL>Anemone blanda</BOTANICAL>
<ZONE>6</ZONE>
@@ -155,7 +155,7 @@
<PRICE>$8.86</PRICE>
<AVAILABILITY>122698</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>20
<COMMON>Grecian Windflower</COMMON>
<BOTANICAL>Anemone blanda</BOTANICAL>
<ZONE>6</ZONE>
@@ -163,7 +163,7 @@
<PRICE>$9.16</PRICE>
<AVAILABILITY>071099</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>21
<COMMON>Bee Balm</COMMON>
<BOTANICAL>Monarda didyma</BOTANICAL>
<ZONE>4</ZONE>
@@ -171,7 +171,7 @@
<PRICE>$4.59</PRICE>
<AVAILABILITY>050399</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>22
<COMMON>Bergamont</COMMON>
<BOTANICAL>Monarda didyma</BOTANICAL>
<ZONE>4</ZONE>
@@ -179,7 +179,7 @@
<PRICE>$7.16</PRICE>
<AVAILABILITY>042799</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>23
<COMMON>Black-Eyed Susan</COMMON>
<BOTANICAL>Rudbeckia hirta</BOTANICAL>
<ZONE>Annual</ZONE>
@@ -187,7 +187,7 @@
<PRICE>$9.80</PRICE>
<AVAILABILITY>061899</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>24
<COMMON>Buttercup</COMMON>
<BOTANICAL>Ranunculus</BOTANICAL>
<ZONE>4</ZONE>
@@ -195,7 +195,7 @@
<PRICE>$2.57</PRICE>
<AVAILABILITY>061099</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>25
<COMMON>Crowfoot</COMMON>
<BOTANICAL>Ranunculus</BOTANICAL>
<ZONE>4</ZONE>
@@ -203,7 +203,7 @@
<PRICE>$9.34</PRICE>
<AVAILABILITY>040399</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>26
<COMMON>Butterfly Weed</COMMON>
<BOTANICAL>Asclepias tuberosa</BOTANICAL>
<ZONE>Annual</ZONE>
@@ -211,7 +211,7 @@
<PRICE>$2.78</PRICE>
<AVAILABILITY>063099</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>27
<COMMON>Cinquefoil</COMMON>
<BOTANICAL>Potentilla</BOTANICAL>
<ZONE>Annual</ZONE>
@@ -219,7 +219,7 @@
<PRICE>$7.06</PRICE>
<AVAILABILITY>052599</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>28
<COMMON>Primrose</COMMON>
<BOTANICAL>Oenothera</BOTANICAL>
<ZONE>3 - 5</ZONE>
@@ -227,7 +227,7 @@
<PRICE>$6.56</PRICE>
<AVAILABILITY>013099</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>29
<COMMON>Gentian</COMMON>
<BOTANICAL>Gentiana</BOTANICAL>
<ZONE>4</ZONE>
@@ -235,7 +235,7 @@
<PRICE>$7.81</PRICE>
<AVAILABILITY>051899</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>30
<COMMON>Blue Gentian</COMMON>
<BOTANICAL>Gentiana</BOTANICAL>
<ZONE>4</ZONE>
@@ -243,7 +243,7 @@
<PRICE>$8.56</PRICE>
<AVAILABILITY>050299</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>31
<COMMON>Jacob's Ladder</COMMON>
<BOTANICAL>Polemonium caeruleum</BOTANICAL>
<ZONE>Annual</ZONE>
@@ -251,7 +251,7 @@
<PRICE>$9.26</PRICE>
<AVAILABILITY>022199</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>32
<COMMON>Greek Valerian</COMMON>
<BOTANICAL>Polemonium caeruleum</BOTANICAL>
<ZONE>Annual</ZONE>
@@ -259,7 +259,7 @@
<PRICE>$4.36</PRICE>
<AVAILABILITY>071499</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>33
<COMMON>California Poppy</COMMON>
<BOTANICAL>Eschscholzia californica</BOTANICAL>
<ZONE>Annual</ZONE>
@@ -267,7 +267,7 @@
<PRICE>$7.89</PRICE>
<AVAILABILITY>032799</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>34
<COMMON>Shooting Star</COMMON>
<BOTANICAL>Dodecatheon</BOTANICAL>
<ZONE>Annual</ZONE>
@@ -275,7 +275,7 @@
<PRICE>$8.60</PRICE>
<AVAILABILITY>051399</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>35
<COMMON>Snakeroot</COMMON>
<BOTANICAL>Cimicifuga</BOTANICAL>
<ZONE>Annual</ZONE>
@@ -283,7 +283,7 @@
<PRICE>$5.63</PRICE>
<AVAILABILITY>071199</AVAILABILITY>
</PLANT>
- <PLANT>
+ <PLANT>36
<COMMON>Cardinal Flower</COMMON>
<BOTANICAL>Lobelia cardinalis</BOTANICAL>
<ZONE>2</ZONE>
Modified: trunk/examples/iteration-demo/src/main/webapp/tree.xhtml
===================================================================
--- trunk/examples/iteration-demo/src/main/webapp/tree.xhtml 2010-10-31 17:05:52 UTC (rev
19801)
+++ trunk/examples/iteration-demo/src/main/webapp/tree.xhtml 2010-10-31 17:06:53 UTC (rev
19802)
@@ -11,6 +11,8 @@
</h:head>
<h:body>
+ <h:messages id="messages" />
+
<h:form>
<h:selectOneRadio value="#{treeBean.toggleMode}"
onclick="submit()">
<f:selectItems value="#{treeBean.modes}" var="item"
itemValue="#{item}" />
@@ -21,7 +23,11 @@
<it:tree id="tree" var="node"
value="#{treeBean.rootNodes}" toggleMode="#{treeBean.toggleMode}">
<it:treeNode>
<h:panelGroup id="group">
- #{node.data}
+ <h:commandLink value="#{node.data}"
action="#{treeBean.clickNode}">
+ <f:setPropertyActionListener value="#{node.data}"
target="#{treeBean.nodeData}" />
+
+ <f:ajax render=":messages" />
+ </h:commandLink>
</h:panelGroup>
</it:treeNode>
</it:tree>