annotate app/view/widgets/TextField.js @ 543:ce188e2fab06

Added custom textfield to shwo errors and warnings.
author Raimund Renkert <raimund.renkert@intevation.de>
date Thu, 18 Dec 2014 15:03:51 +0100
parents
children
rev   line source
543
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
3 *
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
7 */
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
9 Ext.define('Lada.view.widgets.TextField', {
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10 extend: 'Ext.panel.Panel',
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11 alias: 'widget.tfield',
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 layout: 'hbox',
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15 border: 0,
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 initComponent: function() {
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18 this.items = [{
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19 xtype: 'image',
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
20 name: 'warnImg',
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21 src: 'gfx/icon-warning.gif',
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 margin: '2, 5, 2, 5',
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 width: 16,
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 height: 16,
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25 hidden: true
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26 }, {
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
27 xtype: 'image',
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
28 name: 'errorImg',
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
29 src: 'gfx/icon-error.gif',
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30 width: 16,
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31 height: 16,
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32 margin: '2, 5, 2, 5',
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
33 hidden: true
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
34 }, {
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35 xtype: 'textfield',
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36 flex: 1,
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37 name: this.name,
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38 maxLength: this.maxLength,
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39 fieldLabel: this.fieldLabel,
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
40 labelWidth: this.labelWidth,
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
41 listeners: this.listeners
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
42 }];
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
43 this.callParent(arguments);
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
44 },
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
45
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46 showWarnings: function(warnings) {
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47 var img = this.down('image[name=warnImg]');
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
48 var field = this.down('textfield');
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
49 Ext.create('Ext.tip.ToolTip', {
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
50 target: img.getEl(),
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51 html: warnings
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52 });
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53 field.setLabelWidth(field.labelWidth - 18);
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 img.show();
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 },
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57 showErrors: function(errors) {
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
58 var img = this.down('image[name=errorImg]');
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
59 Ext.create('Ext.tip.ToolTip', {
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
60 target: img.getEl(),
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
61 html: errors
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
62 });
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
63 img.show();
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
64 }
ce188e2fab06 Added custom textfield to shwo errors and warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
65 });

http://lada.wald.intevation.org