comparison app/view/window/OrtEdit.js @ 796:7267bae1d43f

made window-panel recyclable, fwd openlayers events to ext
author Dustin Demuth <dustin@intevation.de>
date Wed, 20 May 2015 14:19:12 +0200
parents 6bc05ba2f6b1
children e5f72fb491f4
comparison
equal deleted inserted replaced
795:255568e97c96 796:7267bae1d43f
4 * This file is Free Software under the GNU GPL (v>=3) 4 * This file is Free Software under the GNU GPL (v>=3)
5 * and comes with ABSOLUTELY NO WARRANTY! Check out 5 * and comes with ABSOLUTELY NO WARRANTY! Check out
6 * the documentation coming with IMIS-Labordaten-Application for details. 6 * the documentation coming with IMIS-Labordaten-Application for details.
7 */ 7 */
8 8
9 /* 9 /**
10 * Window to edit a Messung 10 * Window to edit a Ort
11 */ 11 */
12 Ext.define('Lada.view.window.OrtEdit', { 12 Ext.define('Lada.view.window.OrtEdit', {
13 extend: 'Ext.window.Window', 13 extend: 'Ext.window.Window',
14 alias: 'widget.ortedit', 14 alias: 'widget.ortedit',
15 15
91 layout: 'border', 91 layout: 'border',
92 record: this.record, 92 record: this.record,
93 bodyStyle: { 93 bodyStyle: {
94 background: '#fff' 94 background: '#fff'
95 }, 95 },
96 name: 'map' 96 name: 'map',
97 listeners: { //A listener which listens to the mappanels featureselected event
98 featureselected: this.selectedFeature
99 }
97 }] 100 }]
98 }]; 101 }];
99 this.callParent(arguments); 102 this.callParent(arguments);
100 }, 103 },
101 104
139 }, 142 },
140 scope: this 143 scope: this
141 }); 144 });
142 }, 145 },
143 146
147 /**
148 * @private
149 * Override to display and update the map view in the panel.
150 */
151 afterRender: function(){
152 this.superclass.afterRender.apply(this, arguments);
153 var map = this.down('map');
154 if (this.record) {
155 map.selectFeature(this.record.get('ort'));
156 }
157 else {
158 map.map.zoomToMaxExtent();
159 }
160 },
161
162 /**
163 * This function is used by the MapPanel, when a Feature was selected
164 */
165 selectedFeature: function(context, args) {
166 var feature = args[0];
167 if (feature.attributes.id &&
168 feature.attributes.id !== '') {
169 var record = Ext.data.StoreManager.get('locations').getById(feature.attributes.id);
170 context.up('window').down('locationform').setRecord(record);
171 context.up('window').down('locationform').setReadOnly(true);
172 context.up('window').down('ortform').down('combobox').setValue(record.id);
173 }
174 else {
175 context.up('window').down('locationform').setRecord(this.locationRecord);
176 context.up('window').down('locationform').setReadOnly(false);
177 }
178 },
179
144 setMessages: function(errors, warnings) { 180 setMessages: function(errors, warnings) {
145 //todo this is a stub 181 //todo this is a stub
146 }, 182 },
147 183
148 clearMessages: function() { 184 clearMessages: function() {

http://lada.wald.intevation.org