Author: maksimkaszynski
Date: 2008-02-27 11:58:24 -0500 (Wed, 27 Feb 2008)
New Revision: 6386
Added:
trunk/sandbox/samples/sortingFilteringDemo/src/main/java/org/richfaces/sandbox/Comparators.java
Removed:
trunk/sandbox/samples/sortingFilteringDemo/src/main/java/org/richfaces/sandbox/Bean.java
Modified:
trunk/sandbox/samples/sortingFilteringDemo/src/main/webapp/WEB-INF/faces-config.xml
trunk/sandbox/samples/sortingFilteringDemo/src/main/webapp/WEB-INF/web.xml
trunk/sandbox/samples/sortingFilteringDemo/src/main/webapp/pages/index.jsp
Log:
extended demo with custom comparators
Deleted:
trunk/sandbox/samples/sortingFilteringDemo/src/main/java/org/richfaces/sandbox/Bean.java
===================================================================
---
trunk/sandbox/samples/sortingFilteringDemo/src/main/java/org/richfaces/sandbox/Bean.java 2008-02-27
16:42:30 UTC (rev 6385)
+++
trunk/sandbox/samples/sortingFilteringDemo/src/main/java/org/richfaces/sandbox/Bean.java 2008-02-27
16:58:24 UTC (rev 6386)
@@ -1,29 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.sandbox;
-/**
- * @author $Autor$
- *
- */
-public class Bean {
-
-}
\ No newline at end of file
Copied:
trunk/sandbox/samples/sortingFilteringDemo/src/main/java/org/richfaces/sandbox/Comparators.java
(from rev 6366,
trunk/sandbox/samples/sortingFilteringDemo/src/main/java/org/richfaces/sandbox/Bean.java)
===================================================================
---
trunk/sandbox/samples/sortingFilteringDemo/src/main/java/org/richfaces/sandbox/Comparators.java
(rev 0)
+++
trunk/sandbox/samples/sortingFilteringDemo/src/main/java/org/richfaces/sandbox/Comparators.java 2008-02-27
16:58:24 UTC (rev 6386)
@@ -0,0 +1,61 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.sandbox;
+
+import java.util.Comparator;
+
+import org.richfaces.demo.datagrid.model.Issue;
+import org.richfaces.demo.datagrid.model.JiraUser;
+
+/**
+ * @author $Autor$
+ *
+ */
+public class Comparators {
+
+ private final Comparator<JiraUser> jiraUserComparator = new
Comparator<JiraUser> () {
+ public int compare(JiraUser o1, JiraUser o2) {
+ return o1.getName().compareTo(o2.getName());
+ }
+ };
+
+ private final Comparator<Issue> assigneeComparator = new
Comparator<Issue>(){
+ public int compare(Issue o1, Issue o2) {
+ return jiraUserComparator.compare(o1.getAssignee(), o2.getAssignee());
+ }
+ };
+
+ private final Comparator<Issue> reporterComparator = new
Comparator<Issue>(){
+ public int compare(Issue o1, Issue o2) {
+ return jiraUserComparator.compare(o1.getReporter(), o2.getReporter());
+ }
+ };
+
+ public Comparator<Issue> getAssigneeComparator() {
+ return assigneeComparator;
+ }
+
+ public Comparator<Issue> getReporterComparator() {
+ return reporterComparator;
+ }
+
+}
\ No newline at end of file
Modified:
trunk/sandbox/samples/sortingFilteringDemo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
---
trunk/sandbox/samples/sortingFilteringDemo/src/main/webapp/WEB-INF/faces-config.xml 2008-02-27
16:42:30 UTC (rev 6385)
+++
trunk/sandbox/samples/sortingFilteringDemo/src/main/webapp/WEB-INF/faces-config.xml 2008-02-27
16:58:24 UTC (rev 6386)
@@ -3,8 +3,13 @@
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
<managed-bean>
- <managed-bean-name>bean</managed-bean-name>
- <managed-bean-class>org.richfaces.sandbox.Bean</managed-bean-class>
- <managed-bean-scope>request</managed-bean-scope>
+ <managed-bean-name>comparators</managed-bean-name>
+ <managed-bean-class>org.richfaces.sandbox.Comparators</managed-bean-class>
+ <managed-bean-scope>application</managed-bean-scope>
</managed-bean>
+ <managed-bean>
+ <managed-bean-name>userComparator</managed-bean-name>
+
<managed-bean-class>org.richfaces.sandbox.UserComparator</managed-bean-class>
+ <managed-bean-scope>application</managed-bean-scope>
+ </managed-bean>
</faces-config>
Modified: trunk/sandbox/samples/sortingFilteringDemo/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/sandbox/samples/sortingFilteringDemo/src/main/webapp/WEB-INF/web.xml 2008-02-27
16:42:30 UTC (rev 6385)
+++ trunk/sandbox/samples/sortingFilteringDemo/src/main/webapp/WEB-INF/web.xml 2008-02-27
16:58:24 UTC (rev 6386)
@@ -11,8 +11,12 @@
<param-value>server</param-value>
</context-param>
<context-param>
+ <param-name>org.ajax4jsf.xmlparser.ORDER</param-name>
+ <param-value>NEKO</param-value>
+ </context-param>
+ <context-param>
<param-name>org.richfaces.demo.MAX_ISSUES</param-name>
- <param-value>1000</param-value>
+ <param-value>100</param-value>
</context-param>
<context-param>
<param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
Modified: trunk/sandbox/samples/sortingFilteringDemo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/sandbox/samples/sortingFilteringDemo/src/main/webapp/pages/index.jsp 2008-02-27
16:42:30 UTC (rev 6385)
+++ trunk/sandbox/samples/sortingFilteringDemo/src/main/webapp/pages/index.jsp 2008-02-27
16:58:24 UTC (rev 6386)
@@ -9,26 +9,26 @@
<body>
<f:view>
<h:form>
- <dt:dataTable value="#{jiraService.channel.issues}"
var="issue" rows="10">
- <dt:column filterBy="#{issue.key.value}">
+ <dt:dataTable value="#{jiraService.channel.issues}"
var="issue">
+ <dt:column filterBy="#{issue.key.value}" filterValue="CH-"
sortBy="#{issue.key}" width="60px">
<f:facet name="header">
<h:outputText value="Key"></h:outputText>
</f:facet>
<h:outputText value="#{issue.key.value}"></h:outputText>
</dt:column>
- <dt:column sortBy="#{issue.summary}">
+ <dt:column sortBy="#{issue.summary}" width="400px">
<f:facet name="header">
<h:outputText value="Summary"></h:outputText>
</f:facet>
<h:outputText value="#{issue.summary}"></h:outputText>
</dt:column>
- <dt:column>
+ <dt:column width="150px" filterBy="#{issue.assignee.name}"
comparator="#{comparators.assigneeComparator}">
<f:facet name="header">
<h:outputText value="Assignee"></h:outputText>
</f:facet>
<h:outputText value="#{issue.assignee.name}"></h:outputText>
</dt:column>
- <dt:column filterBy="#{issue.reporter.name}">
+ <dt:column filterBy="#{issue.reporter.name}" width="150px"
comparator="#{comparators.reporterComparator}">
<f:facet name="header">
<h:outputText value="Reporter"></h:outputText>
</f:facet>
Show replies by date