[richfaces-svn-commits] JBoss Rich Faces SVN: r4752 - branches/3.1.x/ui/listShuttle/src/main/java/org/richfaces/component.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Tue Dec 11 18:01:43 EST 2007


Author: nbelaevski
Date: 2007-12-11 18:01:43 -0500 (Tue, 11 Dec 2007)
New Revision: 4752

Modified:
   branches/3.1.x/ui/listShuttle/src/main/java/org/richfaces/component/UIListShuttle.java
Log:
save/restore code for LS & OL updated

Modified: branches/3.1.x/ui/listShuttle/src/main/java/org/richfaces/component/UIListShuttle.java
===================================================================
--- branches/3.1.x/ui/listShuttle/src/main/java/org/richfaces/component/UIListShuttle.java	2007-12-11 23:01:37 UTC (rev 4751)
+++ branches/3.1.x/ui/listShuttle/src/main/java/org/richfaces/component/UIListShuttle.java	2007-12-11 23:01:43 UTC (rev 4752)
@@ -126,49 +126,49 @@
 			targetValue = state[2];
 			targetValueSet = Boolean.TRUE.equals(state[3]);
 
-			sourceSelection = (Collection) state[4];
+			sourceSelection = (Collection) restoreAttachedState(context, state[4]);
 			sourceSelectionSet = Boolean.TRUE.equals(state[5]);
 
-			targetSelection = (Collection) state[6];
+			targetSelection = (Collection) restoreAttachedState(context, state[6]);
 			targetSelectionSet = Boolean.TRUE.equals(state[7]);
 
-			activeItem = state[8];
+			activeItem = restoreAttachedState(context, state[8]);
 			activeItemSet = Boolean.TRUE.equals(state[9]);
 		}
 
 		public Object saveState(FacesContext context, final UIListShuttle list) {
-			final HashSet sourceSelectionKeySet = new HashSet();
-			final HashSet targetSelectionKeySet = new HashSet();
-			final Object[] activeItemKeys = new Object[1];
-			
-			Object rowKey = list.getRowKey();
-			try {
-				list.walk(context, new DataVisitor() {
+//			final HashSet sourceSelectionKeySet = new HashSet();
+//			final HashSet targetSelectionKeySet = new HashSet();
+//			final Object[] activeItemKeys = new Object[1];
+//			
+//			Object rowKey = list.getRowKey();
+//			try {
+//				list.walk(context, new DataVisitor() {
+//
+//					public void process(FacesContext context, Object rowKey,
+//							Object argument) throws IOException {
+//
+//						list.setRowKey(context, rowKey);
+//						Object data = list.getRowData();
+//						
+//						if (data != null) {
+//							if (data.equals(activeItem)) {
+//								activeItemKeys[0] = rowKey;
+//							}
+//							
+//							if (sourceSelection != null && sourceSelection.contains(data)) {
+//								sourceSelectionKeySet.add(rowKey);
+//							} else if (targetSelection != null && targetSelection.contains(data)){
+//								targetSelectionKeySet.add(rowKey);
+//							}
+//						}
+//					}
+//					
+//				}, null);
+//			} catch (IOException e) {
+//				throw new FacesException(e.getLocalizedMessage(), e);
+//			}
 
-					public void process(FacesContext context, Object rowKey,
-							Object argument) throws IOException {
-
-						list.setRowKey(context, rowKey);
-						Object data = list.getRowData();
-						
-						if (data != null) {
-							if (data.equals(activeItem)) {
-								activeItemKeys[0] = rowKey;
-							}
-							
-							if (sourceSelection != null && sourceSelection.contains(data)) {
-								sourceSelectionKeySet.add(rowKey);
-							} else if (targetSelection != null && targetSelection.contains(data)){
-								targetSelectionKeySet.add(rowKey);
-							}
-						}
-					}
-					
-				}, null);
-			} catch (IOException e) {
-				throw new FacesException(e.getLocalizedMessage(), e);
-			}
-
 			Object[] state = new Object[10];
 
 			state[0] = sourceValue;
@@ -177,13 +177,13 @@
 			state[2] = targetValue;
 			state[3] = targetValueSet ? Boolean.TRUE : Boolean.FALSE;
 
-			state[4] = sourceSelectionKeySet;
+			state[4] = saveAttachedState(context, sourceSelection);
 			state[5] = sourceSelectionSet ? Boolean.TRUE : Boolean.FALSE;
 
-			state[6] = targetSelectionKeySet;
+			state[6] = saveAttachedState(context, targetSelection);
 			state[7] = targetSelectionSet ? Boolean.TRUE : Boolean.FALSE;
 
-			state[8] = activeItemKeys[0];
+			state[8] = saveAttachedState(context, activeItem);
 			state[9] = activeItemSet ? Boolean.TRUE : Boolean.FALSE;
 
 			return state;




More information about the richfaces-svn-commits mailing list