@Tag(value="vaadin-cookie-consent") @NpmPackage(value="@vaadin/vaadin-cookie-consent", version="1.1.2") @JsModule(value="@vaadin/vaadin-cookie-consent/src/vaadin-cookie-consent.js") public class CookieConsent extends Component
vaadin-cookie-consent
element,
used for showing a cookie consent banner the first time a user visits the
application, until the banner is dismissed.Modifier and Type | Class and Description |
---|---|
static class |
CookieConsent.Position
Position of the banner.
|
Constructor and Description |
---|
CookieConsent()
Creates a banner with default values.
|
CookieConsent(String message,
String dismissLabel,
String learnMoreLabel,
String learnMoreLink,
CookieConsent.Position position)
Creates a banner with the specified data
|
Modifier and Type | Method and Description |
---|---|
void |
setCookieName(String cookieName)
Sets the name of the cookie to remember that the user has consented.
|
void |
setDismissLabel(String dismissLabel)
Sets the dismiss/consent button's text
|
void |
setLearnMoreLabel(String learnMoreLabel)
Sets the label of the 'learn more' link
|
void |
setLearnMoreLink(String learnMoreLink)
Sets the URL of the 'learn more' link
|
void |
setMessage(String message)
Sets the consent message to show in the banner.
|
void |
setPosition(CookieConsent.Position position)
Sets the position of the banner on the page.
|
addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getUI, hasListener, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, set, setElement, setId, setVisible
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addAttachListener
addDetachListener
public CookieConsent()
public CookieConsent(String message, String dismissLabel, String learnMoreLabel, String learnMoreLink, CookieConsent.Position position)
message
- The message to show in the banner.dismissLabel
- The text to show on the dismiss/consent button.learnMoreLabel
- The text to show on the 'learn more' link.learnMoreLink
- The URL the 'learn more' link should open.position
- Determines the position of the banner.public void setMessage(String message)
message
- The message to show in the banner.public void setDismissLabel(String dismissLabel)
dismissLabel
- The text of the button.public void setLearnMoreLabel(String learnMoreLabel)
learnMoreLabel
- The text to show on the 'learn more' link.public void setLearnMoreLink(String learnMoreLink)
learnMoreLink
- The URL the 'learn more' link should open.public void setPosition(CookieConsent.Position position)
position
- Determines the position of the banner.NullPointerException
- if position is null.public void setCookieName(String cookieName)
cookieName
- The name of the cookie.Copyright © 2020. All rights reserved.