changeset 1171:9182430b79d7

Merge
author Evi Huber <ehuber@bfs.de>
date Mon, 04 Jul 2016 11:26:42 +0200
parents 8280cd5694e5 (current diff) e552e82ceb8a (diff)
children 9b157a8eecf1
files
diffstat 3 files changed, 127 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/app/view/form/Messprogramm.js	Mon Jul 04 09:30:18 2016 +0200
+++ b/app/view/form/Messprogramm.js	Mon Jul 04 11:26:42 2016 +0200
@@ -21,6 +21,7 @@
         'Lada.view.widget.Probenart',
         'Lada.view.widget.Umwelt',
         'Lada.view.widget.base.TextField',
+        'Lada.view.widget.base.NumberField',
         'Lada.view.widget.base.FieldSet',
         'Lada.model.Messprogramm',
         'Lada.model.MmtMessprogramm',
@@ -212,7 +213,8 @@
                             width: '40%',
                             name: 'probenintervall'
                         }, {
-                            xtype: 'numberfield',
+                            xtype: 'numfield',
+                            allowDecimals: false,
                             fieldLabel: i18n.getMsg('teilintervallVon'),
                             margin: '0, 10, 5, 10',
                             labelWidth: 90,
@@ -220,7 +222,8 @@
                             name: 'teilintervallVon',
                             period: 'start'
                         }, {
-                            xtype: 'numberfield',
+                            xtype: 'numfield',
+                            allowDecimals: false,
                             fieldLabel: i18n.getMsg('teilintervallBis'),
                             margin: '0, 15, 5, 5',
                             labelWidth: 18,
@@ -228,7 +231,8 @@
                             name: 'teilintervallBis',
                             period: 'end'
                         }, {
-                            xtype: 'numberfield',
+                            xtype: 'numfield',
+                            allowDecimals: false,
                             margin: '0, 10, 5, 5',
                             fieldLabel: i18n.getMsg('offset'),
                             labelWidth: 45,
@@ -616,11 +620,18 @@
         this.down('chkbox[name=test]').clearWarningOrError();
         this.down('cbox[name=probenartId]').clearWarningOrError();
         this.down('cbox[name=netzbetreiberId]').clearWarningOrError();
+        // clear messages in intervall definition
+        this.down('fset[name=probenIntervallFieldset]').clearMessages();
+        this.down('cbox[name=probenintervall]').clearWarningOrError();
+        this.down('fset[name=gueltigPeriodFieldset]').clearMessages();
+        this.down('numfield[name=teilintervallVon]').clearWarningOrError();
+        this.down('numfield[name=teilintervallBis]').clearWarningOrError();
+        this.down('datetime[name=gueltigVon]').clearWarningOrError();
+        this.down('datetime[name=gueltigBis]').clearWarningOrError();
         //no clear for probeNehmerId
         // Deskriptoren are missing
         this.down('cbox[name=umwId]').clearWarningOrError();
-        this.down('fset[name=gueltigPeriodFieldset]').clearMessages();
-        this.down('fset[name=probenIntervallFieldset]').clearMessages();
+        this.down('cbox[name=ortId]').clearWarningOrError();
     },
 
     setReadOnly: function(value) {
--- a/app/view/grid/Messmethoden.js	Mon Jul 04 09:30:18 2016 +0200
+++ b/app/view/grid/Messmethoden.js	Mon Jul 04 11:26:42 2016 +0200
@@ -14,6 +14,7 @@
     alias: 'widget.messmethodengrid',
 
     requires: [
+        'Lada.store.MmtMessprogramm',
         'Lada.view.widget.Messmethode'
     ],
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/view/widget/base/NumberField.js	Mon Jul 04 11:26:42 2016 +0200
@@ -0,0 +1,110 @@
+/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU GPL (v>=3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out
+ * the documentation coming with IMIS-Labordaten-Application for details.
+ */
+
+/**
+ * This Widget extends a Panel to create a Numberfield
+ */
+Ext.define('Lada.view.widget.base.NumberField', {
+    extend: 'Ext.panel.Panel',
+    alias: 'widget.numfield',
+
+    layout: 'hbox',
+
+    border: 0,
+    margin: '0, 0, 5, 0',
+
+    initComponent: function() {
+        this.items = [{
+            xtype: 'numberfield',
+            flex: 1,
+            name: this.name,
+            msgTarget: 'none',
+            allowDecimals: this.allowDecimals,
+            maxLength: this.maxLength || 1000,
+            enforceMaxLength: this.enforceMaxLength || true,
+            fieldLabel: this.fieldLabel,
+            labelWidth: this.labelWidth,
+            readOnly: this.readOnly || false,
+            listeners: this.listeners
+        }, {
+            xtype: 'image',
+            name: 'warnImg',
+            src: 'resources/img/dialog-warning.png',
+            width: 14,
+            height: 14,
+            hidden: true
+        }, {
+            xtype: 'image',
+            name: 'errorImg',
+            src: 'resources/img/emblem-important.png',
+            width: 14,
+            height: 14,
+            hidden: true
+        }];
+        this.callParent(arguments);
+        if (this.regex) {
+            Ext.apply(this.down('numberfield'), {regex: this.regex});
+        }
+        if (this.allowBlank === false) {
+            Ext.apply(this.down('numberfield'), {allowBlank: this.allowBlank});
+        }
+    },
+
+    showWarnings: function(warnings) {
+        var img = this.down('image[name=warnImg]');
+        Ext.create('Ext.tip.ToolTip', {
+            target: img.getEl(),
+            html: warnings
+        });
+        img.show();
+        this.down('numberfield').invalidCls = 'x-lada-warning';
+        this.down('numberfield').markInvalid('');
+        var fieldset = this.up('fieldset[collapsible=true]');
+        if (fieldset) {
+            var i18n = Lada.getApplication().bundle;
+            var warningText = i18n.getMsg(this.name) + ': ' + warnings;
+            fieldset.showWarningOrError(true, warningText);
+        }
+    },
+
+    showErrors: function(errors) {
+        var img = this.down('image[name=errorImg]');
+        var warnImg = this.down('image[name=warnImg]');
+        warnImg.hide();
+        Ext.create('Ext.tip.ToolTip', {
+            target: img.getEl(),
+            html: errors
+        });
+        this.down('numberfield').invalidCls = 'x-lada-error';
+        this.down('numberfield').markInvalid('');
+        img.show();
+        var fieldset = this.up('fieldset[collapsible=true]');
+        if (fieldset) {
+            var i18n = Lada.getApplication().bundle;
+            var errorText = i18n.getMsg(this.name) + ': ' + errors;
+            fieldset.showWarningOrError(false, '', true, errorText);
+        }
+    },
+
+    getValue: function() {
+        return this.down('numberfield').getValue();
+    },
+
+    setValue: function(value) {
+        this.down('numberfield').setValue(value);
+    },
+
+    clearWarningOrError: function() {
+        this.down('image[name=errorImg]').hide();
+        this.down('image[name=warnImg]').hide();
+    },
+
+    setReadOnly: function(value) {
+        this.down('numberfield').setReadOnly(value);
+    }
+});

http://lada.wald.intevation.org