Author: maksimkaszynski
Date: 2007-07-06 08:02:04 -0400 (Fri, 06 Jul 2007)
New Revision: 1514
Modified:
branches/3.0.2/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/datagrid/model/Channel.java
Log:
support for new sorting API
Modified:
branches/3.0.2/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/datagrid/model/Channel.java
===================================================================
---
branches/3.0.2/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/datagrid/model/Channel.java 2007-07-06
12:01:09 UTC (rev 1513)
+++
branches/3.0.2/sandbox-samples/scrollable-grid-demo/src/main/java/org/richfaces/demo/datagrid/model/Channel.java 2007-07-06
12:02:04 UTC (rev 1514)
@@ -20,6 +20,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.richfaces.model.SortField;
import org.richfaces.model.SortOrder;
@@ -255,26 +256,31 @@
protected Comparator <Issue> createComparator(SortOrder sortOrder) {
- int prop = sortOrder.getSortColumn();
- boolean asc = sortOrder.isAscending();
- switch (prop) {
- case 0:
- return asc ? byIdAsc : byIdDesc;
- case 1:
- return asc ? byKeyAsc : byKeyDesc;
- case 2:
- return asc ? bySummaryAsc : bySummaryDesc;
- case 3:
- return asc ? byAssigneeAsc : byAssigneeDesc;
- case 4:
- return asc ? byStatusAsc : byStatusDesc;
- case 5:
- return asc ? byReporterAsc : byReporterDesc;
- case 6:
- return asc ? byPriAsc: byPriDesc;
- case 7:
- return asc ? byResolutionAsc : byResolutionDesc;
+ SortField [] fields = sortOrder.getFields();
+ if (fields != null && fields.length > 0) {
+ SortField field = fields[0];
+ int prop = field.getIndex();
+ boolean asc = field.getAscending().booleanValue();
+
+ switch (prop) {
+ case 0:
+ return asc ? byIdAsc : byIdDesc;
+ case 1:
+ return asc ? byKeyAsc : byKeyDesc;
+ case 2:
+ return asc ? bySummaryAsc : bySummaryDesc;
+ case 3:
+ return asc ? byAssigneeAsc : byAssigneeDesc;
+ case 4:
+ return asc ? byStatusAsc : byStatusDesc;
+ case 5:
+ return asc ? byReporterAsc : byReporterDesc;
+ case 6:
+ return asc ? byPriAsc: byPriDesc;
+ case 7:
+ return asc ? byResolutionAsc : byResolutionDesc;
+ }
}
return null;
Show replies by date