]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fixed #1024
authorJani Laakso <jani.laakso@itmill.com>
Sun, 21 Oct 2007 13:48:13 +0000 (13:48 +0000)
committerJani Laakso <jani.laakso@itmill.com>
Sun, 21 Oct 2007 13:48:13 +0000 (13:48 +0000)
svn changeset:2567/svn branch:trunk

src/com/itmill/toolkit/ui/SplitPanel.java

index e18a6e9840c594c92c9c5110cb6fed7a56db3a44..41416c9de275fc8e089c1c42567a6699f72e8e81 100644 (file)
@@ -177,24 +177,32 @@ public class SplitPanel extends AbstractComponentContainer implements Layout,
                        int i = 0;
 
                        public boolean hasNext() {
-                               if (i < 2)
+                               if (i < (firstComponent == null ? 0 : 1)
+                                               + (secondComponent == null ? 0 : 1))
                                        return true;
                                return false;
                        }
 
                        public Object next() {
+                               if (!hasNext())
+                                       return null;
                                i++;
                                if (i == 1)
-                                       return firstComponent;
+                                       return firstComponent == null ? secondComponent
+                                                       : firstComponent;
                                else if (i == 2)
                                        return secondComponent;
                                return null;
                        }
 
                        public void remove() {
-                               if (i == 1)
-                                       setFirstComponent(null);
-                               else if (i == 2)
+                               if (i == 1) {
+                                       if (firstComponent != null) {
+                                               setFirstComponent(null);
+                                               i = 0;
+                                       } else
+                                               setSecondComponent(null);
+                               } else if (i == 2)
                                        setSecondComponent(null);
                        }
                };