From 3b96123d2a84204375277c62d906e3167ee4f352 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Mon, 25 May 2015 19:20:36 +0300 Subject: Replaced incorrect setter/getter with prope ones and fixed declarative (#17982) Change-Id: If1109d3759d9e6414f7d60ae3b12286aa9e29566 --- server/src/com/vaadin/ui/TabSheet.java | 30 ++++++++++++++++++++-- .../tabsheet/TabSheetDeclarativeTest.java | 19 ++++++++++++++ 2 files changed, 47 insertions(+), 2 deletions(-) (limited to 'server') diff --git a/server/src/com/vaadin/ui/TabSheet.java b/server/src/com/vaadin/ui/TabSheet.java index 67dfdd4258..592515c560 100644 --- a/server/src/com/vaadin/ui/TabSheet.java +++ b/server/src/com/vaadin/ui/TabSheet.java @@ -478,9 +478,11 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, * Are the tab selection parts ("tabs") hidden. * * @return true if the tabs are hidden in the UI + * @deprecated as of 7.5, use {@link #isTabsVisible()} instead */ + @Deprecated public boolean areTabsHidden() { - return !getState(false).tabsVisible; + return !isTabsVisible(); } /** @@ -488,9 +490,33 @@ public class TabSheet extends AbstractComponentContainer implements Focusable, * * @param tabsHidden * true if the tabs should be hidden + * @deprecated as of 7.5, use {@link #setTabsVisible(boolean)} instead */ + @Deprecated public void hideTabs(boolean tabsHidden) { - getState().tabsVisible = !tabsHidden; + setTabsVisible(!tabsHidden); + } + + /** + * Sets whether the tab selection part should be shown in the UI + * + * @since 7.5 + * @param tabsVisible + * true if the tabs should be shown in the UI, false otherwise + */ + public void setTabsVisible(boolean tabsVisible) { + getState().tabsVisible = tabsVisible; + } + + /** + * Checks if the tab selection part should be shown in the UI + * + * @return true if the tabs are shown in the UI, false otherwise + * @since 7.5 + */ + public boolean isTabsVisible() { + return getState(false).tabsVisible; + } /** diff --git a/server/tests/src/com/vaadin/tests/server/component/tabsheet/TabSheetDeclarativeTest.java b/server/tests/src/com/vaadin/tests/server/component/tabsheet/TabSheetDeclarativeTest.java index bb5669a3a1..a92101f550 100644 --- a/server/tests/src/com/vaadin/tests/server/component/tabsheet/TabSheetDeclarativeTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/tabsheet/TabSheetDeclarativeTest.java @@ -18,7 +18,9 @@ package com.vaadin.tests.server.component.tabsheet; import org.junit.Test; import com.vaadin.server.ExternalResource; +import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.tests.design.DeclarativeTestBase; +import com.vaadin.ui.Label; import com.vaadin.ui.TabSheet; import com.vaadin.ui.TabSheet.Tab; import com.vaadin.ui.TextField; @@ -65,4 +67,21 @@ public class TabSheetDeclarativeTest extends DeclarativeTestBase { testRead(design, ts); testWrite(design, ts); } + + @Test + public void tabsNotShown() { + String design = "\n" + + " \n" + + " My Content\n" + " \n" + + "\n"; + TabSheet ts = new TabSheet(); + ts.setTabsVisible(false); + Label l = new Label("My Content", ContentMode.HTML); + Tab tab = ts.addTab(l); + tab.setCaption("My Tab"); + ts.setSelectedTab(tab); + testRead(design, ts); + testWrite(design, ts); + + } } \ No newline at end of file -- cgit v1.2.3