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 2009/03/25 02:13:25 UTC

svn commit: r758112 - /myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableSelectOneRenderer.java

Author: arobinson74
Date: Wed Mar 25 01:13:25 2009
New Revision: 758112

URL: http://svn.apache.org/viewvc?rev=758112&view=rev
Log:
TRINIDAD-1435

Ensure that the row selection state is updated for single selection if the selection state has more than one row

Modified:
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableSelectOneRenderer.java

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableSelectOneRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableSelectOneRenderer.java?rev=758112&r1=758111&r2=758112&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableSelectOneRenderer.java (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/table/TableSelectOneRenderer.java Wed Mar 25 01:13:25 2009
@@ -6,9 +6,9 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- * 
+ *
  *  http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -28,16 +28,14 @@
 import javax.faces.context.ResponseWriter;
 import javax.faces.event.FacesEvent;
 
-import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 import org.apache.myfaces.trinidad.bean.FacesBean;
 import org.apache.myfaces.trinidad.component.UIXCollection;
 import org.apache.myfaces.trinidad.component.UIXTable;
 import org.apache.myfaces.trinidad.component.UIXTree;
-import org.apache.myfaces.trinidad.component.core.data.CoreTable;
+import org.apache.myfaces.trinidad.context.RenderingContext;
 import org.apache.myfaces.trinidad.event.SelectionEvent;
+import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 import org.apache.myfaces.trinidad.model.RowKeySet;
-
-import org.apache.myfaces.trinidad.context.RenderingContext;
 import org.apache.myfaces.trinidad.render.CoreRenderer;
 import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SimpleSelectBooleanCheckboxRenderer;
 import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlConstants;
@@ -76,9 +74,9 @@
 
       String selectionParam = __getSelectionParameterName(context, table);
 
-      Map<String, String> parameters =  
+      Map<String, String> parameters =
         context.getExternalContext().getRequestParameterMap();
-      
+
       _LOG.finest("Params:{0}", parameters);
 
       String selection = parameters.get(selectionParam);
@@ -92,7 +90,10 @@
           state = ((UIXTree) table).getSelectedRowKeys();
 
         table.setClientRowKey(selection);
-        if (!state.isContained())
+        // If the key is not already selected, or the state is more than one
+        // (someone changed the table selection from multiple to single),
+        // update the keys
+        if (!state.isContained() || state.size() > 1)
         {
           RowKeySet unselected = state.clone();
           // TODO : do not mutate the selectedRowKeys here.