raimund@619: /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
raimund@619:  * Software engineering by Intevation GmbH
raimund@619:  *
raimund@619:  * This file is Free Software under the GNU GPL (v>=3)
raimund@619:  * and comes with ABSOLUTELY NO WARRANTY! Check out
raimund@619:  * the documentation coming with IMIS-Labordaten-Application for details.
raimund@619:  */
raimund@619: 
dustin@891: /**
raimund@619:  * Window to edit a Probe
raimund@619:  */
raimund@619: Ext.define('Lada.view.window.ProbeCreate', {
raimund@619:     extend: 'Ext.window.Window',
raimund@619:     alias: 'widget.probecreate',
raimund@619: 
raimund@619:     requires: [
raimund@619:         'Lada.view.form.Probe'
raimund@619:     ],
raimund@619: 
raimund@619:     collapsible: true,
raimund@619:     maximizable: true,
raimund@619:     autoShow: true,
raimund@619:     autoScroll: true,
raimund@619:     layout: 'fit',
dustin@688:     constrain: true,
raimund@619: 
raimund@619:     record: null,
raimund@619: 
dustin@890:     /**
dustin@890:      * This function initialises the Window
dustin@890:      */
raimund@619:     initComponent: function() {
raimund@619:         this.title = '§3-Probe';
raimund@619:         this.buttons = [{
raimund@619:             text: 'Schließen',
raimund@619:             scope: this,
raimund@619:             handler: this.close
raimund@619:         }];
dustin@709: 
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@619:         this.width = 700;
raimund@619:         // InitialConfig is the config object passed to the constructor on
raimund@619:         // creation of this window. We need to pass it throuh to the form as
raimund@619:         // we need the "modelId" param to load the correct item.
raimund@619: 
raimund@619:         this.items = [{
raimund@619:             border: 0,
raimund@619:             autoScroll: true,
raimund@619:             items: [{
raimund@619:                 xtype: 'probeform'
raimund@619:             }]
raimund@619:         }];
raimund@619:         this.callParent(arguments);
raimund@619:     },
raimund@619: 
dustin@890:      /**
dustin@890:       * Initialise the Data of this Window
dustin@890:       */
raimund@619:     initData: function() {
raimund@619:         var record = Ext.create('Lada.model.Probe');
dustin@970:         record.data.probeentnahmeBeginn = new Date();
dustin@970:         record.data.probeentnahmeEnde = new Date();
raimund@619:         this.down('probeform').setRecord(record);
raimund@619:     },
raimund@619: 
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@619:     setMessages: function(errors, warnings) {
raimund@619:         this.down('probeform').setMessages(errors, warnings);
raimund@619:     },
raimund@619: 
dustin@890:     /**
dustin@890:      * Instructs the fields / forms listed in this method to clear their messages.
dustin@890:      */
raimund@619:     clearMessages: function() {
raimund@619:         this.down('probeform').clearMessages();
dustin@707:     },
dustin@707: 
dustin@890:     /**
dustin@890:      * Disable the Childelements of this window
dustin@890:      */
dustin@707:     disableChildren: function(){
dustin@707:         //intentionally!
dustin@707:         return true;
dustin@707:     },
dustin@707: 
dustin@890:     /**
dustin@890:      * Enable the Childelements of this window
dustin@890:      */
dustin@707:     enableChildren: function(){
dustin@707:         //intentionally!
dustin@707:         return true;
raimund@619:     }
raimund@619: });