[richfaces-svn-commits] JBoss Rich Faces SVN: r4753 - branches/3.1.x/ui/orderingList/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:47 EST 2007


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

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

Modified: branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java
===================================================================
--- branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java	2007-12-11 23:01:43 UTC (rev 4752)
+++ branches/3.1.x/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingList.java	2007-12-11 23:01:46 UTC (rev 4753)
@@ -172,51 +172,50 @@
 			
 			value = state[0];
 			
-			selection = (Collection) state[1];
+			selection = (Collection) restoreAttachedState(context, state[1]);
 			selectionSet = Boolean.TRUE.equals(state[2]);
 			
-			activeItem = state[3];
+			activeItem = restoreAttachedState(context, state[3]);
 			activeItemSet = Boolean.TRUE.equals(state[4]);
 		}
 
 		public Object saveState(FacesContext context, final UIOrderingList list) {
-			Object rowKey = list.getRowKey();
+//			Object rowKey = list.getRowKey();
+//
+//			final HashSet selectionKeySet = new HashSet();
+//			final Object[] activeItemSet = new Object[1];
+//			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)) {
+//								activeItemSet[0] = rowKey;
+//							}
+//							
+//							if (selection != null && selection.contains(data)) {
+//								selectionKeySet.add(rowKey);
+//							}
+//						}
+//					}
+//					
+//				}, null);
+//			} catch (IOException e) {
+//				throw new FacesException(e.getLocalizedMessage(), e);
+//			}
 
-			final HashSet selectionKeySet = new HashSet();
-			final Object[] activeItemSet = new Object[1];
-			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)) {
-								activeItemSet[0] = rowKey;
-							}
-							
-							if (selection != null && selection.contains(data)) {
-								selectionKeySet.add(rowKey);
-							}
-						}
-					}
-					
-				}, null);
-			} catch (IOException e) {
-				throw new FacesException(e.getLocalizedMessage(), e);
-			}
-
 			Object[] state = new Object[5];
 			
 			state[0] = value;
-			
-			state[1] = selectionKeySet;
+			state[1] = saveAttachedState(context, selection);
 			state[2] = this.selectionSet ? Boolean.TRUE : Boolean.FALSE;
 			
-			state[3] = activeItemSet[0];
+			state[3] = saveAttachedState(context, activeItem);
 			state[4] = this.activeItemSet ? Boolean.TRUE : Boolean.FALSE;
 
 			return state;




More information about the richfaces-svn-commits mailing list