tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tveron...@apache.org
Subject svn commit: r1291403 - /openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/staging/js/tomee/view/ApplicationView.js
Date Mon, 20 Feb 2012 18:39:27 GMT
Author: tveronezi
Date: Mon Feb 20 18:39:27 2012
New Revision: 1291403

URL: http://svn.apache.org/viewvc?rev=1291403&view=rev
Log:
https://issues.apache.org/jira/browse/TOMEE-130

(JS code) Remove panel object when changing tabs.

Modified:
    openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/staging/js/tomee/view/ApplicationView.js

Modified: openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/staging/js/tomee/view/ApplicationView.js
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/staging/js/tomee/view/ApplicationView.js?rev=1291403&r1=1291402&r2=1291403&view=diff
==============================================================================
--- openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/staging/js/tomee/view/ApplicationView.js
(original)
+++ openejb/trunk/openejb/tomee/tomee-webapp/src/main/webapp/staging/js/tomee/view/ApplicationView.js
Mon Feb 20 18:39:27 2012
@@ -19,13 +19,16 @@
 TOMEE.ApplicationView = function (cfg) {
     "use strict";
 
+
     var channel = cfg.channel;
 
     var appToolbar = TOMEE.ApplicationToolbar(cfg);
-    var home = TOMEE.ApplicationHomePanel(cfg);
-    var jndi = TOMEE.ApplicationJndiPanel(cfg);
-    var test = TOMEE.ApplicationTestPanel(cfg);
-    var help = TOMEE.ApplicationHelpPanel(cfg);
+    var home = null;
+    var jndi = null;
+    var test = null;
+    var help = null;
+
+    var currentPanel = null;
 
     var elements = (function () {
         var containerUid = TOMEE.Sequence.next();
@@ -62,27 +65,50 @@ TOMEE.ApplicationView = function (cfg) {
         });
     };
 
-    var getPanel = function (key) {
+    var getPanel = function (key, isNew) {
         if (key === 'jndi') {
+            if(isNew || jndi === null) {
+                jndi = null;
+                jndi = TOMEE.ApplicationJndiPanel(cfg);
+            }
             return jndi;
 
         } else if (key === 'test') {
+            if(isNew || test === null) {
+                test = null;
+                test = TOMEE.ApplicationTestPanel(cfg);
+            }
             return test;
 
         } else if (key === 'help') {
+            if(isNew || help === null) {
+                help = null;
+                help = TOMEE.ApplicationHelpPanel(cfg);
+            }
             return help;
 
         } else if (key === 'home') {
+            if(isNew || home === null) {
+                home = null;
+                home = TOMEE.ApplicationHomePanel(cfg);
+            }
             return home;
         }
         return null;
     };
 
     var showPanel = function (key) {
-        elements.body.empty();
-        var panel = getPanel(key);
-        if (panel) {
-            renderPanel(key, panel);
+        if(currentPanel) {
+            channel.send('before_application_panel_removed', {
+                panel: currentPanel
+            });
+            currentPanel.getEl().remove();
+            currentPanel = null;
+        }
+
+        currentPanel = getPanel(key, true);
+        if (currentPanel) {
+            renderPanel(key, currentPanel);
         }
     };
 



Mime
View raw message