summaryrefslogtreecommitdiffstatshomepage
path: root/includes/js/dojox/wire/ml/DataStore.js
diff options
context:
space:
mode:
authorGravatar mensonge2008-11-13 09:49:11 +0000
committerGravatar mensonge2008-11-13 09:49:11 +0000
commite44a7e37b6c7b5961adaffc62b9042b8d442938e (patch)
tree95b67c356e93163467db2451f2b8cce84ed5d582 /includes/js/dojox/wire/ml/DataStore.js
parenta62b9742ee5e28bcec6872d88f50f25b820914f6 (diff)
downloadscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.gz
scuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.zip
New feature: basic Ajax suggestion for tags and implementation of Dojo toolkit
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@151 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'includes/js/dojox/wire/ml/DataStore.js')
-rw-r--r--includes/js/dojox/wire/ml/DataStore.js116
1 files changed, 116 insertions, 0 deletions
diff --git a/includes/js/dojox/wire/ml/DataStore.js b/includes/js/dojox/wire/ml/DataStore.js
new file mode 100644
index 0000000..e366d05
--- /dev/null
+++ b/includes/js/dojox/wire/ml/DataStore.js
@@ -0,0 +1,116 @@
+if(!dojo._hasResource["dojox.wire.ml.DataStore"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.wire.ml.DataStore"] = true;
+dojo.provide("dojox.wire.ml.DataStore");
+
+dojo.require("dijit._Widget");
+dojo.require("dojox.wire._base");
+
+dojo.declare("dojox.wire.ml.DataStore", dijit._Widget, {
+ // summary:
+ // A widget for a data store
+ // description:
+ // This widget represents a data store of 'storeClass' attribute.
+ // storeClass:
+ // A class name of a data store
+ storeClass: "",
+
+ postCreate: function(){
+ // summary:
+ // Call _createStore()
+ // description:
+ // See _createStore().
+ this.store = this._createStore();
+ },
+
+ _createStore: function(){
+ // summary:
+ // Create a data store
+ // desription:
+ // A data store of 'storeClass' is created with arguments
+ // specified with attributes.
+ // returns:
+ // A data store
+ if(!this.storeClass){
+ return null; //null
+ }
+ var storeClass = dojox.wire._getClass(this.storeClass);
+ if(!storeClass){
+ return null; //null
+ }
+ var args = {};
+ var attributes = this.domNode.attributes;
+ for(var i = 0; i < attributes.length; i++){
+ var a = attributes.item(i);
+ if(a.specified && !this[a.nodeName]){
+ args[a.nodeName] = a.nodeValue;
+ }
+ }
+ return new storeClass(args); //Object
+ },
+
+ getFeatures: function(){
+ // summary:
+ // Call getFeatures() method of a data store
+ // description:
+ // See dojo.data.api.Read.getFeatures().
+ // returns:
+ // A features object
+ return this.store.getFeatures(); //Object
+ },
+
+ fetch: function(/*Object*/request){
+ // summary:
+ // Call fetch() method of a data store
+ // description:
+ // See dojo.data.api.Read.fetch().
+ // request:
+ // A request object
+ // returns:
+ // A request object
+ return this.store.fetch(request); //Object
+ },
+
+ save: function(/*Object*/args){
+ // summary:
+ // Call save() method of a data store
+ // description:
+ // See dojo.data.api.Write.save().
+ // args:
+ // A save arguments object
+ this.store.save(args);
+ },
+
+ newItem: function(/*Object*/args){
+ // summary:
+ // Call newItem() method of a data store
+ // description:
+ // See dojo.data.api.Write.newItem().
+ // args:
+ // A new item arguments object
+ // returns:
+ // A new item
+ return this.store.newItem(args); //Object
+ },
+
+ deleteItem: function(/*Object*/item){
+ // summary:
+ // Call deleteItem() method of a data store
+ // description:
+ // See dojo.data.api.Write.deleteItem().
+ // returns:
+ // A boolean
+ return this.store.deleteItem(item); //Boolean
+ },
+
+ revert: function(){
+ // summary:
+ // Call revert() method of a data store
+ // description:
+ // See dojo.data.api.Write.revert().
+ // returns:
+ // A boolean
+ return this.store.revert(); //Boolean
+ }
+});
+
+}