annotate app/view/window/ProbeCreate.js @ 1357:b96d98f0cb71

Fix handling of errors and warnings in Ortserstellung form.
author Tom Gottfried <tom@intevation.de>
date Tue, 07 Feb 2017 18:25:18 +0100
parents f4eb53ba63fc
children
rev   line source
619
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
3 *
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
7 */
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8
891
8054232535ba More JSduck
Dustin Demuth <dustin@intevation.de>
parents: 890
diff changeset
9 /**
619
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10 * Window to edit a Probe
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11 */
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 Ext.define('Lada.view.window.ProbeCreate', {
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 extend: 'Ext.window.Window',
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 alias: 'widget.probecreate',
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 requires: [
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 'Lada.view.form.Probe'
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18 ],
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
20 collapsible: true,
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21 maximizable: true,
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 autoShow: true,
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 autoScroll: true,
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 layout: 'fit',
688
6a6d1b02a1a3 constrain windows to viewport
Dustin Demuth <dustin@intevation.de>
parents: 619
diff changeset
25 constrain: true,
619
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
27 record: null,
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
28
890
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 833
diff changeset
29 /**
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 833
diff changeset
30 * This function initialises the Window
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 833
diff changeset
31 */
619
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32 initComponent: function() {
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
33 this.title = '§3-Probe';
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
34 this.buttons = [{
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35 text: 'Schließen',
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36 scope: this,
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37 handler: this.close
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38 }];
709
6f6d2df00130 Added some CSS to make distinction between active and inactice windows more simple for the user
Dustin Demuth <dustin@intevation.de>
parents: 707
diff changeset
39
6f6d2df00130 Added some CSS to make distinction between active and inactice windows more simple for the user
Dustin Demuth <dustin@intevation.de>
parents: 707
diff changeset
40 // add listeners to change the window appearence when it becomes inactive
6f6d2df00130 Added some CSS to make distinction between active and inactice windows more simple for the user
Dustin Demuth <dustin@intevation.de>
parents: 707
diff changeset
41 this.on({
6f6d2df00130 Added some CSS to make distinction between active and inactice windows more simple for the user
Dustin Demuth <dustin@intevation.de>
parents: 707
diff changeset
42 activate: function(){
6f6d2df00130 Added some CSS to make distinction between active and inactice windows more simple for the user
Dustin Demuth <dustin@intevation.de>
parents: 707
diff changeset
43 this.getEl().removeCls('window-inactive');
6f6d2df00130 Added some CSS to make distinction between active and inactice windows more simple for the user
Dustin Demuth <dustin@intevation.de>
parents: 707
diff changeset
44 },
6f6d2df00130 Added some CSS to make distinction between active and inactice windows more simple for the user
Dustin Demuth <dustin@intevation.de>
parents: 707
diff changeset
45 deactivate: function(){
6f6d2df00130 Added some CSS to make distinction between active and inactice windows more simple for the user
Dustin Demuth <dustin@intevation.de>
parents: 707
diff changeset
46 this.getEl().addCls('window-inactive');
6f6d2df00130 Added some CSS to make distinction between active and inactice windows more simple for the user
Dustin Demuth <dustin@intevation.de>
parents: 707
diff changeset
47 }
6f6d2df00130 Added some CSS to make distinction between active and inactice windows more simple for the user
Dustin Demuth <dustin@intevation.de>
parents: 707
diff changeset
48 });
6f6d2df00130 Added some CSS to make distinction between active and inactice windows more simple for the user
Dustin Demuth <dustin@intevation.de>
parents: 707
diff changeset
49
619
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
50 this.width = 700;
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51 // InitialConfig is the config object passed to the constructor on
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52 // creation of this window. We need to pass it throuh to the form as
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53 // we need the "modelId" param to load the correct item.
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 this.items = [{
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56 border: 0,
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57 autoScroll: true,
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
58 items: [{
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
59 xtype: 'probeform'
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
60 }]
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
61 }];
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
62 this.callParent(arguments);
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
63 },
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
64
890
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 833
diff changeset
65 /**
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 833
diff changeset
66 * Initialise the Data of this Window
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 833
diff changeset
67 */
619
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
68 initData: function() {
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
69 var record = Ext.create('Lada.model.Probe');
970
f4eb53ba63fc Setting Timestamps the correct way. Before this commit the times of the instatiation of the model were used as default values, which led to wrong dates.
Dustin Demuth <dustin@intevation.de>
parents: 891
diff changeset
70 record.data.probeentnahmeBeginn = new Date();
f4eb53ba63fc Setting Timestamps the correct way. Before this commit the times of the instatiation of the model were used as default values, which led to wrong dates.
Dustin Demuth <dustin@intevation.de>
parents: 891
diff changeset
71 record.data.probeentnahmeEnde = new Date();
619
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
72 this.down('probeform').setRecord(record);
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
73 },
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
74
890
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 833
diff changeset
75 /**
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 833
diff changeset
76 * Instructs the fields / forms listed in this method to set a message.
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 833
diff changeset
77 * @param errors These Errors shall be shown
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 833
diff changeset
78 * @param warnings These Warning shall be shown
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 833
diff changeset
79 */
619
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
80 setMessages: function(errors, warnings) {
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
81 this.down('probeform').setMessages(errors, warnings);
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
82 },
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
83
890
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 833
diff changeset
84 /**
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 833
diff changeset
85 * Instructs the fields / forms listed in this method to clear their messages.
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 833
diff changeset
86 */
619
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
87 clearMessages: function() {
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
88 this.down('probeform').clearMessages();
707
c632c7c34029 added disable/enableChildren Method
Dustin Demuth <dustin@intevation.de>
parents: 688
diff changeset
89 },
c632c7c34029 added disable/enableChildren Method
Dustin Demuth <dustin@intevation.de>
parents: 688
diff changeset
90
890
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 833
diff changeset
91 /**
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 833
diff changeset
92 * Disable the Childelements of this window
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 833
diff changeset
93 */
707
c632c7c34029 added disable/enableChildren Method
Dustin Demuth <dustin@intevation.de>
parents: 688
diff changeset
94 disableChildren: function(){
c632c7c34029 added disable/enableChildren Method
Dustin Demuth <dustin@intevation.de>
parents: 688
diff changeset
95 //intentionally!
c632c7c34029 added disable/enableChildren Method
Dustin Demuth <dustin@intevation.de>
parents: 688
diff changeset
96 return true;
c632c7c34029 added disable/enableChildren Method
Dustin Demuth <dustin@intevation.de>
parents: 688
diff changeset
97 },
c632c7c34029 added disable/enableChildren Method
Dustin Demuth <dustin@intevation.de>
parents: 688
diff changeset
98
890
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 833
diff changeset
99 /**
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 833
diff changeset
100 * Enable the Childelements of this window
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 833
diff changeset
101 */
707
c632c7c34029 added disable/enableChildren Method
Dustin Demuth <dustin@intevation.de>
parents: 688
diff changeset
102 enableChildren: function(){
c632c7c34029 added disable/enableChildren Method
Dustin Demuth <dustin@intevation.de>
parents: 688
diff changeset
103 //intentionally!
c632c7c34029 added disable/enableChildren Method
Dustin Demuth <dustin@intevation.de>
parents: 688
diff changeset
104 return true;
619
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
105 }
7a7a16b0a548 Added window for creating probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
106 });

http://lada.wald.intevation.org