Author: abelevich
Date: 2009-08-21 10:22:29 -0400 (Fri, 21 Aug 2009)
New Revision: 15251
Added:
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxClientBehavior.java
Modified:
root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextImpl.java
Log:
add interface for behavior
Added:
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxClientBehavior.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxClientBehavior.java
(rev 0)
+++
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxClientBehavior.java 2009-08-21
14:22:29 UTC (rev 15251)
@@ -0,0 +1,29 @@
+ package org.ajax4jsf.component;
+
+import java.util.Collection;
+
+import javax.faces.component.behavior.ClientBehavior;
+
+/**
+ * @author Anton Belevich
+ * interface for our ajax behaviors
+ *
+ */
+public interface AjaxClientBehavior extends ClientBehavior {
+
+ public boolean isLimitRender();
+
+ public void setLimitRender(boolean limitRender);
+
+ public void setExecute(Collection<String> execute);
+
+ public Collection<String> getExecute();
+
+ public void setRender(Collection<String> render);
+
+ public Collection<String> getRender();
+
+ public boolean isDisabled();
+
+ public void setDisabled(boolean disabled);
+}
Modified:
root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextImpl.java
===================================================================
---
root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextImpl.java 2009-08-21
13:50:00 UTC (rev 15250)
+++
root/framework/trunk/impl/src/main/java/org/richfaces/context/PartialViewContextImpl.java 2009-08-21
14:22:29 UTC (rev 15251)
@@ -29,7 +29,6 @@
import java.util.Map;
import javax.faces.component.UIComponent;
-import javax.faces.component.behavior.AjaxBehavior;
import javax.faces.component.behavior.ClientBehavior;
import javax.faces.component.behavior.ClientBehaviorHolder;
import javax.faces.component.visit.VisitCallback;
@@ -41,6 +40,7 @@
import javax.faces.context.PartialViewContextWrapper;
import javax.faces.event.PhaseId;
+import org.ajax4jsf.component.AjaxClientBehavior;
import org.ajax4jsf.component.AjaxOutput;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.ajax4jsf.renderkit.RendererUtils;
@@ -104,19 +104,19 @@
}
- private AjaxBehavior findBehavior(UIComponent target) {
- AjaxBehavior result = null;
+ private AjaxClientBehavior findBehavior(UIComponent target) {
+ AjaxClientBehavior result = null;
if (behaviorEvent != null) {
if (target instanceof ClientBehaviorHolder) {
ClientBehaviorHolder behaviorHolder = (ClientBehaviorHolder) target;
List<ClientBehavior> behaviors =
behaviorHolder.getClientBehaviors().get(behaviorEvent);
if (behaviors != null) {
for (ClientBehavior behavior : behaviors) {
- if (behavior instanceof AjaxBehavior) {
- AjaxBehavior ajaxBehavior = (AjaxBehavior) behavior;
+ if (behavior instanceof AjaxClientBehavior) {
+ AjaxClientBehavior ajaxBehavior = (AjaxClientBehavior) behavior;
if (!ajaxBehavior.isDisabled()) {
//TODO need more reliable algorithm
- result = (AjaxBehavior) behavior;
+ result = (AjaxClientBehavior) behavior;
break;
}
}
@@ -132,11 +132,11 @@
return result;
}
- protected abstract Object getBehaviorAttributeValue(AjaxBehavior behavior);
+ protected abstract Object getBehaviorAttributeValue(AjaxClientBehavior behavior);
protected abstract Object getAttributeValue(UIComponent component);
- protected void doVisit(FacesContext context, UIComponent target, AjaxBehavior behavior)
{
+ protected void doVisit(FacesContext context, UIComponent target, AjaxClientBehavior
behavior) {
Object attributeObject = null;
if (behavior != null) {
attributeObject = getBehaviorAttributeValue(behavior);
@@ -173,7 +173,7 @@
}
public final VisitResult visit(VisitContext visitContext, UIComponent target) {
- AjaxBehavior ajaxBehavior = null;
+ AjaxClientBehavior ajaxBehavior = null;
if (behaviorEvent != null) {
ajaxBehavior = findBehavior(target);
}
@@ -214,7 +214,7 @@
}
@Override
- protected Object getBehaviorAttributeValue(AjaxBehavior behavior) {
+ protected Object getBehaviorAttributeValue(AjaxClientBehavior behavior) {
return behavior.getExecute();
}
}
@@ -233,9 +233,13 @@
@Override
protected void doVisit(FacesContext context, UIComponent target,
- AjaxBehavior behavior) {
+ AjaxClientBehavior behavior) {
+
super.doVisit(context, target, behavior);
limitToList = AjaxRendererUtils.isAjaxLimitToList(target);
+ if(behavior != null) {
+ limitToList = behavior.isLimitRender();
+ }
}
@Override
@@ -244,7 +248,7 @@
}
@Override
- protected Object getBehaviorAttributeValue(AjaxBehavior behavior) {
+ protected Object getBehaviorAttributeValue(AjaxClientBehavior behavior) {
return behavior.getRender();
}
}
Show replies by date