You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sc...@apache.org on 2005/11/18 21:01:53 UTC
svn commit: r345557 -
/myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/tree2/UITreeData.java
Author: schof
Date: Fri Nov 18 12:01:51 2005
New Revision: 345557
URL: http://svn.apache.org/viewcvs?rev=345557&view=rev
Log:
Fixes MYFACES-618 (finally). Patch supplied by Mathias Werlitz. Patch finally tested by Erik Dybdahl.
Modified:
myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/tree2/UITreeData.java
Modified: myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/tree2/UITreeData.java
URL: http://svn.apache.org/viewcvs/myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/tree2/UITreeData.java?rev=345557&r1=345556&r2=345557&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/tree2/UITreeData.java (original)
+++ myfaces/tomahawk/trunk/src/java/org/apache/myfaces/custom/tree2/UITreeData.java Fri Nov 18 12:01:51 2005
@@ -87,16 +87,7 @@
Object values[] = new Object[3];
values[0] = super.saveState(context);
values[1] = _var;
-
- TreeState t = getDataModel().getTreeState();
- if ( t == null)
- {
- // the model supplier has forgotten to return a valid state manager, but we need one
- t = new TreeStateBase();
- }
-
- // save the state with the component, unless it should explicitly not saved eg. session-scoped model and state
- values[2] = (t.isTransient()) ? null : t;
+ values[2] = _restoredState;
return ((Object) (values));
}
@@ -111,6 +102,22 @@
_restoredState = (TreeState) values[2];
}
+ public void encodeEnd(FacesContext context) throws IOException {
+ super.encodeEnd(context);
+
+ // prepare to save the tree state -- fix for MYFACES-618
+ // should be done in saveState() but Sun RI does not call saveState() and restoreState()
+ // with javax.faces.STATE_SAVING_METHOD = server
+ TreeState state = getDataModel().getTreeState();
+ if ( state == null)
+ {
+ // the model supplier has forgotten to return a valid state manager, but we need one
+ state = new TreeStateBase();
+ }
+ // save the state with the component, unless it should explicitly not saved eg. session-scoped model and state
+ _restoredState = (state.isTransient()) ? null : state;
+
+ }
public void queueEvent(FacesEvent event)
{