comparison app/view/window/OrtCreate.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 6f6d2df00130
children def27cdd0dfa
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 create a Ort
11 */ 11 */
12 Ext.define('Lada.view.window.OrtCreate', { 12 Ext.define('Lada.view.window.OrtCreate', {
13 extend: 'Ext.window.Window', 13 extend: 'Ext.window.Window',
14 alias: 'widget.ortcreate', 14 alias: 'widget.ortcreate',
15 15
76 region: 'center', 76 region: 'center',
77 layout: 'border', 77 layout: 'border',
78 bodyStyle: { 78 bodyStyle: {
79 background: '#fff' 79 background: '#fff'
80 }, 80 },
81 name: 'map' 81 name: 'map',
82 listeners: { //A listener which listens to the mappanels featureselected event
83 featureselected: this.selectedFeature
84 }
82 }] 85 }]
83 }]; 86 }];
84 this.callParent(arguments); 87 this.callParent(arguments);
85 }, 88 },
86 89
89 probeId: this.record.get('id') 92 probeId: this.record.get('id')
90 }); 93 });
91 this.down('ortform').setRecord(ort); 94 this.down('ortform').setRecord(ort);
92 }, 95 },
93 96
97 /**
98 * @private
99 * Override to display and update the map view in the panel.
100 */
101 afterRender: function(){
102 this.superclass.afterRender.apply(this, arguments);
103 var map = this.down('map');
104 map.map.zoomToMaxExtent();
105 },
106
107 /**
108 * This function is used by the MapPanel, when a Feature was selected
109 */
110 selectedFeature: function(context, args) {
111 var feature = args[0];
112 if (feature.attributes.id &&
113 feature.attributes.id !== '') {
114 var record = Ext.data.StoreManager.get('locations').getById(feature.attributes.id);
115 context.up('window').down('locationform').setRecord(record);
116 context.up('window').down('locationform').setReadOnly(true);
117 context.up('window').down('ortform').down('combobox').setValue(record.id);
118 }
119 else {
120 context.up('window').down('locationform').setRecord(this.locationRecord);
121 context.up('window').down('locationform').setReadOnly(false);
122 }
123 },
124
94 setMessages: function(errors, warnings) { 125 setMessages: function(errors, warnings) {
95 //todo this is a stub 126 //todo this is a stub
96 }, 127 },
97 128
98 clearMessages: function() { 129 clearMessages: function() {

http://lada.wald.intevation.org