forked from verdnatura/hedera-web
54 lines
754 B
JavaScript
Executable File
54 lines
754 B
JavaScript
Executable File
/**
|
|
* List of Sql.Object
|
|
**/
|
|
Sql.List = new Class
|
|
({
|
|
Extends: Sql.Object
|
|
|
|
,objects: []
|
|
|
|
,add: function (object)
|
|
{
|
|
this.objects.push (object);
|
|
object.on ('changed', this.onObjectChange, this);
|
|
this.onObjectChange ();
|
|
}
|
|
|
|
,get: function (i)
|
|
{
|
|
return objects[i];
|
|
}
|
|
|
|
,getArray: function ()
|
|
{
|
|
return this.objects;
|
|
}
|
|
|
|
,remove: function (i)
|
|
{
|
|
var object = objects.splice (i, 1);
|
|
object.disconnect ('changed', this.onObjectChange, this);
|
|
this.onObjectChange ();
|
|
}
|
|
|
|
,onObjectChange: function ()
|
|
{
|
|
this.signalEmit ('changed');
|
|
}
|
|
|
|
,isReady: function ()
|
|
{
|
|
var o = this.objects;
|
|
|
|
if (o.length == 0)
|
|
return false;
|
|
|
|
for (var i = 0; i < o.length; i++)
|
|
if (!o[i].isReady ())
|
|
return false;
|
|
|
|
return true;
|
|
}
|
|
});
|
|
|