hedera-web/js/db/simple-iterator.js

72 lines
1.0 KiB
JavaScript
Raw Normal View History

2016-09-26 09:28:47 +00:00
2022-05-24 10:18:44 +00:00
var Iterator = require('./iterator');
var Model = require('./model');
2016-09-26 09:28:47 +00:00
/**
* A light iterator for models.
2022-05-24 10:18:44 +00:00
*/
module.exports = new Class({
Extends: Vn.Object
2016-09-26 09:28:47 +00:00
,Implements: Iterator
2022-05-24 10:18:44 +00:00
,Properties: {
/**
* The model associated to this form.
2022-05-24 10:18:44 +00:00
*/
model: {
2016-09-26 09:28:47 +00:00
type: Model
2022-11-16 01:46:44 +00:00
,set(x) {
this._model = x;
}
2022-11-16 01:46:44 +00:00
,get() {
return this._model;
}
},
/**
* The row where the form positioned, has -1 if the row is unselected.
2022-05-24 10:18:44 +00:00
*/
row: {
type: Number
2022-11-16 01:46:44 +00:00
,set(x) {
this._row = x;
}
2022-11-16 01:46:44 +00:00
,get() {
return this._row;
}
},
/**
* The number of rows in the form.
2022-05-24 10:18:44 +00:00
*/
numRows: {
type: Number
2022-11-16 01:46:44 +00:00
,get() {
if (this._model)
return this._model.numRows;
return 0;
}
},
/**
* Checks if the form data is ready.
2022-05-24 10:18:44 +00:00
*/
ready: {
type: Boolean
2022-11-16 01:46:44 +00:00
,get() {
if (this._model)
return this._model.ready;
return false;
}
2022-05-28 15:49:46 +00:00
},
/**
* The row object.
*/
$: {
type: Object
2022-11-16 01:46:44 +00:00
,get() {
2022-05-28 15:49:46 +00:00
return this._model.getObject(this._row);
}
}
}
});