Validators in 1.4-rc1

2008-11-18 Thread Adriano dos Santos Fernandes

I had this in 1.4-m3 working:
   long value = ...;
   textField.add(NumberValidator.maximum(value));

My textField is instantiated as TextFieldInteger and declared as 
TextField?, so I put a long validation for a Integer TextField. It 
also works in 1.4-rc1, but NumberValidator is deprecated.


So I had replaced it:
   textField.add(new MaximumValidator(value));

It caused a warning and assumes a MaximumValidatorLong. This code 
caused a runtime exception:
   WicketMessage: Exception 'java.lang.ClassCastException: 
java.lang.Long cannot be cast to java.lang.Integer' occurred during 
validation ...


How could I have this type of validator? I tried a 
MaximumValidatorNumber but it's not compilable.



Adriano


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Validators in 1.4-rc1

2008-11-18 Thread Jeremy Thomerson
how about new MaximumValidatorInteger(value)?


-- 
Jeremy Thomerson
http://www.wickettraining.com
On Tue, Nov 18, 2008 at 11:37 AM, Adriano dos Santos Fernandes 
[EMAIL PROTECTED] wrote:

 I had this in 1.4-m3 working:
   long value = ...;
   textField.add(NumberValidator.maximum(value));

 My textField is instantiated as TextFieldInteger and declared as
 TextField?, so I put a long validation for a Integer TextField. It also
 works in 1.4-rc1, but NumberValidator is deprecated.

 So I had replaced it:
   textField.add(new MaximumValidator(value));

 It caused a warning and assumes a MaximumValidatorLong. This code caused
 a runtime exception:
   WicketMessage: Exception 'java.lang.ClassCastException: java.lang.Long
 cannot be cast to java.lang.Integer' occurred during validation ...

 How could I have this type of validator? I tried a MaximumValidatorNumber
 but it's not compilable.


 Adriano


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: Validators in 1.4-rc1

2008-11-18 Thread Adriano dos Santos Fernandes

Jeremy Thomerson escreveu:

how about new MaximumValidatorInteger(value)?
  
The problem is that I'm iterating on a list of unknown text fields. And 
the maximum value is from a Entity using Hibernate Annotation.


So it seems a valid case to validate a TextFieldInteger with a long.


Adriano


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]