Can you give an example of how the tree looks like? How many nodes are totally displayed?


I have looked a the source and found out, that the model is saved with the component.

Sean, is that really right? On the other hand the state of the components seems not to be saved between request.



I created a patch that does not save the model ... give it a try.

Index: C:/Documents and Settings/mwerlit/My Documents/workspace/myfaces 
current/tomahawk/src/java/org/apache/myfaces/custom/tree2/UITreeData.java
===================================================================
--- C:/Documents and Settings/mwerlit/My Documents/workspace/myfaces 
current/tomahawk/src/java/org/apache/myfaces/custom/tree2/UITreeData.java  
(revision 232793)
+++ C:/Documents and Settings/mwerlit/My Documents/workspace/myfaces 
current/tomahawk/src/java/org/apache/myfaces/custom/tree2/UITreeData.java  
(working copy)
@@ -84,10 +84,10 @@
     // see superclass for documentation
     public Object saveState(FacesContext context)
     {
-        Object values[] = new Object[4];
+        Object values[] = new Object[3];
         values[0] = super.saveState(context);
-        values[1] = _model;
-        values[2] = _var;
+        //values[1] = _model;
+        values[1] = _var;
         
         TreeState t = getDataModel().getTreeState();
         if ( t == null)
@@ -97,7 +97,7 @@
         }
         
         // save the state with the component, unless it should explicitly not 
saved eg. session-scoped model and state            
-        values[3] = (t.isTransient()) ? null : t; 
+        values[2] = (t.isTransient()) ? null : t; 
         return ((Object) (values));
     }
 
@@ -108,9 +108,9 @@
         Object values[] = (Object[]) state;
         super.restoreState(context, values[0]);
 
-        _model = (TreeModel)values[1];
-        _var = (String)values[2];
-        _restoredState = (TreeState) values[3];
+        //_model = (TreeModel)values[1];
+        _var = (String)values[1];
+        _restoredState = (TreeState) values[2];
     }
 
 
@@ -213,10 +213,15 @@
          * do want to keep the saved state so that we can render the node with
          * the invalid value.
          */
+               
         if (!keepSaved(context))
         {
             _saved = new HashMap();
         }
+        
+        // FIX for MYFACES-404
+        // do not use the cached model the render phase
+        _model = null;
 
         super.encodeBegin(context);
     }
=

Reply via email to