dustin@1013: /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz dustin@1013: * Software engineering by Intevation GmbH dustin@1013: * dustin@1013: * This file is Free Software under the GNU GPL (v>=3) dustin@1013: * and comes with ABSOLUTELY NO WARRANTY! Check out dustin@1013: * the documentation coming with IMIS-Labordaten-Application for details. dustin@1013: */ dustin@1013: dustin@1013: /** dustin@1013: * Window to create/edit the Ort / Probe Relation dustin@1013: */ dustin@1013: Ext.define('Lada.view.window.Ortszuordnung', { dustin@1013: extend: 'Ext.window.Window', dustin@1013: alias: 'widget.ortszuordnungwindow', dustin@1013: dustin@1013: requires: [ dustin@1021: 'Lada.view.form.Ortszuordnung', dustin@1021: 'Lada.view.panel.Ort' dustin@1013: ], dustin@1013: dustin@1013: collapsible: true, dustin@1013: maximizable: true, dustin@1013: autoshow: true, dustin@1021: layout: 'vbox', dustin@1013: constrain: true, dustin@1013: dustin@1013: probe: null, dustin@1013: parentWindow: null, dustin@1013: record: null, dustin@1013: grid: null, dustin@1013: dustin@1013: /** dustin@1013: * This function initialises the Window dustin@1013: */ dustin@1013: initComponent: function() { dustin@1013: var i18n = Lada.getApplication().bundle; dustin@1013: dustin@1013: this.title = i18n.getMsg('ortszuordnung.window.title'); dustin@1013: dustin@1013: if (this.record && this.probe) { dustin@1021: // A record be edited dustin@1013: this.title = i18n.getMsg('ortszuordnung.window.title') dustin@1013: + ' ' dustin@1013: + i18n.getMsg('ortszuordnung.window.title2') dustin@1013: + ' ' dustin@1013: + i18n.getMsg('probe') dustin@1013: + ' ' dustin@1021: + this.probe.get('hauptprobennr') dustin@1013: + ' ' dustin@1013: + i18n.getMsg('edit'); dustin@1013: } dustin@1013: else if (this.probe) { dustin@1013: // A new record will be created dustin@1013: this.title = i18n.getMsg('ortszuordnung.window.title') dustin@1013: + ' ' dustin@1013: + i18n.getMsg('ortszuordnung.window.title2') dustin@1013: + ' ' dustin@1013: + i18n.getMsg('probe') dustin@1013: + ' ' dustin@1021: + this.probe.get('hauptprobennr') dustin@1013: + ' ' dustin@1013: + i18n.getMsg('create'); dustin@1013: } dustin@1013: dustin@1013: this.buttons = [{ dustin@1013: text: i18n.getMsg('close'), dustin@1013: scope: this, dustin@1013: handler: this.close dustin@1013: }]; dustin@1013: this.width = 900; dustin@1013: this.height = 515; dustin@1013: this.bodyStyle = {background: '#fff'}; dustin@1013: dustin@1013: // add listeners to change the window appearence when it becomes inactive dustin@1013: this.on({ dustin@1013: activate: function(){ dustin@1013: this.getEl().removeCls('window-inactive'); dustin@1013: }, dustin@1013: deactivate: function(){ dustin@1013: this.getEl().addCls('window-inactive'); dustin@1013: } dustin@1013: }); dustin@1013: dustin@1013: this.items = [{ dustin@1021: xtype: 'ortszuordnungform', dustin@1021: layout: 'fit', raimund@1049: width: '100%', dustin@1021: margin: 5 dustin@1021: }, { dustin@1021: xtype: 'ortpanel', dustin@1021: flex: 1, dustin@1021: toolbarPos: 'bottom', dustin@1021: margin: 5 dustin@1013: }]; dustin@1013: this.callParent(arguments); dustin@1013: }, dustin@1013: dustin@1013: /** dustin@1013: * Initialise the Data of this Window dustin@1013: */ dustin@1013: initData: function() { raimund@1134: if (!this.record) { raimund@1134: this.record = Ext.create('Lada.model.Ortszuordnung'); raimund@1134: if (!this.record.get('letzteAenderung')) { raimund@1134: this.record.data.letzteAenderung = new Date(); raimund@1134: } raimund@1134: this.record.set('probeId', this.probe.get('id')); raimund@1134: } dustin@1013: this.down('ortszuordnungform').setRecord(this.record); dustin@1021: this.down('ortpanel').setStore(); dustin@1021: }, dustin@1021: dustin@1021: /** dustin@1021: * @private dustin@1021: * Override to display and update the map view in the panel. dustin@1021: */ dustin@1021: afterRender: function(){ dustin@1021: this.superclass.afterRender.apply(this, arguments); dustin@1021: var map = this.down('ortpanel').down('map'); dustin@1021: map.map.zoomToMaxExtent(); dustin@1013: }, dustin@1013: dustin@1013: /** dustin@1013: * Instructs the fields / forms listed in this method to set a message. dustin@1013: * @param errors These Errors shall be shown dustin@1013: * @param warnings These Warning shall be shown dustin@1013: */ dustin@1013: setMessages: function(errors, warnings) { dustin@1013: //todo this is a stub dustin@1013: }, dustin@1013: dustin@1013: /** dustin@1013: * Instructs the fields / forms listed in this method to clear their messages. dustin@1013: */ dustin@1013: clearMessages: function() { dustin@1013: //todo this is a stub dustin@1013: } dustin@1013: }); dustin@1013: