# HG changeset patch # User Dustin Demuth # Date 1429883225 -7200 # Node ID 3ffecbce17d6ba727768d7718fff9c3573e01919 # Parent f99f23ffeb7330b10285cb682cca672a1247f672 Radio-Buttons to switch between query-modes: Probenliste und Probenplanung. Filter-Combobox store wird automatisch gewechselt. ToDo: Query-Store für Probenplanung diff -r f99f23ffeb73 -r 3ffecbce17d6 app.js --- 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' ] }); diff -r f99f23ffeb73 -r 3ffecbce17d6 app/controller/ProbenPlanungSwitcher.js --- /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); + } + } +}); diff -r f99f23ffeb73 -r 3ffecbce17d6 app/view/FilterPanel.js --- 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', diff -r f99f23ffeb73 -r 3ffecbce17d6 app/view/ProbenPlanungSwitcher.js --- /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); + } +}); diff -r f99f23ffeb73 -r 3ffecbce17d6 app/view/Viewport.js --- 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' diff -r f99f23ffeb73 -r 3ffecbce17d6 resources/i18n/Lada_de-DE.properties --- 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: ##