diff options
author | Artur Signell <artur@vaadin.com> | 2015-05-25 19:20:36 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2015-06-02 13:53:57 +0000 |
commit | 3b96123d2a84204375277c62d906e3167ee4f352 (patch) | |
tree | 34619d42965e6b4b79a9a67a6768b135418ba3a0 /server | |
parent | 0349e002b8904e6d91e7d7938cbe085b3501ce0f (diff) | |
download | vaadin-framework-3b96123d2a84204375277c62d906e3167ee4f352.tar.gz vaadin-framework-3b96123d2a84204375277c62d906e3167ee4f352.zip |
Replaced incorrect setter/getter with prope ones and fixed declarative (#17982)
Change-Id: If1109d3759d9e6414f7d60ae3b12286aa9e29566
Diffstat (limited to 'server')
-rw-r--r-- | server/src/com/vaadin/ui/TabSheet.java | 30 | ||||
-rw-r--r-- | server/tests/src/com/vaadin/tests/server/component/tabsheet/TabSheetDeclarativeTest.java | 19 |
2 files changed, 47 insertions, 2 deletions
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<TabSheet> { testRead(design, ts); testWrite(design, ts); } + + @Test + public void tabsNotShown() { + String design = "<v-tab-sheet tabs-visible=\"false\">\n" + + " <tab caption=\"My Tab\" selected=\"true\">\n" + + " <v-label>My Content</v-label>\n" + " </tab>\n" + + "</v-tab-sheet>\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 |