public class CustomizedSystemMessages extends SystemMessages
Vaadin gets the SystemMessages from your application by calling a static getSystemMessages() method. By default the Application.getSystemMessages() is used. You can customize this by defining a static MyApplication.getSystemMessages() and returning CustomizedSystemMessages. Note that getSystemMessages() is static - changing the system messages will by default change the message for all users of the application.
The default behavior is to show a notification, and restart the application
the user clicks the message.
Instead of restarting the application, you can set a specific URL that the
user is taken to.
Setting both caption and message to null will restart the application (or go
to the specified URL) without displaying a notification.
set*NotificationEnabled(false) will achieve the same thing.
The situations are:
cookiesDisabledCaption, cookiesDisabledMessage, cookiesDisabledNotificationEnabled, cookiesDisabledURL, internalErrorCaption, internalErrorMessage, internalErrorNotificationEnabled, internalErrorURL, sessionExpiredCaption, sessionExpiredMessage, sessionExpiredNotificationEnabled, sessionExpiredURL
Constructor and Description |
---|
CustomizedSystemMessages() |
Modifier and Type | Method and Description |
---|---|
void |
setCookiesDisabledCaption(String cookiesDisabledCaption)
Sets the caption to show in an "cookies disabled" notification.
|
void |
setCookiesDisabledMessage(String cookiesDisabledMessage)
Sets the message to show in a "cookies disabled" notification.
|
void |
setCookiesDisabledNotificationEnabled(boolean cookiesDisabledNotificationEnabled)
Sets whether a "cookies disabled" notification should be shown to the end
user.
|
void |
setCookiesDisabledURL(String cookiesDisabledURL)
Sets the URL the user will be redirected to after dismissing a "cookies
disabled" message.
|
void |
setInternalErrorCaption(String internalErrorCaption)
Sets the caption to show in an "internal error" notification.
|
void |
setInternalErrorMessage(String internalErrorMessage)
Sets the message to show in an "internal error" notification.
|
void |
setInternalErrorNotificationEnabled(boolean internalErrorNotificationEnabled)
Sets whether an "internal error" notification should be shown to the end
user.
|
void |
setInternalErrorURL(String internalErrorURL)
Sets the URL the user will be redirected to after dismissing an "internal
error" message.
|
void |
setSessionExpiredCaption(String sessionExpiredCaption)
Sets the caption to show in a "session expired" notification.
|
void |
setSessionExpiredMessage(String sessionExpiredMessage)
Sets the message to show in a "session expired" notification.
|
void |
setSessionExpiredNotificationEnabled(boolean sessionExpiredNotificationEnabled)
Sets whether a "session expired" notification should be shown to the end
user.
|
void |
setSessionExpiredURL(String sessionExpiredURL)
Sets the URL the user will be redirected to after dismissing a "session
expired" message.
|
getCookiesDisabledCaption, getCookiesDisabledMessage, getCookiesDisabledURL, getInternalErrorCaption, getInternalErrorMessage, getInternalErrorURL, getSessionExpiredCaption, getSessionExpiredMessage, getSessionExpiredURL, isCookiesDisabledNotificationEnabled, isInternalErrorNotificationEnabled, isSessionExpiredNotificationEnabled
public void setSessionExpiredURL(String sessionExpiredURL)
sessionExpiredURL
- the URL to redirect to, or null to refresh the pagepublic void setSessionExpiredNotificationEnabled(boolean sessionExpiredNotificationEnabled)
SystemMessages.getSessionExpiredURL()
.sessionExpiredNotificationEnabled
- true
to show the notification to the end user,
false
to redirect directlypublic void setSessionExpiredCaption(String sessionExpiredCaption)
If both SystemMessages.getSessionExpiredCaption()
and
SystemMessages.getSessionExpiredMessage()
return null, the user will
automatically be forwarded to the URL returned by
SystemMessages.getSessionExpiredURL()
when the session expires.
sessionExpiredCaption
- The caption to show or null
to show no caption.public void setSessionExpiredMessage(String sessionExpiredMessage)
If both SystemMessages.getSessionExpiredCaption()
and
SystemMessages.getSessionExpiredMessage()
return null, the user will
automatically be forwarded to the URL returned by
SystemMessages.getSessionExpiredURL()
when the session expires.
sessionExpiredMessage
- The message to show or null
to show no message.public void setInternalErrorURL(String internalErrorURL)
internalErrorURL
- the URL to redirect to, or null to refresh the pagepublic void setInternalErrorNotificationEnabled(boolean internalErrorNotificationEnabled)
SystemMessages.getInternalErrorURL()
.internalErrorNotificationEnabled
- true
to show the notification to the end user,
false
to redirect directlypublic void setInternalErrorCaption(String internalErrorCaption)
internalErrorCaption
- The caption to show or null
to show no caption.public void setInternalErrorMessage(String internalErrorMessage)
internalErrorMessage
- The message to show or null
to show no message.public void setCookiesDisabledURL(String cookiesDisabledURL)
cookiesDisabledURL
- the URL to redirect to, or null to refresh the pagepublic void setCookiesDisabledNotificationEnabled(boolean cookiesDisabledNotificationEnabled)
SystemMessages.getCookiesDisabledURL()
.cookiesDisabledNotificationEnabled
- true
to show the notification to the end user,
false
to redirect directlypublic void setCookiesDisabledCaption(String cookiesDisabledCaption)
cookiesDisabledCaption
- The caption to show or null
to show no caption.public void setCookiesDisabledMessage(String cookiesDisabledMessage)
cookiesDisabledMessage
- The message to show or null
to show no message.Copyright © 2022. All rights reserved.