Mercurial > lada > lada-client
comparison app/view/panel/Ort.js @ 1051:981339d774b8
merged stammdatengrids to default.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Tue, 01 Mar 2016 14:12:39 +0100 |
parents | e0b5e64928c9 |
children | 291df0037835 |
comparison
equal
deleted
inserted
replaced
1048:eacf25f071c0 | 1051:981339d774b8 |
---|---|
1 Ext.define('Lada.view.panel.Ort', { | |
2 extend: 'Ext.panel.Panel', | |
3 alias: 'widget.ortpanel', | |
4 | |
5 requires: [ | |
6 'Lada.view.panel.Map', | |
7 'Lada.view.grid.Orte' | |
8 ], | |
9 | |
10 width: '100%', | |
11 //height: 200, | |
12 | |
13 layout: { | |
14 type: 'border' | |
15 }, | |
16 toolbarPos: 'top', | |
17 | |
18 editableGrid: true, | |
19 | |
20 initComponent: function() { | |
21 var i18n = Lada.getApplication().bundle; | |
22 | |
23 // Different Layout of toolbar depending on the bars position. | |
24 if (this.toolbarPos == 'top') { | |
25 this.dockedItems = [{ | |
26 xtype: 'toolbar', | |
27 dock: 'top', | |
28 items: [{ | |
29 xtype: 'tbtext', | |
30 text: i18n.getMsg('orte.gridTitle') | |
31 }, | |
32 '->', | |
33 { | |
34 text: i18n.getMsg('map.button.add'), | |
35 icon: 'resources/img/list-add.png', | |
36 action: 'addMap', | |
37 disabled: true // disabled on startup, will be enabled by setStore | |
38 }, { | |
39 text: i18n.getMsg('orte.button.add'), | |
40 icon: 'resources/img/list-add.png', | |
41 action: 'add', | |
42 disabled: true // disabled on startup, will be enabled by setStore | |
43 }, { | |
44 text: i18n.getMsg('orte.button.delete'), | |
45 icon: 'resources/img/list-remove.png', | |
46 action: 'delete', | |
47 disabled: true // disabled on startup, will be enabled by controller if necessary | |
48 }] | |
49 }]; | |
50 } | |
51 else { | |
52 this.dockedItems = [{ | |
53 xtype: 'toolbar', | |
54 dock: this.toolbarPos, | |
55 items: [ '->', | |
56 { | |
57 text: i18n.getMsg('map.button.add'), | |
58 icon: 'resources/img/list-add.png', | |
59 action: 'addMap', | |
60 disabled: true // disabled on startup, will be enabled by setStore | |
61 }, { | |
62 text: i18n.getMsg('orte.button.add'), | |
63 icon: 'resources/img/list-add.png', | |
64 action: 'add', | |
65 disabled: true // disabled on startup, will be enabled by setStore | |
66 }] | |
67 }]; | |
68 } | |
69 | |
70 this.items = [{ | |
71 xtype: 'ortstammdatengrid', | |
72 width: '60%', | |
73 editableGrid: this.editableGrid, | |
74 collapsible: true, | |
75 region: 'east' | |
76 }, { | |
77 xtype: 'map', | |
78 region: 'center', | |
79 layout: 'border', | |
80 title: i18n.getMsg('map.title'), | |
81 externalOrteStore: true, | |
82 listeners: { | |
83 beforecollapse: function() { | |
84 var c = this.map.getControlsByClass('OpenLayers.Control.ScaleLine'); | |
85 this.map.removeControl(c[0]); | |
86 }, | |
87 expand: function() { | |
88 this.map.addControl(new OpenLayers.Control.ScaleLine()); | |
89 } | |
90 } | |
91 }]; | |
92 | |
93 this.callParent(arguments); | |
94 }, | |
95 | |
96 afterRender: function() { | |
97 this.superclass.afterRender.apply(this, arguments); | |
98 this.down('map').map.zoomToMaxExtent(); | |
99 }, | |
100 | |
101 setStore: function(store) { | |
102 var me = this; | |
103 var osg = this.down('ortstammdatengrid'); | |
104 var map = this.down('map'); | |
105 | |
106 if (!store) { | |
107 var ortstore = Ext.create('Lada.store.Orte', { | |
108 defaultPageSize: 0, | |
109 listeners: { | |
110 beforeload: { | |
111 fn: function() { | |
112 osg.setLoading(true); | |
113 map.setLoading(true); | |
114 } | |
115 }, | |
116 load: { | |
117 fn: function() { | |
118 osg.setLoading(false); | |
119 map.setLoading(false); | |
120 osg.setStore(ortstore); | |
121 map.addLocations(ortstore); | |
122 } | |
123 } | |
124 } | |
125 }); | |
126 } | |
127 else { | |
128 osg.setStore(store); | |
129 map.addLocations(store); | |
130 } | |
131 this.connectListeners(); | |
132 //enable buttons | |
133 me.down('toolbar button[action=add]').enable(); | |
134 me.down('toolbar button[action=addMap]').enable(); | |
135 }, | |
136 | |
137 getStore: function() { | |
138 return this.down('grid').getStore(); | |
139 }, | |
140 | |
141 connectListeners: function() { | |
142 var osg = this.down('ortstammdatengrid'); | |
143 var map = this.down('map'); | |
144 map.addListener('featureselected', osg.selectOrt, osg); | |
145 osg.addListener('select', map.selectFeature, map); | |
146 } | |
147 }); |