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/04/26 19:36:28 UTC

svn commit: r1096816 - /myfaces/trinidad/trunk/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTemplate.java

Author: arobinson74
Date: Tue Apr 26 17:36:28 2011
New Revision: 1096816

URL: http://svn.apache.org/viewvc?rev=1096816&view=rev
Log:
TRINIDAD-2047 - apply the new fix to the tree as well

Modified:
    myfaces/trinidad/trunk/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTemplate.java

Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTemplate.java?rev=1096816&r1=1096815&r2=1096816&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTemplate.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTemplate.java Tue Apr 26 17:36:28 2011
@@ -62,6 +62,16 @@ abstract public class UIXTreeTemplate ex
 /**/  static public final PropertyKey DISCLOSED_ROW_KEYS_KEY = null;
 /**/  static public final PropertyKey SELECTED_ROW_KEYS_KEY = null;
 
+/**/  static public final FacesBean.Type TYPE = new FacesBean.Type(org.apache.myfaces.trinidad.component.UIXHierarchy.TYPE);
+
+  // These are "fake" properties that allow the table to get the disclosed row keys and the
+  // selected row key without triggering the call to getCollectionModel from the
+  // RowKeyFacesBeanWrapper class. See the stamp state saving code for its usage.
+  static private final PropertyKey _DISCLOSED_ROW_KEYS_WITHOUT_MODEL_KEY =
+    TYPE.registerKey("disclosedRowKeysWithoutModel", RowKeySet.class);
+  static private final PropertyKey _SELECTED_ROW_KEYS_WITHOUT_MODEL_KEY =
+    TYPE.registerKey("selectedRowKeysWithoutModel", RowKeySet.class);
+
   @Deprecated
   public void setRowDisclosureListener(MethodBinding binding)
   {
@@ -128,7 +138,7 @@ abstract public class UIXTreeTemplate ex
     }
 
     selectedRowKeys.setCollectionModel(model);
-    disclosedRowKeys.setCollectionModel(model);    
+    disclosedRowKeys.setCollectionModel(model);
   }
 
   @Override
@@ -167,7 +177,7 @@ abstract public class UIXTreeTemplate ex
       return visitData(visitContext, callback);
     }
   }
-  
+
   @Override
   protected boolean visitData(
     VisitContext  visitContext,
@@ -178,10 +188,10 @@ abstract public class UIXTreeTemplate ex
     RowKeySet disclosedRowKeys = (visitContext.getHints().contains(VisitHint.SKIP_UNRENDERED))
                                    ? getDisclosedRowKeys()
                                    : null;
-    
+
     return visitHierarchy(visitContext, callback, getStamps(), disclosedRowKeys);
   }
-  
+
   @Override
   void __init()
   {
@@ -202,8 +212,17 @@ abstract public class UIXTreeTemplate ex
     Object[] state = new Object[4];
     state[0] = super.__getMyStampState();
     state[1] = getFocusRowKey();
-    state[2] = getSelectedRowKeys();
-    state[3] = getDisclosedRowKeys();
+
+    // Use "hidden" property keys to allow the row key sets to be retrieved without the
+    // RowKeyFacesBeanWrapper trying to resolve the collection model to be set into the row key
+    // set. This is needed to stop the unnecessary lookup of the collection model when it is not
+    // needed during stamp state saving of the table.
+    RowKeySet selectedRowKeys = (RowKeySet)getProperty(_SELECTED_ROW_KEYS_WITHOUT_MODEL_KEY);
+    RowKeySet disclosedRowKeys = (RowKeySet)getProperty(_DISCLOSED_ROW_KEYS_WITHOUT_MODEL_KEY);
+
+    state[2] = selectedRowKeys;
+    state[3] = disclosedRowKeys;
+
     return state;
   }
 
@@ -285,6 +304,24 @@ abstract public class UIXTreeTemplate ex
           }
         }
       }
+      else if (key == _DISCLOSED_ROW_KEYS_WITHOUT_MODEL_KEY)
+      {
+        // This case is only true if the table is trying to serialize the disclosed row keys to
+        // the stamp state of a parent UIXCollection. This work-around prevents EL evaluation to
+        // get the collection model during stamp state saving. This should be permissible as the
+        // state saving code does not need the collection model to be set in the row key set in
+        // order to save its state.
+        value = super.getProperty(DISCLOSED_ROW_KEYS_KEY);
+      }
+      else if (key == _SELECTED_ROW_KEYS_WITHOUT_MODEL_KEY)
+      {
+        // This case is only true if the table is trying to serialize the selected row keys to
+        // the stamp state of a parent UIXCollection. This work-around prevents EL evaluation to
+        // get the collection model during stamp state saving. This should be permissible as the
+        // state saving code does not need the collection model to be set in the row key set in
+        // order to save its state.
+        value = super.getProperty(SELECTED_ROW_KEYS_KEY);
+      }
       return value;
     }