]>
git.wh0rd.org - tt-rss.git/blob - lib/dijit/form/CheckBox.js
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
8 if(!dojo
._hasResource
["dijit.form.CheckBox"]){
9 dojo
._hasResource
["dijit.form.CheckBox"]=true;
10 dojo
.provide("dijit.form.CheckBox");
11 dojo
.require("dijit.form.ToggleButton");
12 dojo
.declare("dijit.form.CheckBox",dijit
.form
.ToggleButton
,{templateString
:dojo
.cache("dijit.form","templates/CheckBox.html","<div class=\"dijit dijitReset dijitInline\" waiRole=\"presentation\"\n\t><input\n\t \t${!nameAttrSetting} type=\"${type}\" ${checkedAttrSetting}\n\t\tclass=\"dijitReset dijitCheckBoxInput\"\n\t\tdojoAttachPoint=\"focusNode\"\n\t \tdojoAttachEvent=\"onclick:_onClick\"\n/></div>\n"),baseClass
:"dijitCheckBox",type
:"checkbox",value
:"on",readOnly
:false,attributeMap
:dojo
.delegate(dijit
.form
._FormWidget
.prototype.attributeMap
,{readOnly
:"focusNode"}),_setReadOnlyAttr:function(_1
){
14 dojo
.attr(this.focusNode
,"readOnly",_1
);
15 dijit
.setWaiState(this.focusNode
,"readonly",_1
);
16 },_setValueAttr:function(_2
,_3
){
17 if(typeof _2
=="string"){
19 dojo
.attr(this.focusNode
,"value",_2
);
23 this.set("checked",_2
,_3
);
25 },_getValueAttr:function(){
26 return (this.checked
?this.value
:false);
27 },_setLabelAttr
:undefined,postMixInProperties:function(){
31 this.checkedAttrSetting
=this.checked
?"checked":"";
32 this.inherited(arguments
);
33 },_fillContent:function(_4
){
35 this._hasBeenBlurred
=false;
36 this.set("checked",this.params
.checked
||false);
37 this.value
=this.params
.value
||"on";
38 dojo
.attr(this.focusNode
,"value",this.value
);
39 },_onFocus:function(){
41 dojo
.query("label[for='"+this.id
+"']").addClass("dijitFocusedLabel");
43 this.inherited(arguments
);
46 dojo
.query("label[for='"+this.id
+"']").removeClass("dijitFocusedLabel");
48 this.inherited(arguments
);
49 },_onClick:function(e
){
53 return this.inherited(arguments
);
55 dojo
.declare("dijit.form.RadioButton",dijit
.form
.CheckBox
,{type
:"radio",baseClass
:"dijitRadio",_setCheckedAttr:function(_5
){
56 this.inherited(arguments
);
62 dojo
.query("INPUT[type=radio]",this.focusNode
.form
||dojo
.doc
).forEach(function(_7
){
63 if(_7
.name
==_6
.name
&&_7
!=_6
.focusNode
&&_7
.form
==_6
.focusNode
.form
){
64 var _8
=dijit
.getEnclosingWidget(_7
);
66 _8
.set("checked",false);
71 },_clicked:function(e
){
73 this.set("checked",true);