From 8fcb2da138eced17f0a6105ae39122a9d096ef0b Mon Sep 17 00:00:00 2001 From: Aleksi Hietanen Date: Fri, 24 Mar 2017 10:34:05 +0200 Subject: Add possibility to configure the content mode of TabSheet tabs (#8920) Fixes #8590 --- server/src/main/java/com/vaadin/ui/TabSheet.java | 28 ++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'server/src') diff --git a/server/src/main/java/com/vaadin/ui/TabSheet.java b/server/src/main/java/com/vaadin/ui/TabSheet.java index b48d35592a..ec018e5fbf 100644 --- a/server/src/main/java/com/vaadin/ui/TabSheet.java +++ b/server/src/main/java/com/vaadin/ui/TabSheet.java @@ -40,6 +40,7 @@ import com.vaadin.server.KeyMapper; import com.vaadin.server.Resource; import com.vaadin.shared.ComponentConstants; import com.vaadin.shared.Registration; +import com.vaadin.shared.ui.ContentMode; import com.vaadin.shared.ui.tabsheet.TabState; import com.vaadin.shared.ui.tabsheet.TabsheetClientRpc; import com.vaadin.shared.ui.tabsheet.TabsheetServerRpc; @@ -1011,12 +1012,33 @@ public class TabSheet extends AbstractComponentContainer * Sets the description for the tab. The description can be used to * briefly describe the state of the tab to the user, and is typically * shown as a tooltip when hovering over the tab. + *

+ * Setting a description through this method will additionally set the + * content mode of the description to preformatted. For setting a + * different content mode see the overload + * {@link #setDescription(String, ContentMode)}. * * @param description * the new description string for the tab. */ public void setDescription(String description); + /** + * Sets the description for the tab. The description can be used to + * briefly describe the state of the tab to the user, and is typically + * shown as a tooltip when hovering over the tab. + * + * @see ContentMode + * + * @param description + * the new description string for the tab + * @param mode + * content mode used to display the description + * + * @since 8.1 + */ + public void setDescription(String description, ContentMode mode); + /** * Sets an error indicator to be shown in the tab. This can be used e.g. * to communicate to the user that there is a problem in the contents of @@ -1217,7 +1239,13 @@ public class TabSheet extends AbstractComponentContainer @Override public void setDescription(String description) { + setDescription(description, ContentMode.PREFORMATTED); + } + + @Override + public void setDescription(String description, ContentMode mode) { tabState.description = description; + tabState.descriptionContentMode = mode; markAsDirty(); } -- cgit v1.2.3