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

constrain windows to viewport
author Dustin Demuth <dustin@intevation.de>
date Wed, 25 Mar 2015 15:59:45 +0100
parents 71e8b84d7829
children e88381fb3bdb
rev   line source
606
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
3 *
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
7 */
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
9 /*
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10 * Window to edit a Messung
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11 */
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 Ext.define('Lada.view.window.OrtEdit', {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 extend: 'Ext.window.Window',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 alias: 'widget.ortedit',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 requires: [
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 'Lada.view.panel.Map',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18 'Lada.view.form.Ort',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19 'Lada.view.form.Location'
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
20 ],
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 collapsible: true,
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 maximizable: true,
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 autoshow: true,
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25 layout: 'border',
688
6a6d1b02a1a3 constrain windows to viewport
Dustin Demuth <dustin@intevation.de>
parents: 644
diff changeset
26 constrain: true,
606
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
27
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
28 record: null,
644
71e8b84d7829 Reload grids on messung or ort changed/added.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 614
diff changeset
29 grid: null,
606
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31 initComponent: function() {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32 if (this.record === null) {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
33 Ext.Msg.alert('Kein valider Ort ausgewählt!');
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
34 this.callParent(arguments);
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35 return;
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36 }
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37 this.title = 'Ort';
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38 this.buttons = [{
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39 text: 'Schließen',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
40 scope: this,
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
41 handler: this.close
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
42 }];
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
43 this.width = 900;
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
44 this.height = 515;
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
45 this.bodyStyle = {background: '#fff'};
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47 this.items = [{
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
48 region: 'west',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
49 border: 0,
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
50 layout: 'vbox',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51 items: [{
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52 xtype: 'ortform',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53 margin: 5,
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 recordId: this.record.get('id')
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 }, {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56 xtype: 'locationform',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57 margin: 5,
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
58 recordId: this.record.get('id')
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
59 }]
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
60 }, {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
61 xtype: 'fset',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
62 bodyStyle: {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
63 background: '#fff'
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
64 },
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
65 layout: 'border',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
66 name: 'mapfield',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
67 title: 'Karte',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
68 region: 'center',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
69 padding: '5, 5',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
70 margin: 5,
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
71 items: [{
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
72 xtype: 'map',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
73 region: 'center',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
74 layout: 'border',
614
04e380ce4d73 Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 606
diff changeset
75 record: this.record,
606
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
76 bodyStyle: {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
77 background: '#fff'
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
78 },
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
79 name: 'map'
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
80 }]
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
81 }];
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
82 this.callParent(arguments);
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
83 },
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
84
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
85 initData: function() {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
86 this.down('ortform').setRecord(this.record);
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
87 Ext.ClassManager.get('Lada.model.Location').load(this.record.get('ort'), {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
88 failure: function(record, action) {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
89 // TODO
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
90 },
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
91 success: function(record, response) {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
92 this.down('locationform').setRecord(record);
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
93 this.down('locationform').setReadOnly(true);
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
94 },
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
95 scope: this
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
96 });
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
97 },
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
98
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
99 setMessages: function(errors, warnings) {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
100 //todo this is a stub
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
101 },
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
102
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
103 clearMessages: function() {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
104 //todo this is a stub
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
105 }
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
106 });

http://lada.wald.intevation.org