You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2008/09/07 00:01:33 UTC
svn commit: r692746 - in
/myfaces/trinidad/trunk_1.2.x/trinidad-partial-lifecycle/src/main/java/org/apache/myfaces/trinidadinternal/lifecycle:
ApplyRequestValuesExecutor.java DecodeCallback.java
RenderResponseExecutor.java
Author: bommel
Date: Sat Sep 6 15:01:32 2008
New Revision: 692746
URL: http://svn.apache.org/viewvc?rev=692746&view=rev
Log:
(TRINIDAD-1220) Partial Lifecycle for Trinidad
Added:
myfaces/trinidad/trunk_1.2.x/trinidad-partial-lifecycle/src/main/java/org/apache/myfaces/trinidadinternal/lifecycle/DecodeCallback.java (with props)
Modified:
myfaces/trinidad/trunk_1.2.x/trinidad-partial-lifecycle/src/main/java/org/apache/myfaces/trinidadinternal/lifecycle/ApplyRequestValuesExecutor.java
myfaces/trinidad/trunk_1.2.x/trinidad-partial-lifecycle/src/main/java/org/apache/myfaces/trinidadinternal/lifecycle/RenderResponseExecutor.java
Modified: myfaces/trinidad/trunk_1.2.x/trinidad-partial-lifecycle/src/main/java/org/apache/myfaces/trinidadinternal/lifecycle/ApplyRequestValuesExecutor.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-partial-lifecycle/src/main/java/org/apache/myfaces/trinidadinternal/lifecycle/ApplyRequestValuesExecutor.java?rev=692746&r1=692745&r2=692746&view=diff
==============================================================================
--- myfaces/trinidad/trunk_1.2.x/trinidad-partial-lifecycle/src/main/java/org/apache/myfaces/trinidadinternal/lifecycle/ApplyRequestValuesExecutor.java (original)
+++ myfaces/trinidad/trunk_1.2.x/trinidad-partial-lifecycle/src/main/java/org/apache/myfaces/trinidadinternal/lifecycle/ApplyRequestValuesExecutor.java Sat Sep 6 15:01:32 2008
@@ -19,9 +19,9 @@
import org.apache.myfaces.trinidadinternal.renderkit.core.CoreResponseStateManager;
+import org.apache.myfaces.trinidad.logging.TrinidadLogger;
import javax.faces.component.ContextCallback;
-import javax.faces.component.UIComponent;
import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;
import javax.faces.event.PhaseId;
@@ -35,8 +35,9 @@
*/
class ApplyRequestValuesExecutor implements PhaseExecutor
{
-
- private ContextCallback contextCallback = new ApplyRequestValuesCallback();
+ private static final TrinidadLogger LOG = TrinidadLogger.createTrinidadLogger(ApplyRequestValuesExecutor.class);
+ private ContextCallback processDecodesCallback = new ApplyRequestValuesCallback();
+ private ContextCallback decodeCallback = new DecodeCallback();
public boolean execute(FacesContext facesContext)
{
@@ -44,41 +45,43 @@
if (partialTargets != null)
{
Map<String, String> parameterMap = facesContext.getExternalContext().getRequestParameterMap();
- String sourceName = parameterMap.get("source");
UIViewRoot viewRoot = facesContext.getViewRoot();
- UIComponent source = viewRoot.findComponent(sourceName);
// TODO partialRequest from inside Tree or Table
// TODO navigationTree
for (String partialTarget : partialTargets)
{
- viewRoot.invokeOnComponent(facesContext, partialTarget, contextCallback);
+ viewRoot.invokeOnComponent(facesContext, partialTarget, processDecodesCallback);
}
// TODO how to check that source and form already included in a partialTarget
-
- if (source != null && !Arrays.asList(partialTargets).contains(sourceName))
+ String sourceName = parameterMap.get("source");
+ if (sourceName != null && !Arrays.asList(partialTargets).contains(sourceName))
{
// TODO source inside a partialTarget
- source.decode(facesContext);
+ boolean found = viewRoot.invokeOnComponent(facesContext, sourceName, decodeCallback);
+ if (!found) {
+ LOG.warning("No source UIComponent found for '" + sourceName + "'");
+ }
}
-
String formName = parameterMap.get(CoreResponseStateManager.FORM_FIELD_NAME);
- UIComponent form = viewRoot.findComponent(formName);
-
- if (form != null && !Arrays.asList(partialTargets).contains(formName))
+ if (formName != null && !Arrays.asList(partialTargets).contains(formName))
{
// TODO form inside partialTarget
// SubForm set submitted by queueEvent
- form.decode(facesContext);
+ boolean found = viewRoot.invokeOnComponent(facesContext, formName, decodeCallback);
+ if (!found) {
+ LOG.warning("No form UIComponent found for '" + formName + "'");
+ }
}
// TODO broadcast Events UIViewRoot has no public method
//viewRoot.broadcastEventsForPhase(facesContext, PhaseId.APPLY_REQUEST_VALUES);
- } else
+ }
+ else
{
facesContext.getViewRoot().processDecodes(facesContext);
}
Added: myfaces/trinidad/trunk_1.2.x/trinidad-partial-lifecycle/src/main/java/org/apache/myfaces/trinidadinternal/lifecycle/DecodeCallback.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-partial-lifecycle/src/main/java/org/apache/myfaces/trinidadinternal/lifecycle/DecodeCallback.java?rev=692746&view=auto
==============================================================================
--- myfaces/trinidad/trunk_1.2.x/trinidad-partial-lifecycle/src/main/java/org/apache/myfaces/trinidadinternal/lifecycle/DecodeCallback.java (added)
+++ myfaces/trinidad/trunk_1.2.x/trinidad-partial-lifecycle/src/main/java/org/apache/myfaces/trinidadinternal/lifecycle/DecodeCallback.java Sat Sep 6 15:01:32 2008
@@ -0,0 +1,36 @@
+package org.apache.myfaces.trinidadinternal.lifecycle;
+
+/*
+ * 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.
+ */
+
+import org.apache.myfaces.trinidad.logging.TrinidadLogger;
+
+import javax.faces.component.ContextCallback;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+
+public class DecodeCallback implements ContextCallback
+{
+ private static final TrinidadLogger LOG = TrinidadLogger.createTrinidadLogger(DecodeCallback.class);
+
+ public void invokeContextCallback(FacesContext facesContext, UIComponent component)
+ {
+ LOG.info(this.getClass().getName() + " called for " + component);
+ component.decode(facesContext);
+ }
+}
Propchange: myfaces/trinidad/trunk_1.2.x/trinidad-partial-lifecycle/src/main/java/org/apache/myfaces/trinidadinternal/lifecycle/DecodeCallback.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/trinidad/trunk_1.2.x/trinidad-partial-lifecycle/src/main/java/org/apache/myfaces/trinidadinternal/lifecycle/DecodeCallback.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: myfaces/trinidad/trunk_1.2.x/trinidad-partial-lifecycle/src/main/java/org/apache/myfaces/trinidadinternal/lifecycle/RenderResponseExecutor.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-partial-lifecycle/src/main/java/org/apache/myfaces/trinidadinternal/lifecycle/RenderResponseExecutor.java?rev=692746&r1=692745&r2=692746&view=diff
==============================================================================
--- myfaces/trinidad/trunk_1.2.x/trinidad-partial-lifecycle/src/main/java/org/apache/myfaces/trinidadinternal/lifecycle/RenderResponseExecutor.java (original)
+++ myfaces/trinidad/trunk_1.2.x/trinidad-partial-lifecycle/src/main/java/org/apache/myfaces/trinidadinternal/lifecycle/RenderResponseExecutor.java Sat Sep 6 15:01:32 2008
@@ -24,6 +24,8 @@
import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderingContext;
import org.apache.myfaces.trinidadinternal.renderkit.core.CoreResponseStateManager;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.CoreFormData;
+import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlConstants;
+import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.PartialPageUtils;
import javax.faces.FacesException;
import javax.faces.application.Application;
@@ -76,6 +78,7 @@
ResponseWriter responseWriter =
facesContext.getRenderKit().createResponseWriter(response.getWriter(), contentType, encoding);
+ LOG.info("ResponseWriter class: " + responseWriter.getClass().getName());
facesContext.setResponseWriter(responseWriter);
ResponseWriter rw = facesContext.getResponseWriter();
@@ -95,9 +98,17 @@
if (form != null)
{
// TODO find a better way
- CoreFormData fData = new CoreFormData(formName);
+ CoreFormData formData = new CoreFormData(formName);
+ // FIXME
+ formData.addNeededValue(XhtmlConstants.PARTIAL_PARAM);
+ formData.addNeededValue(XhtmlConstants.STATE_PARAM);
+ formData.addNeededValue(XhtmlConstants.VALUE_PARAM);
RenderingContext renderingContext = RenderingContext.getCurrentInstance();
- renderingContext.setFormData(fData);
+ renderingContext.setFormData(formData);
+ // FIXME
+ if (PartialPageUtils.isPartialRenderingPass(renderingContext)) {
+ PartialPageUtils.markPPRActive(facesContext);
+ }
if (renderingContext instanceof CoreRenderingContext)
{
Map<String, String> shortStyles = renderingContext.getSkin().getStyleClassMap(renderingContext);