comparison src/djol/LayerCheckBox.js @ 10:8705103f074f

Слияние
author cin
date Mon, 21 Aug 2017 18:03:00 +0300
parents f0035923ff3e
children
comparison
equal deleted inserted replaced
9:37e9e6bbe87a 10:8705103f074f
1 define([
2 "dojo/_base/declare",
3 "dijit/_WidgetBase",
4 "dijit/_TemplatedMixin",
5 "dijit/_WidgetsInTemplateMixin",
6 "dojo/text!./resources/LayerCheckBoxTemplate.html",
7 "dijit/form/CheckBox" ], function(declare, _WidgetBase, _TemplatedMixin,
8 _WidgetsInTemplateMixin, templateString) {
9 return declare([ _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin ], {
10 templateString : templateString,
11 labelNode : null,
12 checkBox : null,
13
14 label : "",
15 _setLabelAttr : {
16 node : "labelNode",
17 type : "innerHTML"
18 },
19
20 name : "layer",
21
22 _layer : null,
23
24 constructor : function(options) {
25 options = options || {};
26
27 if (!options.layer)
28 throw new Error("The layer is required");
29
30 this._layer = options.layer;
31 this.label = options.layer.get("label") || "unnamed";
32 },
33
34 postCreate : function() {
35 var me = this;
36 me.inherited(arguments);
37
38 me.checkBox.set('name', me.name);
39 me.checkBox.set('value', me._layer.getVisible());
40 this.checkBox.on("change", function(value) {
41 me._changed(value);
42 });
43 },
44
45 _changed : function(visible) {
46 this._layer.setVisible(visible);
47 }
48 });
49 });