You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2006/12/27 12:18:20 UTC

svn commit: r490482 - /myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UITreeOld.java

Author: weber
Date: Wed Dec 27 03:18:19 2006
New Revision: 490482

URL: http://svn.apache.org/viewvc?view=rev&rev=490482
Log:
TOBAGO-136 (null TreeState in bean results in javascipt error and no tree at all)

Modified:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UITreeOld.java

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UITreeOld.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UITreeOld.java?view=diff&rev=490482&r1=490481&r2=490482
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UITreeOld.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UITreeOld.java Wed Dec 27 03:18:19 2006
@@ -391,9 +391,16 @@
     }
     ValueBinding valueBinding = getValueBinding(TobagoConstants.ATTR_STATE);
     if (valueBinding != null) {
-        return (TreeState) valueBinding.getValue(getFacesContext());
+      FacesContext facesContext = getFacesContext();
+      TreeState state = (TreeState) valueBinding.getValue(facesContext);
+      if (state == null) {
+        state = new TreeState();
+        valueBinding.setValue(facesContext, state);
+      }
+      return state;
     } else {
-        return null;
+        treeState = new TreeState();
+        return treeState;
     }
   }