1318 |
alexandre_ |
1 |
/*
|
|
|
2 |
Copyright (c) 2004-2006, The Dojo Foundation
|
|
|
3 |
All Rights Reserved.
|
|
|
4 |
|
|
|
5 |
Licensed under the Academic Free License version 2.1 or above OR the
|
|
|
6 |
modified BSD license. For more information on Dojo licensing, see:
|
|
|
7 |
|
|
|
8 |
http://dojotoolkit.org/community/licensing.shtml
|
|
|
9 |
*/
|
|
|
10 |
|
1422 |
alexandre_ |
11 |
|
|
|
12 |
|
1318 |
alexandre_ |
13 |
dojo.provide("dojo.data.old.ResultSet");
|
|
|
14 |
dojo.require("dojo.lang.assert");
|
|
|
15 |
dojo.require("dojo.collections.Collections");
|
|
|
16 |
dojo.data.old.ResultSet = function (dataProvider, arrayOfItems) {
|
|
|
17 |
dojo.lang.assertType(dataProvider, dojo.data.old.provider.Base, {optional:true});
|
|
|
18 |
dojo.lang.assertType(arrayOfItems, Array, {optional:true});
|
|
|
19 |
dojo.data.old.Observable.call(this);
|
|
|
20 |
this._dataProvider = dataProvider;
|
|
|
21 |
this._arrayOfItems = [];
|
|
|
22 |
if (arrayOfItems) {
|
|
|
23 |
this._arrayOfItems = arrayOfItems;
|
|
|
24 |
}
|
|
|
25 |
};
|
|
|
26 |
dojo.inherits(dojo.data.old.ResultSet, dojo.data.old.Observable);
|
|
|
27 |
dojo.data.old.ResultSet.prototype.toString = function () {
|
|
|
28 |
var returnString = this._arrayOfItems.join(", ");
|
|
|
29 |
return returnString;
|
|
|
30 |
};
|
|
|
31 |
dojo.data.old.ResultSet.prototype.toArray = function () {
|
|
|
32 |
return this._arrayOfItems;
|
|
|
33 |
};
|
|
|
34 |
dojo.data.old.ResultSet.prototype.getIterator = function () {
|
|
|
35 |
return new dojo.collections.Iterator(this._arrayOfItems);
|
|
|
36 |
};
|
|
|
37 |
dojo.data.old.ResultSet.prototype.getLength = function () {
|
|
|
38 |
return this._arrayOfItems.length;
|
|
|
39 |
};
|
|
|
40 |
dojo.data.old.ResultSet.prototype.getItemAt = function (index) {
|
|
|
41 |
return this._arrayOfItems[index];
|
|
|
42 |
};
|
|
|
43 |
dojo.data.old.ResultSet.prototype.indexOf = function (item) {
|
|
|
44 |
return dojo.lang.indexOf(this._arrayOfItems, item);
|
|
|
45 |
};
|
|
|
46 |
dojo.data.old.ResultSet.prototype.contains = function (item) {
|
|
|
47 |
return dojo.lang.inArray(this._arrayOfItems, item);
|
|
|
48 |
};
|
|
|
49 |
dojo.data.old.ResultSet.prototype.getDataProvider = function () {
|
|
|
50 |
return this._dataProvider;
|
|
|
51 |
};
|
|
|
52 |
|