You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ar...@apache.org on 2011/08/02 18:04:37 UTC
svn commit: r1153174 - in /myfaces/trinidad/branches/2.0.0.1-branch: ./
trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/
trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/
trinidad-api/src/main/java/org/apache/...
Author: arobinson74
Date: Tue Aug 2 16:04:35 2011
New Revision: 1153174
URL: http://svn.apache.org/viewvc?rev=1153174&view=rev
Log:
TRINIDAD-2101 - Merge the fix into 2.0.0.1 branch
Modified:
myfaces/trinidad/branches/2.0.0.1-branch/ (props changed)
myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXShowDetailTemplate.java
myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSwitcherTemplate.java
myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java
myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponentBase.java
myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/CoreRenderer.java
myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/test/clirr/clirr-runner.txt
Propchange: myfaces/trinidad/branches/2.0.0.1-branch/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Aug 2 16:04:35 2011
@@ -8,4 +8,4 @@
/myfaces/trinidad/branches/jwaldman_StyleMap:754977-770778
/myfaces/trinidad/branches/trinidad-1.2.x:923447,923460,929241
/myfaces/trinidad/branches/trinidad-2.0.x:823098-895949
-/myfaces/trinidad/trunk:819601,819622,834147,886881,888973,893043,896231-908455,908699-921461,1096803,1096816,1096825
+/myfaces/trinidad/trunk:819601,819622,834147,886881,888973,893043,896231-908455,908699-921461,1096803,1096816,1096825,1125570
Modified: myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXShowDetailTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXShowDetailTemplate.java?rev=1153174&r1=1153173&r2=1153174&view=diff
==============================================================================
--- myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXShowDetailTemplate.java (original)
+++ myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXShowDetailTemplate.java Tue Aug 2 16:04:35 2011
@@ -18,11 +18,12 @@
*/
package org.apache.myfaces.trinidad.component;
+import java.util.Collections;
+import java.util.Iterator;
+
import javax.el.MethodExpression;
-import javax.faces.component.visit.VisitCallback;
-import javax.faces.component.visit.VisitContext;
-import javax.faces.component.visit.VisitHint;
+import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.el.MethodBinding;
import javax.faces.event.AbortProcessingException;
@@ -30,9 +31,9 @@ import javax.faces.event.FacesEvent;
import javax.faces.event.PhaseId;
import org.apache.myfaces.trinidad.event.DisclosureEvent;
-
import org.apache.myfaces.trinidad.logging.TrinidadLogger;
+
/**
* Base class for ShowDetail component.
* @version $Name: $ ($Revision$) $Date$
@@ -45,6 +46,7 @@ abstract public class UIXShowDetailTempl
/**/ abstract public boolean isImmediate();
/**/ abstract public MethodExpression getDisclosureListener();
/**/ abstract public boolean isDisclosedTransient();
+/**/ abstract public void setDisclosureListener(MethodExpression expression);
@Deprecated
public void setDisclosureListener(MethodBinding binding)
@@ -53,33 +55,6 @@ abstract public class UIXShowDetailTempl
}
@Override
- public void processDecodes(FacesContext context)
- {
- // If we're not disclosed, only process ourselves
- if (!isDisclosed())
- {
- if (isRendered())
- decode(context);
- }
- else
- super.processDecodes(context);
- }
-
- @Override
- public void processValidators(FacesContext context)
- {
- if (isDisclosed())
- super.processValidators(context);
- }
-
- @Override
- public void processUpdates(FacesContext context)
- {
- if (isDisclosed())
- super.processUpdates(context);
- }
-
- @Override
public void broadcast(FacesEvent event) throws AbortProcessingException
{
// Perform standard superclass processing
@@ -137,14 +112,16 @@ abstract public class UIXShowDetailTempl
super.queueEvent(e);
}
- @Override
- protected boolean visitChildren(VisitContext visitContext,
- VisitCallback callback)
+ protected Iterator<UIComponent> getRenderedFacetsAndChildren(FacesContext facesContext)
{
- return
- (visitContext.getHints().contains(VisitHint.SKIP_UNRENDERED) == false ||
- this.isDisclosed()) &&
- super.visitChildren(visitContext, callback);
+ if (isDisclosed())
+ {
+ return super.getRenderedFacetsAndChildren(facesContext);
+ }
+ else
+ {
+ return Collections.<UIComponent>emptyList().iterator();
+ }
}
static private final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(UIXShowDetail.class);
Modified: myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSwitcherTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSwitcherTemplate.java?rev=1153174&r1=1153173&r2=1153174&view=diff
==============================================================================
--- myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSwitcherTemplate.java (original)
+++ myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSwitcherTemplate.java Tue Aug 2 16:04:35 2011
@@ -20,10 +20,10 @@ package org.apache.myfaces.trinidad.comp
import java.io.IOException;
+import java.util.Collections;
+import java.util.Iterator;
+
import javax.faces.component.UIComponent;
-import javax.faces.component.visit.VisitCallback;
-import javax.faces.component.visit.VisitContext;
-import javax.faces.component.visit.VisitHint;
import javax.faces.context.FacesContext;
@@ -39,46 +39,14 @@ abstract public class UIXSwitcherTemplat
/**/ abstract public String getDefaultFacet();
/**
- * Only decode the currently active facet.
- */
- @Override
- public void processDecodes(FacesContext context)
- {
- UIComponent facet = _getFacet();
- if (facet != null)
- facet.processDecodes(context);
- }
-
- /**
- * Only process validations on the currently active facet.
- */
- @Override
- public void processValidators(FacesContext context)
- {
- UIComponent facet = _getFacet();
- if (facet != null)
- facet.processValidators(context);
- }
-
- /**
- * Only process updates on the currently active facet.
- */
- @Override
- public void processUpdates(FacesContext context)
- {
- UIComponent facet = _getFacet();
- if (facet != null)
- facet.processUpdates(context);
- }
-
- /**
* Processes the selected switcher facet
*/
public <S> boolean processFlattenedChildren(
final FacesContext context,
ComponentProcessingContext cpContext,
final ComponentProcessor<S> childProcessor,
- final S callbackContext) throws IOException
+ final S callbackContext
+ ) throws IOException
{
setupVisitingContext(context);
@@ -151,23 +119,16 @@ abstract public class UIXSwitcherTemplat
return true;
}
- @Override
- protected boolean visitChildren(
- VisitContext visitContext,
- VisitCallback callback)
+ protected Iterator<UIComponent> getRenderedFacetsAndChildren(FacesContext facesContext)
{
- if (visitContext.getHints().contains(VisitHint.SKIP_UNRENDERED))
+ UIComponent facet = _getFacet();
+ if (facet == null)
{
- UIComponent facet = _getFacet();
- if (facet != null)
- {
- return facet.visitTree(visitContext, callback);
- }
- return false;
+ return Collections.<UIComponent>emptyList().iterator();
}
else
{
- return super.visitChildren(visitContext, callback);
+ return Collections.singleton(facet).iterator();
}
}
@@ -190,6 +151,4 @@ abstract public class UIXSwitcherTemplat
return null;
}
-}
-
-
+}
\ No newline at end of file
Modified: myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java?rev=1153174&r1=1153173&r2=1153174&view=diff
==============================================================================
--- myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java (original)
+++ myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java Tue Aug 2 16:04:35 2011
@@ -354,6 +354,29 @@ abstract public class UIXComponent exten
return visitTree(visitContext, this, callback);
}
+ /**
+ * Specifies what facets and children components should be processed as rendered for life-cycle
+ * methods. Any components not returned will not be processed during methods such as decoding,
+ * validating, updating the model, rendered-only tree visiting, etc.
+ *
+ * @param facesContext the facesContext
+ * @return An iterator of components to process. Must not return null (return an empty iterator
+ * if no children components should be processed).
+ */
+ protected Iterator<UIComponent> getRenderedFacetsAndChildren(
+ FacesContext facesContext)
+ {
+ Renderer renderer = getRenderer(facesContext);
+ if (renderer instanceof CoreRenderer)
+ {
+ return ((CoreRenderer)renderer).getRenderedFacetsAndChildren(facesContext, this);
+ }
+ else
+ {
+ return getFacetsAndChildren();
+ }
+ }
+
/**
* Hook for subclasses to override the manner in which the component's children are visited. The default
* implementation visits all of the children and facets of the Component.
@@ -403,7 +426,10 @@ abstract public class UIXComponent exten
VisitCallback callback)
{
// visit the children of the component
- Iterator<UIComponent> kids = getFacetsAndChildren();
+ Iterator<UIComponent> kids =
+ visitContext.getHints().contains(VisitHint.SKIP_UNRENDERED) ?
+ getRenderedFacetsAndChildren(visitContext.getFacesContext()) :
+ getFacetsAndChildren();
while(kids.hasNext())
{
Modified: myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponentBase.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponentBase.java?rev=1153174&r1=1153173&r2=1153174&view=diff
==============================================================================
--- myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponentBase.java (original)
+++ myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponentBase.java Tue Aug 2 16:04:35 2011
@@ -72,11 +72,13 @@ import org.apache.myfaces.trinidad.bean.
import org.apache.myfaces.trinidad.bean.util.ValueMap;
import org.apache.myfaces.trinidad.change.AttributeComponentChange;
import org.apache.myfaces.trinidad.change.RowKeySetAttributeChange;
+import org.apache.myfaces.trinidad.component.UIXComponent;
import org.apache.myfaces.trinidad.context.RequestContext;
import org.apache.myfaces.trinidad.event.AttributeChangeEvent;
import org.apache.myfaces.trinidad.event.AttributeChangeListener;
import org.apache.myfaces.trinidad.logging.TrinidadLogger;
import org.apache.myfaces.trinidad.model.RowKeySet;
+import org.apache.myfaces.trinidad.render.CoreRenderer;
import org.apache.myfaces.trinidad.render.ExtendedRenderer;
import org.apache.myfaces.trinidad.render.LifecycleRenderer;
import org.apache.myfaces.trinidad.util.CollectionUtils;
@@ -322,6 +324,14 @@ abstract public class UIXComponentBase e
return _attributes;
}
+ @Override
+ protected Iterator<UIComponent> getRenderedFacetsAndChildren(
+ FacesContext facesContext)
+ {
+ _cacheRenderer(facesContext);
+ return super.getRenderedFacetsAndChildren(facesContext);
+ }
+
// ------------------------------------------------------------- Properties
/**
@@ -1187,7 +1197,7 @@ abstract public class UIXComponentBase e
*/
protected void decodeChildrenImpl(FacesContext context)
{
- Iterator<UIComponent> kids = getFacetsAndChildren();
+ Iterator<UIComponent> kids = getRenderedFacetsAndChildren(context);
while (kids.hasNext())
{
UIComponent kid = kids.next();
@@ -1222,7 +1232,7 @@ abstract public class UIXComponentBase e
protected void validateChildrenImpl(FacesContext context)
{
// Process all the facets and children of this component
- Iterator<UIComponent> kids = getFacetsAndChildren();
+ Iterator<UIComponent> kids = getRenderedFacetsAndChildren(context);
while (kids.hasNext())
{
UIComponent kid = kids.next();
@@ -1252,7 +1262,7 @@ abstract public class UIXComponentBase e
protected void updateChildrenImpl(FacesContext context)
{
// Process all the facets and children of this component
- Iterator<UIComponent> kids = getFacetsAndChildren();
+ Iterator<UIComponent> kids = getRenderedFacetsAndChildren(context);
while (kids.hasNext())
{
UIComponent kid = kids.next();
Modified: myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/CoreRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/CoreRenderer.java?rev=1153174&r1=1153173&r2=1153174&view=diff
==============================================================================
--- myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/CoreRenderer.java (original)
+++ myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/CoreRenderer.java Tue Aug 2 16:04:35 2011
@@ -67,6 +67,23 @@ public class CoreRenderer extends Render
}
/**
+ * Allows the rendered to specify what components should be involved with rendered children
+ * life-cycle operations and methods.
+ *
+ * @param facesContext the faces context
+ * @param component the component from which to get the rendered facets and children
+ * @see UIXComponentBase#getRenderedFacetsAndChildren(FacesContext)
+ * @return A list of components to process as rendered components. Defaults to all facets and
+ * children of a component
+ */
+ public Iterator<UIComponent> getRenderedFacetsAndChildren(
+ FacesContext facesContext,
+ UIComponent component)
+ {
+ return component.getFacetsAndChildren();
+ }
+
+ /**
* <p>
* Called when visiting the CoreRenderer's component during optimized partial page encoding so
* that the CoreRenderer can modify what is actually encoded. For example tab controls often
@@ -202,7 +219,8 @@ public class CoreRenderer extends Render
VisitCallback callback)
{
// visit the children of the component
- Iterator<UIComponent> kids = component.getFacetsAndChildren();
+ Iterator<UIComponent> kids = getRenderedFacetsAndChildren(
+ visitContext.getFacesContext(), component);
while (kids.hasNext())
{
Modified: myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/test/clirr/clirr-runner.txt
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/test/clirr/clirr-runner.txt?rev=1153174&r1=1153173&r2=1153174&view=diff
==============================================================================
--- myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/test/clirr/clirr-runner.txt (original)
+++ myfaces/trinidad/branches/2.0.0.1-branch/trinidad-api/src/test/clirr/clirr-runner.txt Tue Aug 2 16:04:35 2011
@@ -51,12 +51,10 @@ ERROR: 7005: org.apache.myfaces.trinidad
ERROR: 7005: org.apache.myfaces.trinidad.component.UIXProcess: Parameter 2 of 'protected boolean visitChildren(org.apache.myfaces.trinidad.component.visit.VisitContext, org.apache.myfaces.trinidad.component.visit.VisitCallback)' has changed its type to javax.faces.component.visit.VisitCallback
ERROR: 7005: org.apache.myfaces.trinidad.component.UIXProcess: Parameter 1 of 'protected boolean visitData(org.apache.myfaces.trinidad.component.visit.VisitContext, org.apache.myfaces.trinidad.component.visit.VisitCallback)' has changed its type to javax.faces.component.visit.VisitContext
ERROR: 7005: org.apache.myfaces.trinidad.component.UIXProcess: Parameter 2 of 'protected boolean visitData(org.apache.myfaces.trinidad.component.visit.VisitContext, org.apache.myfaces.trinidad.component.visit.VisitCallback)' has changed its type to javax.faces.component.visit.VisitCallback
-ERROR: 7005: org.apache.myfaces.trinidad.component.UIXShowDetail: Parameter 1 of 'protected boolean visitChildren(org.apache.myfaces.trinidad.component.visit.VisitContext, org.apache.myfaces.trinidad.component.visit.VisitCallback)' has changed its type to javax.faces.component.visit.VisitContext
-ERROR: 7005: org.apache.myfaces.trinidad.component.UIXShowDetail: Parameter 2 of 'protected boolean visitChildren(org.apache.myfaces.trinidad.component.visit.VisitContext, org.apache.myfaces.trinidad.component.visit.VisitCallback)' has changed its type to javax.faces.component.visit.VisitCallback
+ERROR: 7002: org.apache.myfaces.trinidad.component.UIXShowDetail: Method 'protected boolean visitChildren(org.apache.myfaces.trinidad.component.visit.VisitContext, org.apache.myfaces.trinidad.component.visit.VisitCallback)' has been removed
ERROR: 7005: org.apache.myfaces.trinidad.component.UIXShowOne: Parameter 1 of 'public boolean visitTree(org.apache.myfaces.trinidad.component.visit.VisitContext, org.apache.myfaces.trinidad.component.visit.VisitCallback)' has changed its type to javax.faces.component.visit.VisitContext
ERROR: 7005: org.apache.myfaces.trinidad.component.UIXShowOne: Parameter 2 of 'public boolean visitTree(org.apache.myfaces.trinidad.component.visit.VisitContext, org.apache.myfaces.trinidad.component.visit.VisitCallback)' has changed its type to javax.faces.component.visit.VisitCallback
-ERROR: 7005: org.apache.myfaces.trinidad.component.UIXSwitcher: Parameter 1 of 'protected boolean visitChildren(org.apache.myfaces.trinidad.component.visit.VisitContext, org.apache.myfaces.trinidad.component.visit.VisitCallback)' has changed its type to javax.faces.component.visit.VisitContext
-ERROR: 7005: org.apache.myfaces.trinidad.component.UIXSwitcher: Parameter 2 of 'protected boolean visitChildren(org.apache.myfaces.trinidad.component.visit.VisitContext, org.apache.myfaces.trinidad.component.visit.VisitCallback)' has changed its type to javax.faces.component.visit.VisitCallback
+ERROR: 7002: org.apache.myfaces.trinidad.component.UIXSwitcher: Method 'protected boolean visitChildren(org.apache.myfaces.trinidad.component.visit.VisitContext, org.apache.myfaces.trinidad.component.visit.VisitCallback)' has been removed
ERROR: 7005: org.apache.myfaces.trinidad.component.UIXTree: Parameter 1 of 'protected boolean visitChildren(org.apache.myfaces.trinidad.component.visit.VisitContext, org.apache.myfaces.trinidad.component.visit.VisitCallback)' has changed its type to javax.faces.component.visit.VisitContext
ERROR: 7005: org.apache.myfaces.trinidad.component.UIXTree: Parameter 2 of 'protected boolean visitChildren(org.apache.myfaces.trinidad.component.visit.VisitContext, org.apache.myfaces.trinidad.component.visit.VisitCallback)' has changed its type to javax.faces.component.visit.VisitCallback
ERROR: 7005: org.apache.myfaces.trinidad.component.UIXTree: Parameter 1 of 'protected boolean visitData(org.apache.myfaces.trinidad.component.visit.VisitContext, org.apache.myfaces.trinidad.component.visit.VisitCallback)' has changed its type to javax.faces.component.visit.VisitContext