54 lines
1.8 KiB
JavaScript
54 lines
1.8 KiB
JavaScript
"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;
|
|
})
|
|
})();
|