Mercurial > lada > lada-client
comparison app/view/window/Ortszuordnung.js @ 1274:a792eecf1614
Updated Layout and Map for 'ortsbezug'-window. WIP!
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Tue, 10 Jan 2017 10:03:57 +0100 |
parents | a3a715417540 |
children | 291df0037835 |
comparison
equal
deleted
inserted
replaced
1265:a4c1a9862a88 | 1274:a792eecf1614 |
---|---|
19 ], | 19 ], |
20 | 20 |
21 collapsible: true, | 21 collapsible: true, |
22 maximizable: true, | 22 maximizable: true, |
23 autoshow: true, | 23 autoshow: true, |
24 layout: 'vbox', | 24 layout: 'fit', |
25 constrain: true, | 25 constrain: true, |
26 | 26 |
27 probe: null, | 27 probe: null, |
28 parentWindow: null, | 28 parentWindow: null, |
29 record: null, | 29 record: null, |
66 text: i18n.getMsg('close'), | 66 text: i18n.getMsg('close'), |
67 scope: this, | 67 scope: this, |
68 handler: this.close | 68 handler: this.close |
69 }]; | 69 }]; |
70 this.width = 900; | 70 this.width = 900; |
71 this.height = 515; | 71 this.height = 465; |
72 this.bodyStyle = {background: '#fff'}; | 72 this.bodyStyle = {background: '#fff'}; |
73 | 73 |
74 // add listeners to change the window appearence when it becomes inactive | 74 // add listeners to change the window appearence when it becomes inactive |
75 this.on({ | 75 this.on({ |
76 activate: function(){ | 76 activate: function(){ |
79 deactivate: function(){ | 79 deactivate: function(){ |
80 this.getEl().addCls('window-inactive'); | 80 this.getEl().addCls('window-inactive'); |
81 } | 81 } |
82 }); | 82 }); |
83 | 83 |
84 | |
84 this.items = [{ | 85 this.items = [{ |
85 xtype: 'ortszuordnungform', | 86 layout: 'border', |
86 layout: 'fit', | 87 bodyStyle: {background: '#fff'}, |
87 width: '100%', | 88 border: 0, |
88 margin: 5 | 89 items: [{ |
89 }, { | 90 xtype: 'map', |
90 xtype: 'ortpanel', | 91 region: 'center', |
91 flex: 1, | 92 layout: 'border', |
92 toolbarPos: 'bottom', | 93 margin: '13, 5, 10, 5', |
93 margin: 5 | 94 minHeight: 380, |
95 externalOrteStore: true | |
96 }, { | |
97 xtype: 'ortszuordnungform', | |
98 region: 'east', | |
99 minHeight: 380, | |
100 }, { | |
101 region: 'south', | |
102 border: 0, | |
103 layout: 'fit', | |
104 name: 'ortgrid', | |
105 hidden: true, | |
106 maxHeight: '45%', | |
107 items: [{ | |
108 xtype: 'ortstammdatengrid', | |
109 maxHeight: '45%' | |
110 }], | |
111 dockedItems: [{ | |
112 xtype: 'toolbar', | |
113 dock: 'bottom', | |
114 border: '0, 1, 1, 1', | |
115 style: { | |
116 borderBottom: '1px solid #b5b8c8 !important', | |
117 borderLeft: '1px solid #b5b8c8 !important', | |
118 borderRight: '1px solid #b5b8c8 !important' | |
119 }, | |
120 items: [{ | |
121 xtype: 'textfield', | |
122 labelWidth: 50, | |
123 fieldLabel: i18n.getMsg('ortszuordnung.ortsuche'), | |
124 }, '->', { | |
125 text: i18n.getMsg('orte.new'), | |
126 action: 'createort', | |
127 }, { | |
128 text: i18n.getMsg('orte.frommap'), | |
129 action: 'frommap', | |
130 }, { | |
131 text: i18n.getMsg('orte.clone'), | |
132 action: 'clone', | |
133 }, { | |
134 text: i18n.getMsg('orte.select'), | |
135 action: 'select', | |
136 }] | |
137 }] | |
138 }] | |
94 }]; | 139 }]; |
95 this.callParent(arguments); | 140 this.callParent(arguments); |
96 }, | 141 }, |
97 | 142 |
98 /** | 143 /** |
99 * Initialise the Data of this Window | 144 * Initialise the Data of this Window |
100 */ | 145 */ |
101 initData: function() { | 146 initData: function() { |
147 var me = this; | |
102 if (!this.record) { | 148 if (!this.record) { |
103 this.record = Ext.create('Lada.model.Ortszuordnung'); | 149 this.record = Ext.create('Lada.model.Ortszuordnung'); |
104 if (!this.record.get('letzteAenderung')) { | 150 if (!this.record.get('letzteAenderung')) { |
105 this.record.data.letzteAenderung = new Date(); | 151 this.record.data.letzteAenderung = new Date(); |
106 } | 152 } |
107 this.record.set('probeId', this.probe.get('id')); | 153 this.record.set('probeId', this.probe.get('id')); |
108 } | 154 } |
109 this.down('ortszuordnungform').setRecord(this.record); | 155 this.down('ortszuordnungform').setRecord(this.record); |
110 this.down('ortpanel').setStore(); | 156 var map = this.down('map'); |
157 var osg = this.down('ortstammdatengrid'); | |
158 var ortstore = Ext.create('Lada.store.Orte', { | |
159 defaultPageSize: 0, | |
160 autoLoad: false, | |
161 listeners: { | |
162 beforeload: { | |
163 fn: function() { | |
164 osg.setLoading(true); | |
165 map.setLoading(true); | |
166 } | |
167 }, | |
168 load: { | |
169 fn: function() { | |
170 osg.setLoading(false); | |
171 map.setLoading(false); | |
172 osg.setStore(ortstore); | |
173 var store = Ext.create('Lada.store.Orte', { | |
174 autoLoad: false | |
175 }); | |
176 store.add(ortstore.getRange()); | |
177 var rec = store.getById(me.record.get('ortId')); | |
178 store.remove(rec); | |
179 console.log(rec); | |
180 map.addLocations(store); | |
181 } | |
182 } | |
183 } | |
184 }); | |
185 ortstore.load(); | |
111 }, | 186 }, |
112 | 187 |
113 /** | 188 /** |
114 * @private | 189 * @private |
115 * Override to display and update the map view in the panel. | 190 * Override to display and update the map view in the panel. |
116 */ | 191 */ |
117 afterRender: function(){ | 192 afterRender: function(){ |
118 this.superclass.afterRender.apply(this, arguments); | 193 this.superclass.afterRender.apply(this, arguments); |
119 var map = this.down('ortpanel').down('map'); | 194 var map = this.down('map'); |
120 map.map.zoomToMaxExtent(); | 195 map.map.addControl(new OpenLayers.Control.LayerSwitcher()); |
196 //map.map.zoomToMaxExtent(); | |
121 }, | 197 }, |
122 | 198 |
123 /** | 199 /** |
124 * Instructs the fields / forms listed in this method to set a message. | 200 * Instructs the fields / forms listed in this method to set a message. |
125 * @param errors These Errors shall be shown | 201 * @param errors These Errors shall be shown |