/* Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ if(!dojo._hasResource["dijit._PaletteMixin"]){ dojo._hasResource["dijit._PaletteMixin"]=true; dojo.provide("dijit._PaletteMixin"); dojo.require("dijit._CssStateMixin"); dojo.declare("dijit._PaletteMixin",[dijit._CssStateMixin],{defaultTimeout:500,timeoutChangeRate:0.9,value:null,_selectedCell:-1,tabIndex:"0",cellClass:"dijitPaletteCell",dyeClass:"",_preparePalette:function(_1,_2){ this._cells=[]; var _3=this._blankGif; var _4=dojo.getObject(this.dyeClass); for(var _5=0;_5<_1.length;_5++){ var _6=dojo.create("tr",{tabIndex:"-1"},this.gridNode); for(var _7=0;_7<_1[_5].length;_7++){ var _8=_1[_5][_7]; if(_8){ var _9=new _4(_8); var _a=dojo.create("td",{"class":this.cellClass,tabIndex:"-1",title:_2[_8]}); _9.fillCell(_a,_3); this.connect(_a,"ondijitclick","_onCellClick"); this._trackMouseState(_a,this.cellClass); dojo.place(_a,_6); _a.index=this._cells.length; this._cells.push({node:_a,dye:_9}); } } } this._xDim=_1[0].length; this._yDim=_1.length; var _b={UP_ARROW:-this._xDim,DOWN_ARROW:this._xDim,RIGHT_ARROW:this.isLeftToRight()?1:-1,LEFT_ARROW:this.isLeftToRight()?-1:1}; for(var _c in _b){ this._connects.push(dijit.typematic.addKeyListener(this.domNode,{charOrCode:dojo.keys[_c],ctrlKey:false,altKey:false,shiftKey:false},this,function(){ var _d=_b[_c]; return function(_e){ this._navigateByKey(_d,_e); }; }(),this.timeoutChangeRate,this.defaultTimeout)); } },postCreate:function(){ this.inherited(arguments); this._setCurrent(this._cells[0].node); },focus:function(){ dijit.focus(this._currentFocus); },_onCellClick:function(_f){ var _10=_f.currentTarget,_11=this._getDye(_10).getValue(); this._setCurrent(_10); setTimeout(dojo.hitch(this,function(){ dijit.focus(_10); this._setValueAttr(_11,true); })); dojo.removeClass(_10,"dijitPaletteCellHover"); dojo.stopEvent(_f); },_setCurrent:function(_12){ if("_currentFocus" in this){ dojo.attr(this._currentFocus,"tabIndex","-1"); } this._currentFocus=_12; if(_12){ dojo.attr(_12,"tabIndex",this.tabIndex); } },_setValueAttr:function(_13,_14){ this.value=null; if(this._selectedCell>=0){ dojo.removeClass(this._cells[this._selectedCell].node,"dijitPaletteCellSelected"); } this._selectedCell=-1; if(_13){ for(var i=0;i-1){ var _19=this._cells[_18].node; this._setCurrent(_19); setTimeout(dojo.hitch(dijit,"focus",_19),0); } },_getDye:function(_1a){ return this._cells[_1a.index].dye; }}); }