Skip to content

Commit

Permalink
First release of LayerListWidget compatible with Webapp Builder 1.3.
Browse files Browse the repository at this point in the history
  • Loading branch information
arunsebastian committed Feb 26, 2016
1 parent 3f6b994 commit 9cc6126
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/LayerListView.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ define([
postCreate: function () {
var config = this.config.metadataTool;
this.metadata = new Metadata(config);
array.forEach(this.operLayerInfos.finalLayerInfos, function (layerInfo) {
array.forEach(this.operLayerInfos.getLayerInfoArray(), function (layerInfo) {
this.drawListNode(layerInfo, 0, this.layerListTable, true);
}, this);

Expand Down
42 changes: 38 additions & 4 deletions src/Widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ define([
'dojo/_base/declare',
'dojo/_base/lang',
'dojo/_base/array',
'dojo/dom-attr',
"dojo/topic",
'dojo/dom-construct',
'dojo/dom-geometry',
Expand All @@ -27,7 +28,6 @@ define([
'dojo/_base/unload',
'dojo/aspect',
'dojo/query',
'jimu/dijit/Selectionbox',
'./LayerListView',
'./PopupMenu',
'dojo/dom-style',
Expand All @@ -36,8 +36,8 @@ define([
'jimu/LayerInfos/LayerInfos',
'dojo/promise/all'
],
function(BaseWidget, declare, lang, array,topic, domConstruct, domGeometry, dom, on, baseUnload,
aspect, query, Selectionbox, LayerListView, PopupMenu, domStyle, NlsStrings, LayerInfoFactory,
function(BaseWidget, declare, lang, array,domAttr,topic, domConstruct, domGeometry, dom, on, baseUnload,
aspect, query, LayerListView, PopupMenu, domStyle, NlsStrings, LayerInfoFactory,
LayerInfos, all) {
var clazz = declare([BaseWidget], {
/*jshint unused: false*/
Expand All @@ -53,7 +53,8 @@ define([
operLayerInfos: null,

startup: function() {
NlsStrings.value = this.nls;
NlsStrings.value = this.nls;

// summary:
// this function will be called when widget is started.
// description:
Expand Down Expand Up @@ -100,6 +101,7 @@ define([
}));
}
this._registerMapZoom();
this._setVersionTitle();
},
_registerMapZoom:function(){
//this will grey out layer nodes when zoomed out of scale
Expand Down Expand Up @@ -294,6 +296,38 @@ define([
_onLayerInfosChanged: function (layerInfo, changedType) {
this._clearLayers();
this.showLayers();
},
_setVersionTitle: function () {
var labelNode = this._getLabelNode(this);
var manifestInfo = this.manifest;
var devVersion = manifestInfo.version;
var devWabVersion = manifestInfo.developedAgainst || manifestInfo.wabVersion;
var codeSourcedFrom = manifestInfo.codeSourcedFrom;
var client = manifestInfo.client;

var title = "Dev version: " + devVersion + "\n";
title += "Developed/Modified against: WAB" + devWabVersion + "\n";
title += "Client: " + client + "\n";
if (codeSourcedFrom) {
title += "Code sourced from: " + codeSourcedFrom + "\n";
}

if (labelNode) {
domAttr.set(labelNode, 'title', title);
}

},
_getLabelNode: function (widget) {
var labelNode;
if (!(widget.labelNode) && !(widget.titleLabelNode)) {
if (widget.getParent()) {
labelNode = this._getLabelNode(widget.getParent());
}
} else {
labelNode = widget.labelNode || widget.titleLabelNode;
}
return labelNode;

}
//_onLayersScaleChange: function (event) {
// console.log("mapScale");
Expand Down
6 changes: 4 additions & 2 deletions src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
"name": "LayerListWidget",
"2D": true,
"platform": "HTML",
"version": "1.2",
"wabVersion": "1.2",
"version": "11795",
"client":"GISCO",
"developedAgainst":"1.3",
"wabVersion":"1.3",
"author": "Esri R&D Center Beijing",
"description": "",
"copyright": "",
Expand Down

0 comments on commit 9cc6126

Please sign in to comment.