Mercurial > lada > lada-client
annotate app/view/window/OrtCreate.js @ 808:c135201940ee
removed console msg.
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Fri, 22 May 2015 15:59:40 +0200 |
parents | 7267bae1d43f |
children | def27cdd0dfa |
rev | line source |
---|---|
642
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
3 * |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU GPL (v>=3) |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 * the documentation coming with IMIS-Labordaten-Application for details. |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
7 */ |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
8 |
796
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
709
diff
changeset
|
9 /** |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
709
diff
changeset
|
10 * Window to create a Ort |
642
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
11 */ |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
12 Ext.define('Lada.view.window.OrtCreate', { |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 extend: 'Ext.window.Window', |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 alias: 'widget.ortcreate', |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
15 |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
16 requires: [ |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
17 'Lada.view.panel.Map', |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
18 'Lada.view.form.Ort', |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 'Lada.view.form.Location' |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 ], |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 collapsible: true, |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 maximizable: true, |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 autoshow: true, |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 layout: 'border', |
688
6a6d1b02a1a3
constrain windows to viewport
Dustin Demuth <dustin@intevation.de>
parents:
642
diff
changeset
|
26 constrain: true, |
642
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 record: null, |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 grid: null, |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 initComponent: function() { |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 this.title = 'Ort'; |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 this.buttons = [{ |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 text: 'Schließen', |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 scope: this, |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 handler: this.close |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
37 }]; |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
38 this.width = 900; |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 this.height = 515; |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 this.bodyStyle = {background: '#fff'}; |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 |
709
6f6d2df00130
Added some CSS to make distinction between active and inactice windows more simple for the user
Dustin Demuth <dustin@intevation.de>
parents:
688
diff
changeset
|
42 // 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:
688
diff
changeset
|
43 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:
688
diff
changeset
|
44 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:
688
diff
changeset
|
45 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:
688
diff
changeset
|
46 }, |
6f6d2df00130
Added some CSS to make distinction between active and inactice windows more simple for the user
Dustin Demuth <dustin@intevation.de>
parents:
688
diff
changeset
|
47 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:
688
diff
changeset
|
48 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:
688
diff
changeset
|
49 } |
6f6d2df00130
Added some CSS to make distinction between active and inactice windows more simple for the user
Dustin Demuth <dustin@intevation.de>
parents:
688
diff
changeset
|
50 }); |
6f6d2df00130
Added some CSS to make distinction between active and inactice windows more simple for the user
Dustin Demuth <dustin@intevation.de>
parents:
688
diff
changeset
|
51 |
642
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
52 this.items = [{ |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
53 region: 'west', |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
54 border: 0, |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
55 layout: 'vbox', |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
56 items: [{ |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
57 xtype: 'ortform', |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
58 margin: 5 |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
59 }, { |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
60 xtype: 'locationform', |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
61 margin: 5 |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
62 }] |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
63 }, { |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
64 xtype: 'fset', |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
65 bodyStyle: { |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
66 background: '#fff' |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
67 }, |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
68 layout: 'border', |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
69 name: 'mapfield', |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
70 title: 'Karte', |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
71 region: 'center', |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
72 padding: '5, 5', |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
73 margin: 5, |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
74 items: [{ |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
75 xtype: 'map', |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
76 region: 'center', |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
77 layout: 'border', |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
78 bodyStyle: { |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
79 background: '#fff' |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
80 }, |
796
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
709
diff
changeset
|
81 name: 'map', |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
709
diff
changeset
|
82 listeners: { //A listener which listens to the mappanels featureselected event |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
709
diff
changeset
|
83 featureselected: this.selectedFeature |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
709
diff
changeset
|
84 } |
642
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
85 }] |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
86 }]; |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
87 this.callParent(arguments); |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
88 }, |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
89 |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
90 initData: function() { |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
91 var ort = Ext.create('Lada.model.Ort', { |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
92 probeId: this.record.get('id') |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
93 }); |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
94 this.down('ortform').setRecord(ort); |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
95 }, |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
96 |
796
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
709
diff
changeset
|
97 /** |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
709
diff
changeset
|
98 * @private |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
709
diff
changeset
|
99 * Override to display and update the map view in the panel. |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
709
diff
changeset
|
100 */ |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
709
diff
changeset
|
101 afterRender: function(){ |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
709
diff
changeset
|
102 this.superclass.afterRender.apply(this, arguments); |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
709
diff
changeset
|
103 var map = this.down('map'); |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
709
diff
changeset
|
104 map.map.zoomToMaxExtent(); |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
709
diff
changeset
|
105 }, |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
709
diff
changeset
|
106 |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
709
diff
changeset
|
107 /** |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
709
diff
changeset
|
108 * This function is used by the MapPanel, when a Feature was selected |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
709
diff
changeset
|
109 */ |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
709
diff
changeset
|
110 selectedFeature: function(context, args) { |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
709
diff
changeset
|
111 var feature = args[0]; |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
709
diff
changeset
|
112 if (feature.attributes.id && |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
709
diff
changeset
|
113 feature.attributes.id !== '') { |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
709
diff
changeset
|
114 var record = Ext.data.StoreManager.get('locations').getById(feature.attributes.id); |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
709
diff
changeset
|
115 context.up('window').down('locationform').setRecord(record); |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
709
diff
changeset
|
116 context.up('window').down('locationform').setReadOnly(true); |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
709
diff
changeset
|
117 context.up('window').down('ortform').down('combobox').setValue(record.id); |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
709
diff
changeset
|
118 } |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
709
diff
changeset
|
119 else { |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
709
diff
changeset
|
120 context.up('window').down('locationform').setRecord(this.locationRecord); |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
709
diff
changeset
|
121 context.up('window').down('locationform').setReadOnly(false); |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
709
diff
changeset
|
122 } |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
709
diff
changeset
|
123 }, |
7267bae1d43f
made window-panel recyclable, fwd openlayers events to ext
Dustin Demuth <dustin@intevation.de>
parents:
709
diff
changeset
|
124 |
642
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
125 setMessages: function(errors, warnings) { |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
126 //todo this is a stub |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
127 }, |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
128 |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
129 clearMessages: function() { |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
130 //todo this is a stub |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
131 } |
bd151c8b7ad1
Added window to create a new ort.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
132 }); |