Author: alexsmirnov
Date: 2010-07-02 12:45:41 -0400 (Fri, 02 Jul 2010)
New Revision: 17712
Modified:
root/commons/branches/RF8755/
root/commons/branches/RF8755/api/src/main/java/org/richfaces/renderkit/RenderKitUtils.java
root/commons/branches/RF8755/api/src/test/java/org/richfaces/renderkit/RenderKitUtilsMocksTest.java
Log:
Merged revisions 17690 via svnmerge from
https://svn.jboss.org/repos/richfaces/root/commons/trunk
.......
r17690 | nbelaevski | 2010-06-30 12:32:51 -0700 (Wed, 30 Jun 2010) | 1 line
https://jira.jboss.org/browse/RF-8744
.......
Property changes on: root/commons/branches/RF8755
___________________________________________________________________
Name: svnmerge-integrated
- /root/commons/trunk:1-17685
+ /root/commons/trunk:1-17697
Modified:
root/commons/branches/RF8755/api/src/main/java/org/richfaces/renderkit/RenderKitUtils.java
===================================================================
---
root/commons/branches/RF8755/api/src/main/java/org/richfaces/renderkit/RenderKitUtils.java 2010-07-02
16:23:44 UTC (rev 17711)
+++
root/commons/branches/RF8755/api/src/main/java/org/richfaces/renderkit/RenderKitUtils.java 2010-07-02
16:45:41 UTC (rev 17712)
@@ -353,16 +353,16 @@
}
}
- public static void decodeBehaviors(FacesContext context, UIComponent component) {
+ public static String decodeBehaviors(FacesContext context, UIComponent component) {
if (!(component instanceof ClientBehaviorHolder)) {
- return;
+ return null;
}
ClientBehaviorHolder holder = (ClientBehaviorHolder) component;
Map<String, List<ClientBehavior>> behaviors =
holder.getClientBehaviors();
if (behaviors == null || behaviors.isEmpty()) {
- return;
+ return null;
}
ExternalContext externalContext = context.getExternalContext();
@@ -370,7 +370,7 @@
String behaviorEvent = parametersMap.get(BEHAVIOR_EVENT_NAME);
if (behaviorEvent == null) {
- return;
+ return null;
}
List<ClientBehavior> behaviorsForEvent = behaviors.get(behaviorEvent);
@@ -378,12 +378,16 @@
String clientId = component.getClientId(context);
if (behaviorSource != null && behaviorSource.equals(clientId)) {
- if (behaviorsForEvent != null) {
+ if (behaviorsForEvent != null && !behaviorsForEvent.isEmpty()) {
for (ClientBehavior behavior : behaviorsForEvent) {
behavior.decode(context, component);
}
+
+ return behaviorEvent;
}
}
+
+ return null;
}
}
Modified:
root/commons/branches/RF8755/api/src/test/java/org/richfaces/renderkit/RenderKitUtilsMocksTest.java
===================================================================
---
root/commons/branches/RF8755/api/src/test/java/org/richfaces/renderkit/RenderKitUtilsMocksTest.java 2010-07-02
16:23:44 UTC (rev 17711)
+++
root/commons/branches/RF8755/api/src/test/java/org/richfaces/renderkit/RenderKitUtilsMocksTest.java 2010-07-02
16:45:41 UTC (rev 17712)
@@ -25,6 +25,8 @@
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.expectLastCall;
import static org.easymock.EasyMock.same;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
@@ -322,7 +324,7 @@
facesEnvironment.replay();
- RenderKitUtils.decodeBehaviors(facesContext, component);
+ assertEquals("action", RenderKitUtils.decodeBehaviors(facesContext,
component));
}
@Test
@@ -337,7 +339,7 @@
facesEnvironment.replay();
- RenderKitUtils.decodeBehaviors(facesContext, component);
+ assertEquals("blur", RenderKitUtils.decodeBehaviors(facesContext,
component));
}
@Test
@@ -348,7 +350,7 @@
facesEnvironment.replay();
- RenderKitUtils.decodeBehaviors(facesContext, component);
+ assertNull(RenderKitUtils.decodeBehaviors(facesContext, component));
}
@Test
@@ -359,7 +361,7 @@
facesEnvironment.replay();
- RenderKitUtils.decodeBehaviors(facesContext, component);
+ assertNull(RenderKitUtils.decodeBehaviors(facesContext, component));
}
@Test
@@ -370,6 +372,6 @@
facesEnvironment.replay();
- RenderKitUtils.decodeBehaviors(facesContext, component);
+ assertNull(RenderKitUtils.decodeBehaviors(facesContext, component));
}
}
\ No newline at end of file