root / trunk / web / dojo / dojox / form / TimeSpinner.js @ 12
History | View | Annotate | Download (1.25 KB)
1 | 9 | andrej.cim | /*
|
---|---|---|---|
2 | Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||
3 | Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||
4 | see: http://dojotoolkit.org/license for details
|
||
5 | */
|
||
6 | |||
7 | |||
8 | if(!dojo._hasResource["dojox.form.TimeSpinner"]){ |
||
9 | dojo._hasResource["dojox.form.TimeSpinner"]=true; |
||
10 | dojo.provide("dojox.form.TimeSpinner");
|
||
11 | dojo.require("dijit.form._Spinner");
|
||
12 | dojo.require("dojo.date");
|
||
13 | dojo.require("dojo.date.locale");
|
||
14 | dojo.require("dojo.date.stamp");
|
||
15 | dojo.declare("dojox.form.TimeSpinner",[dijit.form._Spinner],{required:false,adjust:function(_1,_2){ |
||
16 | return dojo.date.add(_1,"minute",_2); |
||
17 | },isValid:function(){ |
||
18 | return true; |
||
19 | },smallDelta:5,largeDelta:30,timeoutChangeRate:0.5,parse:function(_3,_4){ |
||
20 | return dojo.date.locale.parse(_3,{selector:"time",formatLength:"short"}); |
||
21 | },format:function(_5,_6){ |
||
22 | if(dojo.isString(_5)){
|
||
23 | return _5;
|
||
24 | } |
||
25 | return dojo.date.locale.format(_5,{selector:"time",formatLength:"short"}); |
||
26 | },serialize:dojo.date.stamp.toISOString,value:"12:00 AM",_onKeyPress:function(e){ |
||
27 | if((e.charOrCode==dojo.keys.HOME||e.charOrCode==dojo.keys.END)&&!(e.ctrlKey||e.altKey||e.metaKey)&&typeof this.get("value")!="undefined"){ |
||
28 | var _7=this.constraints[(e.charOrCode==dojo.keys.HOME?"min":"max")]; |
||
29 | if(_7){
|
||
30 | this._setValueAttr(_7,true); |
||
31 | } |
||
32 | dojo.stopEvent(e); |
||
33 | } |
||
34 | }}); |
||
35 | } |