Author: konstantin.mishin
Date: 2010-03-01 13:28:34 -0500 (Mon, 01 Mar 2010)
New Revision: 16513
Added:
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/model/FilterField.java
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/model/LocaleAware.java
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/model/Modifiable.java
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/model/ModifiableState.java
root/ui-sandbox/trunk/components/tables/impl/src/main/java/org/
root/ui-sandbox/trunk/components/tables/impl/src/main/java/org/richfaces/
root/ui-sandbox/trunk/components/tables/impl/src/main/java/org/richfaces/model/
root/ui-sandbox/trunk/components/tables/impl/src/main/java/org/richfaces/model/ModifiableModel.java
root/ui-sandbox/trunk/components/tables/impl/src/main/java/org/richfaces/model/ModifiableStateDefaultImpl.java
Removed:
root/framework/trunk/api/src/main/java/org/richfaces/model/Field.java
root/framework/trunk/api/src/main/java/org/richfaces/model/FilterField.java
root/framework/trunk/api/src/main/java/org/richfaces/model/LocaleAware.java
root/framework/trunk/api/src/main/java/org/richfaces/model/Modifiable.java
root/framework/trunk/api/src/main/java/org/richfaces/model/ModifiableState.java
root/framework/trunk/api/src/main/java/org/richfaces/model/SortField.java
root/framework/trunk/impl/src/test/java/org/richfaces/model/
Modified:
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/model/Field.java
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/model/SortField.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIColumn.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIDataTableBase.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/html/HtmlColumn.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java
Log:
RF-8118 RF-8119
Deleted: root/framework/trunk/api/src/main/java/org/richfaces/model/Field.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/richfaces/model/Field.java 2010-03-01
14:10:38 UTC (rev 16512)
+++ root/framework/trunk/api/src/main/java/org/richfaces/model/Field.java 2010-03-01
18:28:34 UTC (rev 16513)
@@ -1,42 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.richfaces.model;
-
-import javax.el.ValueExpression;
-
-/**
- * @author Konstantin Mishin
- *
- */
-public abstract class Field {
-
- private ValueExpression expression;
-
- public Field(ValueExpression expression) {
- this.expression = expression;
- }
-
- protected ValueExpression getExpression() {
- return expression;
- }
-}
Deleted: root/framework/trunk/api/src/main/java/org/richfaces/model/FilterField.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/richfaces/model/FilterField.java 2010-03-01
14:10:38 UTC (rev 16512)
+++ root/framework/trunk/api/src/main/java/org/richfaces/model/FilterField.java 2010-03-01
18:28:34 UTC (rev 16513)
@@ -1,54 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.richfaces.model;
-
-import javax.el.ValueExpression;
-
-/**
- * @author Konstantin Mishin
- *
- */
-public class FilterField extends Field{
-
- private Filter<?> filter;
-
- private String filterValue;
-
- public FilterField(ValueExpression filterExpression, Filter<?> filter, String
filterValue) {
- super(filterExpression);
- this.filter = filter;
- this.filterValue = filterValue;
- }
-
- public ValueExpression getFilterExpression() {
- return getExpression();
- }
-
- public Filter<?> getFilter() {
- return filter;
- }
-
- public String getFilterValue() {
- return filterValue;
- }
-}
Deleted: root/framework/trunk/api/src/main/java/org/richfaces/model/LocaleAware.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/richfaces/model/LocaleAware.java 2010-03-01
14:10:38 UTC (rev 16512)
+++ root/framework/trunk/api/src/main/java/org/richfaces/model/LocaleAware.java 2010-03-01
18:28:34 UTC (rev 16513)
@@ -1,39 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.richfaces.model;
-
-import java.util.Locale;
-
-/**
- * Models that are based on locale-dependent operations should implement this interface
- *
- * @author Nick Belaevski
- * @since 3.3.0
- */
-
-public interface LocaleAware {
-
- Locale getLocale();
-
- void setLocale(Locale locale);
-}
Deleted: root/framework/trunk/api/src/main/java/org/richfaces/model/Modifiable.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/richfaces/model/Modifiable.java 2010-03-01
14:10:38 UTC (rev 16512)
+++ root/framework/trunk/api/src/main/java/org/richfaces/model/Modifiable.java 2010-03-01
18:28:34 UTC (rev 16513)
@@ -1,32 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.richfaces.model;
-
-/**
- * @author Konstantin Mishin
- *
- */
-public interface Modifiable {
-
- void modify(ModifiableState state);
-}
Deleted: root/framework/trunk/api/src/main/java/org/richfaces/model/ModifiableState.java
===================================================================
---
root/framework/trunk/api/src/main/java/org/richfaces/model/ModifiableState.java 2010-03-01
14:10:38 UTC (rev 16512)
+++
root/framework/trunk/api/src/main/java/org/richfaces/model/ModifiableState.java 2010-03-01
18:28:34 UTC (rev 16513)
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.richfaces.model;
-
-import java.util.List;
-
-/**
- * @author Konstantin Mishin
- *
- */
-public interface ModifiableState {
-
- List<FilterField> getFilterFields();
-
- List<SortField> getSortFields();
-}
Deleted: root/framework/trunk/api/src/main/java/org/richfaces/model/SortField.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/richfaces/model/SortField.java 2010-03-01
14:10:38 UTC (rev 16512)
+++ root/framework/trunk/api/src/main/java/org/richfaces/model/SortField.java 2010-03-01
18:28:34 UTC (rev 16513)
@@ -1,57 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.richfaces.model;
-
-import java.util.Comparator;
-
-import javax.el.ValueExpression;
-import javax.swing.SortOrder;
-
-/**
- * @author Konstantin Mishin
- *
- */
-public class SortField extends Field {
-
- private Comparator<?> comparator;
-
- private SortOrder order;
-
- public SortField(ValueExpression sortBy, Comparator<?> comparator, SortOrder
order) {
- super(sortBy);
- this.comparator = comparator;
- this.order = order;
- }
-
- public ValueExpression getSortBy() {
- return getExpression();
- }
-
- public Comparator<?> getComparator() {
- return comparator;
- }
-
- public SortOrder getSortOrder() {
- return order;
- }
-}
Modified:
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/model/Field.java
===================================================================
---
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/model/Field.java 2010-03-01
14:10:38 UTC (rev 16512)
+++
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/model/Field.java 2010-03-01
18:28:34 UTC (rev 16513)
@@ -1,44 +1,42 @@
-/**
- * License Agreement.
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
*
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * 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,
+ * This software 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
+ * 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
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
+
package org.richfaces.model;
-import javax.el.Expression;
+import javax.el.ValueExpression;
/**
* @author Konstantin Mishin
- *
+ *
*/
public abstract class Field {
- private Expression expression;
-
- public Field(Expression expression) {
- this.expression = expression;
- }
+ private ValueExpression expression;
- public Expression getExpression() {
- return expression;
- }
+ public Field(ValueExpression expression) {
+ this.expression = expression;
+ }
- public void setExpression(Expression expression) {
- this.expression = expression;
- }
+ protected ValueExpression getExpression() {
+ return expression;
+ }
}
Added:
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/model/FilterField.java
===================================================================
---
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/model/FilterField.java
(rev 0)
+++
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/model/FilterField.java 2010-03-01
18:28:34 UTC (rev 16513)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.richfaces.model;
+
+import javax.el.ValueExpression;
+
+/**
+ * @author Konstantin Mishin
+ *
+ */
+public class FilterField extends Field{
+
+ private Filter<?> filter;
+
+ private String filterValue;
+
+ public FilterField(ValueExpression filterExpression, Filter<?> filter, String
filterValue) {
+ super(filterExpression);
+ this.filter = filter;
+ this.filterValue = filterValue;
+ }
+
+ public ValueExpression getFilterExpression() {
+ return getExpression();
+ }
+
+ public Filter<?> getFilter() {
+ return filter;
+ }
+
+ public String getFilterValue() {
+ return filterValue;
+ }
+}
Added:
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/model/LocaleAware.java
===================================================================
---
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/model/LocaleAware.java
(rev 0)
+++
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/model/LocaleAware.java 2010-03-01
18:28:34 UTC (rev 16513)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.richfaces.model;
+
+import java.util.Locale;
+
+/**
+ * Models that are based on locale-dependent operations should implement this interface
+ *
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+
+public interface LocaleAware {
+
+ Locale getLocale();
+
+ void setLocale(Locale locale);
+}
Added:
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/model/Modifiable.java
===================================================================
---
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/model/Modifiable.java
(rev 0)
+++
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/model/Modifiable.java 2010-03-01
18:28:34 UTC (rev 16513)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.richfaces.model;
+
+/**
+ * @author Konstantin Mishin
+ *
+ */
+public interface Modifiable {
+
+ void modify(ModifiableState state);
+}
Added:
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/model/ModifiableState.java
===================================================================
---
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/model/ModifiableState.java
(rev 0)
+++
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/model/ModifiableState.java 2010-03-01
18:28:34 UTC (rev 16513)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.richfaces.model;
+
+import java.util.List;
+
+/**
+ * @author Konstantin Mishin
+ *
+ */
+public interface ModifiableState {
+
+ List<FilterField> getFilterFields();
+
+ List<SortField> getSortFields();
+}
Modified:
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/model/SortField.java
===================================================================
---
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/model/SortField.java 2010-03-01
14:10:38 UTC (rev 16512)
+++
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/model/SortField.java 2010-03-01
18:28:34 UTC (rev 16513)
@@ -1,21 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
package org.richfaces.model;
-import javax.el.Expression;
+import java.util.Comparator;
+
+import javax.el.ValueExpression;
import javax.swing.SortOrder;
+/**
+ * @author Konstantin Mishin
+ *
+ */
public class SortField extends Field {
+ private Comparator<?> comparator;
+
private SortOrder sortOrder;
-
- public SortField(SortOrder sortOrder, Expression expression) {
- super(expression);
+
+ public SortField(ValueExpression sortBy, Comparator<?> comparator, SortOrder
sortOrder) {
+ super(sortBy);
+ this.comparator = comparator;
this.sortOrder = sortOrder;
}
- public void setSortOrder(SortOrder sortOrder) {
- this.sortOrder = sortOrder;
+ public ValueExpression getSortBy() {
+ return getExpression();
}
+ public Comparator<?> getComparator() {
+ return comparator;
+ }
+
public SortOrder getSortOrder() {
return sortOrder;
}
Added:
root/ui-sandbox/trunk/components/tables/impl/src/main/java/org/richfaces/model/ModifiableModel.java
===================================================================
---
root/ui-sandbox/trunk/components/tables/impl/src/main/java/org/richfaces/model/ModifiableModel.java
(rev 0)
+++
root/ui-sandbox/trunk/components/tables/impl/src/main/java/org/richfaces/model/ModifiableModel.java 2010-03-01
18:28:34 UTC (rev 16513)
@@ -0,0 +1,381 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.richfaces.model;
+
+import java.text.Collator;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.el.ELContext;
+import javax.el.ValueExpression;
+import javax.faces.context.FacesContext;
+import javax.faces.model.DataModelListener;
+import javax.swing.SortOrder;
+
+import org.ajax4jsf.model.DataVisitResult;
+import org.ajax4jsf.model.DataVisitor;
+import org.ajax4jsf.model.ExtendedDataModel;
+import org.ajax4jsf.model.Range;
+import org.ajax4jsf.model.SequenceRange;
+
+/**
+ * @author Konstantin Mishin
+ *
+ */
+public class ModifiableModel extends ExtendedDataModel<Object> implements
Modifiable, LocaleAware {
+
+ protected FacesContext context;
+
+ protected ELContext elContext;
+
+ protected Map<String, Object> requestMap;
+
+ protected ModifiableState state;
+
+ protected List<Object> rowKeys;
+
+ protected ExtendedDataModel<?> originalModel;
+
+ protected String var;
+
+ protected String filterVar;
+
+ protected Locale locale;
+
+ private Comparator<? super String> stringComparator;
+
+ public ModifiableModel(ExtendedDataModel<?> originalModel, String var, String
filterVar) {
+ this(FacesContext.getCurrentInstance(), originalModel, var, filterVar);
+ }
+
+ public ModifiableModel(FacesContext context, ExtendedDataModel<?>
originalModel, String var, String filterVar) {
+ this.context = context;
+ elContext = context.getELContext();
+ requestMap = context.getExternalContext().getRequestMap();
+ this.originalModel = originalModel;
+ this.var = var;
+ this.filterVar = filterVar;
+ }
+
+ @Override
+ public void addDataModelListener(DataModelListener listener) {
+ originalModel.addDataModelListener(listener);
+ }
+
+ @Override
+ public DataModelListener[] getDataModelListeners() {
+ return originalModel.getDataModelListeners();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.model.ExtendedDataModel#getRowKey()
+ */
+ @Override
+ public Object getRowKey() {
+ return originalModel.getRowKey();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.model.ExtendedDataModel#setRowKey(java.lang.Object)
+ */
+ @Override
+ public void setRowKey(Object key) {
+ originalModel.setRowKey(key);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.model.ExtendedDataModel#walk(javax.faces.context.FacesContext,
org.ajax4jsf.model.DataVisitor,
+ * org.ajax4jsf.model.Range, java.lang.Object)
+ */
+ @Override
+ public void walk(FacesContext context, DataVisitor visitor, Range range, Object
argument) {
+ final SequenceRange seqRange = (SequenceRange) range;
+ int rows = seqRange.getRows();
+ int rowCount = getRowCount();
+ int currentRow = seqRange.getFirstRow();
+ if (rows > 0) {
+ rows += currentRow;
+ rows = Math.min(rows, rowCount);
+ } else {
+ rows = rowCount;
+ }
+ for (; currentRow < rows; currentRow++) {
+ visitor.process(context, rowKeys.get(currentRow), argument);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.model.DataModel#getRowCount()
+ */
+ @Override
+ public int getRowCount() {
+ if (rowKeys == null) {
+ return -1;
+ } else {
+ return rowKeys.size();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.model.DataModel#getRowData()
+ */
+ @Override
+ public Object getRowData() {
+ return originalModel.getRowData();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.model.DataModel#getRowIndex()
+ */
+ @Override
+ public int getRowIndex() {
+ return rowKeys.indexOf(originalModel.getRowKey());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.model.DataModel#getWrappedData()
+ */
+ @Override
+ public Object getWrappedData() {
+ return originalModel.getWrappedData();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.model.DataModel#isRowAvailable()
+ */
+ @Override
+ public boolean isRowAvailable() {
+ return originalModel.isRowAvailable();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.model.DataModel#setRowIndex(int)
+ */
+ @Override
+ public void setRowIndex(int rowIndex) {
+ Object originalKey = null;
+ if (rowIndex >= 0 && rowIndex < rowKeys.size()) {
+ originalKey = rowKeys.get(rowIndex);
+ }
+ originalModel.setRowKey(originalKey);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.model.DataModel#setWrappedData(java.lang.Object)
+ */
+ @Override
+ public void setWrappedData(Object data) {
+ originalModel.setWrappedData(data);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.model.Modifiable#modify(org.richfaces.model.ModifiableState)
+ */
+ public void modify(ModifiableState state) {
+ this.state = state;
+ int rowCount = originalModel.getRowCount();
+
+ if (rowCount > 0) {
+ rowKeys = new ArrayList<Object>(rowCount);
+ } else {
+ rowKeys = new ArrayList<Object>();
+ }
+ Object rowKey = originalModel.getRowKey();
+ originalModel.walk(context, new DataVisitor() {
+ public DataVisitResult process(FacesContext context, Object rowKey, Object
argument) {
+ originalModel.setRowKey(rowKey);
+ if (originalModel.isRowAvailable()) {
+ rowKeys.add(rowKey);
+ }
+ return DataVisitResult.CONTINUE;
+ }
+ }, new SequenceRange(0, -1), null);
+ if (this.state != null) {
+ filter();
+ sort();
+ }
+ originalModel.setRowKey(rowKey);
+ }
+
+ protected void filter() {
+ List<FilterField> filterFields = state.getFilterFields();
+ if (filterFields != null && !filterFields.isEmpty()) {
+ List<Object> filteredCollection = new ArrayList<Object>();
+ for (Object rowKey : rowKeys) {
+ if (accept(rowKey)) {
+ filteredCollection.add(rowKey);
+ }
+ }
+ rowKeys = filteredCollection;
+ }
+ }
+
+ protected void sort() {
+ List<SortField> sortFields = state.getSortFields();
+ if (sortFields != null && !sortFields.isEmpty()) {
+ Collections.sort(rowKeys, new Comparator<Object>() {
+ public int compare(Object rowKey1, Object rowKey2) {
+ return ModifiableModel.this.compare(rowKey1, rowKey2);
+ }
+ });
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ protected boolean accept(Object rowKey) {
+ originalModel.setRowKey(rowKey);
+ Object object = originalModel.getRowData();
+ updateVar(var, object);
+ for (FilterField filterField : state.getFilterFields()) {
+ Filter filter = filterField.getFilter();
+ if (filter != null) {
+ return filter.accept(object);
+ } else {
+ ValueExpression filterExpression = filterField.getFilterExpression();
+ if (filterExpression != null) {
+ updateVar(filterVar, filterField.getFilterValue());
+ if (Boolean.FALSE.equals(filterExpression.getValue(elContext))) {
+ return false;
+ }
+ }
+ }
+ }
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ protected int compare(Object rowKey1, Object rowKey2) {
+ originalModel.setRowKey(rowKey1);
+ Object object1 = originalModel.getRowData();
+ originalModel.setRowKey(rowKey2);
+ Object object2 = originalModel.getRowData();
+ int result = 0;
+ for (Iterator<SortField> iterator = state.getSortFields().iterator();
iterator.hasNext() && result == 0;) {
+ SortField sortField = iterator.next();
+ SortOrder sortOrder = sortField.getSortOrder();
+ if (sortOrder != null && !SortOrder.UNSORTED.equals(sortOrder)) {
+ Comparator comparator = sortField.getComparator();
+ if (comparator != null) {
+ result = comparator.compare(object1, object2);
+ } else {
+ ValueExpression sortBy = sortField.getSortBy();
+ if (sortBy != null) {
+ updateVar(var, object1);
+ Object value1 = sortBy.getValue(elContext);
+ updateVar(var, object2);
+ Object value2 = sortBy.getValue(elContext);
+ result = compareSortByValues(value1, value2);
+ }
+ }
+ if (SortOrder.DESCENDING.equals(sortOrder)) {
+ result = -result;
+ }
+ }
+ }
+ return result;
+ }
+
+ @SuppressWarnings("unchecked")
+ private int compareSortByValues(Object value1, Object value2) {
+ int result = 0;
+ if (value1 instanceof String && value2 instanceof String) {
+ if (stringComparator == null) {
+ stringComparator = createStringComparator();
+ }
+ result = stringComparator.compare(((String) value1).trim(), ((String)
value2).trim());
+ } else if (value1 instanceof Comparable<?>) {
+ result = ((Comparable) value1).compareTo(value2);
+ } else if (value1 == null && value2 != null) {
+ result = -1;
+ } else if (value2 == null && value1 != null) {
+ result = 1;
+ }
+ return result;
+ }
+
+ private Comparator<? super String> createStringComparator() {
+ Comparator<? super String> comparator = null;
+ if (locale != null) {
+ comparator = Collator.getInstance(locale);
+ } else {
+ comparator = new Comparator<String>() {
+ public int compare(String o1, String o2) {
+ return o1.compareToIgnoreCase(o2);
+ }
+ };
+ }
+ return comparator;
+ }
+
+ private void updateVar(String var, Object value) {
+ if (var != null && var.length() > 0) {
+ requestMap.put(var, value);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.model.LocaleAware#getLocale()
+ */
+ public Locale getLocale() {
+ return locale;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.model.LocaleAware#setLocale(java.util.Locale)
+ */
+ public void setLocale(Locale locale) {
+ this.locale = locale;
+ }
+
+}
Added:
root/ui-sandbox/trunk/components/tables/impl/src/main/java/org/richfaces/model/ModifiableStateDefaultImpl.java
===================================================================
---
root/ui-sandbox/trunk/components/tables/impl/src/main/java/org/richfaces/model/ModifiableStateDefaultImpl.java
(rev 0)
+++
root/ui-sandbox/trunk/components/tables/impl/src/main/java/org/richfaces/model/ModifiableStateDefaultImpl.java 2010-03-01
18:28:34 UTC (rev 16513)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.richfaces.model;
+
+import java.util.List;
+
+/**
+ * @author Konstantin Mishin
+ *
+ */
+public class ModifiableStateDefaultImpl implements ModifiableState {
+
+ private List<FilterField> filterFields;
+
+ private List<SortField> sortFields;
+
+ public ModifiableStateDefaultImpl(List<FilterField> filterFields,
List<SortField> sortFields) {
+ this.filterFields = filterFields;
+ this.sortFields = sortFields;
+ }
+
+ public List<FilterField> getFilterFields() {
+ return filterFields;
+ }
+
+ public List<SortField> getSortFields() {
+ return sortFields;
+ }
+}
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIColumn.java
===================================================================
---
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIColumn.java 2010-03-01
14:10:38 UTC (rev 16512)
+++
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIColumn.java 2010-03-01
18:28:34 UTC (rev 16513)
@@ -1,33 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
package org.richfaces.component;
+import java.util.Comparator;
+import java.util.Map;
+
+import javax.el.ValueExpression;
import javax.swing.SortOrder;
+import org.richfaces.model.Filter;
+import org.richfaces.model.FilterField;
+import org.richfaces.model.SortField;
public abstract class UIColumn extends javax.faces.component.UIColumn implements Column
{
-
- private SortOrder sortOrder;
-
+
public abstract int getRowspan();
public abstract int getColspan();
public abstract boolean isBreakBefore();
-
+
public abstract boolean isSelfSorted();
-
+
public abstract void setSortOrder(SortOrder sortOrder);
-
+
public abstract SortOrder getSortOrder();
-
-
- public SortOrder toggleSortOrder(){
- if(SortOrder.ASCENDING.equals(getSortOrder())) {
- sortOrder = SortOrder.DESCENDING;
- } else {
- sortOrder = SortOrder.ASCENDING;
- }
-
- return sortOrder;
+
+ public FilterField getFilterField() {
+ FilterField field = null;
+ Map<String, Object> attributes = getAttributes();
+ Filter<?> filter = (Filter<?>) attributes.get("filter");
+ ValueExpression filterExpression =
getValueExpression("filterExpression");
+ if (filter != null || filterExpression != null) {
+ field = new FilterField(filterExpression, filter, (String)
attributes.get("filterValue"));
+ }
+ return field;
}
-
+
+ public SortField getSortField() {
+ SortField field = null;
+ SortOrder sortOrder = getSortOrder();
+ if (sortOrder != null && !SortOrder.UNSORTED.equals(sortOrder)) {
+ Comparator<?> comparator = (Comparator<?>)
getAttributes().get("comparator");
+ ValueExpression sortBy = getValueExpression("sortBy");
+ if (comparator != null || sortBy != null) {
+ field = new SortField(sortBy, comparator, sortOrder);
+ }
+ }
+ return field;
+ }
+
}
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIDataTableBase.java
===================================================================
---
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIDataTableBase.java 2010-03-01
14:10:38 UTC (rev 16512)
+++
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIDataTableBase.java 2010-03-01
18:28:34 UTC (rev 16513)
@@ -1,3 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
package org.richfaces.component;
import java.util.Collection;
@@ -2,5 +24,20 @@
import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
import javax.faces.component.UIComponent;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import org.ajax4jsf.context.ContextInitParameters;
+import org.ajax4jsf.model.ExtendedDataModel;
+import org.richfaces.model.FilterField;
+import org.richfaces.model.LocaleAware;
+import org.richfaces.model.Modifiable;
+import org.richfaces.model.ModifiableModel;
+import org.richfaces.model.ModifiableState;
+import org.richfaces.model.ModifiableStateDefaultImpl;
+import org.richfaces.model.SortField;
import org.richfaces.model.SortMode;
@@ -30,19 +67,80 @@
public UIComponent getFooter() {
return getFacet("footer");
}
-
- @Override
- public boolean getRendersChildren() {
+
+ @Override
+ public boolean getRendersChildren() {
return true;
- }
-
- public abstract SortMode getSortMode();
-
- public abstract void setSortMode(SortMode sortMode);
-
- public abstract Collection <Object> getSortPriority();
-
- public abstract void setSortPriority(Collection<Object> sortPriority);
-
+ }
+ public abstract SortMode getSortMode();
+
+ public abstract void setSortMode(SortMode sortMode);
+
+ public abstract Collection<Object> getSortPriority();
+
+ public abstract void setSortPriority(Collection<Object> sortPriority);
+
+ @Override
+ protected ExtendedDataModel<?> createExtendedDataModel() {
+ ExtendedDataModel<?> dataModel = super.createExtendedDataModel();
+ Modifiable modifiable = null;
+ ModifiableState modifiableState = createModifiableState();
+ if (dataModel instanceof Modifiable) {
+ modifiable = (Modifiable) dataModel;
+ } else if (modifiableState != null) {
+ ModifiableModel modifiableModel = new ModifiableModel(dataModel, getVar(),
(String) getAttributes().get(
+ "filterVar"));
+ dataModel = modifiableModel;
+ modifiable = modifiableModel;
+ }
+
+ if (dataModel instanceof LocaleAware) {
+ FacesContext facesContext = getFacesContext();
+ if (ContextInitParameters.isDatatableUsesViewLocale(facesContext)) {
+ UIViewRoot viewRoot = facesContext.getViewRoot();
+ ((LocaleAware) dataModel).setLocale(viewRoot.getLocale());
+ }
+ }
+
+ if (modifiable != null) {
+ modifiable.modify(modifiableState);
+ }
+ return dataModel;
+ }
+
+ private ModifiableState createModifiableState() {
+ ModifiableState modifiableState = null;
+ List<FilterField> filterFields = new LinkedList<FilterField>();
+ Map<Object, SortField> sortFieldsMap = new LinkedHashMap<Object,
SortField>();
+ for (UIComponent component : getChildren()) {
+ if (component instanceof UIColumn && component.isRendered()) {
+ UIColumn column = (UIColumn) component;
+ FilterField filterField = column.getFilterField();
+ if (filterField != null) {
+ filterFields.add(filterField);
+ }
+ SortField sortField = column.getSortField();
+ if (sortField != null) {
+ sortFieldsMap.put(component.getId(), sortField);
+ }
+ }
+ }
+ List<SortField> sortFields = new LinkedList<SortField>();
+ Collection<Object> sortPriority = getSortPriority();
+ if (sortPriority != null) {
+ for (Object object : sortPriority) {
+ SortField sortField = sortFieldsMap.get(object);
+ if (sortField != null) {
+ sortFields.add(sortField);
+ sortFieldsMap.remove(object);
+ }
+ }
+ }
+ sortFields.addAll(sortFieldsMap.values());
+ if (!filterFields.isEmpty() || !sortFields.isEmpty()) {
+ modifiableState = new ModifiableStateDefaultImpl(filterFields, sortFields);
+ }
+ return modifiableState;
+ }
}
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/html/HtmlColumn.java
===================================================================
---
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/html/HtmlColumn.java 2010-03-01
14:10:38 UTC (rev 16512)
+++
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/html/HtmlColumn.java 2010-03-01
18:28:34 UTC (rev 16513)
@@ -1,3 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
package org.richfaces.component.html;
import javax.swing.SortOrder;
@@ -33,7 +55,7 @@
@Override
public SortOrder getSortOrder() {
- return (SortOrder)
getStateHelper().eval(PropertyKeys.sortOrder,SortOrder.DESCENDING);
+ return (SortOrder)
getStateHelper().eval(PropertyKeys.sortOrder,SortOrder.UNSORTED);
}
@Override
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java
===================================================================
---
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java 2010-03-01
14:10:38 UTC (rev 16512)
+++
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java 2010-03-01
18:28:34 UTC (rev 16513)
@@ -1,10 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
package org.richfaces.renderkit;
import java.io.IOException;
-import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
-import java.util.Map;
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
@@ -19,8 +39,6 @@
import org.richfaces.component.Row;
import org.richfaces.component.UIDataTable;
import org.richfaces.component.UIDataTableBase;
-import org.richfaces.event.SortingEvent;
-import org.richfaces.model.SortMode;
@ResourceDependencies( { @ResourceDependency(library = "javax.faces", name =
"jsf-uncompressed.js"),
@ResourceDependency(name = "jquery.js"), @ResourceDependency(name =
"richfaces.js"),
@@ -28,49 +46,6 @@
@ResourceDependency(name = "table.css") })
public class DataTableRenderer extends AbstractTableRenderer {
-
- @Override
- protected void doDecode(FacesContext context, UIComponent component) {
- Map<String, String> requestMap =
context.getExternalContext().getRequestParameterMap();
-
- //decode column
-
- UIDataTable dataTable = (UIDataTable)component;
-
- String sortColumn = requestMap.get(dataTable.getClientId()+":sort");
-
- if(sortColumn != null && sortColumn.trim().length() > 0) {
- Collection<Object> sortPriority = dataTable.getSortPriority();
-
- boolean isSingle = SortMode.single.equals(dataTable.getSortMode());
-
- if(isSingle) {
- //reset saved sort priorities
- sortPriority.clear();
- }
-
- Iterator<UIComponent> columns = dataTable.columns();
- while(columns.hasNext()) {
-
- UIComponent column = columns.next();
-
- if(column instanceof org.richfaces.component.UIColumn &&
isSortable((org.richfaces.component.UIColumn)column)) {
-
- org.richfaces.component.UIColumn sortableColumn =
(org.richfaces.component.UIColumn)column;
-
- if(sortableColumn.getClientId().equals(sortColumn)) {
- SortOrder newSortOrder = sortableColumn.toggleSortOrder();
- new SortingEvent(dataTable, column.getClientId(context),
newSortOrder).queue();
- sortPriority.add(sortColumn);
- } else if(isSingle) {
- sortableColumn.setSortOrder(SortOrder.UNSORTED);
- }
-
- }
- }
- }
- }
-
public void encodeTableStructure(ResponseWriter writer, FacesContext context,
UIDataTableBase dataTable)
throws IOException {