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 2008/07/14 22:23:04 UTC

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

Author: mcooper
Date: Mon Jul 14 13:23:04 2008
New Revision: 676719

URL: http://svn.apache.org/viewvc?rev=676719&view=rev
Log:
TRINIDAD-1155 - Tree initiallyExpanded="true" attribute leaves a dangling currency

If initiallyExpanded="true" attribute is set on the tree, it leaves a dangling currency pointing to the first row. This causes unexpected results since the clientId of the tree now contains "0" (currency of the first row). The fix is to make sure that after the first rowKey is expanded in the tree, we restore the currency to the initial value.

Thanks to Venkata Guddanti for the patch.

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=676719&r1=676718&r2=676719&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 Mon Jul 14 13:23:04 2008
@@ -149,23 +149,29 @@
   {
     if (isInitiallyExpanded() && !Boolean.TRUE.equals(getAttributes().get(EXPAND_ONCE_KEY)))
     {
-      Object rowKey = getFocusRowKey();
-      if (rowKey == null)
+      Object oldRowKey = getRowKey();
+      try
       {
-        int oldIndex = getRowIndex();
-        setRowIndex(0);
-        rowKey = getRowKey();
-        setRowIndex(oldIndex);
+        Object rowKey = getFocusRowKey();
+        if (rowKey == null)
+        {
+          setRowIndex(0);
+          rowKey = getRowKey();
+        }
+
+        setRowKey(rowKey);
+        RowKeySet old = getDisclosedRowKeys();
+        RowKeySet newset = old.clone();
+        newset.addAll();
+
+        // use an event to ensure the row disclosure listener is called
+        broadcast(new RowDisclosureEvent(old, newset, this));
+      }
+      finally
+      {
+        setRowKey(oldRowKey);
       }
 
-      setRowKey(rowKey);
-      RowKeySet old = getDisclosedRowKeys();
-      RowKeySet newset = old.clone();
-      newset.addAll();
-      
-      // use an event to ensure the row disclosure listener is called 
-      broadcast(new RowDisclosureEvent(old, newset, this));
-      
       // use attributes to store that we have processed the initial expansion
       // as there is no support for private properties in the plug-in at the
       // moment