Author: abelevich
Date: 2007-05-23 13:56:13 -0400 (Wed, 23 May 2007)
New Revision: 852
Added:
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/model/SortOrder.java
Log:
Added: trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/model/SortOrder.java
===================================================================
--- trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/model/SortOrder.java
(rev 0)
+++
trunk/sandbox/scrollable-grid/src/main/java/org/richfaces/model/SortOrder.java 2007-05-23
17:56:13 UTC (rev 852)
@@ -0,0 +1,72 @@
+package org.richfaces.model;
+
+import java.io.Serializable;
+/**
+ *
+ * @author Maksim Kaszynski
+ *
+ */
+public class SortOrder implements Serializable {
+
+ private static final long serialVersionUID = 2423450561570551363L;
+
+ private String sortField;
+
+ private boolean ascending;
+
+ public SortOrder(String sortField, boolean _ascending) {
+ super();
+ this.sortField = sortField;
+ this.ascending = _ascending;
+ }
+
+ public SortOrder() {
+ super();
+ }
+
+ public boolean isAscending() {
+ return ascending;
+ }
+
+ public void setAscending(boolean ascending) {
+ this.ascending = ascending;
+ }
+
+ public String getSortField() {
+ return sortField;
+ }
+
+ public void setSortField(String sortField) {
+ this.sortField = sortField;
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ return "SortOrder: {field:" + sortField + ", ascending: " +
ascending
+ + "}";
+ }
+
+ /**
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object obj) {
+
+ if (obj instanceof SortOrder) {
+ SortOrder sortOrder = (SortOrder) obj;
+ return sortField.equals(sortOrder.sortField)
+ && ascending == sortOrder.ascending;
+ }
+
+ return super.equals(obj);
+ }
+
+ public int hashCode() {
+ int c = sortField.hashCode();
+ if (ascending) {
+ c = -c;
+ }
+ return c;
+ }
+}
\ No newline at end of file
Show replies by date