Author: nbelaevski
Date: 2010-07-15 15:24:34 -0400 (Thu, 15 Jul 2010)
New Revision: 18103
Modified:
root/examples/richfaces-showcase/branches/richfaces-showcase-4.0.0.20100713-M1/src/main/java/org/richfaces/demo/tables/CapitalsSortingBean.java
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/api/src/main/java/org/richfaces/component/SortOrder.java
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/impl/src/main/java/org/richfaces/model/ArrangeableModel.java
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/impl/src/test/java/org/richfaces/model/ArrangeableModelTest.java
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/ui/src/main/java/org/richfaces/component/UIColumn.java
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/ui/src/main/java/org/richfaces/renderkit/SortingFilteringRowsRenderer.java
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/ui/src/test/java/org/richfaces/component/UIColumnTest.java
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/ui/src/test/java/org/richfaces/component/UIDataTableBaseTest.java
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/ui/src/test/java/org/richfaces/renderkit/ExtendedDataTableRendererTest.java
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/ui/src/test/resources/extendedDataTableTest.xhtml
Log:
https://jira.jboss.org/browse/RF-8879
https://jira.jboss.org/browse/RF-8940
Modified:
root/examples/richfaces-showcase/branches/richfaces-showcase-4.0.0.20100713-M1/src/main/java/org/richfaces/demo/tables/CapitalsSortingBean.java
===================================================================
---
root/examples/richfaces-showcase/branches/richfaces-showcase-4.0.0.20100713-M1/src/main/java/org/richfaces/demo/tables/CapitalsSortingBean.java 2010-07-15
19:13:49 UTC (rev 18102)
+++
root/examples/richfaces-showcase/branches/richfaces-showcase-4.0.0.20100713-M1/src/main/java/org/richfaces/demo/tables/CapitalsSortingBean.java 2010-07-15
19:24:34 UTC (rev 18103)
@@ -5,8 +5,8 @@
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
-import javax.swing.SortOrder;
+import org.richfaces.component.SortOrder;
import org.richfaces.demo.tables.model.capitals.Capital;
@ManagedBean
@@ -18,37 +18,37 @@
*/
private static final long serialVersionUID = -6237417487105926855L;
private static final String TIMEZONE_GMT_SEPARATOR = "-";
- private SortOrder capitalsOrder = SortOrder.UNSORTED;
- private SortOrder statesOrder = SortOrder.UNSORTED;
- private SortOrder timeZonesOrder = SortOrder.UNSORTED;
+ private SortOrder capitalsOrder = SortOrder.unsorted;
+ private SortOrder statesOrder = SortOrder.unsorted;
+ private SortOrder timeZonesOrder = SortOrder.unsorted;
public void sortByCapitals() {
- statesOrder = SortOrder.UNSORTED;
- timeZonesOrder = SortOrder.UNSORTED;
- if (capitalsOrder.equals(SortOrder.ASCENDING)) {
- setCapitalsOrder(SortOrder.DESCENDING);
+ statesOrder = SortOrder.unsorted;
+ timeZonesOrder = SortOrder.unsorted;
+ if (capitalsOrder.equals(SortOrder.ascending)) {
+ setCapitalsOrder(SortOrder.descending);
} else {
- setCapitalsOrder(SortOrder.ASCENDING);
+ setCapitalsOrder(SortOrder.ascending);
}
}
public void sortByStates() {
- capitalsOrder = SortOrder.UNSORTED;
- timeZonesOrder = SortOrder.UNSORTED;
- if (statesOrder.equals(SortOrder.ASCENDING)) {
- setStatesOrder(SortOrder.DESCENDING);
+ capitalsOrder = SortOrder.unsorted;
+ timeZonesOrder = SortOrder.unsorted;
+ if (statesOrder.equals(SortOrder.ascending)) {
+ setStatesOrder(SortOrder.descending);
} else {
- setStatesOrder(SortOrder.ASCENDING);
+ setStatesOrder(SortOrder.ascending);
}
}
public void sortByTimeZones() {
- statesOrder = SortOrder.UNSORTED;
- capitalsOrder = SortOrder.UNSORTED;
- if (timeZonesOrder.equals(SortOrder.ASCENDING)) {
- setTimeZonesOrder(SortOrder.DESCENDING);
+ statesOrder = SortOrder.unsorted;
+ capitalsOrder = SortOrder.unsorted;
+ if (timeZonesOrder.equals(SortOrder.ascending)) {
+ setTimeZonesOrder(SortOrder.descending);
} else {
- setTimeZonesOrder(SortOrder.ASCENDING);
+ setTimeZonesOrder(SortOrder.ascending);
}
}
Modified:
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/api/src/main/java/org/richfaces/component/SortOrder.java
===================================================================
---
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/api/src/main/java/org/richfaces/component/SortOrder.java 2010-07-15
19:13:49 UTC (rev 18102)
+++
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/api/src/main/java/org/richfaces/component/SortOrder.java 2010-07-15
19:24:34 UTC (rev 18103)
@@ -25,9 +25,9 @@
public enum SortOrder {
- ASCENDING,
+ ascending,
- DESCENDING,
+ descending,
- UNSORTED
+ unsorted
}
\ No newline at end of file
Modified:
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/impl/src/main/java/org/richfaces/model/ArrangeableModel.java
===================================================================
---
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/impl/src/main/java/org/richfaces/model/ArrangeableModel.java 2010-07-15
19:13:49 UTC (rev 18102)
+++
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/impl/src/main/java/org/richfaces/model/ArrangeableModel.java 2010-07-15
19:24:34 UTC (rev 18103)
@@ -293,7 +293,7 @@
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)) {
+ if (sortOrder != null && !SortOrder.unsorted.equals(sortOrder)) {
Comparator comparator = sortField.getComparator();
if (comparator != null) {
result = comparator.compare(object1, object2);
@@ -307,7 +307,7 @@
result = compareSortByValues(context, value1, value2);
}
}
- if (SortOrder.DESCENDING.equals(sortOrder)) {
+ if (SortOrder.descending.equals(sortOrder)) {
result = -result;
}
}
Modified:
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/impl/src/test/java/org/richfaces/model/ArrangeableModelTest.java
===================================================================
---
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/impl/src/test/java/org/richfaces/model/ArrangeableModelTest.java 2010-07-15
19:13:49 UTC (rev 18102)
+++
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/impl/src/test/java/org/richfaces/model/ArrangeableModelTest.java 2010-07-15
19:24:34 UTC (rev 18103)
@@ -97,12 +97,12 @@
}, null), new FilterField(expressionFactory
.createValueExpression(elContext, "#{var.lname != filterVar}",
Object.class), null, "b")};
SortField[] sortFields = {new SortField(expressionFactory
- .createValueExpression(elContext, "#{var.fname}", Object.class),
null, SortOrder.ASCENDING),
+ .createValueExpression(elContext, "#{var.fname}", Object.class),
null, SortOrder.ascending),
new SortField(null, new Comparator<User>() {
public int compare(User o1, User o2) {
return o1.getLname().compareTo(o2.getLname());
}
- }, SortOrder.DESCENDING)};
+ }, SortOrder.descending)};
arrangeableModel.arrange(facesContext, new
ArrangeableStateDefaultImpl(Arrays.asList(filterFields),
Arrays.asList(sortFields), null));
}
Modified:
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/ui/src/main/java/org/richfaces/component/UIColumn.java
===================================================================
---
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/ui/src/main/java/org/richfaces/component/UIColumn.java 2010-07-15
19:13:49 UTC (rev 18102)
+++
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/ui/src/main/java/org/richfaces/component/UIColumn.java 2010-07-15
19:24:34 UTC (rev 18103)
@@ -49,7 +49,7 @@
}
public SortOrder getSortOrder() {
- return (SortOrder) getStateHelper().eval(PropertyKeys.sortOrder,
SortOrder.UNSORTED);
+ return (SortOrder) getStateHelper().eval(PropertyKeys.sortOrder,
SortOrder.unsorted);
}
public void setFilter(Filter<?> filter) {
@@ -89,7 +89,7 @@
public SortField getSortField() {
SortField field = null;
SortOrder sortOrder = getSortOrder();
- if (sortOrder != null && !SortOrder.UNSORTED.equals(sortOrder)) {
+ if (sortOrder != null && !SortOrder.unsorted.equals(sortOrder)) {
Comparator<?> comparator = getComparator();
ValueExpression sortBy = getValueExpression("sortBy");
if (comparator != null || sortBy != null) {
Modified:
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java
===================================================================
---
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2010-07-15
19:13:49 UTC (rev 18102)
+++
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2010-07-15
19:24:34 UTC (rev 18103)
@@ -785,13 +785,13 @@
}
private void updateSortOrder(FacesContext context, UIComponent component, String
value) {
- SortOrder sortOrder = SortOrder.ASCENDING;
+ SortOrder sortOrder = SortOrder.ascending;
try {
sortOrder = SortOrder.valueOf(value);
} catch (IllegalArgumentException e) {
// If value isn't name of enum constant of SortOrder, toggle sortOrder of
column.
- if
(SortOrder.ASCENDING.equals(component.getAttributes().get("sortOrder"))) {
- sortOrder = SortOrder.DESCENDING;
+ if
(SortOrder.ascending.equals(component.getAttributes().get("sortOrder"))) {
+ sortOrder = SortOrder.descending;
}
}
updateAttribute(context, component, "sortOrder", sortOrder);
Modified:
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/ui/src/main/java/org/richfaces/renderkit/SortingFilteringRowsRenderer.java
===================================================================
---
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/ui/src/main/java/org/richfaces/renderkit/SortingFilteringRowsRenderer.java 2010-07-15
19:13:49 UTC (rev 18102)
+++
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/ui/src/main/java/org/richfaces/renderkit/SortingFilteringRowsRenderer.java 2010-07-15
19:24:34 UTC (rev 18103)
@@ -104,7 +104,7 @@
updateSortOrder(context, column, values[1]);
sortPriority.add(values[0]);
} else {
- updateAttribute(context, column, SORT_ORDER_STRING,
SortOrder.UNSORTED);
+ updateAttribute(context, column, SORT_ORDER_STRING,
SortOrder.unsorted);
}
}
} else {
@@ -122,13 +122,13 @@
}
private void updateSortOrder(FacesContext context, UIComponent component, String
value) {
- SortOrder sortOrder = SortOrder.ASCENDING;
+ SortOrder sortOrder = SortOrder.ascending;
try {
sortOrder = SortOrder.valueOf(value);
} catch (IllegalArgumentException e) {
// If value isn't name of enum constant of SortOrder, toggle sortOrder of
column.
- if
(SortOrder.ASCENDING.equals(component.getAttributes().get(SORT_ORDER_STRING))) {
- sortOrder = SortOrder.DESCENDING;
+ if
(SortOrder.ascending.equals(component.getAttributes().get(SORT_ORDER_STRING))) {
+ sortOrder = SortOrder.descending;
}
}
updateAttribute(context, component, SORT_ORDER_STRING, sortOrder);
Modified:
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/ui/src/test/java/org/richfaces/component/UIColumnTest.java
===================================================================
---
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/ui/src/test/java/org/richfaces/component/UIColumnTest.java 2010-07-15
19:13:49 UTC (rev 18102)
+++
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/ui/src/test/java/org/richfaces/component/UIColumnTest.java 2010-07-15
19:24:34 UTC (rev 18103)
@@ -71,9 +71,9 @@
*/
@Test
public final void testSortOrder() {
- Assert.assertEquals(SortOrder.UNSORTED, column.getSortOrder());
- column.setSortOrder(SortOrder.ASCENDING);
- Assert.assertEquals(SortOrder.ASCENDING, column.getSortOrder());
+ Assert.assertEquals(SortOrder.unsorted, column.getSortOrder());
+ column.setSortOrder(SortOrder.ascending);
+ Assert.assertEquals(SortOrder.ascending, column.getSortOrder());
environment.replay();
}
@@ -162,11 +162,11 @@
return 0;
}
};
- column.setSortOrder(SortOrder.ASCENDING);
+ column.setSortOrder(SortOrder.ascending);
column.setValueExpression("sortBy", expression);
column.setComparator(comparator);
SortField sortField = column.getSortField();
- Assert.assertEquals(SortOrder.ASCENDING, sortField.getSortOrder());
+ Assert.assertEquals(SortOrder.ascending, sortField.getSortOrder());
Assert.assertEquals(expression, sortField.getSortBy());
Assert.assertSame(comparator, sortField.getComparator());
}
Modified:
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/ui/src/test/java/org/richfaces/component/UIDataTableBaseTest.java
===================================================================
---
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/ui/src/test/java/org/richfaces/component/UIDataTableBaseTest.java 2010-07-15
19:13:49 UTC (rev 18102)
+++
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/ui/src/test/java/org/richfaces/component/UIDataTableBaseTest.java 2010-07-15
19:24:34 UTC (rev 18103)
@@ -175,7 +175,7 @@
.createValueExpression(elContext, "#{'id" + i +
"'}", Object.class));
child.setValueExpression("sortBy", expressionFactory
.createValueExpression(elContext, "#{'id" + i +
"'}", Object.class));
- child.setSortOrder(SortOrder.ASCENDING);
+ child.setSortOrder(SortOrder.ascending);
children.add(child);
}
Assert.assertTrue(table.createExtendedDataModel() instanceof Arrangeable);
Modified:
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/ui/src/test/java/org/richfaces/renderkit/ExtendedDataTableRendererTest.java
===================================================================
---
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/ui/src/test/java/org/richfaces/renderkit/ExtendedDataTableRendererTest.java 2010-07-15
19:13:49 UTC (rev 18102)
+++
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/ui/src/test/java/org/richfaces/renderkit/ExtendedDataTableRendererTest.java 2010-07-15
19:24:34 UTC (rev 18103)
@@ -287,13 +287,13 @@
Map<String, Object> column1Attributes =
component.findComponent("column1").getAttributes();
Map<String, Object> column2Attributes =
component.findComponent("column2").getAttributes();
String clientId = component.getClientId(facesContext);
- assertEquals(SortOrder.UNSORTED, column1Attributes.get("sortOrder"));
- assertEquals(SortOrder.ASCENDING, column2Attributes.get("sortOrder"));
+ assertEquals(SortOrder.unsorted, column1Attributes.get("sortOrder"));
+ assertEquals(SortOrder.ascending, column2Attributes.get("sortOrder"));
facesRequest.withParameter(clientId, clientId);
facesRequest.withParameter(clientId + "rich:sorting",
"column1:null:null");
renderer.doDecode(facesContext, component);
- assertEquals(SortOrder.ASCENDING, column1Attributes.get("sortOrder"));
- assertEquals(SortOrder.ASCENDING, column2Attributes.get("sortOrder"));
+ assertEquals(SortOrder.ascending, column1Attributes.get("sortOrder"));
+ assertEquals(SortOrder.ascending, column2Attributes.get("sortOrder"));
assertTrue(facesContext.getPartialViewContext().getRenderIds().contains(clientId));
facesRequest.release();
}
@@ -308,13 +308,13 @@
Map<String, Object> column1Attributes =
component.findComponent("column1").getAttributes();
Map<String, Object> column2Attributes =
component.findComponent("column2").getAttributes();
String clientId = component.getClientId(facesContext);
- assertEquals(SortOrder.UNSORTED, column1Attributes.get("sortOrder"));
- assertEquals(SortOrder.ASCENDING, column2Attributes.get("sortOrder"));
+ assertEquals(SortOrder.unsorted, column1Attributes.get("sortOrder"));
+ assertEquals(SortOrder.ascending, column2Attributes.get("sortOrder"));
facesRequest.withParameter(clientId, clientId);
- facesRequest.withParameter(clientId + "rich:sorting",
"column1:DESCENDING:true");
+ facesRequest.withParameter(clientId + "rich:sorting",
"column1:descending:true");
renderer.doDecode(facesContext, component);
- assertEquals(SortOrder.DESCENDING,
column1Attributes.get("sortOrder"));
- assertEquals(SortOrder.UNSORTED, column2Attributes.get("sortOrder"));
+ assertEquals(SortOrder.descending,
column1Attributes.get("sortOrder"));
+ assertEquals(SortOrder.unsorted, column2Attributes.get("sortOrder"));
assertTrue(facesContext.getPartialViewContext().getRenderIds().contains(clientId));
facesRequest.release();
}
Modified:
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/ui/src/test/resources/extendedDataTableTest.xhtml
===================================================================
---
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/ui/src/test/resources/extendedDataTableTest.xhtml 2010-07-15
19:13:49 UTC (rev 18102)
+++
root/ui/iteration/branches/richfaces-ui-iteration-4.0.0.20100713-M1/tables/ui/src/test/resources/extendedDataTableTest.xhtml 2010-07-15
19:24:34 UTC (rev 18103)
@@ -54,7 +54,7 @@
<h:outputText id="footerColumnFacet1"
value="footerColumnFacet1"/>
</f:facet>
</rich:column>
- <rich:column id="column2" filterValue="filterValue2"
sortOrder="ASCENDING">
+ <rich:column id="column2" filterValue="filterValue2"
sortOrder="ascending">
<f:facet name="header">
<h:outputText id="headerColumnFacet2"
value="headerColumnFacet2"/>
</f:facet>