aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/src/com/vaadin/ui/TabSheet.java30
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/tabsheet/TabSheetDeclarativeTest.java19
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