net/sf/jsm/widgets/jsmCheckBox.js
Summary
No overview generated for 'net/sf/jsm/widgets/jsmCheckBox.js'
function JsmCheckBox(selected, selectedValue, notSelectedValue) {
this.id=new Date().getTime() + "" + Math.random();
this.selected = selected;
this.selectedValue = selectedValue;
this.notSelectedValue = notSelectedValue;
logger.info("Created: " + this);
}
JsmCheckBox.extendClass(JsmWidget);
JsmCheckBox.prototype.className="JsmCheckBox";
JsmCheckBox.prototype.toString = function() {
return "[JsmCheckBox - id: " + this.id + " selectedValue: " + this.selectedValue + " - notSelectedValue: " + this.notSelectedValue + "]\n";
}
JsmCheckBox.prototype.setSelected = function(selected) {
this.selected=selected;
return this;
}
JsmCheckBox.prototype.isSelected = function() {
return this.selected;
}
JsmCheckBox.prototype.setSelectedValue = function(selectedValue) {
this.selectedValue=selectedValue;
return this;
}
JsmCheckBox.prototype.setNotSelectedValue = function(notSelectedValue) {
this.notSelectedValue=notSelectedValue;
return this;
}
JsmCheckBox.prototype.getSelectedValue = function(selectedValue) {
return this.selectedValue;
}
JsmCheckBox.prototype.getNotSelectedValue = function(notSelectedValue) {
return this.notSelectedValue;
}
JsmCheckBox.prototype.init = function(theTd) {
if (this.getSelectedValue() == theTd.getValue()) {
logger.debug("Init checkbox as selected");
this.setSelected(true);
} else {
logger.debug("Init checkbox as not selected");
this.setSelected(false);
}
return this;
}
JsmCheckBox.prototype.updateModel = function(table, rowIdx, columnIdx, theViewComponent) {
if (jsm.noud(theViewComponent)) {return;}
if (!this.validate(table, rowIdx, columnIdx, theViewComponent)) {
return;
}
logger.debug("JsmCheckBox - updateModel: The view component is selected: " + theViewComponent.checked);
this.setSelected(theViewComponent.checked);
var newValue = theViewComponent.checked?this.getSelectedValue():this.getNotSelectedValue();
td = table.getTd(rowIdx, columnIdx);
if (td.getValue() != newValue) {
logger.debug("The cell value is different - will set it to the selected value and set cell dirty");
td.setDirty(true);
td.setValue(newValue);
}
}
JsmCheckBox.prototype.getNode = function() {
var checkbox = document.createElement("input");
checkbox.model=this;
checkbox.setAttribute("id", this.id);
checkbox.setAttribute("name", this.id);
checkbox.setAttribute("type", "checkbox");
checkbox.checked = this.isSelected();
this.addAttributesToViewComponent(checkbox);
return checkbox;
}
JsmCheckBox.prototype.clone = function() {
var clonedWidget = new JsmCheckBox();
clonedWidget._attributes = this._attributes;
clonedWidget._metaData = this._metaData;
clonedWidget.selectedValue = this.selectedValue;
clonedWidget.notSelectedValue = this.notSelectedValue;
return clonedWidget;
}
Documentation generated by
JSDoc on Tue Sep 26 08:42:57 2006