Author: jpapouse
Date: 2011-09-14 02:59:17 -0400 (Wed, 14 Sep 2011)
New Revision: 22716
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/converter/CapitalConverter.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/model/Capital.java
modules/tests/metamer/trunk/application/src/main/webapp/components/richOrderingList/simple.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richOrderingList/withColumn.xhtml
Log:
RF-11397: bug fixed, the ordering list needs tha capital to have properly defined equals
method
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/converter/CapitalConverter.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/converter/CapitalConverter.java 2011-09-13
09:34:13 UTC (rev 22715)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/converter/CapitalConverter.java 2011-09-14
06:59:17 UTC (rev 22716)
@@ -47,24 +47,27 @@
@Override
public Object getAsObject(FacesContext context, UIComponent component, String value)
{
- LOGGER.info("capital as object: " + value);
for(Capital capital : capitals) {
if (capitalAsString(capital).equals(value)) {
Capital toReturn = new Capital();
toReturn.setName(capital.getName());
toReturn.setState(capital.getState());
toReturn.setTimeZone(capital.getTimeZone());
+ LOGGER.info("converting string [" + value + "] to object
[" + toReturn + "].");
return toReturn;
}
}
+ LOGGER.info("converting [" + value + "] to object wasn't
succuessful.");
throw new FacesException("Cannot convert parameter \"" + value +
"\" to the Capital.");
}
@Override
public String getAsString(FacesContext context, UIComponent component, Object value)
{
if (!(value instanceof Capital)) {
+ LOGGER.info("converting [" + value + "] to string wasn't
successful.");
throw new FacesException("Cannot convert parameter \"" + value
+ "\" to the String.");
}
+ LOGGER.info("converting object [" + value + "] to string [" +
capitalAsString((Capital) value) + "].");
return capitalAsString((Capital) value);
}
@@ -77,8 +80,12 @@
}
private String capitalAsString(Capital capital) {
- LOGGER.info("capital as string: " + capital.getName());
- return capital.getName();
+ if (capital == null) {
+ return null;
+ } else {
+ return capital.getName();
+ }
}
}
+
\ No newline at end of file
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/model/Capital.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/model/Capital.java 2011-09-13
09:34:13 UTC (rev 22715)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/model/Capital.java 2011-09-14
06:59:17 UTC (rev 22716)
@@ -82,6 +82,45 @@
this.timeZone = timeZone;
}
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + ((state == null) ? 0 : state.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ Capital other = (Capital) obj;
+ if (name == null) {
+ if (other.name != null) {
+ return false;
+ }
+ } else if (!name.equals(other.name)) {
+ return false;
+ }
+ if (state == null) {
+ if (other.state != null) {
+ return false;
+ }
+ } else if (!state.equals(other.state)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
public String toString() {
return name + " (" + state + ")";
}
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richOrderingList/simple.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richOrderingList/simple.xhtml 2011-09-13
09:34:13 UTC (rev 22715)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richOrderingList/simple.xhtml 2011-09-14
06:59:17 UTC (rev 22716)
@@ -31,9 +31,7 @@
<ui:define name="component">
<h:form>
- <h:commandButton value="submit">
- <f:ajax execute="@form" render="orderingList
output" />
- </h:commandButton>
+ <h:commandButton id="submitButton" value="submit"
execute="@form" />
<br />
<rich:orderingList
columnClasses="#{richOrderingListBean.attributes['columnClasses'].value}"
columnVar="#{richOrderingListBean.attributes['columnVar'].value}"
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richOrderingList/withColumn.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richOrderingList/withColumn.xhtml 2011-09-13
09:34:13 UTC (rev 22715)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richOrderingList/withColumn.xhtml 2011-09-14
06:59:17 UTC (rev 22716)
@@ -31,9 +31,7 @@
<ui:define name="component">
<h:form>
- <h:commandButton value="submit">
- <f:ajax execute="@form" render="orderingList
output" />
- </h:commandButton>
+ <h:commandButton id="submitButton" value="submit"
execute="@form" />
<hr />
<rich:orderingList
columnClasses="#{richOrderingListBean.attributes['columnClasses'].value}"
columnVar="#{richOrderingListBean.attributes['columnVar'].value}"
Show replies by date