wicket 1.3.6/1.3.7 PagingNavigation broken

2009-08-31 Thread james o'brien
Paging navigation produces links (page 2) with start greater than end,
produces the wrong number of pages and is generally borked.  Has anyone else
noticed this?--jim


label fails serializable check when i override model().getObject (wicket 1.3.6)

2009-08-27 Thread james o'brien
I'm trying to change the text of label based on whether a flag is set for
graph or not graph.
graphLink.add(new Label("graphLinkLabel", new Model() {
@Override
public Object getObject() {
return isGraph ? "List" : "Graph";
}
}));

When I do this, I get a private
org.apache.wicket.markup.html.link.PopupSettings
org.apache.wicket.markup.html.link.Link.popupSettings[6]
[class=com.spinn.ui.person.weight.ViewWeights$4, path=6:border:graphLink]
  final javax.servlet.http.HttpServletRequest
com.spinn.ui.person.weight.ViewWeights$4.val$request
[class=org.apache.catalina.connector.RequestFacade] <- field that is not
serializable
at
org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:339)

If I change it to a normal label I do not.
Any ideas?
-jim


DateTextField Runtime Exception on loading textfield that doesn't match format

2009-05-14 Thread james o'brien
I have the following:

DateTextField when = new DateTextField("when", newPropertyModel(bloodPressure,
"when"), "M/d/");

when.setOutputMarkupId(true);

when.add(new DatePicker());


When the form loads with pre-existing date of this format: "5/1/09", I get
the following error:


java.lang.IllegalArgumentException: Cannot format given Object as a Date
 at java.text.DateFormat.format(DateFormat.java:279)
 at java.text.Format.format(Format.java:133)
 at
org.apache.wicket.util.convert.converters.DateConverter.convertToString(DateConverter.java:57)
 at
org.apache.wicket.Component.getModelObjectAsString(Component.java:1605)
 at
org.apache.wicket.Component.getModelObjectAsString(Component.java:1580)


TextField doesn't puke but I have been unable to set the date format for
DatePicker without using DateTextField.


Any suggestions?


Thanks,

--jim


Validator class cast exception wicket 1.3.5

2009-05-13 Thread James O'Brien
Hello,I have a converter which I can verify is being called, but when the
validator is being called it is not being called on the String value but the
object which causes a ClassCastException.

Here is my converter:

@Override

protected IConverterLocator newConverterLocator() {

ConverterLocator locator = new ConverterLocator();


 locator.set(types.thing.wc.microsoft.com.CodableValue.class, newIConverter() {


 public Object convertToObject(String arg0, Locale arg1) {

types.thing.wc.microsoft.com.CodableValue cv =
newtypes.thing.wc.microsoft.com.CodableValue();

cv.setText(arg0);

return cv;

}


 public String convertToString(Object arg0, Locale arg1) {

return ((types.thing.wc.microsoft.com.CodableValue) arg0).getText();

}

});


 return locator;

}


Here is my form:

TextField treatment = new TextField("treatment", new PropertyModel(allergy,
"treatment"));

treatment.setType(CodableValue.class);

treatment.add(StringValidator.lengthBetween(2, 200));

add(treatment);


Here is the error:


org.apache.wicket.WicketRuntimeException: Exception
'java.lang.ClassCastException: types.thing.wc.microsoft.com.CodableValue'
occurred during validation
org.apache.wicket.validation.validator.StringValidator$LengthBetweenValidator
on component 4:border:addAllergy:treatment

at
org.apache.wicket.markup.html.form.FormComponent.validateValidators(FormComponent.java:1510)

at
org.apache.wicket.markup.html.form.FormComponent.validate(FormComponent.java:1102)

at org.apache.wicket.markup.html.form.Form$21.validate(Form.java:1876)

at
org.apache.wicket.markup.html.form.Form$ValidationVisitor.formComponent(Form.java:165)

at
org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPostOrderHelper(FormComponent.java:421)

at
org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPostOrderHelper(FormComponent.java:408)

at
org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPostOrder(FormComponent.java:385)


Re: Validator class cast exception wicket 1.3.5

2009-05-13 Thread james o'brien
Hi Igor,
I'm a little confused.  I attached a StringValidator - shouldn't that work
on a String? Also I assumed Validators work on the values of form fields
after converted to String?Thanks,
--jim

On Wed, May 13, 2009 at 10:00 AM, james o'brien wrote:

> Hello,I have a converter which I can verify is being called, but when the
> validator is being called it is not being called on the String value but the
> object which causes a ClassCastException.
>
> Here is my converter:
>
>  @Override
>
>  protected IConverterLocator newConverterLocator() {
>
>  ConverterLocator locator = new ConverterLocator();
>
>
> locator.set(types.thing.wc.microsoft.com.CodableValue.class, new IConverter()
> {
>
>
>  public Object convertToObject(String arg0, Locale arg1) {
>
>  types.thing.wc.microsoft.com.CodableValue cv = new
>  types.thing.wc.microsoft.com.CodableValue();
>
>  cv.setText(arg0);
>
> return cv;
>
> }
>
>
> public String convertToString(Object arg0, Locale arg1) {
>
> return ((types.thing.wc.microsoft.com.CodableValue) arg0).getText();
>
> }
>
>  });
>
>
>  return locator;
>
>  }
>
>
> Here is my form:
>
>  TextField treatment = new TextField("treatment", new
>  PropertyModel(allergy, "treatment"));
>
> treatment.setType(CodableValue.class);
>
> treatment.add(StringValidator.lengthBetween(2, 200));
>
> add(treatment);
>
>
> Here is the error:
>
>
> org.apache.wicket.WicketRuntimeException: Exception
> 'java.lang.ClassCastException: types.thing.wc.microsoft.com.CodableValue'
> occurred during validation
> org.apache.wicket.validation.validator.StringValidator$LengthBetweenValidator
> on component 4:border:addAllergy:treatment
>
> at
> org.apache.wicket.markup.html.form.FormComponent.validateValidators(FormComponent.java:1510)
>
> at
> org.apache.wicket.markup.html.form.FormComponent.validate(FormComponent.java:1102)
>
> at org.apache.wicket.markup.html.form.Form$21.validate(Form.java:1876)
>
> at
> org.apache.wicket.markup.html.form.Form$ValidationVisitor.formComponent(Form.java:165)
>
> at
> org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPostOrderHelper(FormComponent.java:421)
>
> at
> org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPostOrderHelper(FormComponent.java:408)
>
> at
> org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPostOrder(FormComponent.java:385)
>


Validator class cast exception wicket 1.3.5

2009-05-13 Thread james o'brien
Hello,I have a converter which I can verify is being called, but when the
validator is being called it is not being called on the String value but the
object which causes a ClassCastException.

Here is my converter:

@Override

protected IConverterLocator newConverterLocator() {

ConverterLocator locator = new ConverterLocator();


locator.set(types.thing.wc.microsoft.com.CodableValue.class, new IConverter()
{


public Object convertToObject(String arg0, Locale arg1) {

types.thing.wc.microsoft.com.CodableValue cv = new
 types.thing.wc.microsoft.com.CodableValue();

cv.setText(arg0);

return cv;

}


public String convertToString(Object arg0, Locale arg1) {

return ((types.thing.wc.microsoft.com.CodableValue) arg0).getText();

}

});


return locator;

}


Here is my form:

TextField treatment = new TextField("treatment", new PropertyModel(allergy,
"treatment"));

treatment.setType(CodableValue.class);

treatment.add(StringValidator.lengthBetween(2, 200));

add(treatment);


Here is the error:


org.apache.wicket.WicketRuntimeException: Exception
'java.lang.ClassCastException: types.thing.wc.microsoft.com.CodableValue'
occurred during validation
org.apache.wicket.validation.validator.StringValidator$LengthBetweenValidator
on component 4:border:addAllergy:treatment

at
org.apache.wicket.markup.html.form.FormComponent.validateValidators(FormComponent.java:1510)

at
org.apache.wicket.markup.html.form.FormComponent.validate(FormComponent.java:1102)

at org.apache.wicket.markup.html.form.Form$21.validate(Form.java:1876)

at
org.apache.wicket.markup.html.form.Form$ValidationVisitor.formComponent(Form.java:165)

at
org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPostOrderHelper(FormComponent.java:421)

at
org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPostOrderHelper(FormComponent.java:408)

at
org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPostOrder(FormComponent.java:385)


radiochoice and propertymodel ignoring converter (wicket 1.3.5)

2009-05-06 Thread james o'brien
I have a custom converter registered for Boolean.class that converts "yes"
to Boolean(true) and "no" to Boolean(false).  When the RadioChoice loads the
converter is never called.




private static final List IRREGULAR_HEARTBEAT =
Arrays.asList(newString[] {
"yes", "no" });

RadioChoice irregular = new RadioChoice("irregularHeartbeat",
newPropertyModel(bloodPressure,

"irregularHeartbeat"), IRREGULAR_HEARTBEAT).setSuffix(" ");


BloodPressure Object:


public Boolean isIrregularHeartbeat() {

return bloodPressure.isIrregularHeartbeat();

}

public void setIrregularHeartbeat(Boolean value) {

bloodPressure.setIrregularHeartbeat(value);

}



Thanks,
--jim