Author: maksimkaszynski
Date: 2007-06-07 13:45:47 -0400 (Thu, 07 Jun 2007)
New Revision: 1085
Modified:
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/datagrid/bean/ChannelDataModel2.java
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/datagrid/model/Channel.java
Log:
made data model work with keys more correctly
Modified:
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/datagrid/bean/ChannelDataModel2.java
===================================================================
---
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/datagrid/bean/ChannelDataModel2.java 2007-06-07
17:45:01 UTC (rev 1084)
+++
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/datagrid/bean/ChannelDataModel2.java 2007-06-07
17:45:47 UTC (rev 1085)
@@ -3,11 +3,11 @@
*/
package org.richfaces.demo.datagrid.bean;
-import java.io.Serializable;
import java.util.List;
import org.richfaces.demo.datagrid.model.Channel;
import org.richfaces.demo.datagrid.model.Issue;
+import org.richfaces.demo.datagrid.model.Key;
import org.richfaces.model.GridDataModel;
import org.richfaces.model.SortOrder;
@@ -24,7 +24,7 @@
*/
@Override
public Object getObjectById(Object id) {
- return channel.findById((Integer) id);
+ return channel.findIssueByKey((Key) id);
}
/* (non-Javadoc)
Modified:
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/datagrid/model/Channel.java
===================================================================
---
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/datagrid/model/Channel.java 2007-06-07
17:45:01 UTC (rev 1084)
+++
trunk/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/datagrid/model/Channel.java 2007-06-07
17:45:47 UTC (rev 1085)
@@ -14,12 +14,12 @@
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.richfaces.model.Entity;
import org.richfaces.model.SortOrder;
@@ -281,6 +281,17 @@
return getIndex().get(id);
}
+ public Issue findIssueByKey(Object id) {
+
+ for (Issue issue : getIssues()) {
+ if (issue.getId().equals(id)) {
+ return issue;
+ }
+ }
+
+ return null;
+ }
+
public void replace(Integer id, List<Issue> list) {
Issue issue = issues.get(id.intValue());
issues.removeAll(list);