You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pivot.apache.org by Greg Brown <gk...@mac.com> on 2010/02/25 17:17:10 UTC
Minor validator change
Anyone have any issues with this change? I think it makes the range validators a bit more useful, since I can do something like this to ensure that the user enters a positive value (my use case is a currency amount):
<text:FloatRangeValidator minValue="0"/>
Re: Minor validator change
Posted by Greg Brown <gk...@mac.com>.
Interesting. I didn't realize that the integer and floating point definitions of MIN_VALUE were different.
So yes, that is probably what I mean. :-) I'll fix it - thanks.
On Feb 25, 2010, at 3:51 PM, Noel Grandin wrote:
> Looks good, but I think you mean:
>
> public DoubleRangeValidator() {
> - this.minValue = 0;
> - this.maxValue = 1;
> + this.minValue = -Double.MAX_VALUE;
> + this.maxValue = Double.MAX_VALUE;
> }
>
>
> On Thu, Feb 25, 2010 at 19:45, Todd Volkert <tv...@gmail.com> wrote:
>> I like it :)
>>
>> -T
>>
>> On Thu, Feb 25, 2010 at 12:06 PM, Greg Brown <gk...@mac.com> wrote:
>>
>>> I did. I thought it was only source attachments that got dropped. Here it
>>> is:
>>>
>>> Index:
>>> wtk/src/org/apache/pivot/wtk/text/validation/FloatRangeValidator.java
>>> ===================================================================
>>> --- wtk/src/org/apache/pivot/wtk/text/validation/FloatRangeValidator.java
>>> (revision 912430)
>>> +++ wtk/src/org/apache/pivot/wtk/text/validation/FloatRangeValidator.java
>>> (working copy)
>>> @@ -22,14 +22,14 @@
>>> private float minValue, maxValue;
>>>
>>> public FloatRangeValidator() {
>>> - this.minValue = 0;
>>> - this.maxValue = 1;
>>> + this.minValue = Float.MIN_VALUE;
>>> + this.maxValue = Float.MAX_VALUE;
>>> }
>>>
>>> public FloatRangeValidator(Locale locale) {
>>> super(locale);
>>> - this.minValue = 0;
>>> - this.maxValue = 1;
>>> + this.minValue = Float.MIN_VALUE;
>>> + this.maxValue = Float.MAX_VALUE;
>>> }
>>>
>>> public FloatRangeValidator(float minValue, float maxValue) {
>>> Index:
>>> wtk/src/org/apache/pivot/wtk/text/validation/DoubleRangeValidator.java
>>> ===================================================================
>>> --- wtk/src/org/apache/pivot/wtk/text/validation/DoubleRangeValidator.java
>>> (revision 912430)
>>> +++ wtk/src/org/apache/pivot/wtk/text/validation/DoubleRangeValidator.java
>>> (working copy)
>>> @@ -22,14 +22,14 @@
>>> private double minValue, maxValue;
>>>
>>> public DoubleRangeValidator() {
>>> - this.minValue = 0;
>>> - this.maxValue = 1;
>>> + this.minValue = Double.MIN_VALUE;
>>> + this.maxValue = Double.MAX_VALUE;
>>> }
>>>
>>> public DoubleRangeValidator(Locale locale) {
>>> super(locale);
>>> - this.minValue = 0;
>>> - this.maxValue = 1;
>>> + this.minValue = Double.MIN_VALUE;
>>> + this.maxValue = Double.MAX_VALUE;
>>> }
>>>
>>> public DoubleRangeValidator(double minValue, double maxValue) {
>>> Index: wtk/src/org/apache/pivot/wtk/text/validation/IntRangeValidator.java
>>> ===================================================================
>>> --- wtk/src/org/apache/pivot/wtk/text/validation/IntRangeValidator.java
>>> (revision 912430)
>>> +++ wtk/src/org/apache/pivot/wtk/text/validation/IntRangeValidator.java
>>> (working copy)
>>> @@ -22,14 +22,14 @@
>>> private int minValue, maxValue;
>>>
>>> public IntRangeValidator() {
>>> - this.minValue = 0;
>>> - this.maxValue = 1;
>>> + this.minValue = Integer.MIN_VALUE;
>>> + this.maxValue = Integer.MAX_VALUE;
>>> }
>>>
>>> public IntRangeValidator(Locale locale) {
>>> super(locale);
>>> - this.minValue = 0;
>>> - this.maxValue = 1;
>>> + this.minValue = Integer.MIN_VALUE;
>>> + this.maxValue = Integer.MAX_VALUE;
>>> }
>>>
>>> public IntRangeValidator(int minValue, int maxValue) {
>>>
>>>
>>> On Feb 25, 2010, at 11:54 AM, Todd Volkert wrote:
>>>
>>>> I assume you attached a patch, but it didn't come through.
>>>>
>>>> -T
>>>>
>>>> On Thu, Feb 25, 2010 at 11:17 AM, Greg Brown <gk...@mac.com> wrote:
>>>>
>>>>> Anyone have any issues with this change? I think it makes the range
>>>>> validators a bit more useful, since I can do something like this to
>>> ensure
>>>>> that the user enters a positive value (my use case is a currency
>>> amount):
>>>>>
>>>>> <text:FloatRangeValidator minValue="0"/>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>>
>>
Re: Minor validator change
Posted by Noel Grandin <no...@gmail.com>.
Looks good, but I think you mean:
public DoubleRangeValidator() {
- this.minValue = 0;
- this.maxValue = 1;
+ this.minValue = -Double.MAX_VALUE;
+ this.maxValue = Double.MAX_VALUE;
}
On Thu, Feb 25, 2010 at 19:45, Todd Volkert <tv...@gmail.com> wrote:
> I like it :)
>
> -T
>
> On Thu, Feb 25, 2010 at 12:06 PM, Greg Brown <gk...@mac.com> wrote:
>
>> I did. I thought it was only source attachments that got dropped. Here it
>> is:
>>
>> Index:
>> wtk/src/org/apache/pivot/wtk/text/validation/FloatRangeValidator.java
>> ===================================================================
>> --- wtk/src/org/apache/pivot/wtk/text/validation/FloatRangeValidator.java
>> (revision 912430)
>> +++ wtk/src/org/apache/pivot/wtk/text/validation/FloatRangeValidator.java
>> (working copy)
>> @@ -22,14 +22,14 @@
>> private float minValue, maxValue;
>>
>> public FloatRangeValidator() {
>> - this.minValue = 0;
>> - this.maxValue = 1;
>> + this.minValue = Float.MIN_VALUE;
>> + this.maxValue = Float.MAX_VALUE;
>> }
>>
>> public FloatRangeValidator(Locale locale) {
>> super(locale);
>> - this.minValue = 0;
>> - this.maxValue = 1;
>> + this.minValue = Float.MIN_VALUE;
>> + this.maxValue = Float.MAX_VALUE;
>> }
>>
>> public FloatRangeValidator(float minValue, float maxValue) {
>> Index:
>> wtk/src/org/apache/pivot/wtk/text/validation/DoubleRangeValidator.java
>> ===================================================================
>> --- wtk/src/org/apache/pivot/wtk/text/validation/DoubleRangeValidator.java
>> (revision 912430)
>> +++ wtk/src/org/apache/pivot/wtk/text/validation/DoubleRangeValidator.java
>> (working copy)
>> @@ -22,14 +22,14 @@
>> private double minValue, maxValue;
>>
>> public DoubleRangeValidator() {
>> - this.minValue = 0;
>> - this.maxValue = 1;
>> + this.minValue = Double.MIN_VALUE;
>> + this.maxValue = Double.MAX_VALUE;
>> }
>>
>> public DoubleRangeValidator(Locale locale) {
>> super(locale);
>> - this.minValue = 0;
>> - this.maxValue = 1;
>> + this.minValue = Double.MIN_VALUE;
>> + this.maxValue = Double.MAX_VALUE;
>> }
>>
>> public DoubleRangeValidator(double minValue, double maxValue) {
>> Index: wtk/src/org/apache/pivot/wtk/text/validation/IntRangeValidator.java
>> ===================================================================
>> --- wtk/src/org/apache/pivot/wtk/text/validation/IntRangeValidator.java
>> (revision 912430)
>> +++ wtk/src/org/apache/pivot/wtk/text/validation/IntRangeValidator.java
>> (working copy)
>> @@ -22,14 +22,14 @@
>> private int minValue, maxValue;
>>
>> public IntRangeValidator() {
>> - this.minValue = 0;
>> - this.maxValue = 1;
>> + this.minValue = Integer.MIN_VALUE;
>> + this.maxValue = Integer.MAX_VALUE;
>> }
>>
>> public IntRangeValidator(Locale locale) {
>> super(locale);
>> - this.minValue = 0;
>> - this.maxValue = 1;
>> + this.minValue = Integer.MIN_VALUE;
>> + this.maxValue = Integer.MAX_VALUE;
>> }
>>
>> public IntRangeValidator(int minValue, int maxValue) {
>>
>>
>> On Feb 25, 2010, at 11:54 AM, Todd Volkert wrote:
>>
>> > I assume you attached a patch, but it didn't come through.
>> >
>> > -T
>> >
>> > On Thu, Feb 25, 2010 at 11:17 AM, Greg Brown <gk...@mac.com> wrote:
>> >
>> >> Anyone have any issues with this change? I think it makes the range
>> >> validators a bit more useful, since I can do something like this to
>> ensure
>> >> that the user enters a positive value (my use case is a currency
>> amount):
>> >>
>> >> <text:FloatRangeValidator minValue="0"/>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>>
>>
>
Re: Minor validator change
Posted by Todd Volkert <tv...@gmail.com>.
I like it :)
-T
On Thu, Feb 25, 2010 at 12:06 PM, Greg Brown <gk...@mac.com> wrote:
> I did. I thought it was only source attachments that got dropped. Here it
> is:
>
> Index:
> wtk/src/org/apache/pivot/wtk/text/validation/FloatRangeValidator.java
> ===================================================================
> --- wtk/src/org/apache/pivot/wtk/text/validation/FloatRangeValidator.java
> (revision 912430)
> +++ wtk/src/org/apache/pivot/wtk/text/validation/FloatRangeValidator.java
> (working copy)
> @@ -22,14 +22,14 @@
> private float minValue, maxValue;
>
> public FloatRangeValidator() {
> - this.minValue = 0;
> - this.maxValue = 1;
> + this.minValue = Float.MIN_VALUE;
> + this.maxValue = Float.MAX_VALUE;
> }
>
> public FloatRangeValidator(Locale locale) {
> super(locale);
> - this.minValue = 0;
> - this.maxValue = 1;
> + this.minValue = Float.MIN_VALUE;
> + this.maxValue = Float.MAX_VALUE;
> }
>
> public FloatRangeValidator(float minValue, float maxValue) {
> Index:
> wtk/src/org/apache/pivot/wtk/text/validation/DoubleRangeValidator.java
> ===================================================================
> --- wtk/src/org/apache/pivot/wtk/text/validation/DoubleRangeValidator.java
> (revision 912430)
> +++ wtk/src/org/apache/pivot/wtk/text/validation/DoubleRangeValidator.java
> (working copy)
> @@ -22,14 +22,14 @@
> private double minValue, maxValue;
>
> public DoubleRangeValidator() {
> - this.minValue = 0;
> - this.maxValue = 1;
> + this.minValue = Double.MIN_VALUE;
> + this.maxValue = Double.MAX_VALUE;
> }
>
> public DoubleRangeValidator(Locale locale) {
> super(locale);
> - this.minValue = 0;
> - this.maxValue = 1;
> + this.minValue = Double.MIN_VALUE;
> + this.maxValue = Double.MAX_VALUE;
> }
>
> public DoubleRangeValidator(double minValue, double maxValue) {
> Index: wtk/src/org/apache/pivot/wtk/text/validation/IntRangeValidator.java
> ===================================================================
> --- wtk/src/org/apache/pivot/wtk/text/validation/IntRangeValidator.java
> (revision 912430)
> +++ wtk/src/org/apache/pivot/wtk/text/validation/IntRangeValidator.java
> (working copy)
> @@ -22,14 +22,14 @@
> private int minValue, maxValue;
>
> public IntRangeValidator() {
> - this.minValue = 0;
> - this.maxValue = 1;
> + this.minValue = Integer.MIN_VALUE;
> + this.maxValue = Integer.MAX_VALUE;
> }
>
> public IntRangeValidator(Locale locale) {
> super(locale);
> - this.minValue = 0;
> - this.maxValue = 1;
> + this.minValue = Integer.MIN_VALUE;
> + this.maxValue = Integer.MAX_VALUE;
> }
>
> public IntRangeValidator(int minValue, int maxValue) {
>
>
> On Feb 25, 2010, at 11:54 AM, Todd Volkert wrote:
>
> > I assume you attached a patch, but it didn't come through.
> >
> > -T
> >
> > On Thu, Feb 25, 2010 at 11:17 AM, Greg Brown <gk...@mac.com> wrote:
> >
> >> Anyone have any issues with this change? I think it makes the range
> >> validators a bit more useful, since I can do something like this to
> ensure
> >> that the user enters a positive value (my use case is a currency
> amount):
> >>
> >> <text:FloatRangeValidator minValue="0"/>
> >>
> >>
> >>
> >>
> >>
> >>
>
>
Re: Minor validator change
Posted by Greg Brown <gk...@mac.com>.
I did. I thought it was only source attachments that got dropped. Here it is:
Index: wtk/src/org/apache/pivot/wtk/text/validation/FloatRangeValidator.java
===================================================================
--- wtk/src/org/apache/pivot/wtk/text/validation/FloatRangeValidator.java (revision 912430)
+++ wtk/src/org/apache/pivot/wtk/text/validation/FloatRangeValidator.java (working copy)
@@ -22,14 +22,14 @@
private float minValue, maxValue;
public FloatRangeValidator() {
- this.minValue = 0;
- this.maxValue = 1;
+ this.minValue = Float.MIN_VALUE;
+ this.maxValue = Float.MAX_VALUE;
}
public FloatRangeValidator(Locale locale) {
super(locale);
- this.minValue = 0;
- this.maxValue = 1;
+ this.minValue = Float.MIN_VALUE;
+ this.maxValue = Float.MAX_VALUE;
}
public FloatRangeValidator(float minValue, float maxValue) {
Index: wtk/src/org/apache/pivot/wtk/text/validation/DoubleRangeValidator.java
===================================================================
--- wtk/src/org/apache/pivot/wtk/text/validation/DoubleRangeValidator.java (revision 912430)
+++ wtk/src/org/apache/pivot/wtk/text/validation/DoubleRangeValidator.java (working copy)
@@ -22,14 +22,14 @@
private double minValue, maxValue;
public DoubleRangeValidator() {
- this.minValue = 0;
- this.maxValue = 1;
+ this.minValue = Double.MIN_VALUE;
+ this.maxValue = Double.MAX_VALUE;
}
public DoubleRangeValidator(Locale locale) {
super(locale);
- this.minValue = 0;
- this.maxValue = 1;
+ this.minValue = Double.MIN_VALUE;
+ this.maxValue = Double.MAX_VALUE;
}
public DoubleRangeValidator(double minValue, double maxValue) {
Index: wtk/src/org/apache/pivot/wtk/text/validation/IntRangeValidator.java
===================================================================
--- wtk/src/org/apache/pivot/wtk/text/validation/IntRangeValidator.java (revision 912430)
+++ wtk/src/org/apache/pivot/wtk/text/validation/IntRangeValidator.java (working copy)
@@ -22,14 +22,14 @@
private int minValue, maxValue;
public IntRangeValidator() {
- this.minValue = 0;
- this.maxValue = 1;
+ this.minValue = Integer.MIN_VALUE;
+ this.maxValue = Integer.MAX_VALUE;
}
public IntRangeValidator(Locale locale) {
super(locale);
- this.minValue = 0;
- this.maxValue = 1;
+ this.minValue = Integer.MIN_VALUE;
+ this.maxValue = Integer.MAX_VALUE;
}
public IntRangeValidator(int minValue, int maxValue) {
On Feb 25, 2010, at 11:54 AM, Todd Volkert wrote:
> I assume you attached a patch, but it didn't come through.
>
> -T
>
> On Thu, Feb 25, 2010 at 11:17 AM, Greg Brown <gk...@mac.com> wrote:
>
>> Anyone have any issues with this change? I think it makes the range
>> validators a bit more useful, since I can do something like this to ensure
>> that the user enters a positive value (my use case is a currency amount):
>>
>> <text:FloatRangeValidator minValue="0"/>
>>
>>
>>
>>
>>
>>
Re: Minor validator change
Posted by Todd Volkert <tv...@gmail.com>.
I assume you attached a patch, but it didn't come through.
-T
On Thu, Feb 25, 2010 at 11:17 AM, Greg Brown <gk...@mac.com> wrote:
> Anyone have any issues with this change? I think it makes the range
> validators a bit more useful, since I can do something like this to ensure
> that the user enters a positive value (my use case is a currency amount):
>
> <text:FloatRangeValidator minValue="0"/>
>
>
>
>
>
>