[Lada-commits] [PATCH 2 of 5] Genprobenwindow can only be created once, also fixed messprogrammortewindow 'close with x and can not reopen' bug

Wald Commits scm-commit at wald.intevation.org
Fri May 29 11:01:16 CEST 2015


# HG changeset patch
# User Dustin Demuth <dustin at intevation.de>
# Date 1432883106 -7200
# Node ID 097d4edc2f00420c926e677e33d236d18ac9f9d8
# Parent  1321efe444f0b566b62b801b31bd439f9facf8b0
Genprobenwindow can only be created once, also fixed messprogrammortewindow 'close with x and can not reopen' bug

diff -r 1321efe444f0 -r 097d4edc2f00 app/controller/form/Messprogramm.js
--- a/app/controller/form/Messprogramm.js	Fri May 29 08:31:19 2015 +0200
+++ b/app/controller/form/Messprogramm.js	Fri May 29 09:05:06 2015 +0200
@@ -51,7 +51,7 @@
                 change: this.synchronizeSlider,
                 blur: this.checkPeriod
             },
-             'messprogrammform probenintervall combobox': {
+            'messprogrammform probenintervall combobox': {
                 select: this.updateIntervalls
             },
             'messprogrammform panel[xtype="deskriptor] combobox': {
diff -r 1321efe444f0 -r 097d4edc2f00 app/view/window/GenProbenFromMessprogramm.js
--- a/app/view/window/GenProbenFromMessprogramm.js	Fri May 29 08:31:19 2015 +0200
+++ b/app/view/window/GenProbenFromMessprogramm.js	Fri May 29 09:05:06 2015 +0200
@@ -21,10 +21,21 @@
     constrain: true,
 
     record: null,
+    parentWindow: null,
 
     initComponent: function() {
         var i18n = Lada.getApplication().bundle;
 
+        // add listeners to change the window appearence when it becomes inactive
+        this.on({
+            activate: function(){
+                this.getEl().removeCls('window-inactive');
+            },
+            deactivate: function(){
+                this.getEl().addCls('window-inactive');
+            }
+        });
+
         this.title = i18n.getMsg('gpfm.window.title');
         var me = this;
         this.buttons = [{
@@ -76,7 +87,7 @@
                                     'Der Server konnte die Anfrage nicht authentifizieren.<br/>'+
                                     'Für ein erneutes Login muss die Anwendung neu geladen werden.<br/>' +
                                     'Alle ungesicherten Daten gehen dabei verloren.<br/>' +
-                                    'Soll die Anwendung jetzt neu geladen werden?', this.reload);
+                                    'Soll die Anwendung jetzt neu geladen werden?', me.reload); //TODO Scope?
                             }
                             else if(json.message){
                                 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.generic.title')
@@ -104,6 +115,9 @@
             },
             deactivate: function(){
                 this.getEl().addCls('window-inactive');
+            },
+            close: function () {
+                this.parentWindow.probenWindow = null;
             }
         });
 
diff -r 1321efe444f0 -r 097d4edc2f00 app/view/window/Messprogramm.js
--- a/app/view/window/Messprogramm.js	Fri May 29 08:31:19 2015 +0200
+++ b/app/view/window/Messprogramm.js	Fri May 29 09:05:06 2015 +0200
@@ -25,6 +25,7 @@
     autoScroll: true,
     layout: 'fit',
     constrain: true,
+    probenWindow: null,
 
     record: null,
 
@@ -37,18 +38,26 @@
         else {
             this.title = i18n.getMsg('messprogramm.window.edit.title');
         }
-
         this.buttons = [{
             text: i18n.getMsg('generateproben'),
             scope: this,
             disabled: this.record? false : true, //disable button if no record is set.
             handler: function() {
-                var winname = 'Lada.view.window.GenProbenFromMessprogramm';
-                var win = Ext.create(winname, {
-                    record: this.record
-                });
-                win.show();
-                win.initData();
+                //Make the Window a "singleton"
+                if (! this.probenWindow) {
+                    var winname = 'Lada.view.window.GenProbenFromMessprogramm';
+                    var win = Ext.create(winname, {
+                        record: this.record,
+                        parentWindow: this
+                    });
+                    win.show();
+                    win.initData();
+                    this.probenWindow = win;
+               }
+               else {
+                    this.probenWindow.focus();
+                    this.probenWindow.setActive(true);
+               }
             }
         },
         '->',
diff -r 1321efe444f0 -r 097d4edc2f00 app/view/window/MessprogrammOrt.js
--- a/app/view/window/MessprogrammOrt.js	Fri May 29 08:31:19 2015 +0200
+++ b/app/view/window/MessprogrammOrt.js	Fri May 29 09:05:06 2015 +0200
@@ -41,7 +41,7 @@
             text: i18n.getMsg('cancel'),
             scope: this,
             handler: function() {
-                this.close()
+                this.close();
                 this.parentWindow.down('messprogrammform')
                     .ortWindow = null;
            }
@@ -57,6 +57,10 @@
             },
             deactivate: function(){
                 this.getEl().addCls('window-inactive');
+            },
+            close: function () {
+                this.parentWindow.down('messprogrammform')
+                    .ortWindow = null;
             }
         });
 
diff -r 1321efe444f0 -r 097d4edc2f00 resources/i18n/Lada_de-DE.properties
--- a/resources/i18n/Lada_de-DE.properties	Fri May 29 08:31:19 2015 +0200
+++ b/resources/i18n/Lada_de-DE.properties	Fri May 29 09:05:06 2015 +0200
@@ -12,6 +12,7 @@
 611:Wert nicht eindeutig
 631:Wert nicht gesetzt
 632:Werte passen nicht zusammen
+633:
 651:Punkt nicht in Polygon
 652:Werte passen nicht zusammen
 661:Der Zeitpunkt liegt in der Zukunft


More information about the Lada-commits mailing list