Commit 361b6ce8 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Externaliza TabsDisplayer de módulo Atlas

Para evitar múltiples niveles de tabs en algunas vistas, se trata al
módulo TabsDisplayer como algo externo a Atlas, recibiendo solamente el
canal para añadir sus propios tabs. Se adaptan las vistas que integran
Atlas para funcionar de esta manera.

Fix #67.
parent 83d7df03
Loading
Loading
Loading
Loading
+14 −43
Original line number Diff line number Diff line
@@ -5,7 +5,6 @@ define([
	, "app/designs/mapWithSideContent/layout/MapAndContent"
	, "dijit/layout/LayoutContainer"
	, "dijit/layout/ContentPane"
	, "dijit/layout/TabContainer"
	, "dojo/_base/declare"
	, "dojo/_base/lang"
	, "dojo/aspect"
@@ -19,6 +18,7 @@ define([
	, "redmic/modules/browser/ListImpl"
	, "redmic/modules/atlas/Atlas"
	, "redmic/modules/base/_ShowInPopup"
	, 'redmic/modules/layout/TabsDisplayer'
	, "redmic/modules/mapQuery/QueryOnMap"
	, "redmic/modules/search/TextImpl"
	, "templates/CitationList"
@@ -29,7 +29,6 @@ define([
	, Layout
	, LayoutContainer
	, ContentPane
	, TabContainer
	, declare
	, lang
	, aspect
@@ -43,6 +42,7 @@ define([
	, ListImpl
	, Atlas
	, _ShowInPopup
	, TabsDisplayer
	, QueryOnMap
	, TextImpl
	, TemplateList
@@ -158,12 +158,6 @@ define([
			}
		},

		_setMainOwnCallbacksForEvents: function() {

			this._onEvt('SHOW', lang.hitch(this, this._onGeographicMainShown));
			this._onEvt('RESIZE', lang.hitch(this, this._onGeographicMainResized));
		},

		postCreate: function() {

			this.inherited(arguments);
@@ -175,6 +169,7 @@ define([
			}

			this._createTabContainers();
			this._createAtlas();
		},

		_createTextSearchNode: function() {
@@ -196,7 +191,7 @@ define([
		_createBrowserNode: function() {

			this.browserAndSearchContainer = new LayoutContainer({
				title: "<i class='fa fa-table'></i>",
				title: "<i class='fa fa-table' title='" + this.i18n.data + "'></i>",
				'class': "marginedContainer noScrolledContainer"
			});

@@ -214,17 +209,18 @@ define([

		_createTabContainers: function() {

			this.tabs = new TabContainer({
				tabPosition: "top",
				region: "center",
				'class': "mediumSolidContainer sideTabContainer borderRadiusTabContainer"
			this._tabsDisplayer = new TabsDisplayer({
				parentChannel: this.getChannel()
			});

			// TODO acceso a lo bruto, hasta que se simplifique la estructura de contenedores
			this.tabs = this._tabsDisplayer._container;

			this.tabs.addChild(this.browserAndSearchContainer);
			this.tabs.addChild(this._createAtlas());

			this.tabs.placeAt(this.contentNode);
			this.tabs.startup();
			this._publish(this._tabsDisplayer.getChannel('SHOW'), {
				node: this.contentNode
			});
		},

		_createAtlas: function() {
@@ -234,7 +230,8 @@ define([
			this.atlas = new Atlas({
				parentChannel: this.getChannel(),
				perms: this.perms,
				getMapChannel: getMapChannel
				getMapChannel: getMapChannel,
				addTabChannel: this._tabsDisplayer.getChannel('ADD_TAB')
			});

			var QueryOnMapPopup = declare(QueryOnMap).extend(_ShowInPopup);
@@ -245,17 +242,6 @@ define([
				width: 5,
				height: "md"
			});

			var cp = new ContentPane({
				title: this.i18n.themes,
				region:"center"
			});

			this._publish(this.atlas.getChannel("SHOW"), {
				node: cp.domNode
			});

			return cp;
		},

		_beforeShowMain: function() {
@@ -318,21 +304,6 @@ define([
			this._publish(channel, {
				selectionTarget: this._getTarget()
			});
		},

		_onGeographicMainShown: function() {

			this._resizeTabs();
		},

		_onGeographicMainResized: function() {

			this._resizeTabs();
		},

		_resizeTabs: function() {

			this.tabs.resize();
		}
	});
});
+13 −27
Original line number Diff line number Diff line
@@ -8,7 +8,6 @@ define([
	, "dijit/layout/LayoutContainer"
	, "dijit/layout/ContentPane"
	, "dijit/layout/StackContainer"
	, "dijit/layout/TabContainer"
	, "dojo/_base/declare"
	, "dojo/_base/lang"
	, "dojo/aspect"
@@ -27,6 +26,7 @@ define([
	, "redmic/modules/browser/bars/Order"
	, "redmic/modules/browser/bars/Total"
	, "redmic/modules/layout/dataDisplayer/DataDisplayer"
	, 'redmic/modules/layout/TabsDisplayer'
	, "redmic/modules/atlas/Atlas"
	, "redmic/modules/base/_ShowInPopup"
	, "redmic/modules/map/layer/GeoJsonLayerImpl"
@@ -49,7 +49,6 @@ define([
	, LayoutContainer
	, ContentPane
	, StackContainer
	, TabContainer
	, declare
	, lang
	, aspect
@@ -68,6 +67,7 @@ define([
	, Order
	, Total
	, DataDisplayer
	, TabsDisplayer
	, Atlas
	, _ShowInPopup
	, GeoJsonLayerImpl
@@ -198,7 +198,6 @@ define([
		_setMainOwnCallbacksForEvents: function () {

			this._onEvt('HIDE', lang.hitch(this, this._onHide));
			this._onEvt('SHOW', lang.hitch(this, this._onGeographicEditorMainShown));
		},

		_defineMainSubscriptions: function () {
@@ -268,6 +267,7 @@ define([
			this._emitEvt('ADD_LAYER', {layer: this.geoJsonLayer});

			this._createTabContainers();
			this._createAtlas();

			this._emitEvt('REFRESH');
		},
@@ -289,17 +289,18 @@ define([

		_createTabContainers: function() {

			this.tabs = new TabContainer({
				tabPosition: "top",
				region: "center",
				'class': "mediumSolidContainer sideTabContainer borderRadiusTabContainer"
			this._tabsDisplayer = new TabsDisplayer({
				parentChannel: this.getChannel()
			});

			// TODO acceso a lo bruto, hasta que se simplifique la estructura de contenedores
			this.tabs = this._tabsDisplayer._container;

			this.tabs.addChild(this.browserAndEditorNode);
			this.tabs.addChild(this._createAtlas());

			this.tabs.placeAt(this.contentNode);
			this.tabs.startup();
			this._publish(this._tabsDisplayer.getChannel('SHOW'), {
				node: this.contentNode
			});
		},

		_createTextSearchNode: function() {
@@ -394,7 +395,8 @@ define([
			this.atlas = new Atlas({
				parentChannel: this.getChannel(),
				perms: this.perms,
				getMapChannel: getMapChannel
				getMapChannel: getMapChannel,
				addTabChannel: this._tabsDisplayer.getChannel('ADD_TAB')
			});

			var QueryOnMapPopup = declare(QueryOnMap).extend(_ShowInPopup);
@@ -405,17 +407,6 @@ define([
				width: 5,
				height: "md"
			});

			var cp = new ContentPane({
				title: this.i18n.themes,
				region:"center"
			});

			this._publish(this.atlas.getChannel("SHOW"), {
				node: cp.domNode
			});

			return cp;
		},

		_updateTitle: function(title) {
@@ -656,11 +647,6 @@ define([
		_getIconKeypadNode: function() {

			return this.textSearchNode.domNode;
		},

		_onGeographicEditorMainShown: function() {

			this.tabs.resize();
		}
	});
});
+33 −60
Original line number Diff line number Diff line
@@ -5,12 +5,9 @@ define([
	, "app/designs/mapWithSideContent/layout/MapAndContentAndTopbar"
	, "app/redmicConfig"
	, 'd3/d3.min'
	, "dijit/layout/ContentPane"
	, "dijit/layout/TabContainer"
	, "dojo/_base/declare"
	, "dojo/_base/lang"
	, "dojo/has"
	, "dojo/query"
	, 'moment/moment.min'
	, "put-selector/put"
	, "RWidgets/Utilities"
@@ -19,6 +16,7 @@ define([
	, "redmic/modules/components/ProgressSlider/ProgressSlider"
	, "redmic/modules/atlas/Atlas"
	, "redmic/modules/base/_ShowInPopup"
	, 'redmic/modules/layout/TabsDisplayer'
	, "redmic/modules/map/layer/_AddFilter"
	, "redmic/modules/map/layer/_PublishInfo"
	, "redmic/modules/map/layer/TrackingLayerImpl"
@@ -30,12 +28,9 @@ define([
	, Layout
	, redmicConfig
	, d3
	, ContentPane
	, TabContainer
	, declare
	, lang
	, has
	, query
	, moment
	, put
	, Utilities
@@ -44,6 +39,7 @@ define([
	, ProgressSlider
	, Atlas
	, _ShowInPopup
	, TabsDisplayer
	, _AddFilter
	, _PublishInfo
	, TrackingLayerImpl
@@ -134,8 +130,6 @@ define([
		_setMainOwnCallbacksForEvents: function() {

			this.on([this.events.HIDE, this.events.ANCESTOR_HIDE], lang.hitch(this, this._onHide));
			this._onEvt('SHOW', lang.hitch(this, this._onTrackingMainShown));
			this._onEvt('RESIZE', lang.hitch(this, this._onTrackingMainResized));
		},

		_initializeMain: function() {
@@ -150,22 +144,8 @@ define([
				}
			});

			var getMapChannel = lang.hitch(this.map, this.map.getChannel);

			this.atlas = new Atlas({
				parentChannel: this.getChannel(),
				perms: this.perms,
				getMapChannel: getMapChannel
			});

			var QueryOnMapPopup = declare(QueryOnMap).extend(_ShowInPopup);
			this._queryOnMap = new QueryOnMapPopup({
				parentChannel: this.getChannel(),
				getMapChannel: getMapChannel,
				typeGroupProperty: this.typeGroupProperty,
				title: this.i18n.layersQueryResults,
				width: 5,
				height: "md"
			this._tabsDisplayer = new TabsDisplayer({
				parentChannel: this.getChannel()
			});
		},

@@ -225,16 +205,38 @@ define([

		_fillSideContent: function() {

			this.tabContainer = new TabContainer({
				region: 'center',
				'class': "mediumSolidContainer sideTabContainer borderRadiusTabContainer"
			});
			// TODO acceso a lo bruto, hasta que se simplifique la estructura de contenedores
			this.tabContainer = this._tabsDisplayer._container;

			this.tabContainer.addChild(this._createSettings());
			this.tabContainer.addChild(this._createAtlas());

			this.tabContainer.placeAt(this.contentNode);
			this.tabContainer.startup();
			this._createAtlas();

			this._publish(this._tabsDisplayer.getChannel('SHOW'), {
				node: this.contentNode
			});
		},

		_createAtlas: function() {

			var getMapChannel = lang.hitch(this.map, this.map.getChannel);

			this.atlas = new Atlas({
				parentChannel: this.getChannel(),
				perms: this.perms,
				getMapChannel: getMapChannel,
				addTabChannel: this._tabsDisplayer.getChannel('ADD_TAB')
			});

			var QueryOnMapPopup = declare(QueryOnMap).extend(_ShowInPopup);
			this._queryOnMap = new QueryOnMapPopup({
				parentChannel: this.getChannel(),
				getMapChannel: getMapChannel,
				typeGroupProperty: this.typeGroupProperty,
				title: this.i18n.layersQueryResults,
				width: 5,
				height: "md"
			});
		},

		_createSettings: function() {
@@ -277,20 +279,6 @@ define([
			}
		},

		_createAtlas: function() {

			var cp = new ContentPane({
				title: this.i18n.themes,
				region: "center"
			});

			this._publish(this.atlas.getChannel("SHOW"), {
				node: cp.domNode
			});

			return cp;
		},

		_addDataLayer: function(idProperty, item) {

			if (!this._layerInstances[idProperty]) {
@@ -665,21 +653,6 @@ define([
			this._emitEvt('PRESS_PROGRESS_BUTTON', {
				key: "PAUSE"
			});
		},

		_onTrackingMainShown: function() {

			this._resizeTabs();
		},

		_onTrackingMainResized: function() {

			this._resizeTabs();
		},

		_resizeTabs: function() {

			this.tabContainer.resize();
		}
	});
});
+14 −2
Original line number Diff line number Diff line
@@ -4,8 +4,10 @@ define([
	, "app/redmicConfig"
	, "dojo/_base/declare"
	, "dojo/_base/lang"
	, 'put-selector/put'
	, "redmic/modules/atlas/Atlas"
	, "redmic/modules/base/_ShowInPopup"
	, 'redmic/modules/layout/TabsDisplayer'
	, "redmic/modules/mapQuery/QueryOnMap"
], function(
	Controller
@@ -13,8 +15,10 @@ define([
	, redmicConfig
	, declare
	, lang
	, put
	, Atlas
	, _ShowInPopup
	, TabsDisplayer
	, QueryOnMap
) {

@@ -34,7 +38,8 @@ define([
			this.config = {
				title: this.i18n.map,
				region: "center",
				selectionTarget: redmicConfig.services.atlasLayerSelection
				selectionTarget: redmicConfig.services.atlasLayerSelection,
				_atlasContainerClass: 'atlasContainer',
			};

			lang.mixin(this, this.config, args);
@@ -62,6 +67,11 @@ define([
			this.atlasConfig.getMapChannel = getMapChannel;
			this.queryOnMapConfig.getMapChannel = getMapChannel;

			this._tabsDisplayer = new TabsDisplayer({
				parentChannel: this.getChannel()
			});
			this.atlasConfig.addTabChannel = this._tabsDisplayer.getChannel('ADD_TAB');

			this.atlas = new Atlas(this.atlasConfig);

			var QueryOnMapPopup = declare(QueryOnMap).extend(_ShowInPopup);
@@ -72,7 +82,9 @@ define([

			this.inherited(arguments);

			this._publish(this.atlas.getChannel("SHOW"), {
			put(this.contentNode, '.' + this._atlasContainerClass);

			this._publish(this._tabsDisplayer.getChannel('SHOW'), {
				node: this.contentNode
			});
		},
+26 −44
Original line number Diff line number Diff line
@@ -4,7 +4,6 @@ define([
	, 'app/redmicConfig'
	, 'dijit/layout/LayoutContainer'
	, 'dijit/layout/ContentPane'
	, 'dijit/layout/TabContainer'
	, 'dojo/_base/declare'
	, 'dojo/_base/lang'
	, 'redmic/modules/base/_Filter'
@@ -16,6 +15,7 @@ define([
	, "redmic/modules/gateway/MapCenteringGatewayImpl"
	, 'redmic/modules/atlas/Atlas'
	, "redmic/modules/base/_ShowInPopup"
	, 'redmic/modules/layout/TabsDisplayer'
	, 'redmic/modules/map/layer/PruneClusterLayerImpl'
	, "redmic/modules/mapQuery/QueryOnMap"
	, 'redmic/modules/search/TextImpl'
@@ -27,7 +27,6 @@ define([
	, redmicConfig
	, LayoutContainer
	, ContentPane
	, TabContainer
	, declare
	, lang
	, _Filter
@@ -39,6 +38,7 @@ define([
	, MapCenteringGatewayImpl
	, Atlas
	, _ShowInPopup
	, TabsDisplayer
	, PruneClusterLayerImpl
	, QueryOnMap
	, TextImpl
@@ -120,34 +120,16 @@ define([
			}, this.browserConfig || {}]);
		},

		_setOwnCallbacksForEvents: function() {

			this._onEvt('SHOW', lang.hitch(this, this._onShown));
		},

		_initialize: function() {

			this.searchConfig.queryChannel = this.queryChannel;
			this.textSearch = new declare([TextImpl])(this.searchConfig);
			this.textSearch = new TextImpl(this.searchConfig);

			this.browserConfig.queryChannel = this.queryChannel;
			this.browser = new declare([ListImpl, _Framework, _GeoJsonParser, _ButtonsInRow])(this.browserConfig);

			var getMapChannel = lang.hitch(this.map, this.map.getChannel);

			this.atlas = new Atlas({
				parentChannel: this.getChannel(),
				perms: this.perms,
				getMapChannel: getMapChannel
			});

			var QueryOnMapPopup = declare(QueryOnMap).extend(_ShowInPopup);
			this._queryOnMap = new QueryOnMapPopup({
				parentChannel: this.getChannel(),
				getMapChannel: getMapChannel,
				title: this.i18n.layersQueryResults,
				width: 5,
				height: "md"
			this._tabsDisplayer = new TabsDisplayer({
				parentChannel: this.getChannel()
			});

			this.modelChannel = this.filter.modelChannel;
@@ -195,17 +177,15 @@ define([
			browserAndSearchContainer.addChild(this.textSearchNode);
			browserAndSearchContainer.addChild(this.gridNode);

			this.tabs = new TabContainer({
				tabPosition: 'top',
				splitter: true,
				region: 'right',
				'class': 'softSolidContainer sideTabContainer'
			});
			// TODO acceso a lo bruto, hasta que se simplifique la estructura de contenedores
			this.tabs = this._tabsDisplayer._container;

			this.tabs.addChild(browserAndSearchContainer);
			this.tabs.addChild(this._createAtlas());
			this.tabs.placeAt(this.contentNode);
			this.tabs.startup();
			this._createAtlas();

			this._publish(this._tabsDisplayer.getChannel('SHOW'), {
				node: this.contentNode
			});

			this._emitEvt('ADD_LAYER', {layer: this._layerInstance});

@@ -227,11 +207,6 @@ define([
			this._emitEvt('REFRESH');
		},

		_onShown: function() {

			this.tabs.resize();
		},

		_getPopupContent: function(data) {

			return this.templatePopup({
@@ -242,16 +217,23 @@ define([

		_createAtlas: function() {

			var cp = new ContentPane({
				title: this.i18n.themes,
				region:'center'
			});
			var getMapChannel = lang.hitch(this.map, this.map.getChannel);

			this._publish(this.atlas.getChannel('SHOW'), {
				node: cp.domNode
			this.atlas = new Atlas({
				parentChannel: this.getChannel(),
				perms: this.perms,
				getMapChannel: getMapChannel,
				addTabChannel: this._tabsDisplayer.getChannel('ADD_TAB')
			});

			return cp;
			var QueryOnMapPopup = declare(QueryOnMap).extend(_ShowInPopup);
			this._queryOnMap = new QueryOnMapPopup({
				parentChannel: this.getChannel(),
				getMapChannel: getMapChannel,
				title: this.i18n.layersQueryResults,
				width: 5,
				height: "md"
			});
		}
	});
});
Loading