Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial checkin of file. Nothing much, just a shell of the original S…
…pry Data Set API.
- Loading branch information
Showing
1 changed file
with
172 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,172 @@ | ||
/* | ||
* jQuery Data Set Framework : dataset plugin | ||
* Copyright (c) 2010 Adobe Systems Incorporated - Kin Blas (jblas@adobe.com) | ||
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses. | ||
* Note: Code is in draft form and is subject to change | ||
*/ | ||
|
||
(function($,window,document,undefined){ | ||
|
||
function Notifier() | ||
{ | ||
this._nObservers = {}; | ||
this._nLock = 0; | ||
} | ||
|
||
$.extend(Notifier.prototype, { | ||
bind: function(eventName, func) | ||
{ | ||
var a = this._nObservers[eventName]; | ||
if (!a) { | ||
a = obs[eventName] = {}; | ||
} | ||
for (var i = 0; i < a.length; i++) { | ||
if (a[i] == func) { | ||
return; | ||
} | ||
} | ||
a.unshift(func); | ||
}, | ||
|
||
unbind: function(eventName, func) | ||
{ | ||
var a = this._nObservers[eventName]; | ||
if (a) { | ||
for (var i = 0; i < a.length; i++) { | ||
if (a[i] == func) { | ||
this._nObservers.splice(i, 1); | ||
return; | ||
} | ||
} | ||
} | ||
}, | ||
|
||
trigger: function(eventName, data) | ||
{ | ||
if (!this._nLock) { | ||
var obs = this._nObservers[eventName]; | ||
if (obs) { | ||
var cnt = obs.length; | ||
for (var i = cnt - 1; i >= 0; --i) { | ||
var f = obs[i]; | ||
if (f) { | ||
f(eventName, data); | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
|
||
enableTrigger: function() | ||
{ | ||
if (--this._nLock <= 0) { | ||
this._nLock = 0; | ||
} | ||
}, | ||
|
||
disableTrigger: function() | ||
{ | ||
++this._nLock; | ||
} | ||
}); | ||
|
||
function DataSet(opts) | ||
{ | ||
Notifier.call(this); | ||
this.data = []; | ||
} | ||
|
||
$.extend(DataSet.prototype, Notifier.prototype, { | ||
/* | ||
* findRowsWithColumnValues | ||
* getColumnType | ||
* getDataWasLoaded | ||
* getLoadDataRequestIsPending | ||
* getSortColumn | ||
* getSortOrder | ||
* setColumnType | ||
* setDataFromArray | ||
* startLoadInterval | ||
* stopLoadInterval | ||
*/ | ||
|
||
getData: function(unfiltered) | ||
{ | ||
}, | ||
|
||
getRowCount: function(unfiltered) | ||
{ | ||
}, | ||
|
||
getRowNumber: function() | ||
{ | ||
}, | ||
|
||
loadData: function() | ||
{ | ||
}, | ||
|
||
cancelLoadData: function() | ||
{ | ||
}, | ||
|
||
distinct: function() | ||
{ | ||
}, | ||
|
||
sort: function() | ||
{ | ||
}, | ||
|
||
filter: function() | ||
{ | ||
}, | ||
|
||
filterData: function() | ||
{ | ||
}, | ||
|
||
getRowByID: function() | ||
{ | ||
}, | ||
|
||
getRowByRowNumber: function() | ||
{ | ||
}, | ||
|
||
getCurrentRow: function() | ||
{ | ||
}, | ||
|
||
setCurrentRow: function() | ||
{ | ||
}, | ||
|
||
getCurrentRowID: function() | ||
{ | ||
}, | ||
|
||
setCurrentRowID: function() | ||
{ | ||
}, | ||
|
||
getCurrentRowNumber: function() | ||
{ | ||
}, | ||
|
||
setCurrentRowNumber: function() | ||
{ | ||
}, | ||
|
||
bind: function(func) | ||
{ | ||
}, | ||
|
||
unbind: function(func) | ||
{ | ||
} | ||
}); | ||
|
||
$.data.dataset = DataSet; | ||
|
||
})(jQuery,window,document); |