Author: alexsmirnov
Date: 2008-03-07 20:05:20 -0500 (Fri, 07 Mar 2008)
New Revision: 6626
Removed:
trunk/framework/api/src/main/java/org/ajax4jsf/application/AjaxSingleException.java
trunk/framework/api/src/main/java/org/ajax4jsf/event/AjaxSingleEvent.java
Modified:
trunk/cdk/generator/src/main/resources/META-INF/schema/entities/ajax_region_attributes.ent
trunk/framework/api/src/main/java/org/ajax4jsf/component/AjaxContainerBase.java
trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxActionComponent.java
trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxRegionBrige.java
trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxContainerRenderer.java
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java
trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxRegion.java
Log:
Continue to fix JSF 1.2 compatibility.
Modified:
trunk/cdk/generator/src/main/resources/META-INF/schema/entities/ajax_region_attributes.ent
===================================================================
---
trunk/cdk/generator/src/main/resources/META-INF/schema/entities/ajax_region_attributes.ent 2008-03-07
14:32:02 UTC (rev 6625)
+++
trunk/cdk/generator/src/main/resources/META-INF/schema/entities/ajax_region_attributes.ent 2008-03-08
01:05:20 UTC (rev 6626)
@@ -10,6 +10,12 @@
<name>submitted</name>
<classname>boolean</classname>
</property>
+
+ <property hidden="true">
+ <name>submittedControlId</name>
+ <classname>java.lang.String</classname>
+ </property>
+
<property >
<name>selfRendered</name>
<classname>boolean</classname>
Deleted:
trunk/framework/api/src/main/java/org/ajax4jsf/application/AjaxSingleException.java
===================================================================
---
trunk/framework/api/src/main/java/org/ajax4jsf/application/AjaxSingleException.java 2008-03-07
14:32:02 UTC (rev 6625)
+++
trunk/framework/api/src/main/java/org/ajax4jsf/application/AjaxSingleException.java 2008-03-08
01:05:20 UTC (rev 6626)
@@ -1,33 +0,0 @@
-/**
- *
- */
-package org.ajax4jsf.application;
-
-import javax.faces.component.UIComponent;
-
-/**
- * @author asmirnov
- *
- */
-public class AjaxSingleException extends RuntimeException {
-
- private static final long serialVersionUID = 6624397496732241667L;
-
- private UIComponent component;
-
- /**
- * @param component
- */
- public AjaxSingleException(UIComponent componemt) {
-// super();
- this.component = componemt;
- }
-
- /**
- * @return the component
- */
- public UIComponent getComponent() {
- return component;
- }
-
-}
Modified: trunk/framework/api/src/main/java/org/ajax4jsf/component/AjaxContainerBase.java
===================================================================
---
trunk/framework/api/src/main/java/org/ajax4jsf/component/AjaxContainerBase.java 2008-03-07
14:32:02 UTC (rev 6625)
+++
trunk/framework/api/src/main/java/org/ajax4jsf/component/AjaxContainerBase.java 2008-03-08
01:05:20 UTC (rev 6626)
@@ -88,4 +88,8 @@
*/
// public void renderAjaxRegion(FacesContext context) throws FacesException ;
+ public abstract void setSubmittedControlId(String string);
+
+ public abstract String getSubmittedControlId();
+
}
Deleted: trunk/framework/api/src/main/java/org/ajax4jsf/event/AjaxSingleEvent.java
===================================================================
--- trunk/framework/api/src/main/java/org/ajax4jsf/event/AjaxSingleEvent.java 2008-03-07
14:32:02 UTC (rev 6625)
+++ trunk/framework/api/src/main/java/org/ajax4jsf/event/AjaxSingleEvent.java 2008-03-08
01:05:20 UTC (rev 6626)
@@ -1,45 +0,0 @@
-/**
- *
- */
-package org.ajax4jsf.event;
-
-import javax.faces.component.UIComponent;
-import javax.faces.event.FacesEvent;
-import javax.faces.event.FacesListener;
-import javax.faces.event.PhaseId;
-
-/**
- * @author asmirnov
- *
- */
-public class AjaxSingleEvent extends FacesEvent {
-
- /**
- *
- */
- private static final long serialVersionUID = -3730999641944478334L;
-
- /**
- * @param arg0
- */
- public AjaxSingleEvent(UIComponent arg0) {
- super(arg0);
- }
-
- /* (non-Javadoc)
- * @see
javax.faces.event.FacesEvent#isAppropriateListener(javax.faces.event.FacesListener)
- */
- public boolean isAppropriateListener(FacesListener arg0) {
- return false;
- }
-
- /* (non-Javadoc)
- * @see
javax.faces.event.FacesEvent#processListener(javax.faces.event.FacesListener)
- */
- public void processListener(FacesListener arg0) {
- }
-
- public PhaseId getPhaseId() {
- return PhaseId.APPLY_REQUEST_VALUES;
- }
-}
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxActionComponent.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxActionComponent.java 2008-03-07
14:32:02 UTC (rev 6625)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxActionComponent.java 2008-03-08
01:05:20 UTC (rev 6626)
@@ -29,11 +29,9 @@
import javax.faces.event.FacesEvent;
import javax.faces.event.PhaseId;
-import org.ajax4jsf.application.AjaxSingleException;
import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.event.AjaxEvent;
import org.ajax4jsf.event.AjaxListener;
-import org.ajax4jsf.event.AjaxSingleEvent;
import org.ajax4jsf.event.AjaxSource;
import org.ajax4jsf.renderkit.RendererUtils;
@@ -53,11 +51,6 @@
* @see javax.faces.component.UIComponentBase#broadcast(javax.faces.event.FacesEvent)
*/
public void broadcast(FacesEvent event) throws AbortProcessingException {
- // Hack - throw exception to AjaxViewRoot, to fix state of all iterable
- // components.
- if (event instanceof AjaxSingleEvent) {
- throw new AjaxSingleException(getSingleComponent());
- }
// perform default
super.broadcast(event);
if (event instanceof AjaxEvent) {
@@ -120,10 +113,6 @@
} else {
event.setPhaseId(PhaseId.INVOKE_APPLICATION);
}
- // AjaxSingle component process own childrens in event processing.
- if (isAjaxSingle()) {
- super.queueEvent(new AjaxSingleEvent(this));
- }
}
// UICommand set Phase ID for all ActionEvents - bypass it.
getParent().queueEvent(event);
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxRegionBrige.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxRegionBrige.java 2008-03-07
14:32:02 UTC (rev 6625)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxRegionBrige.java 2008-03-08
01:05:20 UTC (rev 6626)
@@ -80,8 +80,8 @@
private boolean selfRendered = false;
private boolean selfRenderedSet = false;
+ private String submittedControlId;
-
private boolean transientFlag = false;
private UIComponent component ;
@@ -357,6 +357,20 @@
public void setTransient(boolean transientFlag) {
this.transientFlag = transientFlag;
}
+
+ /**
+ * @return the submittedControlId
+ */
+ public String getSubmittedControlId() {
+ return submittedControlId;
+ }
+
+ /**
+ * @param submittedControlId the submittedControlId to set
+ */
+ public void setSubmittedControlId(String submittedControlId) {
+ this.submittedControlId = submittedControlId;
+ }
}
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java 2008-03-07
14:32:02 UTC (rev 6625)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java 2008-03-08
01:05:20 UTC (rev 6626)
@@ -34,7 +34,6 @@
import javax.faces.event.PhaseId;
import org.ajax4jsf.Messages;
-import org.ajax4jsf.application.AjaxSingleException;
import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.context.AjaxContextImpl;
import org.ajax4jsf.context.InvokerCallback;
@@ -262,7 +261,6 @@
};
- private UIComponent singleComponent = null;
/*
* (non-Javadoc)
@@ -272,13 +270,8 @@
public void processDecodes(FacesContext context) {
if (context == null)
throw new NullPointerException("context");
- singleComponent = null;
AjaxContextImpl.invokeOnRegionOrRoot(this, context, _decodeInvoker);
- try {
- broadcastEvents(context, PhaseId.APPLY_REQUEST_VALUES);
- } catch (AjaxSingleException e) {
- singleComponent = e.getComponent();
- }
+ broadcastEvents(context, PhaseId.APPLY_REQUEST_VALUES);
}
private InvokerCallback _updatesInvoker = new InvokerCallback() {
@@ -301,11 +294,7 @@
public void processUpdates(FacesContext context) {
if (context == null)
throw new NullPointerException("context");
- if (null == singleComponent) {
AjaxContextImpl.invokeOnRegionOrRoot(this, context, _updatesInvoker);
- } else {
- singleComponent.processUpdates(context);
- }
broadcastEvents(context, PhaseId.UPDATE_MODEL_VALUES);
}
@@ -329,11 +318,7 @@
public void processValidators(FacesContext context) {
if (context == null)
throw new NullPointerException("context");
- if (null == singleComponent) {
AjaxContextImpl.invokeOnRegionOrRoot(this, context, _validatorsInvoker);
- } else {
- singleComponent.processValidators(context);
- }
broadcastEvents(context, PhaseId.PROCESS_VALIDATIONS);
}
@@ -543,11 +528,29 @@
}
public void setRenderRegionOnly(boolean reRenderPage) {
- // TODO Auto-generated method stub
-
+ // Ignore for a ViewRoot.
+
}
+
+
- public void encodeAjax(FacesContext context) throws IOException {
+ /**
+ * @return
+ * @see org.ajax4jsf.component.AjaxRegionBrige#getSubmittedControlId()
+ */
+ public String getSubmittedControlId() {
+ return _brige.getSubmittedControlId();
+ }
+
+ /**
+ * @param submittedControlId
+ * @see org.ajax4jsf.component.AjaxRegionBrige#setSubmittedControlId(java.lang.String)
+ */
+ public void setSubmittedControlId(String submittedControlId) {
+ _brige.setSubmittedControlId(submittedControlId);
+ }
+
+ public void encodeAjax(FacesContext context) throws IOException {
String rendererType = getRendererType();
if (rendererType != null) {
((AjaxContainerRenderer) getRenderer(context)).encodeAjax(context,
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxContainerRenderer.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxContainerRenderer.java 2008-03-07
14:32:02 UTC (rev 6625)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxContainerRenderer.java 2008-03-08
01:05:20 UTC (rev 6626)
@@ -156,6 +156,7 @@
AjaxContainer ajaxContainer = (AjaxContainer) component;
if (null != ajaxParameter && ajaxParameter.equals(clientId)) {
ajaxContainer.setSubmitted(true);
+ ajaxContainer.setSubmittedControlId(paramMap.get(AjaxRendererUtils.AJAX_SINGLE_ATTR));
AjaxEvent event = new AjaxEvent(component);
component.queueEvent(event);
} else {
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java 2008-03-07
14:32:02 UTC (rev 6625)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java 2008-03-08
01:05:20 UTC (rev 6626)
@@ -106,17 +106,17 @@
private static final Class<?> OBJECT_ARRAY_CLASS = (new Object[0]).getClass();
- private static final String VALUE_ATTR = "value";
+ public static final String VALUE_ATTR = "value";
public static final String AJAX_AREAS_RENDERED =
"org.ajax4jsf.areas.rendered";
- private static final String AJAX_SINGLE_ATTR = "ajaxSingle";
+ public static final String AJAX_SINGLE_ATTR = "ajaxSingle";
public static final String AJAX_QUEUE_ATTR = "eventsQueue";
public static final String AJAX_DELAY_ATTR = "requestDelay";
- private static final String AJAX_ABORT_ATTR = "ignoreDupResponses";
+ public static final String AJAX_ABORT_ATTR = "ignoreDupResponses";
/**
* Static class - protect constructor TODO - make as subclass of chameleon
@@ -204,32 +204,23 @@
Map<String, Object> componentAttributes = uiComponent.getAttributes();
Map<String, Object> options = new HashMap<String, Object>();
Map<String, Object> parameters = new HashMap<String, Object>();
+ UIComponent targetComponent = (uiComponent instanceof
AjaxSupport)?uiComponent.getParent():uiComponent;
// UIForm form = getNestingForm(uiComponent);
// "input" - if assigned to html input element.
- boolean input = (uiComponent instanceof AjaxSupport && uiComponent
- .getParent() instanceof EditableValueHolder)
- || uiComponent instanceof EditableValueHolder;
+ boolean input = targetComponent instanceof EditableValueHolder;
// Action component - button etc.
- boolean action = (uiComponent instanceof AjaxSupport && uiComponent
- .getParent() instanceof ActionSource)
- || uiComponent instanceof ActionSource;
- // TODO - disable ( or not ? ) submission of action for disabled default
- // ?
- // if ( action && uiComponent instanceof AjaxSupport) {
- // AjaxSupport support = (AjaxSupport) uiComponent;
- // if (support.isDisableDefault()) {
- // action = false;
- // }
- // }
+// boolean action = targetComponent instanceof ActionSource;
boolean ajaxSingle = Boolean.TRUE.equals(componentAttributes
.get(AJAX_SINGLE_ATTR));
// For input components in single mode or without form submit input
// control )
- if (ajaxSingle && input) { // || action
- // TODO - inside form, put reference :
- // document.forms['form'].controls['control']
- options.put("control", JSReference.THIS);
+ if (ajaxSingle ) {
+ parameters.put(AJAX_SINGLE_ATTR, targetComponent.getClientId(facesContext));
+// options.put("single", JSReference.TRUE);
+ if (input) {
+ options.put("control", JSReference.THIS);
+ }
}
// Control value for submit
String controlName;
@@ -239,10 +230,6 @@
controlName = clientId;
controlValue = clientId;
parameters.put(controlName, controlValue);
- // Move processing of a 'single' attribute to a server-side.
-// if (ajaxSingle) {
-// options.put("single", JSReference.TRUE);
-// }
AjaxContext ajaxContext = AjaxContext.getCurrentInstance(facesContext);
// Setup action URL. For portlet environment, it will be different from
// page.
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxRegion.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxRegion.java 2008-03-07
14:32:02 UTC (rev 6625)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxRegion.java 2008-03-08
01:05:20 UTC (rev 6626)
@@ -242,4 +242,38 @@
}
+ /**
+ * @return
+ * @see org.ajax4jsf.component.AjaxRegionBrige#getSubmittedControlId()
+ */
+ public String getSubmittedControlId() {
+ return brige.getSubmittedControlId();
+ }
+
+ /**
+ * @return
+ * @see org.ajax4jsf.component.AjaxRegionBrige#isTransient()
+ */
+ public boolean isTransient() {
+ return brige.isTransient();
+ }
+
+ /**
+ * @param submittedControlId
+ * @see org.ajax4jsf.component.AjaxRegionBrige#setSubmittedControlId(java.lang.String)
+ */
+ public void setSubmittedControlId(String submittedControlId) {
+ brige.setSubmittedControlId(submittedControlId);
+ }
+
+ /**
+ * @param transientFlag
+ * @see org.ajax4jsf.component.AjaxRegionBrige#setTransient(boolean)
+ */
+ public void setTransient(boolean transientFlag) {
+ brige.setTransient(transientFlag);
+ }
+
+
+
}