Author: abelevich
Date: 2010-05-17 12:13:33 -0400 (Mon, 17 May 2010)
New Revision: 17086
Modified:
root/ui/core/trunk/api/src/main/java/org/richfaces/view/facelets/html/AjaxHandler.java
Log:
fix behavior processing
Modified:
root/ui/core/trunk/api/src/main/java/org/richfaces/view/facelets/html/AjaxHandler.java
===================================================================
---
root/ui/core/trunk/api/src/main/java/org/richfaces/view/facelets/html/AjaxHandler.java 2010-05-17
16:05:01 UTC (rev 17085)
+++
root/ui/core/trunk/api/src/main/java/org/richfaces/view/facelets/html/AjaxHandler.java 2010-05-17
16:13:33 UTC (rev 17086)
@@ -25,10 +25,8 @@
import java.beans.BeanDescriptor;
import java.beans.BeanInfo;
import java.io.IOException;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-import java.util.Map;
import javax.faces.application.Application;
import javax.faces.component.UIComponent;
@@ -36,7 +34,6 @@
import javax.faces.component.behavior.ClientBehavior;
import javax.faces.component.behavior.ClientBehaviorHolder;
import javax.faces.context.FacesContext;
-import javax.faces.view.AttachedObjectHandler;
import javax.faces.view.AttachedObjectTarget;
import javax.faces.view.BehaviorHolderAttachedObjectTarget;
import javax.faces.view.facelets.BehaviorConfig;
@@ -53,18 +50,12 @@
*
*/
public class AjaxHandler extends CustomBehaviorHandler {
-
- private static final String JAVAX_FACES_RETARGETABLE_HANDLERS =
"javax.faces.RetargetableHandlers";
-
-
public AjaxHandler(BehaviorConfig config) {
super(config);
-
}
public void apply(FaceletContext ctx, UIComponent parent) throws IOException {
- String eventName = getEventName();
Application application = ctx.getFacesContext().getApplication();
Behavior behavior = application.createBehavior(getBehaviorId());
@@ -73,7 +64,9 @@
AjaxBehavior ajaxBehavior = (AjaxBehavior)behavior;
FacesContext context = ctx.getFacesContext();
+
BehaviorStack ajaxBehaviors = BehaviorStack.getBehaviorStack(context, true);
+ String eventName = getEventName();
ajaxBehaviors.pushBehavior(context, ajaxBehavior, AjaxBehavior.BEHAVIOR_ID,
eventName);
AttachQueueStack attachQueueStack = AttachQueueStack.getStack(context,
true);
@@ -93,7 +86,7 @@
if (behaviors != null) {
for (ClientBehavior processBehavior : behaviors) {
if (processBehavior instanceof AjaxBehavior) {
- AjaxBehavior createdAjaxBehavior = (AjaxBehavior)
behavior;
+ AjaxBehavior createdAjaxBehavior = (AjaxBehavior)
processBehavior;
attachQueue.associateWith(createdAjaxBehavior);
}
}
@@ -160,7 +153,7 @@
}
if (supportedEvent) {
- getOrCreateRetargetableHandlersList(parent).add(this);
+ TagHandlerUtils.getOrCreateRetargetableHandlersList(parent).add(this);
} else {
throw new TagException(tag, "Error: enclosing composite component
does not support event " + eventName);
}
@@ -173,20 +166,6 @@
}
}
- private static List<AttachedObjectHandler>
getOrCreateRetargetableHandlersList(UIComponent component) {
- Map<String, Object> attrs = component.getAttributes();
- @SuppressWarnings({
- "unchecked"}) List<AttachedObjectHandler> list =
- (List<AttachedObjectHandler>)
attrs.get(JAVAX_FACES_RETARGETABLE_HANDLERS);
-
- if (list == null) {
- list = new ArrayList<AttachedObjectHandler>();
- attrs.put(JAVAX_FACES_RETARGETABLE_HANDLERS, list);
- }
-
- return list;
- }
-
private String resolveEventName(ClientBehaviorHolder bHolder) {
String eventName = getEventName();
if (null == eventName) {