comparison app/view/widget/base/TextField.js @ 548:d47ee7439f44

Added new js files.
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 06 Mar 2015 12:43:52 +0100
parents
children 41d480b69436
comparison
equal deleted inserted replaced
547:f172b35a3b92 548:d47ee7439f44
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
2 * Software engineering by Intevation GmbH
3 *
4 * This file is Free Software under the GNU GPL (v>=3)
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
6 * the documentation coming with IMIS-Labordaten-Application for details.
7 */
8
9 Ext.define('Lada.view.widget.base.TextField', {
10 extend: 'Ext.panel.Panel',
11 alias: 'widget.tfield',
12
13 layout: 'hbox',
14
15 border: 0,
16
17 initComponent: function() {
18 this.items = [{
19 xtype: 'textfield',
20 flex: 1,
21 name: this.name,
22 msgTarget: 'none',
23 maxLength: this.maxLength,
24 fieldLabel: this.fieldLabel,
25 labelWidth: this.labelWidth,
26 listeners: this.listeners
27 }, {
28 xtype: 'image',
29 name: 'warnImg',
30 src: 'resources/img/icon-warning.gif',
31 width: 12,
32 height: 12,
33 hidden: true
34 }, {
35 xtype: 'image',
36 name: 'errorImg',
37 src: 'resources/img/icon-error.gif',
38 width: 12,
39 height: 12,
40 hidden: true
41 }];
42 this.callParent(arguments);
43 },
44
45 showWarnings: function(warnings) {
46 var img = this.down('image[name=warnImg]');
47 Ext.create('Ext.tip.ToolTip', {
48 target: img.getEl(),
49 html: warnings
50 });
51 img.show();
52 this.down('textfield').invalidCls = 'x-lada-warning';
53 this.down('textfield').markInvalid('');
54 var fieldset = this.up('fieldset[collapsible=true]');
55 if (fieldset) {
56 fieldset.showWarnings(warnings);
57 }
58 },
59
60 showErrors: function(errors) {
61 var img = this.down('image[name=errorImg]');
62 var warnImg = this.down('image[name=warnImg]');
63 warnImg.hide();
64 Ext.create('Ext.tip.ToolTip', {
65 target: img.getEl(),
66 html: errors
67 });
68 this.down('textfield').invalidCls = 'x-lada-error';
69 this.down('textfield').markInvalid('');
70 img.show();
71 var fieldset = this.up('fieldset[collapsible=true]');
72 if (fieldset) {
73 fieldset.showErrors();
74 }
75 },
76
77 clearWarningOrError: function() {
78 this.down('image[name=errorImg]').hide();
79 this.down('image[name=warnImg]').hide();
80 },
81
82 setReadOnly: function(value) {
83 this.down('textfield').setReadOnly(value);
84 }
85 });

http://lada.wald.intevation.org