initial player stuff

This commit is contained in:
Blue 2018-08-05 00:52:16 +03:00 committed by Gitea
parent 4b60ece582
commit 00f26c431e
38 changed files with 1107 additions and 93 deletions

View file

@ -0,0 +1,69 @@
"use strict";
var Controller = require("./controller");
var String = require("./string");
var Vocabulary = require("../wType/vocabulary");
var Button = Controller.inherit({
"className": "Button",
"constructor": function(addr) {
Controller.fn.constructor.call(this, addr);
this.enabled = false;
this.hasLabel = false;
this.addHandler("get");
this.addHandler("setLabel");
this.addHandler("setImage");
this.addHandler("setEnabled");
this.addHandler("changeImage");
},
"destructor": function() {
Controller.fn.destructor.call(this);
},
"activate": function() {
if (this.enabled) {
this.send(new Vocabulary, "activate");
}
},
"_h_changeImage": function(ev) {
},
"_h_get": function(ev) {
this._h_setLabel(ev);
this._h_setImage(ev);
this._h_setEnabled(ev);
},
"_h_setEnabled": function(ev) {
var data = ev.getData();
var enabled = data.at("enabled").valueOf();
if (this.enabled !== enabled) {
this.enabled = enabled;
this.trigger("setEnabled", this.enabled);
}
},
"_h_setLabel": function(ev) {
var data = ev.getData();
var hasLabel = data.at("hasLabel").valueOf();
if (hasLabel !== this.hasLabel) {
this.hasLabel = hasLabel;
if (hasLabel) {
this.label = new String(data.at("label").clone());
this.addController(this.label);
this.trigger("setLabel", true, this.label);
} else {
this.trigger("setLabel", false);
this.removeController(this.label);
this.label.destructor();
}
}
},
"_h_setImage": function(ev) {
}
});
module.exports = Button;

View file

@ -328,8 +328,10 @@ Controller.ModelType = {
String: 0,
List: 1,
Vocabulary: 2,
Image: 3,
Controller: 4,
Catalogue: 3,
Image: 4,
Button: 5,
Controller: 6,
Attributes: 50,
@ -339,15 +341,18 @@ Controller.ModelType = {
PageStorage: 103,
PanesList: 104,
Theme: 105,
ThemeStorage: 106
ThemeStorage: 106,
Player: 107
};
Controller.ReversedModelType = {
"0": "String",
"1": "List",
"2": "Vocabulary",
"3": "Image",
"4": "Controller",
"3": "Catalogue",
"4": "Image",
"5": "Button",
"6": "Controller",
"50": "Attributes",
@ -357,7 +362,8 @@ Controller.ReversedModelType = {
"103": "PageStorage",
"104": "PanesList",
"105": "Theme",
"106": "ThemeStorage"
"106": "ThemeStorage",
"107": "Player"
};
Controller.ModelTypesPaths = {
@ -372,7 +378,10 @@ Controller.ModelTypesPaths = {
PanesList: "./panesList", //resolve as dependency
Theme: "./theme", //resolve as dependency
ThemeStorage: "./themeStorage", //resolve as dependency
Image: "./image" //resolve as dependency
Image: "./image", //resolve as dependency
Button: "./button", //resolve as dependency
Catalogue: "./catalogue", //resolve as dependency
Player: "./player" //resolve as dependency
};
Controller.constructors = {

View file

@ -10,16 +10,12 @@ var Link = Controller.inherit({
"constructor": function(addr) {
Controller.fn.constructor.call(this, addr);
var hop = new Address(["label"]);
this.targetAddress = new Address([]);
this.label = new String(addr['+'](hop));
this.addController(this.label);
this.addHandler("get");
hop.destructor();
},
"destructor": function() {
this.targetAddress.destructor();
@ -35,4 +31,6 @@ var Link = Controller.inherit({
}
});
var hop = new Address(["label"]);
module.exports = Link;