changeset 764:ba8c0e754979

Some work was done on the nuklidegrid, added a checkbox model to select the nuklide. Looks OK, but has no function right now
author Dustin Demuth <dustin@intevation.de>
date Fri, 08 May 2015 15:31:58 +0200
parents 0e8d4178bb7e
children 62721a75d31d
files app/controller/grid/Messmethode.js app/view/grid/Messmethoden.js app/view/grid/Nuklide.js app/view/window/Messprogramm.js resources/i18n/Lada_de-DE.properties
diffstat 5 files changed, 128 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/app/controller/grid/Messmethode.js	Fri May 08 12:47:28 2015 +0200
+++ b/app/controller/grid/Messmethode.js	Fri May 08 15:31:58 2015 +0200
@@ -20,7 +20,8 @@
         this.control({
             'messmethodengrid': {
                 edit: this.gridSave,
-                canceledit: this.cancelEdit
+                canceledit: this.cancelEdit,
+                select: this.selectRow
             },
             'messmethodengrid button[action=add]': {
                 click: this.add
@@ -75,6 +76,22 @@
     },
 
     /**
+     * When a row is selected,
+     * the nuklid-grid will be updated
+     * to display the nuklide which are possible for this
+     * Messmethod
+     */
+    selectRow: function(row, record, index) {
+        var ngrid = row.view.up('window').down('nuklidegrid');
+        var nuklide = record.get('messgroessen');
+        var store = Ext.data.StoreManager.get('messgroessen');
+        if (!store) {
+            store = Ext.create('Lada.store.Messgroessen');
+        }
+        ngrid.setData(store);
+    },
+
+    /**
      * This function adds a new row
      */
     add: function(button) {
--- a/app/view/grid/Messmethoden.js	Fri May 08 12:47:28 2015 +0200
+++ b/app/view/grid/Messmethoden.js	Fri May 08 15:31:58 2015 +0200
@@ -69,7 +69,7 @@
             }]
         }];
         this.columns = [{
-            header: 'Messmethode',
+            header: i18n.getMsg('messmethode'),
             dataIndex: 'mmtId',
             flex: 1,
             renderer: function(value) {
@@ -77,12 +77,9 @@
                     return '';
                 }
                 var store = Ext.data.StoreManager.get('messmethoden');
-                console.log(store);
                 if (!store) {
                     store = Ext.create('Lada.store.Messmethoden');
                 }
-                store.load();
-                console.log(store);
                 return value + " - " + store.findRecord('id', value, 0, false, false, true).get('messmethode');
             },
             editor: {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/view/grid/Nuklide.js	Fri May 08 15:31:58 2015 +0200
@@ -0,0 +1,100 @@
+/* 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.
+ */
+
+/*
+ * Grid to list Nuklide
+ */
+Ext.define('Lada.view.grid.Nuklide', {
+    extend: 'Ext.grid.Panel',
+    alias: 'widget.nuklidegrid',
+
+    selType: 'checkboxmodel',
+    selModel: {
+        checkOnly: false,
+        injectCheckbox: 0
+    },
+    requires: [
+        'Lada.view.widget.Messgroesse'
+    ],
+
+    maxHeight: 350,
+    minHeight: 110,
+    viewConfig: {
+        deferEmptyText: false
+    },
+    margin: '0, 5, 5, 5',
+
+    recordId: null,
+
+    initComponent: function() {
+        var i18n = Lada.getApplication().bundle;
+        this.emptyText = i18n.getMsg('emptytext.nuklidgrid');
+
+        this.dockedItems = [{
+            xtype: 'toolbar',
+            dock: 'bottom',
+            items: ['->', {
+                text: i18n.getMsg('save'),
+                qtip: i18n.getMsg('save.qtip'),
+                icon: 'resources/img/dialog-ok-apply.png',
+                action: 'save',
+                disabled: true
+            }, {
+                text: i18n.getMsg('discard'),
+                qtip: i18n.getMsg('discard.qtip'),
+                icon: 'resources/img/dialog-cancel.png',
+                action: 'discard',
+                disabled: true
+            }]
+        }];
+        this.columns = [{
+            header: i18n.getMsg('nuklid'),
+            dataIndex: 'id',
+            flex: 1,
+            renderer: function(value) {
+                if (!value || value === '') {
+                    return '';
+                }
+                var store = Ext.data.StoreManager.get('messgroessen');
+                if (!store) {
+                    store = Ext.create('Lada.store.Messgroessen');
+                }
+                return store.findRecord('id', value, 0, false, false, true).get('messgroesse');
+            }
+        }];
+        this.initData();
+        this.callParent(arguments);
+    },
+    initData: function() {
+        if (this.store) {
+            this.store.removeAll();
+        }
+    },
+    setData: function(store) {
+       this.setLoading(true);
+       this.reconfigure(store);
+       this.setLoading(false);
+    },
+    setReadOnly: function(b) {
+        if (b == true){
+            //Readonly
+            if (this.getPlugin('rowedit')){
+                this.getPlugin('rowedit').disable();
+            }
+            this.down('button[action=discard]').disable();
+            this.down('button[action=save]').disable();
+        }else{
+            //Writable
+            if (this.getPlugin('rowedit')){
+                this.getPlugin('rowedit').enable();
+            }
+            this.down('button[action=discard]').enable();
+            this.down('button[action=save]').enable();
+         }
+    }
+});
--- a/app/view/window/Messprogramm.js	Fri May 08 12:47:28 2015 +0200
+++ b/app/view/window/Messprogramm.js	Fri May 08 15:31:58 2015 +0200
@@ -16,6 +16,7 @@
     requires: [
         'Lada.view.form.Messprogramm',
         'Lada.view.grid.Messmethoden',
+        'Lada.view.grid.Nuklide'
     ],
 
     collapsible: true,
@@ -91,6 +92,10 @@
                     xtype: 'messmethodengrid',
                     recordId: this.record? this.record.get('id') : null,
                     flex: 1
+                }, {
+                    xtype: 'nuklidegrid',
+                    recordId: this.record? this.record.get('id') : null,
+                    flex: 1
                 }]
             }]
         }];
--- a/resources/i18n/Lada_de-DE.properties	Fri May 08 12:47:28 2015 +0200
+++ b/resources/i18n/Lada_de-DE.properties	Fri May 08 15:31:58 2015 +0200
@@ -58,6 +58,7 @@
 probeKommentar:Probe Kommentar
 messmethode:Messmethode
 nuklide:Nuklide
+nuklid:Nuklid
 from:Von
 to:Bis
 
@@ -67,7 +68,7 @@
 emptytext.probenart:Wahlen Sie eine Probenart
 emptytext.umweltbereich:Wahlen Sie einen Umweltbereich
 emptytext.netzbetrieber:Wahlen Sie einen Netzbetreiber
-emptytext.mmtgrid:Fügen Sie eine Messmethoden hinzu.
+emptytext.mmtgrid:Fügen Sie eine Messmethode hinzu.
 emptytext.nuklidgrid:Für die ausgewählte Messmethode existieren keine Nuklide oder es wurde keine Messmethode ausgewählt.
 
 ##Fieldsets
@@ -95,9 +96,10 @@
 save.qtip:Daten Speichern
 discard:Verwerfen
 discard.qtip:Änderungen verwerfen
-generateproben:Proben aus Messprogramm erzeugen
+generateproben:Proben erzeugen
 nameofmessprogramm:Erzeuge Proben aus dem Messprogramm
 messprogtimeperiod:für den Zeitraum
+select:Auswählen
 
 ##
 # Msg:

http://lada.wald.intevation.org