root / trunk / web / dojo / dijit / form / HorizontalRuleLabels.js
History | View | Annotate | Download (1.61 KB)
1 |
/*
|
---|---|
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["dijit.form.HorizontalRuleLabels"]){ |
9 |
dojo._hasResource["dijit.form.HorizontalRuleLabels"]=true; |
10 |
dojo.provide("dijit.form.HorizontalRuleLabels");
|
11 |
dojo.require("dijit.form.HorizontalRule");
|
12 |
dojo.declare("dijit.form.HorizontalRuleLabels",dijit.form.HorizontalRule,{templateString:"<div class=\"dijitRuleContainer dijitRuleContainerH dijitRuleLabelsContainer dijitRuleLabelsContainerH\"></div>",labelStyle:"",labels:[],numericMargin:0,minimum:0,maximum:1,constraints:{pattern:"#%"},_positionPrefix:"<div class=\"dijitRuleLabelContainer dijitRuleLabelContainerH\" style=\"left:",_labelPrefix:"\"><div class=\"dijitRuleLabel dijitRuleLabelH\">",_suffix:"</div></div>",_calcPosition:function(_1){ |
13 |
return _1;
|
14 |
},_genHTML:function(_2,_3){ |
15 |
return this._positionPrefix+this._calcPosition(_2)+this._positionSuffix+this.labelStyle+this._labelPrefix+this.labels[_3]+this._suffix; |
16 |
},getLabels:function(){ |
17 |
var _4=this.labels; |
18 |
if(!_4.length){
|
19 |
_4=dojo.query("> li",this.srcNodeRef).map(function(_5){ |
20 |
return String(_5.innerHTML);
|
21 |
}); |
22 |
} |
23 |
this.srcNodeRef.innerHTML=""; |
24 |
if(!_4.length&&this.count>1){ |
25 |
var _6=this.minimum; |
26 |
var _7=(this.maximum-_6)/(this.count-1); |
27 |
for(var i=0;i<this.count;i++){ |
28 |
_4.push((i<this.numericMargin||i>=(this.count-this.numericMargin))?"":dojo.number.format(_6,this.constraints)); |
29 |
_6+=_7; |
30 |
} |
31 |
} |
32 |
return _4;
|
33 |
},postMixInProperties:function(){ |
34 |
this.inherited(arguments); |
35 |
this.labels=this.getLabels(); |
36 |
this.count=this.labels.length; |
37 |
}}); |
38 |
} |