Author: nbelaevski
Date: 2010-05-13 13:28:02 -0400 (Thu, 13 May 2010)
New Revision: 17028
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
17:27:36 UTC (rev 17027)
+++
root/examples/core-demo/trunk/src/main/java/org/richfaces/demo/RegionBean.java 2010-05-13
17:28:02 UTC (rev 17028)
@@ -23,6 +23,7 @@
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
+import javax.faces.event.AjaxBehaviorEvent;
import javax.faces.model.SelectItem;
/**
@@ -49,6 +50,8 @@
private String nestedRegionValue;
+ private String lastExecutedLinkValue;
+
private String getInitialExecuteValue() {
return (String) POSSIBLE_EXECUTE_OPTIONS[POSSIBLE_EXECUTE_OPTIONS.length -
1].getValue();
}
@@ -104,4 +107,12 @@
public void setOuterExecute(String outerExecute) {
this.outerExecute = outerExecute;
}
+
+ public void handleBehavior(AjaxBehaviorEvent event) {
+ lastExecutedLinkValue = (String)
event.getComponent().getAttributes().get("value");
+ }
+
+ public String getLastExecutedLinkValue() {
+ return lastExecutedLinkValue;
+ }
}
Modified: root/examples/core-demo/trunk/src/main/webapp/region.xhtml
===================================================================
--- root/examples/core-demo/trunk/src/main/webapp/region.xhtml 2010-05-13 17:27:36 UTC
(rev 17027)
+++ root/examples/core-demo/trunk/src/main/webapp/region.xhtml 2010-05-13 17:28:02 UTC
(rev 17028)
@@ -46,11 +46,17 @@
<h:commandLink value="Apply" />
</h:form>
- <h:panelGrid columns="2" id="outputValues">
- Outer: <h:outputText value="#{regionBean.outerValue}" />
- Region: <h:outputText value="#{regionBean.regionValue}" />
- Nested region: <h:outputText value="#{regionBean.nestedRegionValue}"
/>
- </h:panelGrid>
+ <h:panelGroup layout="block" id="outputValues">
+ <h:panelGrid columns="2" >
+ Outer: <h:outputText value="#{regionBean.outerValue}" />
+ Region: <h:outputText value="#{regionBean.regionValue}" />
+ Nested region: <h:outputText value="#{regionBean.nestedRegionValue}"
/>
+ </h:panelGrid>
+
+ <div>
+ Last executed link value: #{regionBean.lastExecutedLinkValue}
+ </div>
+ </h:panelGroup>
<button type="button" onclick="randomize()">Generate random
values</button>
@@ -58,7 +64,7 @@
<h:inputText value="#{regionBean.outerValue}" />
<h:commandLink value="Out of region">
- <a4j:ajax execute="#{regionBean.outerExecute}"
render="outputValues" />
+ <a4j:ajax listener="#{regionBean.handleBehavior}"
execute="#{regionBean.outerExecute}" render="outputValues" />
</h:commandLink>
<fieldset>
@@ -68,7 +74,7 @@
<h:inputText value="#{regionBean.regionValue}" />
<h:commandLink value="Region">
- <a4j:ajax execute="#{regionBean.execute}"
render="outputValues" />
+ <a4j:ajax listener="#{regionBean.handleBehavior}"
execute="#{regionBean.execute}" render="outputValues" />
</h:commandLink>
<fieldset>
@@ -78,7 +84,7 @@
<h:inputText value="#{regionBean.nestedRegionValue}" />
<h:commandLink value="Nested region">
- <a4j:ajax execute="#{regionBean.nestedExecute}"
render="outputValues" />
+ <a4j:ajax listener="#{regionBean.handleBehavior}"
execute="#{regionBean.nestedExecute}" render="outputValues" />
</h:commandLink>
</a4j:region>