2016-09-26 09:28:47 +00:00
|
|
|
|
|
|
|
var Iterator = require ('./iterator');
|
|
|
|
var Model = require ('./model');
|
|
|
|
|
2016-05-05 15:47:45 +00:00
|
|
|
/**
|
|
|
|
* A light iterator for models.
|
2016-12-20 09:32:17 +00:00
|
|
|
*/
|
2016-09-26 09:28:47 +00:00
|
|
|
module.exports = new Class
|
2016-05-05 15:47:45 +00:00
|
|
|
({
|
|
|
|
Extends: Vn.Object
|
2016-09-26 09:28:47 +00:00
|
|
|
,Implements: Iterator
|
2016-05-05 15:47:45 +00:00
|
|
|
,Properties:
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The model associated to this form.
|
2016-12-20 09:32:17 +00:00
|
|
|
*/
|
2016-05-05 15:47:45 +00:00
|
|
|
model:
|
|
|
|
{
|
2016-09-26 09:28:47 +00:00
|
|
|
type: Model
|
2016-05-05 15:47:45 +00:00
|
|
|
,set: function (x)
|
|
|
|
{
|
|
|
|
this._model = x;
|
|
|
|
}
|
|
|
|
,get: function ()
|
|
|
|
{
|
|
|
|
return this._model;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* The row where the form positioned, has -1 if the row is unselected.
|
2016-12-20 09:32:17 +00:00
|
|
|
*/
|
2016-05-05 15:47:45 +00:00
|
|
|
row:
|
|
|
|
{
|
|
|
|
type: Number
|
|
|
|
,set: function (x)
|
|
|
|
{
|
|
|
|
this._row = x;
|
|
|
|
}
|
|
|
|
,get: function ()
|
|
|
|
{
|
|
|
|
return this._row;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* The number of rows in the form.
|
2016-12-20 09:32:17 +00:00
|
|
|
*/
|
2016-05-05 15:47:45 +00:00
|
|
|
numRows:
|
|
|
|
{
|
|
|
|
type: Number
|
|
|
|
,get: function ()
|
|
|
|
{
|
|
|
|
if (this._model)
|
|
|
|
return this._model.numRows;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* Checks if the form data is ready.
|
2016-12-20 09:32:17 +00:00
|
|
|
*/
|
2016-05-05 15:47:45 +00:00
|
|
|
ready:
|
|
|
|
{
|
|
|
|
type: Boolean
|
|
|
|
,get: function ()
|
|
|
|
{
|
|
|
|
if (this._model)
|
|
|
|
return this._model.ready;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2017-04-08 11:42:27 +00:00
|
|
|
},
|
|
|
|
/**
|
|
|
|
* The current row parameters.
|
|
|
|
*/
|
|
|
|
params:
|
|
|
|
{
|
|
|
|
type: Object
|
|
|
|
,set: function (x)
|
|
|
|
{
|
|
|
|
this.assign (x);
|
|
|
|
}
|
|
|
|
,get: function ()
|
|
|
|
{
|
|
|
|
return this.getParams ();
|
|
|
|
}
|
2016-05-05 15:47:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|