raimund@543: /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz raimund@543: * Software engineering by Intevation GmbH raimund@543: * raimund@543: * This file is Free Software under the GNU GPL (v>=3) raimund@543: * and comes with ABSOLUTELY NO WARRANTY! Check out raimund@543: * the documentation coming with IMIS-Labordaten-Application for details. raimund@543: */ raimund@543: raimund@543: Ext.define('Lada.view.widgets.TextField', { raimund@543: extend: 'Ext.panel.Panel', raimund@543: alias: 'widget.tfield', raimund@543: raimund@543: layout: 'hbox', raimund@543: raimund@543: border: 0, raimund@543: raimund@543: initComponent: function() { raimund@543: this.items = [{ raimund@543: xtype: 'image', raimund@543: name: 'warnImg', raimund@543: src: 'gfx/icon-warning.gif', raimund@543: margin: '2, 5, 2, 5', raimund@543: width: 16, raimund@543: height: 16, raimund@543: hidden: true raimund@543: }, { raimund@543: xtype: 'image', raimund@543: name: 'errorImg', raimund@543: src: 'gfx/icon-error.gif', raimund@543: width: 16, raimund@543: height: 16, raimund@543: margin: '2, 5, 2, 5', raimund@543: hidden: true raimund@543: }, { raimund@543: xtype: 'textfield', raimund@543: flex: 1, raimund@543: name: this.name, raimund@543: maxLength: this.maxLength, raimund@543: fieldLabel: this.fieldLabel, raimund@543: labelWidth: this.labelWidth, raimund@543: listeners: this.listeners raimund@543: }]; raimund@543: this.callParent(arguments); raimund@543: }, raimund@543: raimund@543: showWarnings: function(warnings) { raimund@543: var img = this.down('image[name=warnImg]'); raimund@543: var field = this.down('textfield'); raimund@543: Ext.create('Ext.tip.ToolTip', { raimund@543: target: img.getEl(), raimund@543: html: warnings raimund@543: }); raimund@543: field.setLabelWidth(field.labelWidth - 18); raimund@543: img.show(); raimund@543: }, raimund@543: raimund@543: showErrors: function(errors) { raimund@543: var img = this.down('image[name=errorImg]'); raimund@543: Ext.create('Ext.tip.ToolTip', { raimund@543: target: img.getEl(), raimund@543: html: errors raimund@543: }); raimund@543: img.show(); raimund@543: } raimund@543: });