net/sf/jsm/table/jsmTd.js
Summary
No overview generated for 'net/sf/jsm/table/jsmTd.js'
Class Summary
|
JsmTd |
A table data cell
|
function JsmTd(value, title) {
this.id=new Date().getTime() + "" + Math.random();
logger.info("Created JsmTd with id: " + this.id);
this._dirty=false;
this.value = jsm.noud(value)?"":value;
this.title = jsm.noud(title)?value:title;
}
JsmTd.extendClass(JsmCell);
JsmTd.prototype.className="JsmTd";
JsmTd.prototype.setDirty = function(dirty, propagateToParent) {
logger.debug("Reset the dirty flag for cell: " + this);
propagateToParent = jsm.noud(propagateToParent)?true:propagateToParent;
this._dirty = dirty;
if (!jsm.noud(this.tr) && propagateToParent) {
if (dirty) {
this.tr.setDirty(dirty);
} else {
var allTdsClean = true;
var tds = this.tr.getCells();
for (var tdIdx=0;tdIdx<tds.length;tdIdx++) {
var td = tds[tdIdx];
if (td.isDirty()) {
allTdsClean=false;
break;
}
}
this.tr.setDirty(!allTdsClean);
}
}
return this;
}
JsmTd.prototype.isDirty = function() {
return this._dirty;
}
JsmTd.prototype.getNode = function(specialClassName, jsmRowType) {
var td = document.createElement("td");
td.setAttribute("id", this.id);
td.model=this;
this.addAttributesToViewComponent(td);
if (jsm.noud(this.getAttribute('className'))) {
td.className=specialClassName;
} else {
td.className=this.getAttribute('className') + ' ' + specialClassName;
}
td.onclick=_jsmOnClickEventDelegate;
td.onmousedown=_jsmOnMouseDownEventDelegate;
this.setAttribute("onmousedown", "if (!e) e=window.event; jsm.resizeColumn=" + this.getIndex() + "; jsm.resize=true; jsm.resizeStartX=e.screenX;");
td.onmouseup=_jsmOnMouseUpEventDelegate;
this.setAttribute("onmouseup", "jsm.resize=false; jsm.resizeColumn=-1; jsm.resizeOriginalWidth=-1;");
td.setAttribute("title", this.title);
if (this.tr.isEditMode() && !jsm.noud(this.tr.table._columnIdx2Widget[this.idx])) {
logger.debug('JsmTd: getNode: Row ' + this.tr.idx + ' is in edit mode');
var theWidget = this.tr.table._columnIdx2Widget[this.idx];
theWidget.init(this);
var theNode = theWidget.getNode();
jsmHangOntoSelectedWidgetNodes(theNode);
td.appendChild(theNode);
} else {
logger.debug('JsmTd: getNode: typeof: ' + typeof this.value);
if (typeof this.value == 'string') {
if (this.value.indexOf('%{') == 0) {
var expression = this.value.substring(2, this.value.length-1);
td.innerHTML=eval(expression);
} else {
td.innerHTML = this.value;
}
}
if (typeof this.value == 'object') {
var theNode = this.value.getNode();
jsmHangOntoSelectedWidgetNodes(theNode);
td.appendChild(theNode);
}
}
return td;
}
Documentation generated by
JSDoc on Tue Sep 26 08:42:57 2006