Debian Codegraph @

dojox/grid/_RowManager.js

raw symbols SCIP
1 define([
2 "dojo/_base/declare",
3 "dojo/_base/lang",
4 "dojo/dom-class"
5 ], function(declare, lang, domClass){
6
7 var setStyleText = function(inNode, inStyleText){
8 if(inNode.style.cssText == undefined){
9 inNode.setAttribute("style", inStyleText);
10 }else{
11 inNode.style.cssText = inStyleText;
12 }
13 };
14
15 return declare("dojox.grid._RowManager", null, {
16 // Stores information about grid rows. Owned by grid and used internally.
17 constructor: function(inGrid){
18 this.grid = inGrid;
19 },
20 linesToEms: 2,
21 overRow: -2,
22 // styles
23 prepareStylingRow: function(inRowIndex, inRowNode){
24 return {
25 index: inRowIndex,
26 node: inRowNode,
27 odd: Boolean(inRowIndex&1),
28 selected: !!this.grid.selection.isSelected(inRowIndex),
29 over: this.isOver(inRowIndex),
30 customStyles: "",
31 customClasses: "dojoxGridRow"
32 };
33 },
34 styleRowNode: function(inRowIndex, inRowNode){
35 var row = this.prepareStylingRow(inRowIndex, inRowNode);
36 this.grid.onStyleRow(row);
37 this.applyStyles(row);
38 },
39 applyStyles: function(inRow){
40 var i = inRow;
41
42 i.node.className = i.customClasses;
43 var h = i.node.style.height;
44 setStyleText(i.node, i.customStyles + ';' + (i.node._style||''));
45 i.node.style.height = h;
46 },
47 updateStyles: function(inRowIndex){
48 this.grid.updateRowStyles(inRowIndex);
49 },
50 // states and events
51 setOverRow: function(inRowIndex){
52 var last = this.overRow;
53 this.overRow = inRowIndex;
54 if((last!=this.overRow)&&(lang.isString(last) || last >= 0)){
55 this.updateStyles(last);
56 }
57 this.updateStyles(this.overRow);
58 },
59 isOver: function(inRowIndex){
60 return (this.overRow == inRowIndex && !domClass.contains(this.grid.domNode, "dojoxGridColumnResizing"));
61 }
62 });
63 });