incubator-adffaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From awi...@apache.org
Subject svn commit: r449864 - in /incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad: component/UIXComponent.java component/UIXComponentBase.java render/ExtendedRenderer.java render/LifecycleRenderer.java
Date Mon, 25 Sep 2006 23:45:37 GMT
Author: awiner
Date: Mon Sep 25 16:45:36 2006
New Revision: 449864

URL: http://svn.apache.org/viewvc?view=rev&rev=449864
Log:
Enhanced LifecycleRenderer API to return a boolean from each method, making it simpler for
a renderer to only conditionally override parts of the lifecycle

Modified:
    incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java
    incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponentBase.java
    incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/ExtendedRenderer.java
    incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/LifecycleRenderer.java

Modified: incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java?view=diff&rev=449864&r1=449863&r2=449864
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java
Mon Sep 25 16:45:36 2006
@@ -34,10 +34,6 @@
 /**
  * Pure abstract base class for all UIX components.
  * @author The Oracle ADF Faces Team
- * @todo Remove UIComponent methods when mock maker walks up hierarchy during 
- *       mock generation of abstract classes to ensure all abstract methods
- *       have mock implementations.
- * @mock
  */
 abstract public class UIXComponent extends UIComponent
 {
@@ -61,117 +57,22 @@
   @SuppressWarnings("unchecked")
   @Override
   public abstract Map getAttributes();
-  
-  @Override
-	public abstract ValueBinding getValueBinding(String name);
-  
-  @Override
-  public abstract void setValueBinding(String name, ValueBinding binding);
-
-  @Override
-  public abstract String getClientId(FacesContext context);
-
-  @Override
-  public abstract String getFamily();
-
-  @Override
-  public abstract String getId();
-
-  @Override
-  public abstract void setId(String id);
-
-  @Override
-  public abstract UIComponent getParent();
-
-  @Override
-  public abstract void setParent(UIComponent parent);
-
-  @Override
-  public abstract boolean isRendered();
-
-  @Override
-  public abstract void setRendered(boolean rendered);
-
-  @Override
-  public abstract String getRendererType();
-
-  @Override
-  public abstract void setRendererType(String rendererType);
-
-  @Override
-  public abstract boolean getRendersChildren();
 
   @SuppressWarnings("unchecked")
   @Override
   public abstract List getChildren();
 
-  @Override
-  public abstract int getChildCount();
-
-  @Override
-  public abstract UIComponent findComponent(String expr);
-
   @SuppressWarnings("unchecked")
   @Override
   public abstract Map getFacets();
 
-  @Override
-  public abstract UIComponent getFacet(String name);
-
   @SuppressWarnings("unchecked")
   @Override
   public abstract Iterator getFacetsAndChildren();
 
-  @Override
-  public abstract void broadcast(FacesEvent event)
-      throws AbortProcessingException;
-
-  @Override
-  public abstract void decode(FacesContext context);
-
-  @Override
-  public abstract void encodeBegin(FacesContext context) throws IOException;
-
-  @Override
-  public abstract void encodeChildren(FacesContext context) throws IOException;
-
-  @Override
-  public abstract void encodeEnd(FacesContext context) throws IOException;
-
-  @Override
-  protected abstract void addFacesListener(FacesListener listener);
-
   @SuppressWarnings("unchecked")
   @Override
   protected abstract FacesListener[] getFacesListeners(Class clazz);
-
-  @Override
-  protected abstract void removeFacesListener(FacesListener listener);
-
-  @Override
-  public abstract void queueEvent(FacesEvent event);
-
-  @Override
-  public abstract void processRestoreState(FacesContext context,
-                                           Object state);
-
-  @Override
-  public abstract void processDecodes(FacesContext context);
-
-  @Override
-  public abstract void processValidators(FacesContext context);
-
-  @Override
-  public abstract void processUpdates(FacesContext context);
-
-  @Override
-  public abstract Object processSaveState(FacesContext context);
-
-  @Override
-  protected abstract FacesContext getFacesContext();
-
-  @Override
-  protected abstract Renderer getRenderer(FacesContext context);
 
   public abstract Object saveState(FacesContext context);
   public abstract void restoreState(FacesContext context, Object state);

Modified: incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponentBase.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponentBase.java?view=diff&rev=449864&r1=449863&r2=449864
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponentBase.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponentBase.java
Mon Sep 25 16:45:36 2006
@@ -867,12 +867,11 @@
     // if there is a HierarchyRenderer for this component
     if (renderer != null)
     {
-      renderer.decodeChildren(context, this);
-    }
-    else
-    {
-      decodeChildrenImpl(context);
+      if (renderer.decodeChildren(context, this))
+        return;
     }
+
+    decodeChildrenImpl(context);
   }
 
   /**
@@ -904,12 +903,11 @@
     // if there is a ExtendedRenderer for this component
     if (renderer != null)
     {
-      renderer.validateChildren(context, this);
-    }
-    else
-    {
-      validateChildrenImpl(context);
+      if (renderer.validateChildren(context, this))
+        return;
     }
+
+    validateChildrenImpl(context);
   }
 
   /**
@@ -942,12 +940,11 @@
     // if there is a ExtendedRenderer for this component
     if (renderer != null)
     {
-      renderer.updateChildren(context, this);
-    }
-    else
-    {
-      updateChildrenImpl(context);
+      if (renderer.updateChildren(context, this))
+        return;
     }
+
+    updateChildrenImpl(context);
   }
 
   @SuppressWarnings("unchecked")

Modified: incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/ExtendedRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/ExtendedRenderer.java?view=diff&rev=449864&r1=449863&r2=449864
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/ExtendedRenderer.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/ExtendedRenderer.java
Mon Sep 25 16:45:36 2006
@@ -49,16 +49,11 @@
    * @param component  the component to render
    */
   @SuppressWarnings("unchecked")
-  public void decodeChildren(
+  public boolean decodeChildren(
     FacesContext context,
     UIComponent  component)
   {
-    // Process all the facets and children of this component
-    Iterator<UIComponent> kids = component.getFacetsAndChildren();
-    while (kids.hasNext())
-    {
-      kids.next().processDecodes(context);
-    }
+    return false;
   }
 
   /**
@@ -68,16 +63,11 @@
    * @param component  the component to render
    */
   @SuppressWarnings("unchecked")
-  public void validateChildren(
+  public boolean validateChildren(
     FacesContext context,
     UIComponent  component)
   {
-    // Process all the facets and children of this component
-    Iterator<UIComponent> kids = component.getFacetsAndChildren();
-    while (kids.hasNext())
-    {
-      kids.next().processValidators(context);
-    }
+    return false;
   }
 
   /**
@@ -87,15 +77,10 @@
    * @param component  the component to render
    */
   @SuppressWarnings("unchecked")
-  public void updateChildren(
+  public boolean updateChildren(
     FacesContext context,
     UIComponent  component)
   {
-    // Process all the facets and children of this component
-    Iterator<UIComponent> kids = component.getFacetsAndChildren();
-    while (kids.hasNext())
-    {
-      kids.next().processUpdates(context);
-    }
+    return false;
   }
 }

Modified: incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/LifecycleRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/LifecycleRenderer.java?view=diff&rev=449864&r1=449863&r2=449864
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/LifecycleRenderer.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/LifecycleRenderer.java
Mon Sep 25 16:45:36 2006
@@ -19,41 +19,53 @@
 import javax.faces.context.FacesContext;
 
 /**
- * LifecycleRenderer can be used to enhance the general component renderer
- * contract, by providing control over all child component hierarchy lifecycle
- * phases.
+ * LifecycleRenderer can be used to enhance the general component-renderer
+ * contract, by letting a renderer take over control of
+ * all child component hierarchy lifecycle phases.  In particular,
+ * the renderer can take over the implementation of
+ * UIComponent.processValidators(), processDecode(), and processUpdates().
+ * (This requires that the component be a subclass of UIXComponentBase.)
  *
  * @author The Oracle ADF Faces Team
  */
 public interface LifecycleRenderer
 {
   /**
-   * Decodes a component and its children.
+   * Decodes a component's children.
    *
    * @param context    the Faces context
    * @param component  the component to render
+   * @return whether the lifecycle was processed;  if returns false,
+   *   the component should continue default processing of the
+   *    Apply Request Values phase.
    */
-  public void decodeChildren(
+  public boolean decodeChildren(
     FacesContext context,
     UIComponent  component);
 
   /**
-   * Validates a component and its children.
+   * Validates a component's children.
    *
    * @param context    the Faces context
    * @param component  the component to render
+   * @return whether the lifecycle was processed;  if returns false,
+   *   the component should continue default processing of the
+   *    Process Validation phase.
    */
-  public void validateChildren(
+  public boolean validateChildren(
     FacesContext context,
     UIComponent  component);
 
   /**
-   * Updates a component and its children.
+   * Updates a component's children.
    *
    * @param context    the Faces context
    * @param component  the component to render
+   * @return whether the lifecycle was processed;  if returns false,
+   *   the component should continue default processing of the
+   *    Update Model phase.
    */
-  public void updateChildren(
+  public boolean updateChildren(
     FacesContext context,
     UIComponent  component);
 }



Mime
View raw message