radio/magnus/pages/test.js

31 lines
1.1 KiB
JavaScript
Raw Permalink Normal View History

2018-08-04 21:46:25 +00:00
"use strict";
var Page = require("../lib/wModel/page");
var String = require("../lib/wModel/string");
2018-08-04 21:52:16 +00:00
var Button = require("../lib/wModel/button");
2018-08-04 21:46:25 +00:00
var Address = require("../lib/wType/address");
var TestPage = Page.inherit({
"className": "TestPage",
"constructor": function(address, name) {
Page.fn.constructor.call(this, address, name);
var header = new String(this._address["+"](new Address(["message"])), "This is a test page");
header.addProperty("fontFamily", "casualFont");
this.addItem(header, 0, 0, 1, 1, Page.Aligment.CenterTop);
2018-08-04 21:52:16 +00:00
this._button = new Button(this._address["+"](new Address(["testButton"])));
this._button.setLabel("Push me");
this._button.on("activated", this._onActivate, this);
this.addItem(this._button, 1, 0, 1, 1, Page.Aligment.CenterTop);
},
"_onActivate": function() {
this.trigger("serviceMessage", "Button works!");
this._button.setEnabled(false);
setTimeout(this._button.setEnabled.bind(this._button, true), 3000);
2018-08-04 21:46:25 +00:00
}
});
module.exports = TestPage;