changeset 747:3ffecbce17d6

Radio-Buttons to switch between query-modes: Probenliste und Probenplanung. Filter-Combobox store wird automatisch gewechselt. ToDo: Query-Store für Probenplanung
author Dustin Demuth <dustin@intevation.de>
date Fri, 24 Apr 2015 15:47:05 +0200
parents f99f23ffeb73
children 344330d3d1cd
files app.js app/controller/ProbenPlanungSwitcher.js app/view/FilterPanel.js app/view/ProbenPlanungSwitcher.js app/view/Viewport.js resources/i18n/Lada_de-DE.properties
diffstat 6 files changed, 131 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/app.js	Fri Apr 24 15:41:14 2015 +0200
+++ b/app.js	Fri Apr 24 15:47:05 2015 +0200
@@ -176,6 +176,7 @@
         'Lada.controller.grid.Messwert',
         'Lada.controller.grid.Status',
         'Lada.controller.Map',
-        'Lada.controller.form.Location'
+        'Lada.controller.form.Location',
+        'Lada.controller.ProbenPlanungSwitcher'
     ]
 });
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/controller/ProbenPlanungSwitcher.js	Fri Apr 24 15:47:05 2015 +0200
@@ -0,0 +1,56 @@
+/* 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.
+ */
+
+/**
+ * Controller for the ProbenPlanungSwitcher
+ * This controller handles all logic related to the PPS
+ */
+Ext.define('Lada.controller.ProbenPlanungSwitcher', {
+    extend: 'Ext.app.Controller',
+    displayFields: null,
+
+    /**
+     * Initialize this Controller
+     * It has 1 Listeners
+     * A checked PPS-Radiofield fired a 'check'-event
+     */
+    init: function() {
+        this.control({
+            'radiofield[name=ppswitch]': {
+                check: this.switchStores
+            }
+        });
+        this.callParent(arguments);
+    },
+
+    /**
+     * Function is called when the user selects a checkbox.
+     * according to the checkboxes inputValue,
+     * the function alters the store which was loaded by the
+     * filterpanels combobox
+     */
+    switchStores: function(field) {
+        var cbox = field.up('probenplanungswitcher').up().down('combobox');
+
+        if (field.inputValue == "probenplanung" && cbox) {
+            var sname = 'Lada.store.Queries'; // TODO change store!
+        }
+        else if (field.inputValue == "probenliste" && cbox) {
+            var sname = 'Lada.store.Queries';
+        }
+
+        var store = Ext.StoreManager.lookup(sname);
+        if (!store) {
+            store = Ext.create(sname);
+        }
+        if (store) {
+            store.load();
+            cbox.bindStore(store);
+        }
+    }
+});
--- a/app/view/FilterPanel.js	Fri Apr 24 15:41:14 2015 +0200
+++ b/app/view/FilterPanel.js	Fri Apr 24 15:47:05 2015 +0200
@@ -7,7 +7,7 @@
  */
 
 /*
- * Panel to show available search queryies
+ * Panel to show available search queries
  */
 Ext.define('Lada.view.FilterPanel', {
     extend: 'Ext.form.FieldSet',
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/view/ProbenPlanungSwitcher.js	Fri Apr 24 15:47:05 2015 +0200
@@ -0,0 +1,63 @@
+/* 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 is a Widget for a ProbenPlanungSwitcher
+ */
+Ext.define('Lada.view.ProbenPlanungSwitcher', {
+    extend: 'Ext.form.RadioGroup',
+    alias: 'widget.probenplanungswitcher',
+
+    mixins: {
+        observable: 'Ext.util.Observable'
+    },
+    /**
+     * Initialise the Widget.
+     * When the Checkbox is checked, it fires a 'check' Event
+     */
+    initComponent: function() {
+       var i18n = Lada.getApplication().bundle;
+       this.items= [{
+            xtype: 'panel',
+            border: false,
+            items: [{
+                xtype: 'radiogroup',
+                fieldLabel: i18n.getMsg('modus'),
+                //labelWidth: '30 px',
+                columns: 'auto',
+                vertical: false,
+                width: '100%',
+                items: [{
+                    xtype: 'radiofield',
+                    name: 'ppswitch',
+                    boxLabel: i18n.getMsg('probelist'),
+                    boxLabelAlign: 'before',
+                    inputValue: 'probenliste',
+                    checked: true,
+                    handler: function(field, state){
+                        if (state === true) {
+                            this.fireEvent('check', field);
+                        }
+                    }
+                },{
+                    xtype: 'radiofield',
+                    name: 'ppswitch',
+                    boxLabel: i18n.getMsg('probeplanning'),
+                    boxLabelAlign: 'before',
+                    inputValue: 'probenplanung',
+                    handler: function(field, state){
+                        if (state === true) {
+                            this.fireEvent('check', field);
+                        }
+                    }
+                 }]
+            }]
+       }];
+       this.callParent(arguments);
+    }
+});
--- a/app/view/Viewport.js	Fri Apr 24 15:41:14 2015 +0200
+++ b/app/view/Viewport.js	Fri Apr 24 15:47:05 2015 +0200
@@ -10,12 +10,13 @@
  * Viewport for the Lada-Client
  *
  * The viewport initialises the graphical elements of the application. For
- * debugging it is possible to initialize other components directly see the
+ * debugging it is possible to initialise other components directly see the
  * initComponent function.
  */
 Ext.define('Lada.view.Viewport', {
     extend: 'Ext.container.Viewport',
     requires: [
+        'Lada.view.ProbenPlanungSwitcher',
         'Lada.view.FilterPanel',
         'Lada.view.grid.FilterResult'
     ],
@@ -94,6 +95,9 @@
                     }]
                 }],
                 items: [{
+                    xtype: 'probenplanungswitcher',
+                    margin: '0, 10, 0, 10'
+                }, {
                     // Auswahl einer Abfrage.
                     xtype: 'filterpanel',
                     margin: '0, 10, 0, 10'
--- a/resources/i18n/Lada_de-DE.properties	Fri Apr 24 15:41:14 2015 +0200
+++ b/resources/i18n/Lada_de-DE.properties	Fri Apr 24 15:47:05 2015 +0200
@@ -36,6 +36,10 @@
 probenartId: Probenart
 probeentnahmeBeginn: Probeentnahme Beginn
 
+modus: Modus
+probeplanning: Probenplanung
+probelist: Probenliste
+
 ##
 # Msg:
 ##

http://lada.wald.intevation.org