You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mc...@apache.org on 2010/07/20 01:54:05 UTC

svn commit: r965684 - in /myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main: java-templates/org/apache/myfaces/trinidad/component/ java/org/apache/myfaces/trinidad/component/ java/org/apache/myfaces/trinidad/model/

Author: mcooper
Date: Mon Jul 19 23:54:05 2010
New Revision: 965684

URL: http://svn.apache.org/viewvc?rev=965684&view=rev
Log:
TRINIDAD-1840 - UIXTable and UIXTreeTable should provide hooks into decode/validate/updateChildrenImpl

Thanks to Kamran Kashanian for the patch:

The Trinidad UIXCollection class provides hooks for processing of stamped/unstamped children and facets during decode/validate/update-model JSF lifecycle phases for any collection components that extent UIXCollection.

See the abstract method "processFacetsAndChildren" in decode/validate/updateChildrenImpl in UIXCollection. This allows collection component subclasses to perform special logic for handling stamped/unstamped children, and facets during decode/validate/update-model phases.

UIXTable and UIXTreeTable provide concrete implementations for processFacetsAndChildren. However, both of these components make processFacetsAndChildren final and disallow any subclasses from overriding and customizing the child processing logic.

The proposal is to make UIXTable and UIXTreeTable child component processing more extensible as follows:

1) Remove the 'final' keyword from processFacetsAndChildren and allow subclasses to override these methods
2) Provide more hooks into the existing processFacetsAndChildren processing by making the utility methods in TableUtils (processStampedChildren, processColumnFacets, and processFacets) public.

Modified:
    myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTableTemplate.java
    myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTableTemplate.java
    myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/HierarchyUtils.java
    myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/TableUtils.java
    myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/LocalRowKeyIndex.java

Modified: myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTableTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTableTemplate.java?rev=965684&r1=965683&r2=965684&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTableTemplate.java (original)
+++ myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTableTemplate.java Mon Jul 19 23:54:05 2010
@@ -302,21 +302,21 @@ abstract public class UIXTableTemplate e
   }
 
   @Override
-  protected final void processFacetsAndChildren(
+  protected void processFacetsAndChildren(
     FacesContext context,
     PhaseId phaseId)
   {
     // process all the facets of this table just once
     // (except for the "detailStamp" facet which must be processed once
     // per row):
-    TableUtils.__processFacets(context, this, this, phaseId,
+    TableUtils.processFacets(context, this, this, phaseId,
       UIXTable.DETAIL_STAMP_FACET);
 
     // process all the facets of this table's column children:
-    TableUtils.__processColumnFacets(context, this, this, phaseId);
+    TableUtils.processColumnFacets(context, this, this, phaseId);
 
     // process all the children and the detailStamp as many times as necessary
-    _processStamps(context, phaseId);
+    processStamps(context, phaseId);
   }
 
   /**
@@ -442,7 +442,7 @@ abstract public class UIXTableTemplate e
     setDisclosedRowKeys((RowKeySet) state[5]);
   }
 
-  private void _processStamps(
+  protected void processStamps(
     FacesContext context,
     PhaseId phaseId)
   {
@@ -460,12 +460,15 @@ abstract public class UIXTableTemplate e
       for (int i = startIndex; i <= endIndex; i++)
       {
         setRowIndex(i);
-        TableUtils.__processStampedChildren(context, this, phaseId);
-
-        if ((disclosureState != null) && disclosureState.isContained())
+        if (isRowAvailable())
         {
-          assert getRowIndex() == i;
-          processComponent(context, detail, phaseId);
+          TableUtils.processStampedChildren(context, this, phaseId);
+  
+          if ((disclosureState != null) && disclosureState.isContained())
+          {
+            assert getRowIndex() == i;
+            processComponent(context, detail, phaseId);
+          }
         }
       }
 

Modified: myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTableTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTableTemplate.java?rev=965684&r1=965683&r2=965684&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTableTemplate.java (original)
+++ myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTableTemplate.java Mon Jul 19 23:54:05 2010
@@ -326,25 +326,25 @@ abstract public class UIXTreeTableTempla
 
   @SuppressWarnings("unchecked")
   @Override
-  protected final void processFacetsAndChildren(
+  protected void processFacetsAndChildren(
     FacesContext context,
     PhaseId phaseId)
   {
     // process all the facets of this hgrid just once
     // (except for the "nodeStamp" facet which must be processed once
     // per row):
-    TableUtils.__processFacets(context, this, this, phaseId,
+    TableUtils.processFacets(context, this, this, phaseId,
       UIXTreeTable.NODE_STAMP_FACET);
 
     UIComponent nodeStamp = getNodeStamp();
     // process any facets of the nodeStamp column:
-    TableUtils.__processFacets(context, this, nodeStamp, phaseId, null);
+    TableUtils.processFacets(context, this, nodeStamp, phaseId, null);
 
     // process all the facets of this table's column children:
-    TableUtils.__processColumnFacets(context, this, this, phaseId);
+    TableUtils.processColumnFacets(context, this, this, phaseId);
 
     // recursively process any grandchild columns of the nodeStamp column:
-    TableUtils.__processColumnFacets(context, this, nodeStamp, phaseId);
+    TableUtils.processColumnFacets(context, this, nodeStamp, phaseId);
 
     Object oldPath = getRowKey();
     RowKeySet state = getDisclosedRowKeys();
@@ -363,7 +363,7 @@ abstract public class UIXTreeTableTempla
       }
       else
       {
-        TableUtils.__processStampedChildren(context, this, phaseId);
+        TableUtils.processStampedChildren(context, this, phaseId);
         processComponent(context, nodeStamp, phaseId); // bug 4688568
   
         if (state.isContained())

Modified: myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/HierarchyUtils.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/HierarchyUtils.java?rev=965684&r1=965683&r2=965684&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/HierarchyUtils.java (original)
+++ myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/HierarchyUtils.java Mon Jul 19 23:54:05 2010
@@ -120,7 +120,7 @@ public final class HierarchyUtils 
     {
       comp.setRowIndex(i);
       if (processChildrenAsStamps)
-        TableUtils.__processStampedChildren(context, comp, phaseId);
+        TableUtils.processStampedChildren(context, comp, phaseId);
       comp.processComponent(context, nodeStamp, phaseId);
       if (comp.isContainer() && (state.isContained()))
       {

Modified: myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/TableUtils.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/TableUtils.java?rev=965684&r1=965683&r2=965684&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/TableUtils.java (original)
+++ myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/TableUtils.java Mon Jul 19 23:54:05 2010
@@ -218,7 +218,7 @@ public final class TableUtils 
    * at this time.
    */
   @SuppressWarnings("unchecked")
-  static void __processFacets(
+  public static void processFacets(
     FacesContext context,
     final UIXCollection table,
     UIComponent  component,
@@ -245,7 +245,7 @@ public final class TableUtils 
    * Process all the facets of any children that are columns; these are
    * generally not processed once per row.
    */
-  static void __processColumnFacets(
+  public static void processColumnFacets(
     FacesContext context,
     final UIXCollection table,
     UIComponent  column,
@@ -259,9 +259,9 @@ public final class TableUtils 
         if (child instanceof UIXColumn)
         {
           // process any facets of the child column:
-          __processFacets(context, table, child, phaseId, null);
+          processFacets(context, table, child, phaseId, null);
           // recursively process the facets of any grandchild columns:
-          __processColumnFacets(context, table, child, phaseId);
+          processColumnFacets(context, table, child, phaseId);
         }
       }
     }.runAlways(context, column);
@@ -270,7 +270,7 @@ public final class TableUtils 
   /**
    * Process all the children of the given table
    */
-  static void __processStampedChildren(
+  public static void processStampedChildren(
     FacesContext context,
     final UIXCollection table,
     final PhaseId phaseId)

Modified: myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/LocalRowKeyIndex.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/LocalRowKeyIndex.java?rev=965684&r1=965683&r2=965684&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/LocalRowKeyIndex.java (original)
+++ myfaces/trinidad/branches/1.2.12.3-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/LocalRowKeyIndex.java Mon Jul 19 23:54:05 2010
@@ -53,7 +53,7 @@ public interface LocalRowKeyIndex
    * <p>
    * This method can return -1 or a row count estimate if determining
    * exact row count requires a data fetch.  When dealing with estimated row counts,
-   * the model user needs to gracefully handle the case where isRowAvailable
+   * the caller needs to gracefully handle the case where <code>isRowAvailable</code>
    * returns <code>false</code> for a row index or a row key.
    * @return estimated row count
    */
@@ -81,7 +81,12 @@ public interface LocalRowKeyIndex
     /**
      * The row count returned by {@link #getEstimatedRowCount} is an estimate
      */
-    ESTIMATE
+    ESTIMATE,
+        
+    /**
+     * The row count returned by {@link #getEstimatedRowCount} is unknown (-1)
+     */
+    UNKNOWN    
   }