1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- define("dojox/charting/widget/BidiSupport", ["dojo/dom", "dojo/_base/lang", "dojo/_base/html", "dojo/_base/array", "dojo/_base/connect", "dojo/query",
- "dijit/_BidiSupport", "../BidiSupport", "dijit/registry", "./Chart", "./Legend"],
- function(dom, lang, html, arrayUtil, hub, query, dBidi, cBidi, widgetManager, Chart, Legend){
-
- if( Legend ){
- lang.extend(Legend, {
-
-
-
-
-
- postMixInProperties: function(){
-
-
-
-
-
-
-
- if(!this.chart){
- if(!this.chartRef){ return; }
- var chart = widgetManager.byId(this.chartRef);
- if(!chart){
- var node = dom.byId(this.chartRef);
- if(node){
- chart = widgetManager.byNode(node);
- }else{
- return;
- }
- }
- this.textDir = chart.chart.textDir;
- hub.connect(chart.chart, "setTextDir", this, "_setTextDirAttr");
- }else{
- this.textDir = this.chart.textDir;
- hub.connect(this.chart, "setTextDir", this, "_setTextDirAttr");
- }
- },
- _setTextDirAttr: function(/*String*/ textDir){
-
-
-
-
-
-
-
-
-
- if(validateTextDir(textDir) != null){
- if(this.textDir != textDir){
- this._set("textDir", textDir);
-
- var legendLabels = query(".dojoxLegendText", this._tr);
-
- arrayUtil.forEach(legendLabels, function(label){
- label.dir = this.getTextDir(label.innerHTML, label.dir);
- }, this);
- }
- }
- }
- });
- }
-
-
- if( Chart ){
- lang.extend( Chart ,{
- postMixInProperties: function(){
-
-
-
- this.textDir = this.params["textDir"] ? this.params["textDir"] : this.params["dir"];
- },
- _setTextDirAttr: function(/*String*/ textDir){
- if(validateTextDir(textDir) != null){
- this._set("textDir", textDir);
- this.chart.setTextDir(textDir);
- }
- }
- });
- }
- function validateTextDir(textDir){
- return /^(ltr|rtl|auto)$/.test(textDir) ? textDir : null;
- }
-
- });
|