IconList: that. -> self.

This commit is contained in:
rlx 2014-09-22 13:20:52 +02:00
parent e7f9279a9d
commit 4a9400cbd9

View file

@ -58,17 +58,17 @@ Ox.IconList = function(options, self) {
.options(options || {})
.update({
items: function() {
that.$element.options({items: self.options.items});
self.$list.options({items: self.options.items});
},
query: function() {
that.$element.options({query: self.options.query});
self.$list.options({query: self.options.query});
},
selected: function() {
that.$element.options({selected: self.options.selected});
self.$list.options({selected: self.options.selected});
},
sort: function() {
updateKeys();
that.$element.options({sort: self.options.sort});
self.$list.options({sort: self.options.sort});
}
});
@ -91,8 +91,7 @@ Ox.IconList = function(options, self) {
self.itemWidth = self.options.size;
self.itemHeight = self.iconHeight + self.options.size * 0.5;
that.setElement(
Ox.List({
self.$list = Ox.List({
centered: self.options.centered,
// fixme: change all occurences of construct to render
construct: constructItem,
@ -120,8 +119,9 @@ Ox.IconList = function(options, self) {
self.options.selected = data.ids;
}
that.triggerEvent(event, data);
})
);
});
that.setElement(self.$list);
updateKeys();
@ -153,7 +153,7 @@ Ox.IconList = function(options, self) {
}
function updateKeys() {
that.$element.options({
self.$list.options({
keys: Ox.unique(
[self.options.sort[0].key].concat(self.options.keys)
)
@ -165,7 +165,7 @@ Ox.IconList = function(options, self) {
() -> <o> the list
@*/
that.closePreview = function() {
that.$element.closePreview();
self.$list.closePreview();
return that;
};
@ -173,23 +173,23 @@ Ox.IconList = function(options, self) {
gainFocus <f> gainFocus
@*/
that.gainFocus = function() {
that.$element.gainFocus();
self.$list.gainFocus();
return that;
};
that.getPasteIndex = function() {
return that.$element.getPasteIndex();
return self.$list.getPasteIndex();
};
/*@
hasFocus <f> hasFocus
@*/
that.hasFocus = function() {
return that.$element.hasFocus();
return self.$list.hasFocus();
};
that.invertSelection = function() {
that.$element.invertSelection();
self.$list.invertSelection();
return that;
};
@ -197,7 +197,7 @@ Ox.IconList = function(options, self) {
loseFocus <f> loseFocus
@*/
that.loseFocus = function() {
that.$element.loseFocus();
self.$list.loseFocus();
return that;
};
@ -205,7 +205,7 @@ Ox.IconList = function(options, self) {
openPreview <f> openPreview
@*/
that.openPreview = function() {
that.$element.openPreview();
self.$list.openPreview();
return that;
};
@ -214,7 +214,7 @@ Ox.IconList = function(options, self) {
() -> <o> the list
@*/
that.reloadList = function() {
that.$element.reloadList();
self.$list.reloadList();
return that;
};
@ -223,22 +223,22 @@ Ox.IconList = function(options, self) {
() -> <o> the list
@*/
that.scrollToSelection = function() {
that.$element.scrollToSelection();
self.$list.scrollToSelection();
return that;
};
that.selectAll = function() {
that.$element.selectAll();
self.$list.selectAll();
return that;
};
that.selectPosition = function(pos) {
that.$element.selectPosition(pos);
self.$list.selectPosition(pos);
return that;
};
that.selectSelected = function(offset) {
that.$element.selectSelected(offset);
self.$list.selectSelected(offset);
return that;
};
@ -247,7 +247,7 @@ Ox.IconList = function(options, self) {
() -> <n> size
@*/
that.size = function() {
that.$element.size();
self.$list.size();
return that;
};
@ -264,7 +264,7 @@ Ox.IconList = function(options, self) {
operator: operator
}];
updateKeys();
that.$element.sortList(key, operator);
self.$list.sortList(key, operator);
return that;
};
@ -280,12 +280,12 @@ Ox.IconList = function(options, self) {
id = args.shift(),
sort = false;
if (arguments.length == 1) {
return that.$element.value(id);
return self.$list.value(id);
} else if (arguments.length == 2 && Ox.isString(arguments[1])) {
return that.$element.value(id, arguments[1]);
return self.$list.value(id, arguments[1]);
} else {
Ox.forEach(Ox.makeObject(args), function(value, key) {
that.$element.value(id, key, value);
self.$list.value(id, key, value);
if (key == self.unique) {
// unique id has changed
self.options.selected = self.options.selected.map(function(id_) {
@ -298,7 +298,7 @@ Ox.IconList = function(options, self) {
sort = true;
}
});
sort && that.$element.sort();
sort && self.$list.sort();
return that;
}
};