Author: konstantin.mishin
Date: 2008-05-08 12:49:36 -0400 (Thu, 08 May 2008)
New Revision: 8507
Removed:
trunk/samples/scrollableDataTableDemo/src/main/java/org/richfaces/demo/datagrid/bean/ChannelDataModel2.java
Modified:
trunk/samples/jira-data/src/main/java/org/richfaces/demo/datagrid/model/Channel.java
Log:
RF-2854
Modified:
trunk/samples/jira-data/src/main/java/org/richfaces/demo/datagrid/model/Channel.java
===================================================================
---
trunk/samples/jira-data/src/main/java/org/richfaces/demo/datagrid/model/Channel.java 2008-05-08
16:37:18 UTC (rev 8506)
+++
trunk/samples/jira-data/src/main/java/org/richfaces/demo/datagrid/model/Channel.java 2008-05-08
16:49:36 UTC (rev 8507)
@@ -151,31 +151,6 @@
}
/**
- * Execute query. Care for sorting
- * @param startRow
- * @param endRow
- * @param sortOrder
- * @return
- */
- public List <Issue> executeQuery(int startRow, int endRow, SortOrder sortOrder) {
- log.trace("Channel.executeQuery()");
- List <Issue> copy = getIssues();
- if (sortOrder != null) {
- copy = new ArrayList<Issue>(getIssues());
- Comparator<Issue> comparator = createComparator(sortOrder);
- if (comparator != null) {
- Collections.sort(copy, comparator);
- }
- }
- List <Issue> issuz = new ArrayList<Issue>(endRow - startRow + 1);
- for(int i = startRow; i < endRow; i++ ) {
- issuz.add(copy.get(i));
- }
- return issuz;
- }
-
-
- /**
* @return the language
*/
public String getLanguage() {
@@ -241,7 +216,9 @@
if (maxSize >= 0 && issues.size() > maxSize) {
return;
}
-
+ if (issue.getAssignee().getUsername().startsWith("a")) {
+ issue.setAssignee(null);
+ }
issues.add(issue);
index.put(issue.getIndex(), issue);
}
@@ -259,37 +236,6 @@
}
- protected Comparator <Issue> createComparator(SortOrder sortOrder) {
-
- 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;
- }
-
public Issue findById(Integer id) {
return getIndex().get(id);
}
Deleted:
trunk/samples/scrollableDataTableDemo/src/main/java/org/richfaces/demo/datagrid/bean/ChannelDataModel2.java
===================================================================
---
trunk/samples/scrollableDataTableDemo/src/main/java/org/richfaces/demo/datagrid/bean/ChannelDataModel2.java 2008-05-08
16:37:18 UTC (rev 8506)
+++
trunk/samples/scrollableDataTableDemo/src/main/java/org/richfaces/demo/datagrid/bean/ChannelDataModel2.java 2008-05-08
16:49:36 UTC (rev 8507)
@@ -1,110 +0,0 @@
-/**
- *
- */
-package org.richfaces.demo.datagrid.bean;
-
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-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.ScrollableTableDataModel;
-import org.richfaces.model.SortOrder;
-
-/**
- * @author Maksim Kaszynski
- *
- */
-public class ChannelDataModel2 extends ScrollableTableDataModel<Issue> {
-
- private final Log log = LogFactory.getLog(ChannelDataModel2.class);
-
- public static final int BIG_QUERY_DELAY = 0*1000;
-
- public static final int SMALL_QUERY_DELAY = 0*500;
-
- private Channel channel;
-
- /* (non-Javadoc)
- * @see org.richfaces.model.GridDataModel#getObjectById(java.io.Serializable)
- */
- @Override
- public Issue getObjectById(Object id) {
-
- if (log.isTraceEnabled()) {
- log.trace(id);
- }
-
- if (SMALL_QUERY_DELAY > 0) {
- log.info("sleeping " + SMALL_QUERY_DELAY + "ms");
-
- try {
- Thread.sleep(SMALL_QUERY_DELAY);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- log.info("Awoke from slumber");
- }
-
-
- return channel.findIssueByKey((Key) id);
- }
-
- @Override
- public Object getId(Issue o) {
- Issue issue = (Issue)o;
- return issue.getKey();
- }
-
- /* (non-Javadoc)
- * @see org.richfaces.model.GridDataModel#loadData(int, int,
org.richfaces.model.SortOrder)
- */
- @Override
- public List <Issue> loadData(int startRow, int endRow, SortOrder sortOrder) {
-
- if (log.isTraceEnabled()){
- log.trace("startRow=" + startRow + ", endRow=" + endRow +
",sortOrder=" + sortOrder);
- }
-
- if (BIG_QUERY_DELAY > 0) {
- log.info("sleeping " + BIG_QUERY_DELAY);
-
- try {
- Thread.sleep(BIG_QUERY_DELAY);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
-
- log.info("Awoke from slumber");
- }
-
-
- return channel.executeQuery(startRow, endRow, sortOrder);
- }
-
- /* (non-Javadoc)
- * @see javax.faces.model.DataModel#getRowCount()
- */
- @Override
- public int getRowCount() {
- return channel.size();
- }
-
- /* (non-Javadoc)
- * @see javax.faces.model.DataModel#getWrappedData()
- */
- @Override
- public Object getWrappedData() {
- return channel;
- }
-
- @Override
- public void setWrappedData(Object arg0) {
- this.channel = (Channel) arg0;
- }
-
-}
Show replies by date