annotate app/view/widget/Netzbetreiber.js @ 1083:cbe5a19449a4

Code style etc.
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 13 Apr 2016 20:11:06 +0200
parents 15d7b7a9e177
children f5cc079cd683
rev   line source
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
3 *
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
7 */
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
9 /**
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10 * Combobox for Netzbetreiber
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11 */
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 Ext.define('Lada.view.widget.Netzbetreiber', {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 extend: 'Lada.view.widget.base.ComboBox',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 alias: 'widget.netzbetreiber',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15 store: 'StaNetzbetreiber',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 displayField: 'netzbetreiber',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 valueField: 'id',
847
95d40ca7bb70 Netbetreiber Combobox shall be readonly
Dustin Demuth <dustin@intevation.de>
parents: 830
diff changeset
18 readOnly: this.readOnly,
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19 // Enable filtering of comboboxes
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
20 queryMode: 'local',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21 triggerAction: 'all',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 typeAhead: false,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 minChars: 0,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25 initComponent: function() {
755
3637c453f67d Enabled Creation of a Messprogramm, an empty Window is now shown. The save operation leads to a E 500
Dustin Demuth <dustin@intevation.de>
parents: 740
diff changeset
26 var i18n = Lada.getApplication().bundle;
830
60b15e3983a6 Emptytext wurde falsch gesetzt
Dustin Demuth <dustin@intevation.de>
parents: 755
diff changeset
27 this.emptyText = i18n.getMsg('emptytext.netzbetreiber');
755
3637c453f67d Enabled Creation of a Messprogramm, an empty Window is now shown. The save operation leads to a E 500
Dustin Demuth <dustin@intevation.de>
parents: 740
diff changeset
28
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
29 this.store = Ext.data.StoreManager.get('netzbetreiber');
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30 if (!this.store) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31 this.store = Ext.create('Lada.store.Netzbetreiber');
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32 }
740
2e8da590ea0c made Comboboces editable and filterable for; Messungenform: Messstelle,Datenbasis,Betriebsarts,Testdatensatz,Preobenart,Netzbetreiber Messungform: Messmethode Messwertegrid: Messgroesse,Messeinheit
Dustin Demuth <dustin@intevation.de>
parents: 548
diff changeset
33 else {
2e8da590ea0c made Comboboces editable and filterable for; Messungenform: Messstelle,Datenbasis,Betriebsarts,Testdatensatz,Preobenart,Netzbetreiber Messungform: Messmethode Messwertegrid: Messgroesse,Messeinheit
Dustin Demuth <dustin@intevation.de>
parents: 548
diff changeset
34 this.store.clearFilter();
2e8da590ea0c made Comboboces editable and filterable for; Messungenform: Messstelle,Datenbasis,Betriebsarts,Testdatensatz,Preobenart,Netzbetreiber Messungform: Messmethode Messwertegrid: Messgroesse,Messeinheit
Dustin Demuth <dustin@intevation.de>
parents: 548
diff changeset
35 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36 this.callParent(arguments);
1080
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
37 },
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
38
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
39 getValue: function() {
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
40 var value = this.down('combobox').getValue();
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
41 if (value instanceof Array) {
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
42 return value;
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
43 }
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
44 value = value.trim().split(' ');
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
45 var retValues = [];
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
46 for (var i = 0; i < value.length; i++) {
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
47 var item = value[i];
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
48 var found = this.store.queryBy(function(rec) {
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
49 if (rec.get('id') == item ||
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
50 rec.get('netzbetreiber') == item) {
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
51 return true;
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
52 }
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
53 });
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
54 if (found.getCount() >= 0) {
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
55 retValues.push(found.getAt(0).get('id'));
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
56 continue;
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
57 }
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
58 }
15d7b7a9e177 Override getValue for Netzbetreiber Combobox to allways return the correct
Raimund Renkert <raimund.renkert@intevation.de>
parents: 847
diff changeset
59 return retValues;
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
60 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
61 });

http://lada.wald.intevation.org