svn commit: r17624 - trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui

Bob Tarling <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2009-12-10 08:58:52-0800
New Revision: 17624

Modified:
   trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/RowSelector.java
   trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/XmlPropertyPanel.java

Log:
Use removeNotify to detect when a panel or component is removed - then remove from it any listeners

Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/RowSelector.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/RowSelector.java?view=diff&pathrev=17624&r1=17623&r2=17624
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/RowSelector.java	(original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/RowSelector.java	2009-12-10 08:58:52-0800
@@ -77,7 +77,7 @@
  * @since 0.29.2
  */
 class RowSelector extends JPanel
-        implements MouseListener, ContainerListener, ListDataListener {
+        implements MouseListener, ListDataListener {
 
     /**
      * The logger
@@ -310,8 +310,6 @@
             }
             
             getModel().addListDataListener(this);
-
-            addContainerListener(this);
         }
     }
 
@@ -400,14 +398,10 @@
         }
     }
 
-    public void componentAdded(ContainerEvent arg0) {
-        LOG.info("The RowSelector is being added to a panel");
-    }
-
     /**
      * Remove all the listeners that were added in the constructor
      */
-    public void componentRemoved(ContainerEvent event) {
+    public void removeNotify() {
         LOG.info("The RowSelector is being removed from a panel");
         getList().removeListSelectionListener(deleteAction);
         if (moveUpAction != null) {
@@ -417,7 +411,6 @@
             getList().removeListSelectionListener(moveBottomAction);
         }
         this.removeMouseListener(this);
-        this.removeContainerListener(this);
         getModel().removeListDataListener(this);
         ((UMLModelElementListModel) getModel()).removeModelEventListener();
     }

Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/XmlPropertyPanel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/XmlPropertyPanel.java?view=diff&pathrev=17624&r1=17623&r2=17624
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/XmlPropertyPanel.java	(original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/XmlPropertyPanel.java	2009-12-10 08:58:52-0800
@@ -65,6 +65,8 @@
         }
         return comp;
     }
+    
+    
 
     /**
      * If a RowSelector is removed then its selection listener
@@ -75,9 +77,6 @@
         if (comp instanceof RowSelector) {
             RowSelector rs = (RowSelector) comp;
             rs.removeListSelectionListener(this);
-            // TODO: Why do we have to call this manually
-            // when the component is listening for its own removal?
-            rs.componentRemoved(null);
         }
     }
 
@@ -99,4 +98,9 @@
         }
 
     }
+
+    public void removeNotify() {
+        LOG.info("The XML panel is being removed");
+        removeAll();
+    }
 }

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2429250

To unsubscribe from this discussion, e-mail: [[email protected]].
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.