diff app/view/window/Messprogramm.js @ 818:097d4edc2f00

Genprobenwindow can only be created once, also fixed messprogrammortewindow 'close with x and can not reopen' bug
author Dustin Demuth <dustin@intevation.de>
date Fri, 29 May 2015 09:05:06 +0200
parents f0b26df02157
children 6249b731d438
line wrap: on
line diff
--- 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);
+               }
             }
         },
         '->',

http://lada.wald.intevation.org