From 35a223e3a3da7e1094cec585421898c8150e23c1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Johannes=20Dahlstr=C3=B6m?= Date: Thu, 5 Apr 2012 12:08:08 +0000 Subject: [PATCH] #8203 Added TabSheet#setSelectedTab(int) and TabSheet#setSelectedTab(TabSheet.Tab) svn changeset:23408/svn branch:6.8 --- src/com/vaadin/ui/TabSheet.java | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/com/vaadin/ui/TabSheet.java b/src/com/vaadin/ui/TabSheet.java index 70fa95ba97..cb89c5e0c8 100644 --- a/src/com/vaadin/ui/TabSheet.java +++ b/src/com/vaadin/ui/TabSheet.java @@ -581,7 +581,7 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, /** * Sets the selected tab. The tab is identified by the tab content - * component. + * component. Does nothing if the tabsheet doesn't contain the component. * * @param c */ @@ -594,6 +594,27 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, } } + /** + * Sets the selected tab. The tab is identified by the corresponding + * {@link Tab Tab} instance. Does nothing if the tabsheet doesn't contain + * the given tab. + * + * @param tab + */ + public void setSelectedTab(Tab tab) { + setSelectedTab(tab.getComponent()); + } + + /** + * Sets the selected tab, identified by its position. Does nothing if + * index < 0 || index > {@link #getComponentCount()}. + * + * @param index + */ + public void setSelectedTab(int index) { + setSelectedTab(getTab(index)); + } + /** * Checks if the current selection is valid, and updates the selection if * the previously selected component is not visible and enabled. The first -- 2.39.5