2017-04-21 10:53:15 +00:00
|
|
|
|
2017-05-22 07:08:21 +00:00
|
|
|
var LotIface = require ('./lot-iface');
|
|
|
|
var ModelIface = require ('./model-iface');
|
2017-04-21 10:53:15 +00:00
|
|
|
|
|
|
|
module.exports = new Class
|
|
|
|
({
|
2017-05-22 07:08:21 +00:00
|
|
|
Implements: LotIface
|
2017-04-21 10:53:15 +00:00
|
|
|
,Properties:
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The model associated to this form.
|
|
|
|
*/
|
|
|
|
model:
|
|
|
|
{
|
2017-05-22 07:08:21 +00:00
|
|
|
type: ModelIface
|
2017-04-21 10:53:15 +00:00
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
,insertRow: function ()
|
|
|
|
{
|
|
|
|
if (this._model)
|
|
|
|
this.row = this._model.insertRow ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes the current row.
|
|
|
|
*/
|
|
|
|
,deleteRow: function ()
|
|
|
|
{
|
|
|
|
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
|
|
|
|
*/
|
|
|
|
,get: function (columnName)
|
|
|
|
{
|
|
|
|
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
|
|
|
|
*/
|
|
|
|
,set: function (columnName, value)
|
|
|
|
{
|
|
|
|
this._model.set (this._row, columnName, value);
|
|
|
|
}
|
|
|
|
});
|