You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ms...@apache.org on 2011/05/10 20:38:37 UTC
svn commit: r1101588 - in /myfaces/trinidad/trunk:
trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/
trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/
trinidad-api/src/main/xrts/org/apache/myfaces/trinidad/resource/
trinidad-i...
Author: mstarets
Date: Tue May 10 18:38:36 2011
New Revision: 1101588
URL: http://svn.apache.org/viewvc?rev=1101588&view=rev
Log:
Backed out TRINIDAD-2073 due to test failures
Modified:
myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/RowKeySetAttributeChange.java
myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/UIXComponentELTag.java
myfaces/trinidad/trunk/trinidad-api/src/main/xrts/org/apache/myfaces/trinidad/resource/LoggerBundle.xrts
myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/ViewDeclarationLanguageFactoryImpl.java
Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/RowKeySetAttributeChange.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/RowKeySetAttributeChange.java?rev=1101588&r1=1101587&r2=1101588&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/RowKeySetAttributeChange.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/change/RowKeySetAttributeChange.java Tue May 10 18:38:36 2011
@@ -1,7 +1,5 @@
package org.apache.myfaces.trinidad.change;
-import java.util.Collection;
-import java.util.HashSet;
import java.util.Map;
import javax.el.ValueExpression;
@@ -11,7 +9,6 @@ import javax.faces.component.UIComponent
import javax.faces.context.FacesContext;
import javax.faces.el.ValueBinding;
-import org.apache.myfaces.trinidad.logging.TrinidadLogger;
import org.apache.myfaces.trinidad.model.RowKeySet;
/**
@@ -77,21 +74,6 @@ public final class RowKeySetAttributeCha
private void _updateRowKeySetInPlace(UIComponent component, String attrName, RowKeySet newValue)
{
- // Take a snapshot of the remembered keys, so we are insulated from any heayweight implementations of RowKeySet
- Collection<Object> newKeySet = new HashSet<Object>();
-
- try
- {
- newKeySet.addAll(newValue);
- }
- // addAll() can raise a few exceptions, a behavior we can't reliably predict for different possible implementations
- // of RowKeySet during invokeOnComponent, we do not want to propogate either, gracefully fail change attempt.
- catch (Exception e)
- {
- _LOG.warning("FAILED_ROWKEYSETATTRIBUTECHANGE", e.getClass());
- return;
- }
-
ValueExpression oldExpression = component.getValueExpression(attrName);
// due to bug in how the trinidad table and tree handle their RowKeySets, always use
@@ -103,7 +85,7 @@ public final class RowKeySetAttributeCha
context.getViewRoot().invokeOnComponent(
context,
_clientId,
- new GetOldValueAndUpdate(oldExpression, attrName, newKeySet));
+ new GetOldValueAndUpdate(oldExpression, attrName, newValue));
}
/**
@@ -111,11 +93,11 @@ public final class RowKeySetAttributeCha
*/
private static final class GetOldValueAndUpdate implements ContextCallback
{
- public GetOldValueAndUpdate(ValueExpression expression, String attributeName, Collection<Object> newKeySet)
+ public GetOldValueAndUpdate(ValueExpression expression, String attributeName, RowKeySet newKeySet)
{
_expression = expression;
_attributeName = attributeName;
- _newKeySet = newKeySet;
+ _newKeySet = newKeySet;
}
public void invokeContextCallback(FacesContext context,
@@ -161,11 +143,10 @@ public final class RowKeySetAttributeCha
private final ValueExpression _expression;
private final String _attributeName;
- private final Collection<Object> _newKeySet;
+ private final RowKeySet _newKeySet;
}
private static final long serialVersionUID = 1L;
- static private final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(RowKeySetAttributeChange.class);
private final String _clientId;
}
Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/UIXComponentELTag.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/UIXComponentELTag.java?rev=1101588&r1=1101587&r2=1101588&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/UIXComponentELTag.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/webapp/UIXComponentELTag.java Tue May 10 18:38:36 2011
@@ -35,13 +35,17 @@ import javax.el.ValueExpression;
import javax.faces.component.UIComponent;
import javax.faces.component.UIViewRoot;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
import javax.faces.webapp.UIComponentELTag;
import javax.servlet.jsp.JspException;
import org.apache.myfaces.trinidad.bean.FacesBean;
import org.apache.myfaces.trinidad.bean.PropertyKey;
+import org.apache.myfaces.trinidad.change.ChangeManager;
import org.apache.myfaces.trinidad.component.UIXComponent;
+import org.apache.myfaces.trinidad.component.UIXDocument;
import org.apache.myfaces.trinidad.context.RequestContext;
import org.apache.myfaces.trinidad.logging.TrinidadLogger;
@@ -75,6 +79,28 @@ abstract public class UIXComponentELTag
}
@Override
+ public int doEndTag() throws JspException
+ {
+ UIComponent component = getComponentInstance();
+
+ // Apply changes once we have a stable UIComponent subtree is completely
+ // created. End of document tag is a best bet.
+ if (component instanceof UIXDocument)
+ {
+ if (getCreated())
+ {
+ ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
+ // Used by SessionChangeManager to confirm that the state was not restored.
+ ec.getRequestMap().put(DOCUMENT_CREATED_KEY, Boolean.TRUE);
+ }
+ ChangeManager cm = RequestContext.getCurrentInstance().getChangeManager();
+ cm.applyComponentChangesForCurrentView(FacesContext.getCurrentInstance());
+ }
+ return super.doEndTag();
+ }
+
+
+ @Override
protected final void setProperties(UIComponent component)
{
if (component instanceof UIViewRoot)
@@ -469,8 +495,6 @@ abstract public class UIXComponentELTag
return sdf;
}
- // No more used anywhere in Trinidad code, so deprecate since 2.0.x.
- @Deprecated
public static final String DOCUMENT_CREATED_KEY = "org.apache.myfaces.trinidad.DOCUMENTCREATED";
private MethodExpression _attributeChangeListener;
Modified: myfaces/trinidad/trunk/trinidad-api/src/main/xrts/org/apache/myfaces/trinidad/resource/LoggerBundle.xrts
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/xrts/org/apache/myfaces/trinidad/resource/LoggerBundle.xrts?rev=1101588&r1=1101587&r2=1101588&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/xrts/org/apache/myfaces/trinidad/resource/LoggerBundle.xrts (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/xrts/org/apache/myfaces/trinidad/resource/LoggerBundle.xrts Tue May 10 18:38:36 2011
@@ -39,9 +39,6 @@
<!-- CONVERSION_CLASS_TYPE -->
<resource key="CONVERSION_CLASS_TYPE">Conversion class: {0} not of type {1}</resource>
-<!-- FAILED_ROWKEYSETATTRIBUTECHANGE -->
-<resource key="FAILED_ROWKEYSETATTRIBUTECHANGE">Failed to apply row key set attribute change. Reason : {1}</resource>
-
<!-- UNABLE_INSTANTIATE_CONVERTERCLASS -->
<resource key="UNABLE_INSTANTIATE_CONVERTERCLASS">Unable to instantiate converterClass: {0}</resource>
Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/ViewDeclarationLanguageFactoryImpl.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/ViewDeclarationLanguageFactoryImpl.java?rev=1101588&r1=1101587&r2=1101588&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/ViewDeclarationLanguageFactoryImpl.java (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/ViewDeclarationLanguageFactoryImpl.java Tue May 10 18:38:36 2011
@@ -18,8 +18,6 @@
*/
package org.apache.myfaces.trinidadinternal.application;
-import java.beans.BeanInfo;
-
import java.io.IOException;
import java.io.InputStream;
@@ -32,22 +30,18 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
+
import java.util.concurrent.ConcurrentHashMap;
-import javax.faces.application.Resource;
import javax.faces.component.UIViewRoot;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
-import javax.faces.view.StateManagementStrategy;
import javax.faces.view.ViewDeclarationLanguage;
import javax.faces.view.ViewDeclarationLanguageFactory;
-import javax.faces.view.ViewMetadata;
-import org.apache.myfaces.trinidad.change.ChangeManager;
import org.apache.myfaces.trinidad.context.RequestContext;
-import org.apache.myfaces.trinidad.logging.TrinidadLogger;
import org.apache.myfaces.trinidad.render.InternalView;
-
+import org.apache.myfaces.trinidad.logging.TrinidadLogger;
public class ViewDeclarationLanguageFactoryImpl
extends ViewDeclarationLanguageFactory
@@ -82,12 +76,7 @@ public class ViewDeclarationLanguageFact
// implementation
viewId = _getPath(context, viewId);
- ViewDeclarationLanguage vdl = getWrapped().getViewDeclarationLanguage(viewId);
- // Possiblity of nested VDLs of the same kind
- if (vdl instanceof ChangeApplyingVDLWrapper)
- return vdl;
-
- return new ChangeApplyingVDLWrapper(getWrapped().getViewDeclarationLanguage(viewId));
+ return getWrapped().getViewDeclarationLanguage(viewId);
}
@Override
@@ -292,70 +281,4 @@ public class ViewDeclarationLanguageFact
{
public InternalView getInternalView(FacesContext context, String viewId);
}
-
- /**
- * The VDL implementation that wraps an underlying VDL and additionally applies component changes based
- * customization (usually SessionChangeManager). Note that this works both for Facelets and JSPs.
- */
- private static class ChangeApplyingVDLWrapper extends ViewDeclarationLanguage
- {
- ChangeApplyingVDLWrapper(ViewDeclarationLanguage wrapped)
- {
- _wrapped = wrapped;
- }
-
- @Override
- public BeanInfo getComponentMetadata(FacesContext facesContext, Resource resource)
- {
- return _wrapped.getComponentMetadata(facesContext, resource);
- }
-
- @Override
- public ViewMetadata getViewMetadata(FacesContext facesContext, String string)
- {
- return _wrapped.getViewMetadata(facesContext, string);
- }
-
- @Override
- public Resource getScriptComponentResource(FacesContext facesContext, Resource resource)
- {
- return _wrapped.getScriptComponentResource(facesContext, resource);
- }
-
- @Override
- public UIViewRoot createView(FacesContext facesContext, String string)
- {
- return _wrapped.createView(facesContext, string);
- }
-
- @Override
- public UIViewRoot restoreView(FacesContext facesContext, String string)
- {
- return _wrapped.restoreView(facesContext, string);
- }
-
- @Override
- public void buildView(FacesContext facesContext, UIViewRoot uiViewRoot)
- throws IOException
- {
- _wrapped.buildView(facesContext, uiViewRoot);
- ChangeManager cm = RequestContext.getCurrentInstance().getChangeManager();
- cm.applyComponentChangesForCurrentView(FacesContext.getCurrentInstance());
- }
-
- @Override
- public void renderView(FacesContext facesContext, UIViewRoot uiViewRoot)
- throws IOException
- {
- _wrapped.renderView(facesContext, uiViewRoot);
- }
-
- @Override
- public StateManagementStrategy getStateManagementStrategy(FacesContext facesContext, String string)
- {
- return _wrapped.getStateManagementStrategy(facesContext, string);
- }
-
- private final ViewDeclarationLanguage _wrapped;
- }
}