details:   https://code.openbravo.com/erp/devel/pi/rev/367eaab45edd
changeset: 13651:367eaab45edd
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Fri Sep 02 10:02:14 2011 +0200
summary:   Fixes issue 18227: Closing a tab doesn't release all objects
Added method to Layout to make it possible to destroy and remove members, use 
this method from all applicable locations

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-statusbar.js
                   |   4 +-
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form-attachments.js
       |   2 +-
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/navbar/ob-help-about-widget.js
         |   4 ++
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/navbar/ob-quick-launch.js
              |   3 ++
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-personalize-form.js
 |   6 ++--
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js
                  |   4 +-
 
modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-community-branding-widget.js
                      |   2 +-
 
modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-myopenbravo.js
                                    |   4 +-
 
modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-showparameter-widget.js
                           |   2 +-
 
modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
        |  14 ++++++++++
 10 files changed, 33 insertions(+), 12 deletions(-)

diffs (178 lines):

diff -r aec4c4f24da5 -r 367eaab45edd 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-statusbar.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-statusbar.js
     Thu Sep 01 16:47:28 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-statusbar.js
     Fri Sep 02 10:02:14 2011 +0200
@@ -288,13 +288,13 @@
 
   addIcon : function(icon) {
       // remove any existing icon or spacer
-    this.leftStatusBar.removeMember(this.leftStatusBar.members[0]);
+    this.leftStatusBar.destroyAndRemoveMembers(this.leftStatusBar.members[0]);
     this.leftStatusBar.addMember(icon, 0);
   },
 
   removeIcon : function() {
     // remove any existing icon or spacer
-    this.leftStatusBar.removeMember(this.leftStatusBar.members[0]);
+    this.leftStatusBar.destroyAndRemoveMembers(this.leftStatusBar.members[0]);
     this.leftStatusBar.addMember(this.spacer, 0);
   },
 
diff -r aec4c4f24da5 -r 367eaab45edd 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form-attachments.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form-attachments.js
 Thu Sep 01 16:47:28 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form-attachments.js
 Fri Sep 02 10:02:14 2011 +0200
@@ -220,7 +220,7 @@
   
   fillAttachments: function(attachments){
     this.savedAttachments = attachments;
-    this.removeMembers(this.getMembers());
+    this.destroyAndRemoveMembers(this.getMembers());
     var hLayout = isc.HLayout.create();
     if(this.getForm().isNew){
       return;  
diff -r aec4c4f24da5 -r 367eaab45edd 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/navbar/ob-help-about-widget.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/navbar/ob-help-about-widget.js
   Thu Sep 01 16:47:28 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/navbar/ob-help-about-widget.js
   Fri Sep 02 10:02:14 2011 +0200
@@ -69,6 +69,10 @@
       tabPane = selectedTab.pane;
     }
     // determine if a help link should be shown or not
+    // destroy the current members
+    if (this.members[0].getMembers()) {
+      
this.members[0].destroyAndRemoveMembers(this.members[0].getMembers().duplicate());
+    } 
     if (!tabPane) {
       this.members[0].setMembers([aboutLink]);
     } else {
diff -r aec4c4f24da5 -r 367eaab45edd 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/navbar/ob-quick-launch.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/navbar/ob-quick-launch.js
        Thu Sep 01 16:47:28 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/navbar/ob-quick-launch.js
        Fri Sep 02 10:02:14 2011 +0200
@@ -88,6 +88,9 @@
           index++;
         }
       }
+      if (this.members[0].getMembers()) {
+        
this.members[0].destroyAndRemoveMembers(this.members[0].getMembers().duplicate());
+      } 
 
       this.members[0].setMembers(newFields);
 
diff -r aec4c4f24da5 -r 367eaab45edd 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-personalize-form.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-personalize-form.js
   Thu Sep 01 16:47:28 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-personalize-form.js
   Fri Sep 02 10:02:14 2011 +0200
@@ -690,7 +690,7 @@
     this.isSaved = false;
     this.isNew = !this.personalizationData.personalizationId;
     
-    this.removeMember(this.mainLayout);
+    this.destroyAndRemoveMembers(this.mainLayout);
     this.mainLayout = null;
     this.createAddMainLayout();
 
@@ -874,7 +874,7 @@
     var i, prop, fld;
     
     if (this.fieldsTreeGrid) {
-      this.fieldsLayout.removeMember(this.fieldsTreeGrid);
+      this.fieldsLayout.destroyAndRemoveMembers(this.fieldsTreeGrid);
     }
     
     // the tree will add properties to the objects as fieldData
@@ -980,7 +980,7 @@
       }
       window = this.form.view.standardWindow;
     }
-    window.removeMember(this);
+    window.destroyAndRemoveMembers(this);
     
     // restores the tabtitle
     window.view.updateTabTitle();
diff -r aec4c4f24da5 -r 367eaab45edd 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js
    Thu Sep 01 16:47:28 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js
    Fri Sep 02 10:02:14 2011 +0200
@@ -652,7 +652,7 @@
     for (i = 0; i < oldMembersSorted.length; i++) { /* Update the 
'leftMembers' array */
       this.leftMembers.splice(oldMembersSorted[i], 1);
     }
-    this.removeMembers(oldArray); /* Remove visually the desired elements */
+    this.destroyAndRemoveMembers(oldArray); /* Remove visually the desired 
elements */
   },
   
   // ** {{{ removeAllLeftMembers() }}} **
@@ -864,7 +864,7 @@
     for (i = 0; i < oldMembersSorted.length; i++) { /* Update the 
'rightMembers' array */
       this.rightMembers.splice(oldMembersSorted[i], 1);
     }
-    this.removeMembers(oldArray); /* Remove visually the desired elements */
+    this.destroyAndRemoveMembers(oldArray); /* Remove visually the desired 
elements */
   },
   
   // ** {{{ removeAllRightMembers() }}} **
diff -r aec4c4f24da5 -r 367eaab45edd 
modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-community-branding-widget.js
--- 
a/modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-community-branding-widget.js
        Thu Sep 01 16:47:28 2011 +0200
+++ 
b/modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-community-branding-widget.js
        Fri Sep 02 10:02:14 2011 +0200
@@ -130,7 +130,7 @@
     purposeStack.addMembers(toolTip);
     purposeStack.addMembers(layout.separator);
 
-    layout.removeMember(loadingBar);
+    layout.destroyAndRemoveMembers(loadingBar);
 
     layout.addMember(purposeStack);
     layout.addMember(this.versionLabel);
diff -r aec4c4f24da5 -r 367eaab45edd 
modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-myopenbravo.js
--- 
a/modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-myopenbravo.js
      Thu Sep 01 16:47:28 2011 +0200
+++ 
b/modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-myopenbravo.js
      Fri Sep 02 10:02:14 2011 +0200
@@ -359,7 +359,7 @@
       recentIndex = 0, recent, lbl, newIcon, entryLayout, icon;
     
     // start with a fresh content
-    layout.removeMembers(layout.members);
+    layout.destroyAndRemoveMembers(layout.members);
     
     // reads the list of recents and displays them
     recentList = 
OB.Layout.ViewManager.recentManager.getRecentValue('OBUIAPP_RecentViewList');
@@ -453,7 +453,7 @@
       lbl, newIcon, entryLayout, icon;
     
     // start with a fresh content
-    layout.removeMembers(layout.members);
+    layout.destroyAndRemoveMembers(layout.members);
 
     // reads the list of recents and displays them
     recentList = 
OB.Layout.ViewManager.recentManager.getRecentValue('OBUIAPP_RecentDocumentsList');
diff -r aec4c4f24da5 -r 367eaab45edd 
modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-showparameter-widget.js
--- 
a/modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-showparameter-widget.js
     Thu Sep 01 16:47:28 2011 +0200
+++ 
b/modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-showparameter-widget.js
     Fri Sep 02 10:02:14 2011 +0200
@@ -25,7 +25,7 @@
   setParameters: function(parameters){
     this.Super('setParameters', arguments);
     var oldForm = this.displayForm;
-    this.windowContents.removeMember(this.displayForm);
+    this.windowContents.destroyAndRemoveMembers(this.displayForm);
     this.windowContents.addMember(this.createDisplayForm());
     oldForm.destroy();
   },
diff -r aec4c4f24da5 -r 367eaab45edd 
modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
--- 
a/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
  Thu Sep 01 16:47:28 2011 +0200
+++ 
b/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
  Fri Sep 02 10:02:14 2011 +0200
@@ -50,6 +50,20 @@
 
 isc.StaticTextItem.getPrototype().getCanFocus = function() {return false;};
 
+isc.Layout.addProperties({
+  
+  destroyAndRemoveMembers: function(toDestroy) {
+    var i;
+    if (!isc.isA.Array(toDestroy)) {
+      toDestroy = [toDestroy];
+    }
+    for (i = 0; i < toDestroy.length; i++) {
+      toDestroy[i].destroy();
+    }
+    this.removeMembers(toDestroy);
+  }
+});
+
 isc.TextItem.addProperties({
   // see comments in super type for useDisabledEventMask
   // http://forums.smartclient.com/showthread.php?p=70160#post70160

------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to