]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fix for #4609 Retrieving an index of a component in an AbstractOrderedLayout
authorArtur Signell <artur.signell@itmill.com>
Thu, 29 Apr 2010 11:18:35 +0000 (11:18 +0000)
committerArtur Signell <artur.signell@itmill.com>
Thu, 29 Apr 2010 11:18:35 +0000 (11:18 +0000)
svn changeset:12910/svn branch:6.4

src/com/vaadin/ui/AbstractOrderedLayout.java

index 123c5a8dc0c4ae4cbbaca0d15b2fb700c723dd5b..89b72b0f883b08ca7a821f65aa2553fbdcbf58c5 100644 (file)
@@ -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);
+    }
+
 }