SV: Correct use of RangeValidator

2009-03-17 Thread Wilhelmsen Tor Iver
WicketMessage: Exception 'java.lang.ClassCastException: java.lang.Integer' occurred during validation org.apache.wicket.validation.validator.RangeValidator on component 2:body:recvAnalisysForm:intField Root cause:java.lang.ClassCastException: java.lang.Integer at

Re: Correct use of RangeValidator

2009-03-17 Thread Igor Vaynberg
to construct a textfield that works with integer you either have to pass Integer.class as a constructor arg, or call setType(Integer.class); -igor On Tue, Mar 17, 2009 at 8:21 AM, Wilhelmsen Tor Iver toriv...@arrive.no wrote: WicketMessage: Exception 'java.lang.ClassCastException:

Re: Correct use of RangeValidator

2009-03-17 Thread Warren Bell
I thought that I was telling the TextField, by the type Integer, that it's model object is an integer. And I thought that it would retrieve its value from the model I set on it's form. super(name, new CompoundPropertyModelValueMap(valueMap) valueMap is an existing ValueMap with a value with

Re: Correct use of RangeValidator

2009-03-17 Thread Igor Vaynberg
textfield doesnt know that it has been declared as textfieldinteger at runtime unless it is an anonymous class. welcome to java generics. lookup type erasure. -igor On Tue, Mar 17, 2009 at 11:44 AM, Warren Bell warrenbe...@gmail.com wrote: I thought that I was telling the TextField, by the type

Re: Correct use of RangeValidator

2009-03-17 Thread Adriano dos Santos Fernandes
Igor Vaynberg escreveu: textfield doesnt know that it has been declared as textfieldinteger at runtime unless it is an anonymous class. welcome to java generics. lookup type erasure. Hmm... And what about work done using IObjectClassAwareModel? It seems to work for me, I never need to pass

Re: Correct use of RangeValidator

2009-03-17 Thread Igor Vaynberg
if you use a propertymodel alongside a formcomponent then yes, but it is not the generic you declare that is used, it is the model performing a runtime reflection check on the type of getter/field it is using. -igor On Tue, Mar 17, 2009 at 12:08 PM, Adriano dos Santos Fernandes

Re: Correct use of RangeValidator

2009-03-17 Thread Matej Knopp
If you are using a map TextField can't determine the type. -Matej On Tue, Mar 17, 2009 at 9:27 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: if you use a propertymodel alongside a formcomponent then yes, but it is not the generic you declare that is used, it is the model performing a

Correct use of RangeValidator

2009-03-16 Thread Warren Bell
I am getting a ClassCastException when using RangeValidator like this: RequiredTextFieldInteger intField = new RequiredTextFieldInteger(intField); intField.add(new RangeValidator(0, 100)); or like this: RequiredTextFieldInteger intField = new RequiredTextFieldInteger(intField);