2022-05-30 01:30:33 +00:00
|
|
|
|
|
|
|
var LotIface = require('./lot-iface');
|
|
|
|
var ModelIface = require('./model-iface');
|
|
|
|
|
|
|
|
module.exports = new Class({
|
|
|
|
Implements: LotIface
|
|
|
|
,Properties: {
|
|
|
|
/**
|
|
|
|
* The model associated to this form.
|
|
|
|
*/
|
|
|
|
model: {
|
|
|
|
type: ModelIface
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* The row where the form positioned, has -1 if the row is unselected.
|
|
|
|
*/
|
|
|
|
row: {
|
|
|
|
type: Number
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* The number of rows in the form.
|
|
|
|
*/
|
|
|
|
numRows: {
|
|
|
|
type: Number
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* Checks if the form data is ready.
|
|
|
|
*/
|
|
|
|
ready: {
|
|
|
|
type: Boolean
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-16 01:46:44 +00:00
|
|
|
,insertRow() {
|
2022-05-30 01:30:33 +00:00
|
|
|
if (this._model)
|
|
|
|
this.row = this._model.insertRow();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes the current row.
|
|
|
|
*/
|
2022-11-16 01:46:44 +00:00
|
|
|
,deleteRow() {
|
2022-05-30 01:30:33 +00:00
|
|
|
if (this._row >= 0)
|
|
|
|
this._model.deleteRow(this._row);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets a value from the form.
|
|
|
|
*
|
|
|
|
* @param {string} columnName The column name
|
|
|
|
* @return {Object} The value
|
|
|
|
*/
|
2022-11-16 01:46:44 +00:00
|
|
|
,get(columnName) {
|
2022-05-30 01:30:33 +00:00
|
|
|
return this._model ?
|
|
|
|
this._model.get(this._row, columnName) : undefined;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets a value on the form.
|
|
|
|
*
|
|
|
|
* @param {string} columnName The column name
|
|
|
|
* @param {Object} value The new value
|
|
|
|
*/
|
2022-11-16 01:46:44 +00:00
|
|
|
,set(columnName, value) {
|
2022-05-30 01:30:33 +00:00
|
|
|
this._model.set(this._row, columnName, value);
|
|
|
|
}
|
|
|
|
});
|