diff options
author | Henri Sara <henri.sara@itmill.com> | 2010-10-26 14:58:06 +0000 |
---|---|---|
committer | Henri Sara <henri.sara@itmill.com> | 2010-10-26 14:58:06 +0000 |
commit | 089f43092d7bf6f99e5abca56415d8cf6fcc3cf2 (patch) | |
tree | bfb23494c862d7072ffbdf127ca9518e149507cd /src/com/vaadin/ui/SplitPanel.java | |
parent | a98ecb2b8d2949eec1b32a66eb8e1f5cddb5910d (diff) | |
download | vaadin-framework-089f43092d7bf6f99e5abca56415d8cf6fcc3cf2.tar.gz vaadin-framework-089f43092d7bf6f99e5abca56415d8cf6fcc3cf2.zip |
#4611 add getComponentCount() method for ComponentContainer implementations
svn changeset:15724/svn branch:6.5
Diffstat (limited to 'src/com/vaadin/ui/SplitPanel.java')
-rw-r--r-- | src/com/vaadin/ui/SplitPanel.java | 20 |
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 |