a draft of player view, debug

This commit is contained in:
Blue 2018-10-29 00:32:44 +03:00 committed by blue
parent 9abb5ee116
commit cacbc5d891
13 changed files with 183 additions and 33 deletions

View file

@ -23,7 +23,7 @@ var Enum = Class.inherit({
this.additional = Object.create(null);
this._additionals = additional || [];
this._lastId = 0;
this._lastId = -1;
storage[name] = this;
},

View file

@ -34,6 +34,8 @@ var Button = Controller.inherit({
this._h_setLabel(ev);
this._h_setImage(ev);
this._h_setEnabled(ev);
this.initialized = true;
},
"_h_setEnabled": function(ev) {
var data = ev.getData();

View file

@ -4,7 +4,7 @@ var Subscribable = require("../utils/subscribable");
var LocalModel = Subscribable.inherit({
"className": "LocalModel",
"constructor": function(properties) {
"constructor": function(properties, data) {
Subscribable.fn.constructor.call(this);
this.properties = [];
@ -18,6 +18,11 @@ var LocalModel = Subscribable.inherit({
}
}
}
if (data !== undefined) {
this.data = data;
this.initialized = true;
}
},
"setData": function(data) {
this.data = data;

View file

@ -30,6 +30,7 @@ var Player = Controller.inherit({
btn.itemType = t;
this.controls[t] = btn;
this.addController(btn);
this.trigger("newElement", btn, t);
break;
default:
this.trigger("serviceMessage", "An attempt to add ItemType " + ItemType.reversed[t] + " to controls of the Player, but it's not qualified to be a control");
@ -55,6 +56,8 @@ var Player = Controller.inherit({
cpb.ItemType = t;
this.views[t] = cpb;
this.addController(cpb);
this.trigger("newElement", cpb, t);
break;
default:
this.trigger("serviceMessage", "An attempt to add ItemType " + ItemType.reversed[t] + " to views of the Player, but it's not qualified to be a view");
}
@ -78,8 +81,11 @@ var Player = Controller.inherit({
size = views.length();
for (i = 0; i < size; ++i) {
vc = views.at(i);
this._addview(vc.at("type"), vc.at("address"));
this._addView(vc.at("type"), vc.at("address"));
}
this.initialized = true;
this.trigger("data");
},
_h_viewsChange: function(ev) {
var data = ev.getData();
@ -96,7 +102,7 @@ var Player = Controller.inherit({
size = add.length();
for (i = 0; i < size; ++i) {
vc = add.at(i);
this._addview(vc.at("type"), vc.at("address"));
this._addView(vc.at("type"), vc.at("address"));
}
},
_removeControl: function(type) {