123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226 |
- if(!dojo._hasResource["dojox.grid.enhanced._Events"]){
- dojo._hasResource["dojox.grid.enhanced._Events"] = true;
- dojo.provide("dojox.grid.enhanced._Events");
- dojo.declare("dojox.grid.enhanced._Events", null, {
-
-
-
-
-
-
-
-
- _events: null,
-
-
- headerCellActiveClass: 'dojoxGridHeaderActive',
-
-
-
- cellActiveClass: 'dojoxGridCellActive',
-
-
-
- rowActiveClass: 'dojoxGridRowActive',
- constructor: function(inGrid){
-
- this._events = new dojox.grid._Events();
-
- for(var p in this._events){
- if(!this[p]){
- this.p = this._events.p;
- }
- }
-
- inGrid.mixin(inGrid, this);
- },
- dokeyup: function(e){
-
-
-
-
- this.focus.currentArea().keyup(e);
- },
- onKeyDown: function(e){
-
-
- if(e.altKey || e.metaKey){ return; }
- var dk = dojo.keys;
- var focus = this.focus;
- var editing = this.edit.isEditing();
- switch(e.keyCode){
- case dk.TAB:
- if(e.ctrlKey){ return; }
- focus.tab(e.shiftKey ? -1:1,e);
- break;
- case dk.UP_ARROW:
- case dk.DOWN_ARROW:
- if(editing){ return; }
- focus.currentArea().move(e.keyCode == dk.UP_ARROW ? -1 : 1, 0, e);
- break;
- case dk.LEFT_ARROW:
- case dk.RIGHT_ARROW:
- if(editing){ return; }
- var offset = (e.keyCode == dk.LEFT_ARROW) ? 1 : -1;
- if(dojo._isBodyLtr()){ offset *= -1; }
- focus.currentArea().move(0, offset, e);
- break;
- case dk.F10:
- if(this.menus && e.shiftKey){
- this.onRowContextMenu(e);
- }
- break;
- default:
- focus.currentArea().keydown(e);
- break;
- }
- },
-
-
- domouseup: function(e){
- if(e.cellNode){
- this.onMouseUp(e);
- }else{
- this.onRowSelectorMouseUp(e);
- }
- },
- domousedown: function(e){
- if(!e.cellNode){
- this.onRowSelectorMouseDown(e);
- }
- },
- onMouseUp: function(e){
-
-
-
-
- this[e.rowIndex == -1 ? "onHeaderCellMouseUp" : "onCellMouseUp"](e);
- },
- onCellMouseDown: function(e){
-
-
- dojo.addClass(e.cellNode, this.cellActiveClass);
- dojo.addClass(e.rowNode, this.rowActiveClass);
- },
- onCellMouseUp: function(e){
-
-
-
-
- dojo.removeClass(e.cellNode, this.cellActiveClass);
- dojo.removeClass(e.rowNode, this.rowActiveClass);
- },
- onCellClick: function(e){
-
-
-
- this._events.onCellClick.call(this, e);
-
- this.focus.contentMouseEvent(e);
- },
- onCellDblClick: function(e){
-
-
- if(this.pluginMgr.isFixedCell(e.cell)){ return; }
- if(this._click.length > 1 && (!this._click[0] || !this._click[1])){
- this._click[0] = this._click[1] = e;
- }
-
- this._events.onCellDblClick.call(this, e);
-
-
- },
- onRowClick: function(e){
-
-
- this.edit.rowClick(e);
- if(!e.cell || (!e.cell.isRowSelector && (!this.rowSelectCell || !this.rowSelectCell.disabled(e.rowIndex)))){
- this.selection.clickSelectEvent(e);
- }
- },
- onRowContextMenu: function(e){
-
-
- if(!this.edit.isEditing() && this.menus){
- this.showMenu(e);
- }
- },
- onSelectedRegionContextMenu: function(e){
-
-
-
-
-
- if(this.selectedRegionMenu){
- this.selectedRegionMenu._openMyself({
- target: e.target,
- coords: e.keyCode !== dojo.keys.F10 && "pageX" in e ? {
- x: e.pageX,
- y: e.pageY
- } : null
- });
- dojo.stopEvent(e);
- }
- },
- onHeaderCellMouseOut: function(e){
-
-
- if(e.cellNode){
- dojo.removeClass(e.cellNode, this.cellOverClass);
- dojo.removeClass(e.cellNode, this.headerCellActiveClass);
- }
- },
- onHeaderCellMouseDown: function(e){
-
-
- if(e.cellNode){
- dojo.addClass(e.cellNode, this.headerCellActiveClass);
- }
- },
- onHeaderCellMouseUp: function(e){
-
-
- if(e.cellNode){
- dojo.removeClass(e.cellNode, this.headerCellActiveClass);
- }
- },
- onHeaderCellClick: function(e){
-
-
-
- this.focus.currentArea("header");
-
- if(!e.cell.isRowSelector){
- this._events.onHeaderCellClick.call(this, e);
- }
-
- this.focus.headerMouseEvent(e);
- },
- onRowSelectorMouseDown: function(e){
- this.focus.focusArea("rowHeader", e);
- },
-
- onRowSelectorMouseUp: function(e){},
-
-
- onMouseUpRow: function(e){
- if(e.rowIndex != -1){
- this.onRowMouseUp(e);
- }
- },
- onRowMouseUp: function(e){}
- });
- }
|