raimund@642: /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz raimund@642: * Software engineering by Intevation GmbH raimund@642: * raimund@642: * This file is Free Software under the GNU GPL (v>=3) raimund@642: * and comes with ABSOLUTELY NO WARRANTY! Check out raimund@642: * the documentation coming with IMIS-Labordaten-Application for details. raimund@642: */ raimund@642: dustin@796: /** dustin@796: * Window to create a Ort raimund@642: */ raimund@642: Ext.define('Lada.view.window.OrtCreate', { raimund@642: extend: 'Ext.window.Window', raimund@642: alias: 'widget.ortcreate', raimund@642: raimund@642: requires: [ raimund@642: 'Lada.view.panel.Map', raimund@642: 'Lada.view.form.Ort', raimund@642: 'Lada.view.form.Location' raimund@642: ], raimund@642: raimund@642: collapsible: true, raimund@642: maximizable: true, raimund@642: autoshow: true, raimund@642: layout: 'border', dustin@688: constrain: true, raimund@642: raimund@642: record: null, raimund@642: grid: null, raimund@642: dustin@890: /** dustin@890: * This function initialises the Window dustin@890: */ raimund@642: initComponent: function() { raimund@642: this.title = 'Ort'; raimund@642: this.buttons = [{ raimund@642: text: 'Schließen', raimund@642: scope: this, raimund@642: handler: this.close raimund@642: }]; raimund@642: this.width = 900; raimund@642: this.height = 515; raimund@642: this.bodyStyle = {background: '#fff'}; raimund@642: dustin@709: // add listeners to change the window appearence when it becomes inactive dustin@709: this.on({ dustin@709: activate: function(){ dustin@709: this.getEl().removeCls('window-inactive'); dustin@709: }, dustin@709: deactivate: function(){ dustin@709: this.getEl().addCls('window-inactive'); dustin@709: } dustin@709: }); dustin@709: raimund@642: this.items = [{ raimund@642: region: 'west', raimund@642: border: 0, raimund@642: layout: 'vbox', raimund@642: items: [{ raimund@642: xtype: 'ortform', raimund@642: margin: 5 raimund@642: }, { raimund@642: xtype: 'locationform', raimund@642: margin: 5 raimund@642: }] raimund@642: }, { raimund@642: xtype: 'fset', raimund@642: bodyStyle: { raimund@642: background: '#fff' raimund@642: }, raimund@642: layout: 'border', raimund@642: name: 'mapfield', raimund@642: title: 'Karte', raimund@642: region: 'center', raimund@642: padding: '5, 5', raimund@642: margin: 5, raimund@642: items: [{ raimund@642: xtype: 'map', raimund@642: region: 'center', raimund@642: layout: 'border', raimund@642: bodyStyle: { raimund@642: background: '#fff' raimund@642: }, dustin@796: name: 'map', dustin@796: listeners: { //A listener which listens to the mappanels featureselected event dustin@796: featureselected: this.selectedFeature dustin@796: } raimund@642: }] raimund@642: }]; raimund@642: this.callParent(arguments); raimund@642: }, raimund@642: dustin@890: /** dustin@890: * Initialise the Data of this Window dustin@890: */ raimund@642: initData: function() { raimund@642: var ort = Ext.create('Lada.model.Ort', { raimund@642: probeId: this.record.get('id') raimund@642: }); raimund@642: this.down('ortform').setRecord(ort); raimund@642: }, raimund@642: dustin@796: /** dustin@796: * @private dustin@796: * Override to display and update the map view in the panel. dustin@796: */ dustin@796: afterRender: function(){ dustin@796: this.superclass.afterRender.apply(this, arguments); dustin@796: var map = this.down('map'); dustin@796: map.map.zoomToMaxExtent(); dustin@796: }, dustin@796: dustin@796: /** dustin@796: * This function is used by the MapPanel, when a Feature was selected dustin@796: */ dustin@796: selectedFeature: function(context, args) { dustin@796: var feature = args[0]; dustin@796: if (feature.attributes.id && dustin@796: feature.attributes.id !== '') { dustin@796: var record = Ext.data.StoreManager.get('locations').getById(feature.attributes.id); dustin@796: context.up('window').down('locationform').setRecord(record); dustin@796: context.up('window').down('locationform').setReadOnly(true); dustin@796: context.up('window').down('ortform').down('combobox').setValue(record.id); dustin@796: } dustin@796: else { dustin@796: context.up('window').down('locationform').setRecord(this.locationRecord); dustin@796: context.up('window').down('locationform').setReadOnly(false); dustin@796: } dustin@796: }, dustin@796: dustin@890: /** dustin@890: * Instructs the fields / forms listed in this method to set a message. dustin@890: * @param errors These Errors shall be shown dustin@890: * @param warnings These Warning shall be shown dustin@890: */ raimund@642: setMessages: function(errors, warnings) { raimund@642: //todo this is a stub raimund@642: }, raimund@642: dustin@890: /** dustin@890: * Instructs the fields / forms listed in this method to clear their messages. dustin@890: */ raimund@642: clearMessages: function() { raimund@642: //todo this is a stub raimund@642: } raimund@642: });