myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arobinso...@apache.org
Subject svn commit: r745923 - in /myfaces/trinidad/trunk: ./ trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/ trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/ trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/conte...
Date Thu, 19 Feb 2009 16:52:40 GMT
Author: arobinson74
Date: Thu Feb 19 16:52:39 2009
New Revision: 745923

URL: http://svn.apache.org/viewvc?rev=745923&view=rev
Log:
TRINIDAD-1402 - add component level control of partial target adding

Modified:
    myfaces/trinidad/trunk/   (props changed)
    myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java
    myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/PartialPageContext.java
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/RequestContextImpl.java
    myfaces/trinidad/trunk/trinidad-sandbox/sandbox-api/src/main/java-templates/org/apache/myfaces/trinidad/sandbox/component/
  (props changed)
    myfaces/trinidad/trunk/trinidad-sandbox/sandbox-api/src/main/java/org/apache/myfaces/trinidad/sandbox/event/
  (props changed)

Propchange: myfaces/trinidad/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Feb 19 16:52:39 2009
@@ -1 +1,2 @@
 /myfaces/trinidad/branches/1.2.9.1-branch:697924,699406,699496
+/myfaces/trinidad/branches/TRINIDAD-1402:745675

Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java?rev=745923&r1=745922&r2=745923&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java
(original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java
Thu Feb 19 16:52:39 2009
@@ -6,9 +6,9 @@
  *  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
@@ -23,14 +23,12 @@
 import java.util.Collection;
 import java.util.Iterator;
 
-import javax.faces.component.UIComponent;
-
 import javax.el.MethodExpression;
 
 import javax.faces.component.NamingContainer;
+import javax.faces.component.UIComponent;
 import javax.faces.component.UINamingContainer;
 import javax.faces.context.FacesContext;
-
 import javax.faces.event.PhaseId;
 import javax.faces.render.Renderer;
 
@@ -44,6 +42,7 @@
 import org.apache.myfaces.trinidad.event.AttributeChangeListener;
 import org.apache.myfaces.trinidad.render.CoreRenderer;
 
+
 /**
  * Pure abstract base class for all UIX components.
  */
@@ -108,7 +107,7 @@
     S callbackContext) throws IOException
   {
     if (child.isRendered())
-    {      
+    {
        // component is an action FlattenedComponent.  Ask it to flatten its children
       if ((child instanceof FlattenedComponent) &&
           ((FlattenedComponent)child).isFlatteningChildren(context))
@@ -130,7 +129,7 @@
           // if startDepth is > 0, only the first visible child will be marked as starting
a group
           cpContext.resetStartDepth();
         }
-        
+
         return true;
       }
     }
@@ -195,7 +194,7 @@
   {
     // we haven't processed a child yet
     boolean processedChild = false;
-    
+
     for (UIComponent currChild : children)
     {
       // latch processed child to the first child processed
@@ -204,7 +203,7 @@
                                                  currChild,
                                                  callbackContext);
     }
-    
+
     return processedChild;
   }
 
@@ -237,7 +236,7 @@
   {
     return visitTree(visitContext, this, callback);
   }
-  
+
   /**
   * <p>Perform a tree visit starting at the specified node in the tree.</p>
   *
@@ -272,7 +271,7 @@
     if (component instanceof UIXComponent)
     {
       uixComponent = (UIXComponent)component;
-      
+
       // delegate to the UIXComponent
       if (!uixComponent.isVisitable(visitContext))
         return false;
@@ -282,10 +281,10 @@
       // use generic isVisitable implemetation
       if (!_isVisitable(visitContext, component))
         return false;
-      
+
       uixComponent = null;
     }
-    
+
     // invoke the callback for this component
     VisitResult result = visitContext.invokeVisitCallback(component, callback);
 
@@ -299,7 +298,7 @@
       RenderingContext rc = (PhaseId.RENDER_RESPONSE == phaseId)
                               ? RenderingContext.getCurrentInstance()
                               : null;
-      
+
       if (uixComponent != null)
       {
         // assume that all UIXComponent NamingContainers always act as NamingContainers,
@@ -311,7 +310,7 @@
           if (visitContext.getSubtreeIdsToVisit(uixComponent).isEmpty())
             return false;
         }
-        
+
         // UIXComponents are allowed to set up their context differently for encoding
         // than normal processing, so behave differently if this is the RenderResponse
         // phase
@@ -334,22 +333,22 @@
             return false;
         }
       }
-      
+
       // visit the children of the component
       try
       {
         Iterator<UIComponent> kids = component.getFacetsAndChildren();
-              
+
         while(kids.hasNext())
         {
           boolean done;
-          
+
           UIComponent currChild = kids.next();
-          
+
           if (currChild instanceof UIXComponent)
           {
             UIXComponent uixChild = (UIXComponent)currChild;
-            
+
             // delegate to UIXComponent's visitTree implementation to allow
             // subclassses to modify the behavior
             done = uixChild.visitTree(visitContext, callback);
@@ -359,7 +358,7 @@
             // use generic visit implementation
             done = visitTree(visitContext, currChild, callback);
           }
-          
+
           // If any kid visit returns true, we are done.
           if (done)
           {
@@ -385,15 +384,53 @@
     }
     else
     {
-      assert(result == VisitResult.REJECT);      
+      assert(result == VisitResult.REJECT);
     }
 
     // if we got this far, we're not done
     return false;
   }
 
-  
-  
+  /**
+   * Add a component as a partial target to the current request. This code handles the
+   * delegation to {@link #setPartialTarget(FacesContext, PartialPageContext)}
+   * for UIXComponents or assumes for {@link UIComponent} that components with a renderer
+   * type are able to produce DOM elements that have IDs that can be replaced.
+   *
+   * @param facesContext the faces context
+   * @param partialContext the partial page context
+   * @param component the component to add as a target
+   */
+  public static void addPartialTarget(FacesContext facesContext,
+    PartialPageContext partialContext, UIComponent component)
+  {
+    if (component instanceof UIXComponent)
+    {
+      ((UIXComponent)component).setPartialTarget(facesContext, partialContext);
+    }
+    else
+    {
+      // default to using the renderer type implementation
+      _addPartialTargetImpl(facesContext, partialContext, component);
+    }
+  }
+
+  /**
+   * Marks this component as a partial target for this request. Typically called
+   * by the {@link org.apache.myfaces.trinidad.context.RequestContext RequestContext}.
+   * The component should add the client ID the desired rendered component to the context.
+   * This allows components that do not render a replacable DOM element with an ID
+   * to choose an alternative component, like a parent.
+   *
+   * @param facesContext the faces context
+   * @param partialContext the partial page context
+   */
+  protected void setPartialTarget(FacesContext facesContext,
+    PartialPageContext partialContext)
+  {
+    UIXComponent._addPartialTargetImpl(facesContext, partialContext, this);
+  }
+
   /**
    * <p>Called by
    * {@link UIXComponent#visitTree UIXComponent.visitTree()} to determine
@@ -413,7 +450,29 @@
   {
     return _isVisitable(visitContext, this);
   }
-  
+
+  /**
+   * @see #addPartialTarget(FacesContext, PartialPageContext, UIComponent)
+   * @see #setPartialTarget(FacesContext, PartialPageContext)
+   */
+  private static void _addPartialTargetImpl(
+    FacesContext facesContext, PartialPageContext partialContext, UIComponent component)
+  {
+    if (component.getRendererType() == null)
+    {
+      if (component.getParent() != null)
+      {
+        // delegate to the parent component, assuming that no renderer type means that
+        // there is no suitable replacable DOM element for this component
+        addPartialTarget(facesContext, partialContext, component.getParent());
+      }
+    }
+    else
+    {
+      partialContext.addPartialTarget(component.getClientId(facesContext));
+    }
+  }
+
   /**
    * default implementation checking the <code>VisitHint.SKIP_TRANSIENT</code>
and
    * <code>VisitHint.SKIP_UNRENDERED</code> hints.
@@ -421,16 +480,16 @@
   private static boolean _isVisitable(VisitContext visitContext, UIComponent component)
   {
     Collection<VisitHint> hints = visitContext.getHints();
-    
+
     if (hints.contains(VisitHint.SKIP_TRANSIENT) && component.isTransient())
       return false;
-    
+
     if (hints.contains(VisitHint.SKIP_UNRENDERED) && !component.isRendered())
       return false;
-    
+
     return true;
   }
-  
+
   /**
    * <p>
    * Called when visiting the component during optimized partial page encoding so that the
@@ -457,7 +516,7 @@
   {
     FacesContext context  = visitContext.getFacesContext();
     Renderer     renderer = getRenderer(context);
-    
+
     if (renderer instanceof CoreRenderer)
     {
       // delegate to the CoreRenderer
@@ -500,7 +559,7 @@
   {
     // do nothing
   }
-  
+
   /**
    * <p>Tears down context created in order to visit or invoke the component
    * for all phases.</p>
@@ -513,11 +572,11 @@
    * @see #setUpEncodingContext
    * @see #tearDownEncodingContext
    */
-  protected void tearDownVisitingContext(FacesContext context) 
+  protected void tearDownVisitingContext(FacesContext context)
   {
     // do nothing
   }
-  
+
   /**
    * <p>Sets up the context necessary to encode the component.</p>
    * <p>The default implementation delegates to
@@ -535,13 +594,13 @@
   protected void setUpEncodingContext(FacesContext context, RenderingContext rc)
   {
     setupVisitingContext(context);
-    
+
     Renderer renderer = getRenderer(context);
-    
+
     if (renderer instanceof CoreRenderer)
     {
       CoreRenderer coreRenderer = (CoreRenderer)renderer;
-      
+
       coreRenderer.setupEncodingContext(context, rc, this);
     }
   }
@@ -565,15 +624,15 @@
     RenderingContext rc)
   {
     Renderer renderer = getRenderer(context);
-    
+
     try
     {
       if (renderer instanceof CoreRenderer)
       {
         CoreRenderer coreRenderer = (CoreRenderer)renderer;
-      
+
         coreRenderer.tearDownEncodingContext(context, rc, this);
-      } 
+      }
     }
     finally
     {
@@ -606,7 +665,7 @@
 
   /**
    * Gets the registered AttributeChangeListeners.
-   */ 
+   */
   abstract public AttributeChangeListener[] getAttributeChangeListeners();
 
   /**
@@ -630,11 +689,11 @@
   abstract public MethodExpression getAttributeChangeListener();
 
   abstract public void markInitialState();
-  
+
   /**
-   * Provides additional context (the target child component for which the container 
+   * Provides additional context (the target child component for which the container
    * client ID is requested) to a naming container for constructing a client ID.
-   * This is useful for components such as @link UIXTable and @link UIXTreeTable which need

+   * This is useful for components such as @link UIXTable and @link UIXTreeTable which need
    * to return different container client IDs for stamped and non-stamped child components.
    * @see UIXComponentBase#getClientId(FacesContext context)
    */

Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/PartialPageContext.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/PartialPageContext.java?rev=745923&r1=745922&r2=745923&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/PartialPageContext.java
(original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/PartialPageContext.java
Thu Feb 19 16:52:39 2009
@@ -6,9 +6,9 @@
  *  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
@@ -38,6 +38,7 @@
  *
  * @version $Name:  $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/renderkit/core/ppr/PartialPageContext.java#0
$) $Date: 10-nov-2005.19:02:58 $
  */
+// TODO why is this an abstract class and not an interface?
 abstract public class PartialPageContext
 {
   protected PartialPageContext()
@@ -110,7 +111,7 @@
    * @return the client ids of the partial targets that have been rendered so far.
    */
   abstract public Iterator<String> getRenderedPartialTargets();
-  
+
   /**
    * Returns the VisitContext to use when partial rendering.
    * @return the VisitContext to use when partial rendering.

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/RequestContextImpl.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/RequestContextImpl.java?rev=745923&r1=745922&r2=745923&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/RequestContextImpl.java
(original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/RequestContextImpl.java
Thu Feb 19 16:52:39 2009
@@ -6,9 +6,9 @@
  *  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
@@ -23,6 +23,7 @@
 import java.io.Serializable;
 
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -37,12 +38,12 @@
 import javax.faces.component.UIViewRoot;
 import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
-
 import javax.faces.event.PhaseId;
 
 import org.apache.myfaces.trinidad.change.ChangeManager;
 import org.apache.myfaces.trinidad.change.NullChangeManager;
 import org.apache.myfaces.trinidad.change.SessionChangeManager;
+import org.apache.myfaces.trinidad.component.UIXComponent;
 import org.apache.myfaces.trinidad.component.visit.VisitContext;
 import org.apache.myfaces.trinidad.component.visit.VisitHint;
 import org.apache.myfaces.trinidad.config.RegionManager;
@@ -74,6 +75,8 @@
 import org.apache.myfaces.trinidadinternal.util.nls.LocaleUtils;
 import org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl;
 
+import sun.reflect.generics.reflectiveObjects.NotImplementedException;
+
 
 /**
  */
@@ -191,7 +194,7 @@
 
     return true;
   }
-  
+
   @SuppressWarnings("unchecked")
   @Override
   public boolean isPartialRequest(FacesContext context)
@@ -218,11 +221,11 @@
   {
     //=-= Scott O'Bryan =-=
     // FIXME: Not real happy with this.  We should find a way to get this into
-    // the bean.  The bean is cached by the RequestContextFactory, and the 
+    // the bean.  The bean is cached by the RequestContextFactory, and the
     // Portlet mode needs to be assigned per request since it's possible to run
     // a trinidad application from a servlet container and a portlet container
     // at the same time.  For now?  Hey, it works.
-    
+
     if(ExternalContextUtils.isPortlet(__getFacesContext().getExternalContext()))
     {
       return CoreRenderKit.OUTPUT_MODE_PORTLET;
@@ -238,23 +241,23 @@
 
   @Override
   public Accessibility getAccessibilityMode()
-  { 
+  {
     String name = (String) _bean.getProperty(
       RequestContextBean.ACCESSIBILITY_MODE_KEY);
-    
+
     return _ACCESSIBILITY_NAMES.get(name);
   }
 
   @Override
   public AccessibilityProfile getAccessibilityProfile()
-  { 
+  {
     return (AccessibilityProfile) _bean.getProperty(
       RequestContextBean.ACCESSIBILITY_PROFILE_KEY);
   }
 
   @Override
   public ClientValidation getClientValidation()
-  { 
+  {
     ClientValidation clientValidation = (ClientValidation)
       _bean.getProperty(RequestContextBean.CLIENT_VALIDATION_KEY);
 
@@ -275,7 +278,7 @@
   {
     return !Boolean.FALSE.equals(_bean.getProperty(RequestContextBean.ANIMATION_ENABLED_KEY));
   }
-  
+
   @Override
   public char getNumberGroupingSeparator()
   {
@@ -297,7 +300,7 @@
     char c = CoreRenderer.toChar(property);
     if (c != CoreRenderer.CHAR_UNDEFINED)
       return c;
-      
+
     return (char) 0;
   }
 
@@ -333,14 +336,14 @@
     FacesContext context = __getFacesContext();
     Map<String, Object> appMap = context.getExternalContext().getApplicationMap();
     ChangeManager changeManager = _getHeldProperty(appMap, _CHANGE_MANAGER_KEY, ChangeManager.class);
-    
+
     if (changeManager == null)
     {
       changeManager = _createChangeManager();
-      
+
       _setHeldProperty(appMap, _CHANGE_MANAGER_KEY, changeManager);
     }
-    
+
     return changeManager;
   }
 
@@ -437,10 +440,10 @@
 
     if (o instanceof Locale)
       return (Locale) o;
-    
+
     // Don't know how this would ever get here.  ConfigParser should have set the key if
     // formatting-locale was specified, or it is null.
-    if (o instanceof String)  
+    if (o instanceof String)
       o = ((String)o).replace('_', '-');
     return LocaleUtils.getLocaleForIANAString(o.toString());
   }
@@ -471,7 +474,7 @@
   //
 
   @Override
-  public void addPartialTarget(UIComponent newTarget)
+  public void addPartialTarget(UIComponent target)
   {
     FacesContext fContext = __getFacesContext();
 
@@ -480,26 +483,19 @@
     PartialPageContext pContext = null;
 
     if (afContext != null)
-      pContext = afContext.getPartialPageContext();
-
-    // find the nearest ancestor that generates html markup:
-    newTarget = _getNearestPPRTarget(newTarget);
-    String clientId = newTarget.getClientId(fContext);
-
-    _LOG.finer("Adding partial target: {0}", newTarget);
-
-    if (pContext != null)
     {
-      pContext.addPartialTarget(clientId);
+      pContext = afContext.getPartialPageContext();
     }
-    else
+
+    if (pContext == null)
     {
-      // If we haven't built the partial context yet, maintain a list of the
-      // target IDs that have requested partial update.
-      _partialTargets.add(clientId);
+      pContext = new MockPartialPageContext(fContext);
     }
+
+    // delegate to UIXComponent to allow for components to influence the IDs that get added
+    UIXComponent.addPartialTarget(fContext, pContext, target);
   }
-  
+
   /**
    * @see org.apache.myfaces.trinidad.context.RequestContext#addPartialTargets(javax.faces.component.UIComponent,
java.lang.String[])
    */
@@ -528,9 +524,9 @@
   {
     HashSet<UIComponent> set = new HashSet<UIComponent>();
     _addPartialTargets(set, source);
-    return set;    
+    return set;
   }
-  
+
   @Override
   public void addPartialTriggerListeners
     (UIComponent listener,
@@ -544,24 +540,24 @@
     for (int i = 0; i < triggers.length; i++)
     {
       String trigger = triggers[i];
-            
+
 
       UIComponent master = ComponentUtils.findRelativeComponent(listener, trigger);
-      
+
       boolean deprecatedFind = false;
-    
+
       if (master == null)
       {
         UIComponent from = listener;
         // backward compatible code
-        // The old rule is "if the component is a naming container, search relative 
-        // to the parent; otherwise, search relative to the component." 
+        // The old rule is "if the component is a naming container, search relative
+        // to the parent; otherwise, search relative to the component."
         if (listener instanceof NamingContainer)
         {
           from = listener.getParent();
           master = ComponentUtils.findRelativeComponent(from, trigger);
           deprecatedFind = true;
-        } 
+        }
       }
 
       if (master == null)
@@ -570,14 +566,14 @@
       }
       else
       {
-        // if we found this with the deprecated method, 
+        // if we found this with the deprecated method,
         // then warn the user to change their syntax.
         if (deprecatedFind)
         {
-          _LOG.warning("DEPRECATED_TRIGGER_SYNTAX", 
+          _LOG.warning("DEPRECATED_TRIGGER_SYNTAX",
             new Object[] {trigger, listener});
         }
-      
+
         // Get the set of listeners on this trigger and add this component.
         Set<UIComponent> listeners = pl.get(master);
         if (listeners == null)
@@ -625,7 +621,7 @@
   }
 
   /**
-   * <p>Creates a VisitContext instance for use with 
+   * <p>Creates a VisitContext instance for use with
    * {@link org.apache.myfaces.trinidad.component.UIXComponent#visitTree UIComponent.visitTree()}.</p>
    *
    * @param context the FacesContext for the current request
@@ -634,7 +630,7 @@
    * @param hints the VisitHints to apply to the visit
    * @param phaseId.  PhaseId if any for this visit.  If PhaseId is specified,
    * hints must contain VisitHint.EXECUTE_LIFECYCLE
-   * @return a VisitContext instance that is initialized with the 
+   * @return a VisitContext instance that is initialized with the
    *   specified ids and hints.
    */
    @Override
@@ -781,24 +777,6 @@
     return fContext;
   }
 
-  /**
-   * Components that do not render any html-markup cannot be
-   * added as PPR targets. This method will walk up the component
-   * tree finding the nearest ancestor that does render markup.
-   * Components that return null for {@link UIComponent#getRendererType}
-   * are treated as generating no markup.
-   * @param component This component, and its ancestors will be searched.
-   * @return the first component that does render html-markup.
-   */
-  private UIComponent _getNearestPPRTarget(UIComponent component)
-  {
-    while(component.getRendererType() == null)
-    {
-      component = component.getParent();
-    }
-    return component;
-  }
-
   private Map<UIComponent, Set<UIComponent>> _getPartialListeners()
   {
     if (_partialListeners == null)
@@ -818,7 +796,7 @@
     Set<UIComponent> listeners = pl.get(from);
     if (listeners == null)
       return;
-    
+
     for (UIComponent target : listeners)
     {
       // If we haven't encountered this target yet, add
@@ -832,7 +810,7 @@
   }
 
   /**
-   * Convenience function for cached properties potentially held using a TransientHolder

+   * Convenience function for cached properties potentially held using a TransientHolder
    * that hides the TransientHolder.getValue() step from the caller
    * @param stateMap Map containing TransientHolders to retrieve value from
    * @param key Key value/TransientHolder value is held under
@@ -862,7 +840,7 @@
         }
       }
     }
-    
+
     return null;
   }
 
@@ -873,10 +851,89 @@
   {
     if (!(value instanceof Serializable))
       value = TransientHolder.newTransientHolder(value);
-    
+
     stateMap.put(key, value);
   }
 
+  private class MockPartialPageContext
+    extends PartialPageContext
+  {
+    private MockPartialPageContext(FacesContext facesContext)
+    {
+      _facesContext = facesContext;
+    }
+
+    @Override
+    public boolean areAllTargetsProcessed()
+    {
+      // will never be true outside of rendering
+      return false;
+    }
+
+    @Override
+    public boolean isPartialTargetRendered(String id)
+    {
+      // not valid outside of rendering
+      return false;
+    }
+
+    @Override
+    public boolean isInsidePartialTarget()
+    {
+      // not valid outside of rendering
+      return false;
+    }
+
+    public void addRenderedPartialTarget(String id)
+    {
+      // not valid outside of rendering
+      throw new NotImplementedException();
+    }
+
+    public boolean isPartialTarget(String clientId)
+    {
+      return _partialTargets.contains(clientId);
+    }
+
+    public boolean isPossiblePartialTarget(String componentId)
+    {
+      return _componentIds.contains(componentId);
+    }
+
+    public Iterator<String> getPartialTargets()
+    {
+      return _partialTargets.iterator();
+    }
+
+    public void addPartialTarget(String clientId)
+    {
+      _partialTargets.add(clientId);
+
+      int lastFragmentIndex = clientId.lastIndexOf(NamingContainer.SEPARATOR_CHAR);
+
+      String id = (lastFragmentIndex != -1)
+                    ? clientId.substring(lastFragmentIndex + 1)
+                    : clientId;
+
+      _componentIds.add(id);
+    }
+
+    public Iterator<String> getRenderedPartialTargets()
+    {
+      // not valid outside of rendering
+      Set<String> empty = Collections.emptySet();
+      return empty.iterator();
+    }
+
+    public VisitContext getVisitContext()
+    {
+      // not valid outside of rendering
+      throw new NotImplementedException();
+    }
+
+    private FacesContext _facesContext;
+    private HashSet<String> _componentIds = new HashSet<String>();
+  }
 
   private RequestContextBean _bean;
   private HelpProvider        _provider;
@@ -888,7 +945,7 @@
 
   private PageResolver        _pageResolver;
   private PageFlowScopeProvider _pageFlowScopeProvider;
-  
+
   //todo: get factory from configuration (else implementations have to provide their own
RequestContext)
   static private final AgentFactory _agentFactory = new AgentFactoryImpl();
 
@@ -903,7 +960,7 @@
   // to accessibility objects
   static private final Map<String, Accessibility>
     _ACCESSIBILITY_NAMES = new HashMap<String, Accessibility>();
-  
+
   static
   {
     _ACCESSIBILITY_NAMES.put("default", Accessibility.DEFAULT);

Propchange: myfaces/trinidad/trunk/trinidad-sandbox/sandbox-api/src/main/java-templates/org/apache/myfaces/trinidad/sandbox/component/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Feb 19 16:52:39 2009
@@ -1 +1,2 @@
 /myfaces/trinidad/branches/1.2.9.1-branch/trinidad-sandbox/sandbox-api/src/main/java-templates/org/apache/myfaces/trinidad/sandbox/component:699406,699496
+/myfaces/trinidad/branches/TRINIDAD-1402/trinidad-sandbox/sandbox-api/src/main/java-templates/org/apache/myfaces/trinidad/sandbox/component:745675

Propchange: myfaces/trinidad/trunk/trinidad-sandbox/sandbox-api/src/main/java/org/apache/myfaces/trinidad/sandbox/event/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Feb 19 16:52:39 2009
@@ -1 +1,2 @@
 /myfaces/trinidad/branches/1.2.9.1-branch/trinidad-sandbox/sandbox-api/src/main/java/org/apache/myfaces/trinidad/sandbox/event:699406,699496
+/myfaces/trinidad/branches/TRINIDAD-1402/trinidad-sandbox/sandbox-api/src/main/java/org/apache/myfaces/trinidad/sandbox/event:745675



Mime
View raw message