diff options
author | Artur Signell <artur.signell@itmill.com> | 2010-04-29 11:18:35 +0000 |
---|---|---|
committer | Artur Signell <artur.signell@itmill.com> | 2010-04-29 11:18:35 +0000 |
commit | 8ae8c6bdf5745498a232cb5aa464178eb60fbc25 (patch) | |
tree | ae5ae66cb9944801709479d63ce4cfe24ae0adf5 /src | |
parent | 01ab62228befd8e3dc6a766b042d0fd1c33f239c (diff) | |
download | vaadin-framework-8ae8c6bdf5745498a232cb5aa464178eb60fbc25.tar.gz vaadin-framework-8ae8c6bdf5745498a232cb5aa464178eb60fbc25.zip |
Fix for #4609 Retrieving an index of a component in an AbstractOrderedLayout
svn changeset:12910/svn branch:6.4
Diffstat (limited to 'src')
-rw-r--r-- | src/com/vaadin/ui/AbstractOrderedLayout.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/com/vaadin/ui/AbstractOrderedLayout.java b/src/com/vaadin/ui/AbstractOrderedLayout.java index 123c5a8dc0..89b72b0f88 100644 --- a/src/com/vaadin/ui/AbstractOrderedLayout.java +++ b/src/com/vaadin/ui/AbstractOrderedLayout.java @@ -360,4 +360,28 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements removeListener(CLICK_EVENT, LayoutClickEvent.class, listener); } + /** + * Returns the index of the given component. + * + * @param component + * The component to look up. + * @return The index of the component or -1 if the component is not a child. + */ + public int getComponentIndex(Component component) { + return components.indexOf(component); + } + + /** + * Returns the component at the given position. + * + * @param index + * The position of the component. + * @return The component at the given index. + * @throws IndexOutOfBoundsException + * If the index is out of range. + */ + public Component getComponent(int index) throws IndexOutOfBoundsException { + return components.get(index); + } + } |