a new oblect utils - enum, enum view, refactoring of mainLayout, debugging, states for sockets
This commit is contained in:
parent
b5ea024faf
commit
f4529f0023
14 changed files with 260 additions and 57 deletions
53
lorgar/views/enumeration.js
Normal file
53
lorgar/views/enumeration.js
Normal file
|
@ -0,0 +1,53 @@
|
|||
"use strict";
|
||||
(function view_enumeration_js() {
|
||||
var moduleName = "views/enumeration";
|
||||
|
||||
var deps = [];
|
||||
deps.push("views/gridLayout");
|
||||
deps.push("views/label");
|
||||
deps.push("lib/wController/localModel");
|
||||
|
||||
define(moduleName, deps, function view_enumeration_module() {
|
||||
var GridLayout = require("views/gridLayout");
|
||||
var Label = require("views/label");
|
||||
var LocalModel = require("lib/wController/localModel");
|
||||
|
||||
var Enumeration = GridLayout.inherit({
|
||||
className: "Enumeration",
|
||||
constructor: function(controller, options) {
|
||||
var base = {};
|
||||
W.extend(base, options)
|
||||
|
||||
this._lm = new LocalModel();
|
||||
GridLayout.fn.constructor.call(this, controller, base);
|
||||
|
||||
this._lv = new Label(this._lm);
|
||||
this.append(this._lv, 0, 0, 1, 1, GridLayout.Aligment.CenterCenter);
|
||||
|
||||
this._uncyclic.push(this._lm.destructor.bind(this._lm));
|
||||
},
|
||||
_onData: function() {
|
||||
if (this._f.initialized) {
|
||||
var e = this._f.enum;
|
||||
var value = this._f.data;
|
||||
var title;
|
||||
if (e.hasAdditional("title")) {
|
||||
title = e.additional[value].title;
|
||||
} else {
|
||||
title = e.reversed[value];
|
||||
}
|
||||
|
||||
var desc = "";
|
||||
if (e.hasAdditional("description")) {
|
||||
desc = e.additional[value].description;
|
||||
}
|
||||
|
||||
this._lm.setData(title);
|
||||
this._e.setAttribute("title", desc);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return Enumeration;
|
||||
})
|
||||
})();
|
Loading…
Add table
Add a link
Reference in a new issue