You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2007/05/26 22:30:19 UTC
svn commit: r541933 - in
/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago:
ajax/api/ component/ lifecycle/ util/
Author: weber
Date: Sat May 26 13:30:17 2007
New Revision: 541933
URL: http://svn.apache.org/viewvc?view=rev&rev=541933
Log:
TOBAGO-404 : Allow ajax refresh inside sheet.
Added:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ApplyRequestValuesCallback.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/Callback.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/EncodeAjaxCallback.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ProcessValidationsCallback.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/UpdateModelValuesCallback.java
Modified:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/ajax/api/AjaxResponseRenderer.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/ajax/api/AjaxUtils.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/ApplyRequestValuesExecutor.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/ProcessValidationsExecutor.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/UpdateModelValuesExecutor.java
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/ajax/api/AjaxResponseRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/ajax/api/AjaxResponseRenderer.java?view=diff&rev=541933&r1=541932&r2=541933
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/ajax/api/AjaxResponseRenderer.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/ajax/api/AjaxResponseRenderer.java Sat May 26 13:30:17 2007
@@ -25,6 +25,8 @@
import org.apache.myfaces.tobago.util.RequestUtils;
import org.apache.myfaces.tobago.util.ResponseUtils;
+import org.apache.myfaces.tobago.util.EncodeAjaxCallback;
+import org.apache.myfaces.tobago.util.Callback;
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import static org.apache.myfaces.tobago.lifecycle.TobagoLifecycle.VIEW_ROOT_KEY;
@@ -57,6 +59,12 @@
public static final String CODE_NOT_MODIFIED = "<status code=\"304\"/>";
public static final String CODE_RELOAD_REQUIRED = "<status code=\"309\"/>";
+ private Callback callback;
+
+
+ public AjaxResponseRenderer() {
+ callback = new EncodeAjaxCallback();
+ }
public void renderResponse(FacesContext facesContext) throws IOException {
final UIViewRoot viewRoot = facesContext.getViewRoot();
@@ -94,18 +102,12 @@
writeResponseReload(facesContext, renderKit);
} else {
List<StringWriter> responseParts = new ArrayList<StringWriter>();
- List<UIComponent> ajaxComponents = AjaxUtils.getAjaxComponents(facesContext);
+ Map<String, UIComponent> ajaxComponents = AjaxUtils.getAjaxComponents(facesContext);
- for (int i = 0; i < 1; i++) { // TODO render multiple components
- StringWriter content = new StringWriter();
- responseParts.add(content);
- ResponseWriter contentWriter = renderKit.createResponseWriter(content, null, null);
- facesContext.setResponseWriter(contentWriter);
- AjaxComponent ajaxComponent = ((AjaxComponent) ajaxComponents.get(i));
- if (LOG.isDebugEnabled()) {
- LOG.debug("write ajax response for " + ajaxComponent);
- }
- ajaxComponent.encodeAjax(facesContext);
+ for (String clientId : ajaxComponents.keySet()) {
+ AjaxComponent component = ((AjaxComponent) ajaxComponents.get(clientId));
+ responseParts.add(renderComponent(facesContext, renderKit, clientId, component));
+ break; // TODO render multiple components
}
String state = saveState(facesContext, renderKit);
@@ -113,6 +115,21 @@
}
}
+ private StringWriter renderComponent(FacesContext facesContext, RenderKit renderKit, String clientId, AjaxComponent component)
+ throws IOException {
+ StringWriter content = new StringWriter();
+ ResponseWriter contentWriter = renderKit.createResponseWriter(content, null, null);
+ facesContext.setResponseWriter(contentWriter);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("write ajax response for " + component);
+ }
+
+ // TODO: invokeOnComponent()
+ ComponentUtil.invokeOnComponent(facesContext, clientId, (UIComponent) component, callback);
+
+ return content;
+ }
+
private void writeResponse(FacesContext facesContext, RenderKit renderKit,
List<StringWriter> parts, String state)
throws IOException {
@@ -159,7 +176,7 @@
ExternalContext externalContext = facesContext.getExternalContext();
RequestUtils.ensureEncoding(externalContext);
ResponseUtils.ensureNoCacheHeader(externalContext);
- UIComponent page = ComponentUtil.findPage(facesContext, AjaxUtils.getAjaxComponents(facesContext).get(0));
+ UIComponent page = ComponentUtil.findPage(facesContext);
String charset = (String) page.getAttributes().get(ATTR_CHARSET);
ResponseUtils.ensureContentTypeHeader(facesContext, charset);
StringBuilder buffer = new StringBuilder(responseCode);
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/ajax/api/AjaxUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/ajax/api/AjaxUtils.java?view=diff&rev=541933&r1=541932&r2=541933
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/ajax/api/AjaxUtils.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/ajax/api/AjaxUtils.java Sat May 26 13:30:17 2007
@@ -32,6 +32,7 @@
import java.util.StringTokenizer;
import java.util.List;
import java.util.ArrayList;
+import java.util.HashMap;
/*
* Created by IntelliJ IDEA.
@@ -133,13 +134,13 @@
}
}
- public static ArrayList<UIComponent> parseAndStoreComponents(FacesContext facesContext) {
+ public static Map<String, UIComponent> parseAndStoreComponents(FacesContext facesContext) {
Map parameterMap = facesContext.getExternalContext().getRequestParameterMap();
String ajaxComponentIds = (String) parameterMap.get(AjaxPhaseListener.AJAX_COMPONENT_ID);
if (ajaxComponentIds != null) {
LOG.info("ajaxComponentIds = \"" + ajaxComponentIds + "\"");
StringTokenizer tokenizer = new StringTokenizer(ajaxComponentIds, ",");
- ArrayList<UIComponent> ajaxComponents = new ArrayList<UIComponent>(tokenizer.countTokens());
+ Map<String, UIComponent> ajaxComponents = new HashMap<String, UIComponent>(tokenizer.countTokens());
//noinspection unchecked
facesContext.getExternalContext().getRequestMap().put(AJAX_COMPONENTS, ajaxComponents);
javax.faces.component.UIViewRoot viewRoot = facesContext.getViewRoot();
@@ -147,8 +148,8 @@
String ajaxId = tokenizer.nextToken();
UIComponent ajaxComponent = viewRoot.findComponent(ajaxId);
if (ajaxComponent != null) {
- LOG.info("ajaxComponent = \"" + ajaxComponent + "\"");
- ajaxComponents.add(ajaxComponent);
+ LOG.info("ajaxComponent for \"" + ajaxId + "\" = \"" + ajaxComponent + "\"");
+ ajaxComponents.put(ajaxId, ajaxComponent);
}
}
return ajaxComponents;
@@ -156,9 +157,9 @@
return null;
}
- public static List<UIComponent> getAjaxComponents(FacesContext facesContext) {
+ public static Map<String, UIComponent> getAjaxComponents(FacesContext facesContext) {
//noinspection unchecked
- return (List<UIComponent>)
+ return (Map<String, UIComponent>)
facesContext.getExternalContext().getRequestMap().get(AJAX_COMPONENTS);
}
@@ -167,9 +168,9 @@
}
public static void ensureDecoded(FacesContext facesContext, UIComponent component) {
- List<UIComponent> ajaxComponents = getAjaxComponents(facesContext);
+ Map<String, UIComponent> ajaxComponents = getAjaxComponents(facesContext);
if (ajaxComponents != null) {
- for (UIComponent uiComponent : ajaxComponents) {
+ for (UIComponent uiComponent : ajaxComponents.values()) {
UIComponent currentComponent = component;
while (currentComponent != null) {
if (component == uiComponent) {
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java?view=diff&rev=541933&r1=541932&r2=541933
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java Sat May 26 13:30:17 2007
@@ -57,6 +57,7 @@
import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
import org.apache.myfaces.tobago.renderkit.html.StyleClasses;
import org.apache.myfaces.tobago.util.RangeParser;
+import org.apache.myfaces.tobago.util.Callback;
import org.apache.myfaces.tobago.context.TransientStateHolder;
import javax.faces.FactoryFinder;
@@ -92,6 +93,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.Collections;
public class ComponentUtil {
@@ -1187,5 +1189,62 @@
}
}
return from.findComponent(relativeId);
+ }
+
+ public static void invokeOnComponent(FacesContext facesContext, String clientId, UIComponent component, Callback callback) {
+ List<UIComponent> list = new ArrayList<UIComponent>();
+ while (component != null) {
+ list.add(component);
+ component = component.getParent();
+ }
+ Collections.reverse(list);
+ invokeOrPrepare(facesContext, list, clientId, callback);
+ }
+
+ private static void invokeOrPrepare(FacesContext facesContext, List<UIComponent> list, String clientId, Callback callback) {
+ if (list.size() == 1) {
+ callback.execute(facesContext, list.get(0));
+ } else if (list.get(0) instanceof UIData) {
+ prepareOnUIData(facesContext, list, clientId, callback);
+ } else {
+ prepareOnUIComponent(facesContext, list, clientId, callback);
+ }
+ }
+
+ private static void prepareOnUIComponent(FacesContext facesContext, List<UIComponent> list, String clientId, Callback callback) {
+ list.remove(0);
+ invokeOrPrepare(facesContext, list, clientId, callback);
+ }
+
+ private static void prepareOnUIData(FacesContext facesContext, List<UIComponent> list, String clientId, Callback callback) {
+ UIComponent currentComponent = list.remove(0);
+ if (! (currentComponent instanceof UIData)) {
+ throw new IllegalStateException(currentComponent.getClass().getName());
+ }
+
+ // we may need setRowIndex on UIData
+ javax.faces.component.UIData uiData = (javax.faces.component.UIData) currentComponent;
+ int oldRowIndex = uiData.getRowIndex();
+ String sheetId = uiData.getClientId(facesContext);
+ String idRemainder = clientId.substring(sheetId.length());
+ LOG.info("idRemainder = \"" + idRemainder + "\"");
+ if (idRemainder.matches("^:\\d+:.*")) {
+ idRemainder = idRemainder.substring(1);
+ int idx = idRemainder.indexOf(":");
+ try {
+ int rowIndex = Integer.parseInt(idRemainder.substring(0, idx));
+ LOG.info("set rowIndex = \"" + rowIndex + "\"");
+ uiData.setRowIndex(rowIndex);
+ } catch (NumberFormatException e) {
+ LOG.error("idRemainder = \"" + idRemainder + "\"" , e);
+ }
+ } else {
+ LOG.info("no match for \"^:\\d+:.*\"");
+ }
+
+ invokeOrPrepare(facesContext, list, clientId, callback);
+
+ // we should reset rowIndex on UIData
+ uiData.setRowIndex(oldRowIndex);
}
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/ApplyRequestValuesExecutor.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/ApplyRequestValuesExecutor.java?view=diff&rev=541933&r1=541932&r2=541933
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/ApplyRequestValuesExecutor.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/ApplyRequestValuesExecutor.java Sat May 26 13:30:17 2007
@@ -23,14 +23,16 @@
import org.apache.myfaces.tobago.component.ComponentUtil;
import org.apache.myfaces.tobago.component.UIPage;
import org.apache.myfaces.tobago.component.UIViewRoot;
+import org.apache.myfaces.tobago.util.ApplyRequestValuesCallback;
+import org.apache.myfaces.tobago.util.Callback;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import javax.faces.context.FacesContext;
import javax.faces.event.PhaseId;
import javax.faces.component.UIComponent;
-import javax.faces.component.UIData;
-import java.util.ArrayList;
+import java.util.Map;
/**
* Implements the lifecycle as described in Spec. 1.0 PFD Chapter 2
@@ -38,10 +40,19 @@
* Apply request values phase (JSF Spec 2.2.2)
*/
class ApplyRequestValuesExecutor implements PhaseExecutor {
+
+ @SuppressWarnings({"UnusedDeclaration"})
private static final Log LOG = LogFactory.getLog(ApplyRequestValuesExecutor.class);
+ private Callback callback;
+
+
+ public ApplyRequestValuesExecutor() {
+ callback = new ApplyRequestValuesCallback();
+ }
+
public boolean execute(FacesContext facesContext) {
- ArrayList<UIComponent> ajaxComponents
+ Map<String, UIComponent> ajaxComponents
= AjaxUtils.parseAndStoreComponents(facesContext);
if (ajaxComponents != null) {
// first decode the page
@@ -51,46 +62,13 @@
// decode the action if actioncomponent not inside one of the ajaxcomponets
// otherwise it is decoded there
- String actionId = page.getActionId();
- UIComponent actionComponent = null;
- if (actionId != null) {
- actionComponent = page.findComponent(actionId);
- }
-
- if (actionComponent != null) {
- boolean decodeNeeded = true;
- UIData sheet = null;
-
- for (UIComponent ajaxComponent : ajaxComponents) {
- UIComponent component = actionComponent;
- while (component != null) {
- if (component == ajaxComponent) {
- decodeNeeded = false;
- break;
- } else {
- component = component.getParent();
- if (component instanceof UIData) {
- sheet = (UIData) component;
- }
- }
- }
- if (!decodeNeeded) {
- break;
- }
- }
- if (decodeNeeded) {
- if (sheet == null) {
- actionComponent.processDecodes(facesContext);
- } else {
- // action component is inside UIData, we need to proccess this component!
- sheet.processDecodes(facesContext);
- }
- }
- }
+ decodeActionComponent(facesContext, page, ajaxComponents);
// and all ajax components
- for (UIComponent ajaxComponent : ajaxComponents) {
- ajaxComponent.processDecodes(facesContext);
+ for (String ajaxComponentId : ajaxComponents.keySet()) {
+ UIComponent ajaxComponent = ajaxComponents.get(ajaxComponentId);
+ // TODO: invokeOnComponent()
+ ComponentUtil.invokeOnComponent(facesContext, ajaxComponentId, ajaxComponent, callback);
}
UIViewRoot viewRoot = ((UIViewRoot) facesContext.getViewRoot());
@@ -100,6 +78,28 @@
facesContext.getViewRoot().processDecodes(facesContext);
}
return false;
+ }
+
+ private void decodeActionComponent(FacesContext facesContext, UIPage page, Map<String, UIComponent> ajaxComponents) {
+ String actionId = page.getActionId();
+ UIComponent actionComponent = null;
+ if (actionId != null) {
+ actionComponent = facesContext.getViewRoot().findComponent(actionId);
+ }
+ if (actionComponent == null) {
+ return;
+ }
+ for (UIComponent ajaxComponent : ajaxComponents.values()) {
+ UIComponent component = actionComponent;
+ while (component != null) {
+ if (component == ajaxComponent) {
+ return;
+ }
+ component = component.getParent();
+ }
+ }
+ // TODO: invokeOnComponent()
+ ComponentUtil.invokeOnComponent(facesContext, actionId, actionComponent, callback);
}
public PhaseId getPhase() {
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/ProcessValidationsExecutor.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/ProcessValidationsExecutor.java?view=diff&rev=541933&r1=541932&r2=541933
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/ProcessValidationsExecutor.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/ProcessValidationsExecutor.java Sat May 26 13:30:17 2007
@@ -21,22 +21,35 @@
import org.apache.myfaces.tobago.ajax.api.AjaxUtils;
import org.apache.myfaces.tobago.component.UIViewRoot;
+import org.apache.myfaces.tobago.component.ComponentUtil;
+import org.apache.myfaces.tobago.util.Callback;
+import org.apache.myfaces.tobago.util.ProcessValidationsCallback;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.event.PhaseId;
-import java.util.List;
+import java.util.Map;
/**
* Implements the lifecycle as described in Spec. 1.0 PFD Chapter 2
* Process validations phase (JSF Spec 2.2.3)
*/
class ProcessValidationsExecutor implements PhaseExecutor {
+
+ private Callback callback;
+
+ public ProcessValidationsExecutor() {
+ this.callback = new ProcessValidationsCallback();
+ }
+
public boolean execute(FacesContext facesContext) {
- List<UIComponent> ajaxComponents = AjaxUtils.getAjaxComponents(facesContext);
+ Map<String,UIComponent> ajaxComponents = AjaxUtils.getAjaxComponents(facesContext);
if (ajaxComponents != null) {
- for (UIComponent ajaxComponent : ajaxComponents) {
- ajaxComponent.processValidators(facesContext);
+ for (String ajaxComponentId : ajaxComponents.keySet()) {
+ UIComponent ajaxComponent = ajaxComponents.get(ajaxComponentId);
+ // TODO: invokeOnComponent()
+ ComponentUtil.invokeOnComponent(facesContext, ajaxComponentId, ajaxComponent, callback);
+// ajaxComponent.processValidators(facesContext);
}
UIViewRoot viewRoot = ((UIViewRoot) facesContext.getViewRoot());
viewRoot.broadcastEventsForPhase(facesContext, PROCESS_VALIDATIONS);
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/UpdateModelValuesExecutor.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/UpdateModelValuesExecutor.java?view=diff&rev=541933&r1=541932&r2=541933
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/UpdateModelValuesExecutor.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/lifecycle/UpdateModelValuesExecutor.java Sat May 26 13:30:17 2007
@@ -21,11 +21,14 @@
import org.apache.myfaces.tobago.ajax.api.AjaxUtils;
import org.apache.myfaces.tobago.component.UIViewRoot;
+import org.apache.myfaces.tobago.component.ComponentUtil;
+import org.apache.myfaces.tobago.util.Callback;
+import org.apache.myfaces.tobago.util.UpdateModelValuesCallback;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.event.PhaseId;
-import java.util.List;
+import java.util.Map;
/**
@@ -33,11 +36,21 @@
* Update model values phase (JSF Spec 2.2.4)
*/
class UpdateModelValuesExecutor implements PhaseExecutor {
+
+ private Callback callback;
+
+ public UpdateModelValuesExecutor() {
+ callback = new UpdateModelValuesCallback();
+ }
+
public boolean execute(FacesContext facesContext) {
- List<UIComponent> ajaxComponents = AjaxUtils.getAjaxComponents(facesContext);
+ Map<String,UIComponent> ajaxComponents = AjaxUtils.getAjaxComponents(facesContext);
if (ajaxComponents != null) {
- for (UIComponent ajaxComponent : ajaxComponents) {
- ajaxComponent.processUpdates(facesContext);
+ for (String ajaxComponentId : ajaxComponents.keySet()) {
+ UIComponent ajaxComponent = ajaxComponents.get(ajaxComponentId);
+ // TODO: invokeOnComponent()
+ ComponentUtil.invokeOnComponent(facesContext, ajaxComponentId, ajaxComponent, callback);
+// ajaxComponent.processUpdates(facesContext);
}
UIViewRoot viewRoot = ((UIViewRoot) facesContext.getViewRoot());
viewRoot.broadcastEventsForPhase(facesContext, UPDATE_MODEL_VALUES);
Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ApplyRequestValuesCallback.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ApplyRequestValuesCallback.java?view=auto&rev=541933
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ApplyRequestValuesCallback.java (added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ApplyRequestValuesCallback.java Sat May 26 13:30:17 2007
@@ -0,0 +1,35 @@
+package org.apache.myfaces.tobago.util;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.myfaces.tobago.ajax.api.AjaxComponent;
+
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+import javax.faces.FacesException;
+import java.io.IOException;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class ApplyRequestValuesCallback implements Callback {
+
+ private final Log LOG = LogFactory.getLog(ApplyRequestValuesCallback.class);
+ public void execute(FacesContext facesContext, UIComponent component) {
+ component.processDecodes(facesContext);
+ }
+}
Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/Callback.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/Callback.java?view=auto&rev=541933
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/Callback.java (added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/Callback.java Sat May 26 13:30:17 2007
@@ -0,0 +1,24 @@
+package org.apache.myfaces.tobago.util;
+
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public interface Callback {
+ void execute(FacesContext facesContext, UIComponent component);
+}
Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/EncodeAjaxCallback.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/EncodeAjaxCallback.java?view=auto&rev=541933
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/EncodeAjaxCallback.java (added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/EncodeAjaxCallback.java Sat May 26 13:30:17 2007
@@ -0,0 +1,35 @@
+package org.apache.myfaces.tobago.util;
+
+import org.apache.myfaces.tobago.ajax.api.AjaxComponent;
+
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+import javax.faces.FacesException;
+import java.io.IOException;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class EncodeAjaxCallback implements Callback {
+
+ public void execute(FacesContext facesContext, UIComponent component) {
+ try {
+ ((AjaxComponent)component).encodeAjax(facesContext);
+ } catch (IOException e) {
+ throw new FacesException(e);
+ }
+ }
+}
Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ProcessValidationsCallback.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ProcessValidationsCallback.java?view=auto&rev=541933
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ProcessValidationsCallback.java (added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ProcessValidationsCallback.java Sat May 26 13:30:17 2007
@@ -0,0 +1,27 @@
+package org.apache.myfaces.tobago.util;
+
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class ProcessValidationsCallback implements Callback {
+
+ public void execute(FacesContext facesContext, UIComponent component) {
+ component.processValidators(facesContext);
+ }
+}
Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/UpdateModelValuesCallback.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/UpdateModelValuesCallback.java?view=auto&rev=541933
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/UpdateModelValuesCallback.java (added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/UpdateModelValuesCallback.java Sat May 26 13:30:17 2007
@@ -0,0 +1,27 @@
+package org.apache.myfaces.tobago.util;
+
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class UpdateModelValuesCallback implements Callback {
+
+ public void execute(FacesContext facesContext, UIComponent component) {
+ component.processUpdates(facesContext);
+ }
+}