aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/ui/SplitPanel.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/vaadin/ui/SplitPanel.java')
-rw-r--r--src/com/vaadin/ui/SplitPanel.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/com/vaadin/ui/SplitPanel.java b/src/com/vaadin/ui/SplitPanel.java
index cc8a19aa3d..2fe5f43d97 100644
--- a/src/com/vaadin/ui/SplitPanel.java
+++ b/src/com/vaadin/ui/SplitPanel.java
@@ -74,8 +74,7 @@ public class SplitPanel extends AbstractLayout {
int i = 0;
public boolean hasNext() {
- if (i < (firstComponent == null ? 0 : 1)
- + (secondComponent == null ? 0 : 1)) {
+ if (i < getComponentCount()) {
return true;
}
return false;
@@ -231,6 +230,23 @@ public class SplitPanel extends AbstractLayout {
}
/**
+ * Gets the number of contained components. Consistent with the iterator
+ * returned by {@link #getComponentIterator()}.
+ *
+ * @return the number of contained components (zero, one or two)
+ */
+ public int getComponentCount() {
+ int count = 0;
+ if (firstComponent != null) {
+ count++;
+ }
+ if (secondComponent != null) {
+ count++;
+ }
+ return count;
+ }
+
+ /**
* Paints the content of this component.
*
* @param target