annotate app/view/widget/base/TextField.js @ 1019:637cf968a49c

No default value for statuswerte
author Dustin Demuth <dustin@intevation.de>
date Thu, 04 Feb 2016 16:09:05 +0100
parents d6e259e76de6
children 5ceb0381ae73
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
892
777bf66dbb11 even more jsduck... for widgets this time
Dustin Demuth <dustin@intevation.de>
parents: 659
diff changeset
9 /**
777bf66dbb11 even more jsduck... for widgets this time
Dustin Demuth <dustin@intevation.de>
parents: 659
diff changeset
10 * This Widget extends a Panel to create a Textfield
777bf66dbb11 even more jsduck... for widgets this time
Dustin Demuth <dustin@intevation.de>
parents: 659
diff changeset
11 */
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 Ext.define('Lada.view.widget.base.TextField', {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 extend: 'Ext.panel.Panel',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 alias: 'widget.tfield',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 layout: 'hbox',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18 border: 0,
599
41d480b69436 UI update for textfield widget.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 548
diff changeset
19 margin: '0, 0, 5, 0',
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
20
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21 initComponent: function() {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 this.items = [{
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 xtype: 'textfield',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 flex: 1,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25 name: this.name,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26 msgTarget: 'none',
659
40834912929e Textfields sind nun max. 1000 Zeichen Lang. Die begrenzung wird erzwungen, kann jedoch überschrieben werden
Dustin Demuth <dustin@intevation.de>
parents: 634
diff changeset
27 maxLength: this.maxLength || 1000,
40834912929e Textfields sind nun max. 1000 Zeichen Lang. Die begrenzung wird erzwungen, kann jedoch überschrieben werden
Dustin Demuth <dustin@intevation.de>
parents: 634
diff changeset
28 enforceMaxLength: this.enforceMaxLength || true,
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
29 fieldLabel: this.fieldLabel,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30 labelWidth: this.labelWidth,
930
efb8cf646771 Changed 'medie' and 'mediadesk' fields to readonly fields
Michael Stanko <mstanko@bfs.de>
parents: 892
diff changeset
31 readOnly: this.readOnly || false,
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32 listeners: this.listeners
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
33 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
34 xtype: 'image',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35 name: 'warnImg',
632
fead63bb5fb4 Updated images for errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 599
diff changeset
36 src: 'resources/img/dialog-warning.png',
fead63bb5fb4 Updated images for errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 599
diff changeset
37 width: 14,
fead63bb5fb4 Updated images for errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 599
diff changeset
38 height: 14,
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39 hidden: true
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
40 }, {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
41 xtype: 'image',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
42 name: 'errorImg',
632
fead63bb5fb4 Updated images for errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 599
diff changeset
43 src: 'resources/img/emblem-important.png',
fead63bb5fb4 Updated images for errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 599
diff changeset
44 width: 14,
fead63bb5fb4 Updated images for errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 599
diff changeset
45 height: 14,
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46 hidden: true
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47 }];
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
48 this.callParent(arguments);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
49 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
50
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51 showWarnings: function(warnings) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52 var img = this.down('image[name=warnImg]');
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53 Ext.create('Ext.tip.ToolTip', {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 target: img.getEl(),
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 html: warnings
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56 });
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57 img.show();
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
58 this.down('textfield').invalidCls = 'x-lada-warning';
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
59 this.down('textfield').markInvalid('');
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
60 var fieldset = this.up('fieldset[collapsible=true]');
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
61 if (fieldset) {
634
291ac2e2bcf5 Set translateable messages for the parent fieldset.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 632
diff changeset
62 var i18n = Lada.getApplication().bundle;
291ac2e2bcf5 Set translateable messages for the parent fieldset.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 632
diff changeset
63 var warningText = i18n.getMsg(this.name) + ': ' + warnings;
291ac2e2bcf5 Set translateable messages for the parent fieldset.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 632
diff changeset
64 fieldset.showWarningOrError(true, warningText);
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
65 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
66 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
67
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
68 showErrors: function(errors) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
69 var img = this.down('image[name=errorImg]');
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
70 var warnImg = this.down('image[name=warnImg]');
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
71 warnImg.hide();
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
72 Ext.create('Ext.tip.ToolTip', {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
73 target: img.getEl(),
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
74 html: errors
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
75 });
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
76 this.down('textfield').invalidCls = 'x-lada-error';
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
77 this.down('textfield').markInvalid('');
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
78 img.show();
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
79 var fieldset = this.up('fieldset[collapsible=true]');
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
80 if (fieldset) {
634
291ac2e2bcf5 Set translateable messages for the parent fieldset.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 632
diff changeset
81 var i18n = Lada.getApplication().bundle;
291ac2e2bcf5 Set translateable messages for the parent fieldset.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 632
diff changeset
82 var errorText = i18n.getMsg(this.name) + ': ' + errors;
291ac2e2bcf5 Set translateable messages for the parent fieldset.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 632
diff changeset
83 fieldset.showWarningOrError(false, '', true, errorText);
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
84 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
85 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
86
1016
d6e259e76de6 Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 930
diff changeset
87 getValue: function() {
d6e259e76de6 Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 930
diff changeset
88 return this.down('textfield').getValue();
d6e259e76de6 Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 930
diff changeset
89 },
d6e259e76de6 Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 930
diff changeset
90
d6e259e76de6 Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 930
diff changeset
91 setValue: function(value) {
d6e259e76de6 Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 930
diff changeset
92 this.down('textfield').setValue(value);
d6e259e76de6 Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 930
diff changeset
93 },
d6e259e76de6 Updated filter value handling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 930
diff changeset
94
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
95 clearWarningOrError: function() {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
96 this.down('image[name=errorImg]').hide();
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
97 this.down('image[name=warnImg]').hide();
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
98 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
99
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
100 setReadOnly: function(value) {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
101 this.down('textfield').setReadOnly(value);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
102 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
103 });

http://lada.wald.intevation.org