90 lines
1.2 KiB
JavaScript
90 lines
1.2 KiB
JavaScript
|
|
var Iterator = require ('./iterator');
|
|
var Model = require ('./model');
|
|
|
|
/**
|
|
* A light iterator for models.
|
|
*/
|
|
module.exports = new Class
|
|
({
|
|
Extends: Vn.Object
|
|
,Implements: Iterator
|
|
,Properties:
|
|
{
|
|
/**
|
|
* The model associated to this form.
|
|
*/
|
|
model:
|
|
{
|
|
type: Model
|
|
,set: function (x)
|
|
{
|
|
this._model = x;
|
|
}
|
|
,get: function ()
|
|
{
|
|
return this._model;
|
|
}
|
|
},
|
|
/**
|
|
* The row where the form positioned, has -1 if the row is unselected.
|
|
*/
|
|
row:
|
|
{
|
|
type: Number
|
|
,set: function (x)
|
|
{
|
|
this._row = x;
|
|
}
|
|
,get: function ()
|
|
{
|
|
return this._row;
|
|
}
|
|
},
|
|
/**
|
|
* The number of rows in the form.
|
|
*/
|
|
numRows:
|
|
{
|
|
type: Number
|
|
,get: function ()
|
|
{
|
|
if (this._model)
|
|
return this._model.numRows;
|
|
|
|
return 0;
|
|
}
|
|
},
|
|
/**
|
|
* Checks if the form data is ready.
|
|
*/
|
|
ready:
|
|
{
|
|
type: Boolean
|
|
,get: function ()
|
|
{
|
|
if (this._model)
|
|
return this._model.ready;
|
|
|
|
return false;
|
|
}
|
|
},
|
|
/**
|
|
* The current row parameters.
|
|
*/
|
|
params:
|
|
{
|
|
type: Object
|
|
,set: function (x)
|
|
{
|
|
this.assign (x);
|
|
}
|
|
,get: function ()
|
|
{
|
|
return this.getParams ();
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|