Permalink
Browse files

a bunch of changes to the api - as well as bug fixes

  • Loading branch information...
1 parent 48c9bec commit 9fe54d00a48ea08f18b9db49b5ff6ef452969612 @hofmeister committed Aug 24, 2012
View
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title></title>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ </head>
+ <body></body>
+</html>
View
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Oops, something went wrong.
Binary file not shown.
Binary file not shown.
View
@@ -96,7 +96,7 @@ var require = function(path,cb,async) {
}
if (requireAllIx > -1) {
paths.splice(requireAllIx,0,
- "jquery-ui","utils","localization","data","template","widget","form",'module','draw','geo');
+ "jquery-ui","utils","localization","data","template","widget","form",'widget-ext','module','draw','geo');
}
var oks = new Array(paths.length);
@@ -773,6 +773,9 @@ require($wbConfig.jQuery,function() {
* @param {Object} obj
*/
fromObject:function(obj) {
+ if (!obj) {
+ return;
+ }
for(var i = 0;i < this.opts.key.length;i++) {
var key = this.opts.key[i];
this[key] = obj[key];
@@ -784,6 +787,31 @@ require($wbConfig.jQuery,function() {
}
},
+ base:function() {
+ var out = "";
+ if (this.host) {
+ out += this.protocol+"://";
+ if (this.username) {
+ out += this.username;
+ if (this.password) {
+ out += ":"+this.password;
+ }
+ out += "@";
+ }
+ out += this.host;
+
+ var defPort = $wb.Url.protocols[this.protocol];
+ if (!defPort || this.port && this.port != defPort) {
+ out += ":"+this.port;
+ }
+ }
+
+ if (!this.path)
+ this.path = "/";
+ out += this.path;
+
+ return out.substr(0,out.lastIndexOf('/')+1);
+ },
/**
* @description Read url from string
* @param {String} str
@@ -1146,10 +1174,12 @@ require($wbConfig.jQuery,function() {
_name:'',
_type:'default',
_context:null,
- __construct:function(name,method,type) {
+ __construct:function(name,method,type,ctxt) {
this._name = name;
this._method = method;
this._type = type;
+ if (ctxt)
+ this._context = ctxt;
},
context:function() {
if (arguments.length > 0) {
View
@@ -71,6 +71,9 @@ $wb.data.Model = $wb.Class('Model',{
}
return out;
},
+ getFieldCount:function() {
+ return this.getFieldNames().length;
+ },
create:function(data) {
if (!data) data = {};
var row = {};
@@ -288,6 +291,12 @@ $wb.data.JsonSocket = $wb.Class('JsonSocket',{
throw new $wb.Error('Failed to contact server',{socket:this,error:e});
}
});
+ },
+ close:function() {
+ if (this._ws) {
+ this._ws.close();
+ delete this._ws;
+ }
}
});
@@ -675,7 +684,7 @@ $wb.data.ListStore = $wb.Class('ListStore',{
add:function(row) {
this.addAll([row]);
},
- addAll:function(rows) {
+ _addRows:function(rows) {
for(var i = 0; i < rows.length;i++) {
if (this._model)
rows[i] = this._model.create(rows[i]);
@@ -698,6 +707,9 @@ $wb.data.ListStore = $wb.Class('ListStore',{
}
this._makeDirty();
+ },
+ addAll:function(rows) {
+ this._addRows(rows);
this._data.total += rows.length;
this.trigger('change');
this.trigger('added',[rows]);
@@ -708,9 +720,9 @@ $wb.data.ListStore = $wb.Class('ListStore',{
if (!totalRows)
totalRows = rows.length;
this._data.total = totalRows;
- this.addAll(rows);
- //Add all also increases row count - compensate.
- this._data.total -= rows.length
+ this._addRows(rows);
+ this.trigger('change');
+ this.trigger('added',[rows]);
},
getTotalRows:function() {
return this._data.total;
@@ -776,6 +788,8 @@ $wb.data.ListStore = $wb.Class('ListStore',{
return this.getIndexByKey(key);
},
get:function(ix) {
+ if ($.type(ix) == 'object')
+ ix = this.indexOf(ix);
return this._data.rows.get(ix);
},
remove:function(ix) {
@@ -797,7 +811,7 @@ $wb.data.ListStore = $wb.Class('ListStore',{
this._makeDirty();
this.trigger('change');
- this.trigger('remove',[ixs]);
+ this.trigger('removed',[ixs]);
},
addFilter:function(filterFunction) {
this._filters.push(filterFunction);
@@ -906,11 +920,11 @@ $wb.data.TableStore = $wb.Class('TableStore',{
},
getColumns:function() {
var fields = this._model.getFields();
- if (!this.opts.columns)
+ if (!this.opts.fields)
return fields;
var out = {};
- for(var i in this.opts.columns) {
- var colId = this.opts.columns[i];
+ for(var i in this.opts.fields) {
+ var colId = this.opts.fields[i];
if (fields[colId])
out[colId] = fields[colId];
}
View
@@ -140,6 +140,13 @@ $wb.draw.Layer = $wb.Class('Layer',{
},
clear:function() {
this.context().clearRect(0,0,parseInt(this.elm().attr('width')),parseInt(this.elm().attr('height')));
+
+ },
+ empty:function() {
+ while(this._elements.length > 0) {
+ delete this._elements.pop();
+ }
+ this.clear();
},
context:function() {
return this.elm()[0].getContext('2d');
Oops, something went wrong.

0 comments on commit 9fe54d0

Please sign in to comment.