incubator-adffaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From awi...@apache.org
Subject svn commit: r449866 - in /incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit: ./ core/ core/ppr/ core/xhtml/
Date Mon, 25 Sep 2006 23:46:53 GMT
Author: awiner
Date: Mon Sep 25 16:46:52 2006
New Revision: 449866

URL: http://svn.apache.org/viewvc?view=rev&rev=449866
Log:
Remove unused APIs from PartialPageContext public API to simplify the public contract, and
improve the Javadoc a bit

Modified:
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/PartialPageContext.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/RenderingContext.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/ppr/PPRResponseWriter.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/ppr/PartialPageContextImpl.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FormRenderer.java

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/PartialPageContext.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/PartialPageContext.java?view=diff&rev=449866&r1=449865&r2=449866
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/PartialPageContext.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/PartialPageContext.java
Mon Sep 25 16:46:52 2006
@@ -16,31 +16,21 @@
 package org.apache.myfaces.trinidadinternal.renderkit;
 
 import java.util.Iterator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.Stack;
-
-import org.apache.myfaces.trinidad.context.RequestContext;
-
-import org.apache.myfaces.trinidadinternal.context.RequestContextImpl;
 
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 
 /**
  * Context object which is used to track the targets of a partial
- * page render during the partial page rendering pass.
+ * page render during the Render Response phase.
  * Clients never need to explicitly create PartialPageContext
- * objects.
+ * objects, but can retrieve them from a RenderingContext instance.
+ * For general access to Partial Page Rendering during all phases,
+ * see APIs on the RequestContext API.
  * <p>
  * During the partial rendering pass, some Renderer implementations
  * may modify the set of partial targets that are rendered.
  * (For example, the FormRenderer adds a partial target for its
- * shared hidden fields if any children of the form are rendered.)
- * After the partial render pass, getPartialTargets() can be
- * called to determine the actual set of partial targets that were
- * rendered.
+ * shared hidden fields.)
  *
  * @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 $
  * @author The Oracle ADF Faces Team
@@ -51,13 +41,6 @@
   {
   }
 
-  abstract public void finish();
-
-  /**
-   * Returns the set of partial targets for this rendering pass.
-   */
-  abstract public Iterator<String> getPartialTargets();
-
   /**
    * Tests whether the specified id is the client id of a UIComponent that
    * should be rendered as part of the partial rendering pass.
@@ -65,14 +48,14 @@
   abstract public boolean isPartialTarget(String id);
 
   /**
-   * Tests whether the specified partial target has been rendered.
+   * Returns the set of partial targets for this rendering pass.
    */
-  abstract public boolean isPartialTargetRendered(String id);
+  abstract public Iterator<String> getPartialTargets();
 
   /**
-   * Tests whether any targets were rendered in this pass.
+   * Tests whether the specified partial target has been rendered.
    */
-  abstract public boolean hasRenderedTargets();
+  abstract public boolean isPartialTargetRendered(String id);
 
   /**
    * Adds a new partial target to render.
@@ -101,36 +84,4 @@
   abstract public void addRenderedPartialTarget(String id);
 
   abstract public Iterator<String> getRenderedPartialTargets();
-
-  /**
-   * Tests whether all of the partial targets for this tree have been rendered.
-   */
-  abstract public boolean isPartialPassComplete();
-
-  /**
-   * Notifies the PartialPageContext that the specified partial target is
-   * about to be rendered.
-   * <p>
-   * This method is called automatically by ADF Faces during the partial
-   * rendering pass when a partial target is about to be rendered.
-   * Clients should never need to call this method.
-   *
-   * @param context the current FacesContext
-   * @param id The ID of the partial target that is about to be rendered
-   * @see #popRenderedPartialTarget
-   */
-  abstract public void pushRenderedPartialTarget(
-    String id);
-
-  /**
-   * Notifies the PartialPageContext that the current partial target
-   * has finished rendering.
-   * <p>
-   * This method is called automatically by ADF Faces during the partial
-   * rendering pass when a partial target has finished rendering.
-   * Clients should never need to call this method.
-   *
-   * @param context the current FacesContext
-   */
-  abstract public void popRenderedPartialTarget();
 }

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/RenderingContext.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/RenderingContext.java?view=diff&rev=449866&r1=449865&r2=449866
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/RenderingContext.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/RenderingContext.java
Mon Sep 25 16:46:52 2006
@@ -22,14 +22,11 @@
 import org.apache.myfaces.trinidad.context.RequestContext;
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 
-import org.apache.myfaces.trinidadinternal.agent.TrinidadAgent;
-
 import org.apache.myfaces.trinidadinternal.share.nls.LocaleContext;
 import org.apache.myfaces.trinidadinternal.skin.Skin;
 import org.apache.myfaces.trinidadinternal.skin.icon.Icon;
 
 /**
- * @todo REMOVE DEPENDENCY ON AcessibilityMode
  */
 abstract public class RenderingContext
 {

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java?view=diff&rev=449866&r1=449865&r2=449866
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderKit.java
Mon Sep 25 16:46:52 2006
@@ -70,6 +70,7 @@
 import org.apache.myfaces.trinidadinternal.renderkit.RenderKitBase;
 import org.apache.myfaces.trinidadinternal.renderkit.RenderUtils;
 import org.apache.myfaces.trinidadinternal.renderkit.PartialPageContext;
+import org.apache.myfaces.trinidadinternal.renderkit.core.ppr.PartialPageContextImpl;
 import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.PartialPageUtils;
 import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlRenderer;
 import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlUtils;
@@ -364,10 +365,16 @@
       // Write out a script;  let PPR know to use it
       String scriptId = "::launchScript";
       PartialPageContext ppContext = arc.getPartialPageContext();
-      if (ppContext != null)
+      // TODO: Create the span with a bogus component where
+      // getClientId() returns the scriptId;  this avoids
+      // the need to downcast - you just need to
+      // call addPartialTarget().  Or, come up with a better
+      // PPR api to make it simpler
+      PartialPageContextImpl ppImpl = (PartialPageContextImpl) ppContext;
+      if (ppImpl != null)
       {
-        ppContext.addRenderedPartialTarget(scriptId);
-        ppContext.pushRenderedPartialTarget(scriptId);
+        ppImpl.addRenderedPartialTarget(scriptId);
+        ppImpl.pushRenderedPartialTarget(scriptId);
       }
 
       ResponseWriter out = context.getResponseWriter();
@@ -400,8 +407,8 @@
       if (hasScript)
         scriptList.clear();
 
-      if (ppContext != null)
-        ppContext.popRenderedPartialTarget();
+      if (ppImpl != null)
+        ppImpl.popRenderedPartialTarget();
     }
   }
 

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/ppr/PPRResponseWriter.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/ppr/PPRResponseWriter.java?view=diff&rev=449866&r1=449865&r2=449866
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/ppr/PPRResponseWriter.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/ppr/PPRResponseWriter.java
Mon Sep 25 16:46:52 2006
@@ -36,7 +36,10 @@
                            boolean            useXMLDom)
   {
     super(out);
-    _pprContext = pprContext;
+    if (!(pprContext instanceof PartialPageContextImpl))
+        throw new IllegalArgumentException();
+
+    _pprContext = (PartialPageContextImpl) pprContext;
     _useXMLDom = useXMLDom;
     _componentStack = new ArrayList<PPRTag>(50);
     _facesContext = FacesContext.getCurrentInstance();
@@ -286,7 +289,7 @@
       _id = id;
     }
 
-    public void start(PartialPageContext pprContext) throws IOException
+    public void start(PartialPageContextImpl pprContext) throws IOException
     {
       if (_id != null)
       {
@@ -307,7 +310,7 @@
       }
     }
 
-    public void finish(PartialPageContext pprContext) throws IOException
+    public void finish(PartialPageContextImpl pprContext) throws IOException
     {
       if (_id != null)
       {
@@ -345,7 +348,7 @@
     }
 
     @Override
-    public void start(PartialPageContext pprContext) throws IOException
+    public void start(PartialPageContextImpl pprContext) throws IOException
     {
       super.start(pprContext);
 
@@ -357,7 +360,7 @@
     }
 
     @Override
-    public void finish(PartialPageContext pprContext) throws IOException
+    public void finish(PartialPageContextImpl pprContext) throws IOException
     {
       // And then end them in reverse order...
       for (int i = _tags.length - 1; i >= 0; i--)
@@ -376,7 +379,7 @@
   private boolean _writingForm;
   private final boolean _useXMLDom;
   private final List<PPRTag> _componentStack;
-  private final PartialPageContext _pprContext;
+  private final PartialPageContextImpl _pprContext;
   private final FacesContext _facesContext;
 
   static private final String[] _ADD_TABLE_AND_TR =

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/ppr/PartialPageContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/ppr/PartialPageContextImpl.java?view=diff&rev=449866&r1=449865&r2=449866
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/ppr/PartialPageContextImpl.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/ppr/PartialPageContextImpl.java
Mon Sep 25 16:46:52 2006
@@ -82,20 +82,6 @@
     }
   }
 
-  public void finish()
-  {
-    if (_LOG.isWarning())
-    {
-      for(Map.Entry<String, Boolean> entry : _targets.entrySet())
-      {
-        if (entry.getValue() == Boolean.FALSE)
-          _LOG.warning("PPR target {0} was not rendered.",
-                       entry.getKey());
-      }
-    }
-  }
-
-
   /**
    * Returns the set of partial targets for this rendering pass.
    */
@@ -104,6 +90,8 @@
     return _targets.keySet().iterator();
   }
 
+
+
   /**
    * Tests whether the specified id is the client id of a UIComponent that
    * should be rendered as part of the partial rendering pass.
@@ -122,14 +110,6 @@
   }
 
   /**
-   * Tests whether any targets were rendered in this pass.
-   */
-  public boolean hasRenderedTargets()
-  {
-    return !_renderedTargets.isEmpty();
-  }
-
-  /**
    * Adds a new partial target to render.
    * <p>
    * This method may be called during the partial rendering pass to
@@ -167,17 +147,6 @@
   public Iterator<String> getRenderedPartialTargets()
   {
     return _renderedTargets.iterator();
-  }
-
-
-
-  /**
-   * Tests whether all of the partial targets for this tree have been rendered.
-   */
-  public boolean isPartialPassComplete()
-  {
-    // REMOVED
-    return false;
   }
 
   /**

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FormRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FormRenderer.java?view=diff&rev=449866&r1=449865&r2=449866
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FormRenderer.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FormRenderer.java
Mon Sep 25 16:46:52 2006
@@ -43,6 +43,7 @@
 import org.apache.myfaces.trinidadinternal.renderkit.PartialPageContext;
 import org.apache.myfaces.trinidadinternal.renderkit.RenderingContext;
 import org.apache.myfaces.trinidadinternal.renderkit.core.CoreResponseStateManager;
+import org.apache.myfaces.trinidadinternal.renderkit.core.ppr.PartialPageContextImpl;
 import org.apache.myfaces.trinidadinternal.renderkit.uix.SubformRenderer;
 
 // TODO: Remove this class
@@ -208,6 +209,13 @@
 
     String formName = arc.getFormData().getName();
     PartialPageContext pprContext = arc.getPartialPageContext();
+    // Downcast to pprContext to have access to push and pop
+    // TODO: Create the span with a bogus component where
+    // getClientId() returns the postscriptId;  this avoids
+    // the need for push and pop calls - you just need to
+    // call addPartialTarget().  Or, come up with a better
+    // PPR api to make it simpler
+    PartialPageContextImpl pprImpl = (PartialPageContextImpl) pprContext;
 
     boolean isXMLDOM = supportsXMLDOM(arc);
 
@@ -222,9 +230,9 @@
     // Check to see if this is a partial page render.  If so, we need
     // to push the ID of the postscript onto the partial target stack
     String postscriptId = _getPostscriptId(arc, formName);
-    if (pprContext != null)
+    if (pprImpl != null)
     {
-      _startPartialPostscriptRender(pprContext, postscriptId);
+      _startPartialPostscriptRender(pprImpl, postscriptId);
       if (isXMLDOM)
       {
         writer.startElement("ppr",null);
@@ -270,7 +278,7 @@
     //this condition is needed for bug 4526850- It ensures that only
     //state token and form name parameters are overwritten when there is
     //a partial page submission.
-    if (isPIE && pprContext == null)
+    if (isPIE && pprImpl == null)
     {
       //PH: Add hidden elements in the form for enabling PPR on IE Mobile.
 
@@ -296,14 +304,14 @@
     }
 
     // Pop the partial target stack if this is a partial page render
-    if (pprContext != null)
+    if (pprImpl != null)
     {
       if (isXMLDOM)
       {
         writer.write("]]>");
         writer.endElement("ppr");
       }
-      _endPartialPostscriptRender(pprContext, postscriptId);
+      _endPartialPostscriptRender(pprImpl, postscriptId);
     }
 
     // Render submitFormCheck js function --
@@ -885,7 +893,7 @@
 
   // Starts rendering the postscript partial target
   private static void _startPartialPostscriptRender(
-    PartialPageContext pprContext,
+    PartialPageContextImpl pprContext,
     String             postscriptId
     )
   {
@@ -897,7 +905,7 @@
 
   // Ends rendering the postscript partial target
   private static void _endPartialPostscriptRender(
-    PartialPageContext pprContext,
+    PartialPageContextImpl pprContext,
     String             postscriptId
     )
   {



Mime
View raw message