annotate app/view/window/MessungEdit.js @ 688:6a6d1b02a1a3

constrain windows to viewport
author Dustin Demuth <dustin@intevation.de>
date Wed, 25 Mar 2015 15:59:45 +0100
parents aedf0709af92
children e88381fb3bdb
rev   line source
576
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
3 *
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
7 */
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
8
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
9 /*
590
e440b66a859f Added grid (+controller) for messwerte.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 581
diff changeset
10 * Window to edit a Messung
576
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
11 */
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
12 Ext.define('Lada.view.window.MessungEdit', {
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
13 extend: 'Ext.window.Window',
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
14 alias: 'widget.messungedit',
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
15
581
424802824648 Added a form for Messungen (unfinished)
Dustin Demuth <dustin@intevation.de>
parents: 576
diff changeset
16 requires: [
590
e440b66a859f Added grid (+controller) for messwerte.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 581
diff changeset
17 'Lada.view.form.Messung',
595
a81dafe06d1d Add status to messung edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 590
diff changeset
18 'Lada.view.grid.Messwert',
a81dafe06d1d Add status to messung edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 590
diff changeset
19 'Lada.view.grid.Status',
597
d2ce1c4c3aad Add messung kommentare to messung edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 595
diff changeset
20 'Lada.view.grid.MKommentar'
581
424802824648 Added a form for Messungen (unfinished)
Dustin Demuth <dustin@intevation.de>
parents: 576
diff changeset
21 ],
576
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
22
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
23 collapsible: true,
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
24 maximizable: true,
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
25 autoshow: true,
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
26 autoscroll: true,
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
27 layout: 'fit',
688
6a6d1b02a1a3 constrain windows to viewport
Dustin Demuth <dustin@intevation.de>
parents: 687
diff changeset
28 constrain: true,
576
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
29 record: null,
644
71e8b84d7829 Reload grids on messung or ort changed/added.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 613
diff changeset
30 grid: null,
576
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
31
590
e440b66a859f Added grid (+controller) for messwerte.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 581
diff changeset
32 initComponent: function() {
576
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
33 if (this.record === null) {
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
34 Ext.Msg.alert('Keine valide Messung ausgewählt!');
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
35 this.callParent(arguments);
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
36 return;
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
37 }
590
e440b66a859f Added grid (+controller) for messwerte.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 581
diff changeset
38 this.title = 'Messung ' + this.record.get('nebenprobenNr');
576
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
39 this.buttons = [{
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
40 text: 'Schließen',
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
41 scope: this,
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
42 handler: this.close
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
43 }];
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
44 this.width = 700;
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
45 this.height = Ext.getBody().getViewSize().height - 30;
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
46
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
47 this.items = [{
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
48 border: 0,
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
49 autoScroll: true,
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
50 items: [{
581
424802824648 Added a form for Messungen (unfinished)
Dustin Demuth <dustin@intevation.de>
parents: 576
diff changeset
51 xtype: 'messungform',
611
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents: 597
diff changeset
52 margin: 5,
590
e440b66a859f Added grid (+controller) for messwerte.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 581
diff changeset
53 recordId: this.record.get('id')
613
f959205ab173 reverted changes on messungenedit.js
Dustin Demuth <dustin@intevation.de>
parents: 611
diff changeset
54 }, {
576
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
55 xtype: 'fset',
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
56 name: 'messwerte',
590
e440b66a859f Added grid (+controller) for messwerte.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 581
diff changeset
57 title: 'Messwerte',
e440b66a859f Added grid (+controller) for messwerte.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 581
diff changeset
58 padding: '5, 5',
e440b66a859f Added grid (+controller) for messwerte.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 581
diff changeset
59 margin: 5,
e440b66a859f Added grid (+controller) for messwerte.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 581
diff changeset
60 items: [{
e440b66a859f Added grid (+controller) for messwerte.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 581
diff changeset
61 xtype: 'messwertgrid',
e440b66a859f Added grid (+controller) for messwerte.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 581
diff changeset
62 recordId: this.record.get('id')
613
f959205ab173 reverted changes on messungenedit.js
Dustin Demuth <dustin@intevation.de>
parents: 611
diff changeset
63 }]
576
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
64 }, {
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
65 xtype: 'fset',
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
66 name: 'messungstatus',
595
a81dafe06d1d Add status to messung edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 590
diff changeset
67 title: 'Status',
a81dafe06d1d Add status to messung edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 590
diff changeset
68 padding: '5, 5',
a81dafe06d1d Add status to messung edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 590
diff changeset
69 margin: 5,
a81dafe06d1d Add status to messung edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 590
diff changeset
70 items: [{
a81dafe06d1d Add status to messung edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 590
diff changeset
71 xtype: 'statusgrid',
a81dafe06d1d Add status to messung edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 590
diff changeset
72 recordId: this.record.get('id')
a81dafe06d1d Add status to messung edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 590
diff changeset
73 }]
576
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
74 }, {
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
75 xtype: 'fset',
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
76 name: 'messungskommentare',
597
d2ce1c4c3aad Add messung kommentare to messung edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 595
diff changeset
77 title: 'Kommentare',
d2ce1c4c3aad Add messung kommentare to messung edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 595
diff changeset
78 padding: '5, 5',
d2ce1c4c3aad Add messung kommentare to messung edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 595
diff changeset
79 margin: 5,
d2ce1c4c3aad Add messung kommentare to messung edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 595
diff changeset
80 items: [{
d2ce1c4c3aad Add messung kommentare to messung edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 595
diff changeset
81 xtype: 'mkommentargrid',
d2ce1c4c3aad Add messung kommentare to messung edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 595
diff changeset
82 recordId: this.record.get('id')
d2ce1c4c3aad Add messung kommentare to messung edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 595
diff changeset
83 }]
576
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
84 }]
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
85 }];
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
86 this.callParent(arguments);
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
87 },
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
88
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
89 initData: function() {
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
90 this.clearMessages();
611
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents: 597
diff changeset
91 this.down('messungform').setRecord(this.record);
576
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
92 Ext.ClassManager.get('Lada.model.Messung').load(this.record.get('id'), {
590
e440b66a859f Added grid (+controller) for messwerte.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 581
diff changeset
93 failure: function(record) {
e440b66a859f Added grid (+controller) for messwerte.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 581
diff changeset
94 // TODO
e440b66a859f Added grid (+controller) for messwerte.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 581
diff changeset
95 console.log(record);
576
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
96 },
590
e440b66a859f Added grid (+controller) for messwerte.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 581
diff changeset
97 success: function(record, response) {
e440b66a859f Added grid (+controller) for messwerte.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 581
diff changeset
98 this.down('messungform').setRecord(record);
e440b66a859f Added grid (+controller) for messwerte.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 581
diff changeset
99 var json = Ext.decode(response.response.responseText);
e440b66a859f Added grid (+controller) for messwerte.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 581
diff changeset
100 if (json) {
e440b66a859f Added grid (+controller) for messwerte.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 581
diff changeset
101 this.setMessages(json.errors, json.warnings);
e440b66a859f Added grid (+controller) for messwerte.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 581
diff changeset
102 }
576
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
103 },
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
104 scope: this
611
8a156a7fbe67 added a controller for messungforms, modified testdatensatz-widget to load a local store, removed dirtychange listeners from probe-form
Dustin Demuth <dustin@intevation.de>
parents: 597
diff changeset
105 });
687
aedf0709af92 Applied ReadOnlyParadigm to a Messung Window
Dustin Demuth <dustin@intevation.de>
parents: 644
diff changeset
106
aedf0709af92 Applied ReadOnlyParadigm to a Messung Window
Dustin Demuth <dustin@intevation.de>
parents: 644
diff changeset
107 if (this.record.get('readonly') == true){
aedf0709af92 Applied ReadOnlyParadigm to a Messung Window
Dustin Demuth <dustin@intevation.de>
parents: 644
diff changeset
108 this.down('messungform').setReadOnly(true);
aedf0709af92 Applied ReadOnlyParadigm to a Messung Window
Dustin Demuth <dustin@intevation.de>
parents: 644
diff changeset
109 this.disableChildren();
aedf0709af92 Applied ReadOnlyParadigm to a Messung Window
Dustin Demuth <dustin@intevation.de>
parents: 644
diff changeset
110 }
aedf0709af92 Applied ReadOnlyParadigm to a Messung Window
Dustin Demuth <dustin@intevation.de>
parents: 644
diff changeset
111 },
aedf0709af92 Applied ReadOnlyParadigm to a Messung Window
Dustin Demuth <dustin@intevation.de>
parents: 644
diff changeset
112
aedf0709af92 Applied ReadOnlyParadigm to a Messung Window
Dustin Demuth <dustin@intevation.de>
parents: 644
diff changeset
113 disableChildren: function(){
aedf0709af92 Applied ReadOnlyParadigm to a Messung Window
Dustin Demuth <dustin@intevation.de>
parents: 644
diff changeset
114 this.down('fset[name=messwerte]').down('messwertgrid').setReadOnly(true);
aedf0709af92 Applied ReadOnlyParadigm to a Messung Window
Dustin Demuth <dustin@intevation.de>
parents: 644
diff changeset
115 this.down('fset[name=messungstatus]').down('statusgrid').setReadOnly(true);
aedf0709af92 Applied ReadOnlyParadigm to a Messung Window
Dustin Demuth <dustin@intevation.de>
parents: 644
diff changeset
116 this.down('fset[name=messungskommentare]').down('mkommentargrid').setReadOnly(true);
aedf0709af92 Applied ReadOnlyParadigm to a Messung Window
Dustin Demuth <dustin@intevation.de>
parents: 644
diff changeset
117 },
aedf0709af92 Applied ReadOnlyParadigm to a Messung Window
Dustin Demuth <dustin@intevation.de>
parents: 644
diff changeset
118
aedf0709af92 Applied ReadOnlyParadigm to a Messung Window
Dustin Demuth <dustin@intevation.de>
parents: 644
diff changeset
119 enableChildren: function(){
aedf0709af92 Applied ReadOnlyParadigm to a Messung Window
Dustin Demuth <dustin@intevation.de>
parents: 644
diff changeset
120 this.down('fset[name=messwerte]').down('messwertgrid').setReadOnly(false);
aedf0709af92 Applied ReadOnlyParadigm to a Messung Window
Dustin Demuth <dustin@intevation.de>
parents: 644
diff changeset
121 this.down('fset[name=messungstatus]').down('statusgrid').setReadOnly(false);
aedf0709af92 Applied ReadOnlyParadigm to a Messung Window
Dustin Demuth <dustin@intevation.de>
parents: 644
diff changeset
122 this.down('fset[name=messungskommentare]').down('mkommentargrid').setReadOnly(false);
576
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
123 },
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
124
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
125 setMessages: function(errors, warnings) {
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
126 //todo this is a stub
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
127 },
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
128 clearMessages: function() {
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
129 //todo this is a stub
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
130 }
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
131
0d4137e0fe36 Added a blank window to edit a Messung
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
132 });

http://lada.wald.intevation.org