summaryrefslogtreecommitdiff
path: root/includes/js/dijit/form/NumberTextBox.js
diff options
context:
space:
mode:
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-13 09:49:11 +0000
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-13 09:49:11 +0000
commite44a7e37b6c7b5961adaffc62b9042b8d442938e (patch)
tree95b67c356e93163467db2451f2b8cce84ed5d582 /includes/js/dijit/form/NumberTextBox.js
parenta62b9742ee5e28bcec6872d88f50f25b820914f6 (diff)
downloadsemanticscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.gz
semanticscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.bz2
New feature: basic Ajax suggestion for tags and implementation of Dojo toolkit
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@151 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'includes/js/dijit/form/NumberTextBox.js')
-rw-r--r--includes/js/dijit/form/NumberTextBox.js79
1 files changed, 79 insertions, 0 deletions
diff --git a/includes/js/dijit/form/NumberTextBox.js b/includes/js/dijit/form/NumberTextBox.js
new file mode 100644
index 0000000..f8344a9
--- /dev/null
+++ b/includes/js/dijit/form/NumberTextBox.js
@@ -0,0 +1,79 @@
+if(!dojo._hasResource["dijit.form.NumberTextBox"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dijit.form.NumberTextBox"] = true;
+dojo.provide("dijit.form.NumberTextBox");
+
+dojo.require("dijit.form.ValidationTextBox");
+dojo.require("dojo.number");
+
+/*=====
+dojo.declare(
+ "dijit.form.NumberTextBox.__Constraints",
+ [dijit.form.RangeBoundTextBox.__Constraints, dojo.number.__FormatOptions, dojo.number.__ParseOptions]
+);
+=====*/
+
+dojo.declare(
+ "dijit.form.NumberTextBoxMixin",
+ null,
+ {
+ // summary:
+ // A mixin for all number textboxes
+
+ regExpGen: dojo.number.regexp,
+
+ /*=====
+ // constraints: dijit.form.NumberTextBox.__Constraints
+ constraints: {},
+ ======*/
+
+ // editOptions: Object
+ // properties to mix into constraints when the value is being edited
+ editOptions: { pattern: '#.######' },
+
+ _onFocus: function(){
+ this.setValue(this.getValue(), false);
+ this.inherited(arguments);
+ },
+
+ _formatter: dojo.number.format,
+
+ format: function(/*Number*/ value, /*dojo.number.__FormatOptions*/ constraints){
+ // summary: formats the value as a Number, according to constraints
+
+ if(typeof value == "string") { return value; }
+ if(isNaN(value)){ return ""; }
+ if(this.editOptions && this._focused){
+ constraints = dojo.mixin(dojo.mixin({}, this.editOptions), this.constraints);
+ }
+ return this._formatter(value, constraints);
+ },
+
+ parse: dojo.number.parse,
+ /*=====
+ parse: function(value, constraints){
+ // summary: parses the value as a Number, according to constraints
+ // value: String
+ //
+ // constraints: dojo.number.__ParseOptions
+ },
+ =====*/
+
+ filter: function(/*Number*/ value){
+ if(typeof value == "string"){ return this.inherited('filter', arguments); }
+ return isNaN(value) ? '' : value;
+ },
+
+ value: NaN
+ }
+);
+
+dojo.declare(
+ "dijit.form.NumberTextBox",
+ [dijit.form.RangeBoundTextBox,dijit.form.NumberTextBoxMixin],
+ {
+ // summary:
+ // A validating, serializable, range-bound text box.
+ }
+);
+
+}