Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2150 mathias 1
if(!dojo._hasResource["dojox.wire.ml.DataStore"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
2
dojo._hasResource["dojox.wire.ml.DataStore"] = true;
3
dojo.provide("dojox.wire.ml.DataStore");
4
 
5
dojo.require("dijit._Widget");
6
dojo.require("dojox.wire._base");
7
 
8
dojo.declare("dojox.wire.ml.DataStore", dijit._Widget, {
9
	//	summary:
10
	//		A widget for a data store
11
	//	description:
12
	//		This widget represents a data store of 'storeClass' attribute.
13
	//	storeClass:
14
	//		A class name of a data store
15
	storeClass: "",
16
 
17
	postCreate: function(){
18
		//	summary:
19
		//		Call _createStore()
20
		//	description:
21
		//		See _createStore().
22
		this.store = this._createStore();
23
	},
24
 
25
	_createStore: function(){
26
		//	summary:
27
		//		Create a data store
28
		//	desription:
29
		//		A data store of 'storeClass' is created with arguments
30
		//		specified with attributes.
31
		//	returns:
32
		//		A data store
33
		if(!this.storeClass){
34
			return null; //null
35
		}
36
		var storeClass = dojox.wire._getClass(this.storeClass);
37
		if(!storeClass){
38
			return null; //null
39
		}
40
		var args = {};
41
		var attributes = this.domNode.attributes;
42
		for(var i = 0; i < attributes.length; i++){
43
			var a = attributes.item(i);
44
			if(a.specified && !this[a.nodeName]){
45
				args[a.nodeName] = a.nodeValue;
46
			}
47
		}
48
		return new storeClass(args); //Object
49
	},
50
 
51
	getFeatures: function(){
52
		//	summary:
53
		//		Call getFeatures() method of a data store
54
		//	description:
55
		//		See dojo.data.api.Read.getFeatures().
56
		//	returns:
57
		//		A features object
58
		return this.store.getFeatures(); //Object
59
	},
60
 
61
	fetch: function(/*Object*/request){
62
		//	summary:
63
		//		Call fetch() method of a data store
64
		//	description:
65
		//		See dojo.data.api.Read.fetch().
66
		//	request:
67
		//		A request object
68
		//	returns:
69
		//		A request object
70
		return this.store.fetch(request); //Object
71
	},
72
 
73
	save: function(/*Object*/args){
74
		//	summary:
75
		//		Call save() method of a data store
76
		//	description:
77
		//		See dojo.data.api.Write.save().
78
		//	args:
79
		//		A save arguments object
80
		this.store.save(args);
81
	},
82
 
83
	newItem: function(/*Object*/args){
84
		//	summary:
85
		//		Call newItem() method of a data store
86
		//	description:
87
		//		See dojo.data.api.Write.newItem().
88
		//	args:
89
		//		A new item arguments object
90
		//	returns:
91
		//		A new item
92
		return this.store.newItem(args); //Object
93
	},
94
 
95
	deleteItem: function(/*Object*/item){
96
		//	summary:
97
		//		Call deleteItem() method of a data store
98
		//	description:
99
		//		See dojo.data.api.Write.deleteItem().
100
		//	returns:
101
		//		A boolean
102
		return this.store.deleteItem(item); //Boolean
103
	},
104
 
105
	revert: function(){
106
		//	summary:
107
		//		Call revert() method of a data store
108
		//	description:
109
		//		See dojo.data.api.Write.revert().
110
		//	returns:
111
		//		A boolean
112
		return this.store.revert(); //Boolean
113
	}
114
});
115
 
116
}