diff options
author | Artur Signell <artur@vaadin.com> | 2014-12-19 01:50:32 +0200 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2015-01-02 16:40:29 +0200 |
commit | 26832b6947266ce5cffd92558c23e6556278038d (patch) | |
tree | 6e550fb5dc1510c22b5d76e097970a0f97e4c31d /server/src/com/vaadin/ui | |
parent | fea60eaea2c791766be9f17ff2900739b32bf576 (diff) | |
download | vaadin-framework-26832b6947266ce5cffd92558c23e6556278038d.tar.gz vaadin-framework-26832b6947266ce5cffd92558c23e6556278038d.zip |
Option for rendering Calendar event captions as HTML (#9030)
Change-Id: Ib7f6e67c242449e58a10359c596489fea2f679f6
Diffstat (limited to 'server/src/com/vaadin/ui')
-rw-r--r-- | server/src/com/vaadin/ui/Calendar.java | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/server/src/com/vaadin/ui/Calendar.java b/server/src/com/vaadin/ui/Calendar.java index 5b5c390fa1..206cc01d1a 100644 --- a/server/src/com/vaadin/ui/Calendar.java +++ b/server/src/com/vaadin/ui/Calendar.java @@ -297,6 +297,11 @@ public class Calendar extends AbstractComponent implements } @Override + protected CalendarState getState(boolean markAsDirty) { + return (CalendarState) super.getState(markAsDirty); + } + + @Override public void beforeClientResponse(boolean initial) { super.beforeClientResponse(initial); @@ -1667,7 +1672,7 @@ public class Calendar extends AbstractComponent implements * weekly mode */ public boolean isMonthlyMode() { - CalendarState state = (CalendarState) getState(false); + CalendarState state = getState(false); if (state.days != null) { return state.days.size() > 7; } else { @@ -1895,4 +1900,34 @@ public class Calendar extends AbstractComponent implements dropHandler.getAcceptCriterion().paint(target); } } + + /** + * Sets whether the event captions are rendered as HTML. + * <p> + * If set to true, the captions are rendered in the browser as HTML and the + * developer is responsible for ensuring no harmful HTML is used. If set to + * false, the caption is rendered in the browser as plain text. + * <p> + * The default is false, i.e. to render that caption as plain text. + * + * @param captionAsHtml + * true if the captions are rendered as HTML, false if rendered + * as plain text + */ + public void setEventCaptionAsHtml(boolean eventCaptionAsHtml) { + getState().eventCaptionAsHtml = eventCaptionAsHtml; + } + + /** + * Checks whether event captions are rendered as HTML + * <p> + * The default is false, i.e. to render that caption as plain text. + * + * @return true if the captions are rendered as HTML, false if rendered as + * plain text + */ + public boolean isEventCaptionAsHtml() { + return getState(false).eventCaptionAsHtml; + } + } |