diff options
author | Artur Signell <artur@vaadin.com> | 2014-09-04 22:12:59 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2014-12-18 21:47:26 +0000 |
commit | 42ef01bfdb2c93e03b8b8e54b7422cbc9b1eea32 (patch) | |
tree | 6959d960cf291550d97de6a681bc1588bb532be8 /client | |
parent | 304cd3f48a0e7729053491d6f2afc51b3947a240 (diff) | |
download | vaadin-framework-42ef01bfdb2c93e03b8b8e54b7422cbc9b1eea32.tar.gz vaadin-framework-42ef01bfdb2c93e03b8b8e54b7422cbc9b1eea32.zip |
Allow TabSheet and Accordion tab captions to contain HTML (#14609)
Change-Id: If15db442fdbdcc80918e52f8c87e0808f76eb336
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/ui/VAccordion.java | 1 | ||||
-rw-r--r-- | client/src/com/vaadin/client/ui/VTabsheet.java | 1 | ||||
-rw-r--r-- | client/src/com/vaadin/client/ui/VTabsheetBase.java | 30 |
3 files changed, 32 insertions, 0 deletions
diff --git a/client/src/com/vaadin/client/ui/VAccordion.java b/client/src/com/vaadin/client/ui/VAccordion.java index ff77a8cb91..422f195af9 100644 --- a/client/src/com/vaadin/client/ui/VAccordion.java +++ b/client/src/com/vaadin/client/ui/VAccordion.java @@ -344,6 +344,7 @@ public class VAccordion extends VTabsheetBase { public void updateCaption(TabState tabState) { // TODO need to call this because the caption does not have an owner + caption.setCaptionAsHtml(isTabCaptionsAsHtml()); caption.updateCaptionWithoutOwner( tabState.caption, !tabState.enabled, diff --git a/client/src/com/vaadin/client/ui/VTabsheet.java b/client/src/com/vaadin/client/ui/VTabsheet.java index 10c9a332e0..2d34897986 100644 --- a/client/src/com/vaadin/client/ui/VTabsheet.java +++ b/client/src/com/vaadin/client/ui/VTabsheet.java @@ -235,6 +235,7 @@ public class VTabsheet extends VTabsheetBase implements Focusable, SubPartAware } private void updateFromState(TabState tabState) { + tabCaption.setCaptionAsHtml(getTabsheet().isTabCaptionsAsHtml()); tabCaption.update(tabState); // Apply the styleName set for the tab String newStyleName = tabState.styleName; diff --git a/client/src/com/vaadin/client/ui/VTabsheetBase.java b/client/src/com/vaadin/client/ui/VTabsheetBase.java index d3c9bf9e10..e96aa035ed 100644 --- a/client/src/com/vaadin/client/ui/VTabsheetBase.java +++ b/client/src/com/vaadin/client/ui/VTabsheetBase.java @@ -49,6 +49,8 @@ public abstract class VTabsheetBase extends ComplexPanel implements HasEnabled { /** For internal use only. May be removed or replaced in the future. */ protected AbstractComponentConnector connector; + private boolean tabCaptionsAsHtml = false; + public VTabsheetBase(String classname) { setElement(DOM.createDiv()); setStyleName(classname); @@ -168,4 +170,32 @@ public abstract class VTabsheetBase extends ComplexPanel implements HasEnabled { public boolean isEnabled() { return !disabled; } + + /** + * Sets whether the caption is rendered as HTML. + * <p> + * The default is false, i.e. render tab captions as plain text + * + * @since 7.4 + * @param captionAsHtml + * true if the captions are rendered as HTML, false if rendered + * as plain text + */ + public void setTabCaptionsAsHtml(boolean tabCaptionsAsHtml) { + this.tabCaptionsAsHtml = tabCaptionsAsHtml; + } + + /** + * Checks whether captions are rendered as HTML + * + * The default is false, i.e. render tab captions as plain text + * + * @since 7.4 + * @return true if the captions are rendered as HTML, false if rendered as + * plain text + */ + public boolean isTabCaptionsAsHtml() { + return tabCaptionsAsHtml; + } + } |