Author: nbelaevski
Date: 2010-05-13 18:38:01 -0400 (Thu, 13 May 2010)
New Revision: 17043
Modified:
root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/RegionBean.java
root/examples/core-demo/trunk/src/main/webapp/region.xhtml
Log:
https://jira.jboss.org/jira/browse/RF-8639
Modified: root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/RegionBean.java
===================================================================
---
root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/RegionBean.java 2010-05-13
22:16:19 UTC (rev 17042)
+++
root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/RegionBean.java 2010-05-13
22:38:01 UTC (rev 17043)
@@ -24,6 +24,7 @@
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.event.AjaxBehaviorEvent;
+import javax.faces.event.ValueChangeEvent;
import javax.faces.model.SelectItem;
/**
@@ -34,15 +35,15 @@
@SessionScoped
public class RegionBean {
- private static final SelectItem[] POSSIBLE_EXECUTE_OPTIONS = new SelectItem[] {
- new SelectItem("@region"), new SelectItem("@all")
+ private static final SelectItem[] AVAILABLE_EXECUTE_OPTIONS = new SelectItem[] {
+ new SelectItem(null, "default"), new SelectItem("@region"),
new SelectItem("@all"), new SelectItem("@this")
};
- private String execute = getInitialExecuteValue();
+ private String execute = null;
- private String nestedExecute = getInitialExecuteValue();
+ private String nestedExecute = null;
- private String outerExecute = getInitialExecuteValue();
+ private String outerExecute = null;
private String outerValue;
@@ -52,12 +53,8 @@
private String lastExecutedLinkValue;
- private String getInitialExecuteValue() {
- return (String) POSSIBLE_EXECUTE_OPTIONS[POSSIBLE_EXECUTE_OPTIONS.length -
1].getValue();
- }
-
public SelectItem[] getExecuteOptions() {
- return POSSIBLE_EXECUTE_OPTIONS;
+ return AVAILABLE_EXECUTE_OPTIONS;
}
public String getOuterValue() {
@@ -115,4 +112,12 @@
public String getLastExecutedLinkValue() {
return lastExecutedLinkValue;
}
+
+ public void handleDefaultsValueChange(ValueChangeEvent event) {
+ String newValue = (String) event.getNewValue();
+
+ setOuterExecute(newValue);
+ setExecute(newValue);
+ setNestedExecute(newValue);
+ }
}
Modified: root/examples/core-demo/trunk/src/main/webapp/region.xhtml
===================================================================
--- root/examples/core-demo/trunk/src/main/webapp/region.xhtml 2010-05-13 22:16:19 UTC
(rev 17042)
+++ root/examples/core-demo/trunk/src/main/webapp/region.xhtml 2010-05-13 22:38:01 UTC
(rev 17043)
@@ -29,6 +29,14 @@
<utils:highlighter />
<h:form>
+ <h:outputLabel value="Defaults for all"
for="defaultsSelect"/>
+ <h:selectOneMenu id="defaultsSelect"
valueChangeListener="#{regionBean.handleDefaultsValueChange}"
onchange="submit()">
+ <f:selectItems value="#{regionBean.executeOptions}" />
+ </h:selectOneMenu>
+ <br />
+ </h:form>
+
+ <h:form>
<h:outputLabel value="Out of region" for="outerSelect"/>
<h:selectOneMenu id="outerSelect"
value="#{regionBean.outerExecute}" onchange="submit()">
<f:selectItems value="#{regionBean.executeOptions}" />