Author: kaiyi4
Date: Wed Aug 27 09:04:54 2008
New Revision: 2625

Modified:
   trunk/src/ca/sqlpower/architect/swingui/olap/OLAPPlayPenFactory.java

Log:
code review changes. Used iterator to control/remove the content of the list, a list of playpencomponents subject to removal.

Modified: trunk/src/ca/sqlpower/architect/swingui/olap/OLAPPlayPenFactory.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/swingui/olap/OLAPPlayPenFactory.java (original) +++ trunk/src/ca/sqlpower/architect/swingui/olap/OLAPPlayPenFactory.java Wed Aug 27 09:04:54 2008
@@ -21,6 +21,7 @@

 import java.awt.event.KeyEvent;
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;

 import javax.swing.Action;
@@ -191,11 +192,12 @@

         public void olapChildRemoved(OLAPChildEvent e) {
             OLAPUtil.unlistenToHierarchy(e.getChild(), this, null);
-
-            for (PlayPenComponent ppc : pp.getPlayPenComponents()) {
+ Iterator<PlayPenComponent> it = pp.getPlayPenComponents().iterator();
+            while (it.hasNext()) {
+                PlayPenComponent ppc = it.next();
                 if (ppc.getModel() == e.getChild()) {
                     ppc.setSelected(false, SelectionEvent.SINGLE_SELECT);
-                    pp.getContentPane().remove(ppc);
+                    it.remove();
                 }
             }
         }

Reply via email to