Author: nbelaevski
Date: 2010-10-31 20:58:49 -0400 (Sun, 31 Oct 2010)
New Revision: 19808
Modified:
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeBean.java
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
20:46:11 UTC (rev 19807)
+++
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeBean.java 2010-11-01
00:58:49 UTC (rev 19808)
@@ -31,6 +31,7 @@
import javax.faces.context.FacesContext;
import javax.swing.tree.TreeNode;
+import org.richfaces.component.Selection;
import org.richfaces.component.SwitchType;
import org.richfaces.log.LogFactory;
import org.richfaces.log.Logger;
@@ -51,8 +52,12 @@
private SwitchType toggleMode = SwitchType.DEFAULT;
+ private SwitchType selectionMode = SwitchType.client;
+
private Object nodeData;
+ private Selection selection;
+
@PostConstruct
public void init() {
try {
@@ -80,6 +85,14 @@
this.toggleMode = switchType;
}
+ public SwitchType getSelectionMode() {
+ return selectionMode;
+ }
+
+ public void setSelectionMode(SwitchType selectionMode) {
+ this.selectionMode = selectionMode;
+ }
+
public Object getNodeData() {
return nodeData;
}
@@ -88,6 +101,14 @@
this.nodeData = nodeData;
}
+ public Selection getSelection() {
+ return selection;
+ }
+
+ public void setSelection(Selection selection) {
+ this.selection = selection;
+ }
+
public void clickNode() {
FacesContext facesContext = FacesContext.getCurrentInstance();
facesContext.addMessage(null, new FacesMessage("Clicked node: " +
getNodeData()));
Modified: trunk/examples/iteration-demo/src/main/webapp/tree.xhtml
===================================================================
--- trunk/examples/iteration-demo/src/main/webapp/tree.xhtml 2010-10-31 20:46:11 UTC (rev
19807)
+++ trunk/examples/iteration-demo/src/main/webapp/tree.xhtml 2010-11-01 00:58:49 UTC (rev
19808)
@@ -14,16 +14,21 @@
<h:messages id="messages" />
<h:form>
- <h:selectOneRadio value="#{treeBean.toggleMode}"
onclick="submit()">
+ Toggle mode: <h:selectOneRadio value="#{treeBean.toggleMode}"
onclick="submit()">
<f:selectItems value="#{treeBean.modes}" var="item"
itemValue="#{item}" />
</h:selectOneRadio>
+
+ Selection mode: <h:selectOneRadio value="#{treeBean.selectionMode}"
onclick="submit()">
+ <f:selectItems value="#{treeBean.modes}" itemDisabled="#{item ==
'server'}" var="item" itemValue="#{item}" />
+ </h:selectOneRadio>
</h:form>
<h:form id="form">
- <it:tree id="tree" var="node"
value="#{treeBean.rootNodes}" toggleMode="#{treeBean.toggleMode}">
+ <it:tree id="tree" var="node"
value="#{treeBean.rootNodes}"
selectionMode="#{treeBean.selectionMode}"
toggleMode="#{treeBean.toggleMode}">
<it:treeNode>
<h:panelGroup id="group">
- <h:commandLink value="#{node.data}"
action="#{treeBean.clickNode}">
+ #{node.data} -
+ <h:commandLink value="link"
action="#{treeBean.clickNode}">
<f:setPropertyActionListener value="#{node.data}"
target="#{treeBean.nodeData}" />
<f:ajax render=":messages" />