Location: A review of cardiac cellular electrophysiology models @ 1c3a018574af / dojo-presentation / js / dojo / dojox / grid / _RowManager.js

Author:
David Nickerson <david.nickerson@gmail.com>
Date:
2023-04-27 23:14:49-07:00
Desc:
Updates to get things working with OpenCOR 0.7.1
Permanent Source URI:
http://models.cellml.org/workspace/a1/rawfile/1c3a018574af68610e2b95973f32fa831ea3096f/dojo-presentation/js/dojo/dojox/grid/_RowManager.js

dojo.provide("dojox.grid._RowManager");

(function(){
	var setStyleText = function(inNode, inStyleText){
		if(inNode.style.cssText == undefined){
			inNode.setAttribute("style", inStyleText);
		}else{
			inNode.style.cssText = inStyleText;
		}
	};

	dojo.declare("dojox.grid._RowManager", null, {
		//	Stores information about grid rows. Owned by grid and used internally.
		constructor: function(inGrid){
			this.grid = inGrid;
		},
		linesToEms: 2,
		defaultRowHeight: 1, // lines
		overRow: -2,
		// metrics
		getHeight: function(inRowIndex){
			return '';
		},
		getDefaultHeightPx: function(){
			// summmary:
			// retrieves the default row height
			// returns: int, default row height
			return 32;
			//return Math.round(this.defaultRowHeight * this.linesToEms * this.grid.contentPixelToEmRatio);
		},
		// styles
		prepareStylingRow: function(inRowIndex, inRowNode){
			return {
				index: inRowIndex, 
				node: inRowNode,
				odd: Boolean(inRowIndex&1),
				selected: this.grid.selection.isSelected(inRowIndex),
				over: this.isOver(inRowIndex),
				customStyles: "",
				customClasses: "dojoxGridRow"
			}
		},
		styleRowNode: function(inRowIndex, inRowNode){
			var row = this.prepareStylingRow(inRowIndex, inRowNode);
			this.grid.onStyleRow(row);
			this.applyStyles(row);
		},
		applyStyles: function(inRow){
			var i = inRow;

			i.node.className = i.customClasses;
			var h = i.node.style.height;
			setStyleText(i.node, i.customStyles + ';' + (i.node._style||''));
			i.node.style.height = h;
		},
		updateStyles: function(inRowIndex){
			this.grid.updateRowStyles(inRowIndex);
		},
		// states and events
		setOverRow: function(inRowIndex){
			var last = this.overRow;
			this.overRow = inRowIndex;
			if((last!=this.overRow)&&(last >=0)){
				this.updateStyles(last);
			}
			this.updateStyles(this.overRow);
		},
		isOver: function(inRowIndex){
			return (this.overRow == inRowIndex);
		}
	});
})();