1318 |
alexandre_ |
1 |
/*
|
|
|
2 |
Copyright (c) 2004-2006, The Dojo Foundation
|
|
|
3 |
All Rights Reserved.
|
|
|
4 |
|
|
|
5 |
Licensed under the Academic Free License version 2.1 or above OR the
|
|
|
6 |
modified BSD license. For more information on Dojo licensing, see:
|
|
|
7 |
|
|
|
8 |
http://dojotoolkit.org/community/licensing.shtml
|
|
|
9 |
*/
|
|
|
10 |
|
|
|
11 |
dojo.provide("dojo.widget.RealNumberTextbox");
|
|
|
12 |
dojo.require("dojo.widget.IntegerTextbox");
|
|
|
13 |
dojo.require("dojo.validate.common");
|
|
|
14 |
dojo.widget.defineWidget("dojo.widget.RealNumberTextbox", dojo.widget.IntegerTextbox, {mixInProperties:function (localProperties, frag) {
|
|
|
15 |
dojo.widget.RealNumberTextbox.superclass.mixInProperties.apply(this, arguments);
|
|
|
16 |
if (localProperties.places) {
|
|
|
17 |
this.flags.places = Number(localProperties.places);
|
|
|
18 |
}
|
|
|
19 |
if ((localProperties.exponent == "true") || (localProperties.exponent == "always")) {
|
|
|
20 |
this.flags.exponent = true;
|
|
|
21 |
} else {
|
|
|
22 |
if ((localProperties.exponent == "false") || (localProperties.exponent == "never")) {
|
|
|
23 |
this.flags.exponent = false;
|
|
|
24 |
} else {
|
|
|
25 |
this.flags.exponent = [true, false];
|
|
|
26 |
}
|
|
|
27 |
}
|
|
|
28 |
if ((localProperties.esigned == "true") || (localProperties.esigned == "always")) {
|
|
|
29 |
this.flags.eSigned = true;
|
|
|
30 |
} else {
|
|
|
31 |
if ((localProperties.esigned == "false") || (localProperties.esigned == "never")) {
|
|
|
32 |
this.flags.eSigned = false;
|
|
|
33 |
} else {
|
|
|
34 |
this.flags.eSigned = [true, false];
|
|
|
35 |
}
|
|
|
36 |
}
|
|
|
37 |
if (localProperties.min) {
|
|
|
38 |
this.flags.min = parseFloat(localProperties.min);
|
|
|
39 |
}
|
|
|
40 |
if (localProperties.max) {
|
|
|
41 |
this.flags.max = parseFloat(localProperties.max);
|
|
|
42 |
}
|
|
|
43 |
}, isValid:function () {
|
|
|
44 |
return dojo.validate.isRealNumber(this.textbox.value, this.flags);
|
|
|
45 |
}, isInRange:function () {
|
|
|
46 |
return dojo.validate.isInRange(this.textbox.value, this.flags);
|
|
|
47 |
}});
|
|
|
48 |
|