|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.vaadin.ui.Notification
public class Notification
A notification message, used to display temporary messages to the user - for example "Document saved", or "Save failed".
The notification message can consist of several parts: caption, description and icon. It is usually used with only caption - one should be wary of filling the notification with too much information.
The notification message tries to be as unobtrusive as possible, while still drawing needed attention. There are several basic types of messages that can be used in different situations:
In addition to the basic pre-configured types, a Notification can also be configured to show up in a custom position, for a specified time (or until clicked), and with a custom stylename. An icon can also be added.
Nested Class Summary | |
---|---|
static class |
Notification.Type
|
Field Summary | |
---|---|
static int |
DELAY_FOREVER
|
static int |
DELAY_NONE
|
static com.vaadin.shared.Position |
POSITION_BOTTOM_LEFT
Deprecated. |
static com.vaadin.shared.Position |
POSITION_BOTTOM_RIGHT
Deprecated. |
static com.vaadin.shared.Position |
POSITION_CENTERED
Deprecated. |
static com.vaadin.shared.Position |
POSITION_CENTERED_BOTTOM
Deprecated. |
static com.vaadin.shared.Position |
POSITION_CENTERED_TOP
Deprecated. |
static com.vaadin.shared.Position |
POSITION_TOP_LEFT
Deprecated. |
static com.vaadin.shared.Position |
POSITION_TOP_RIGHT
Deprecated. |
static Notification.Type |
TYPE_ERROR_MESSAGE
Deprecated. |
static Notification.Type |
TYPE_HUMANIZED_MESSAGE
Deprecated. |
static Notification.Type |
TYPE_TRAY_NOTIFICATION
Deprecated. |
static Notification.Type |
TYPE_WARNING_MESSAGE
Deprecated. |
Constructor Summary | |
---|---|
Notification(java.lang.String caption)
Creates a "humanized" notification message. |
|
Notification(java.lang.String caption,
Notification.Type type)
Creates a notification message of the specified type. |
|
Notification(java.lang.String caption,
java.lang.String description)
Creates a "humanized" notification message with a bigger caption and smaller description. |
|
Notification(java.lang.String caption,
java.lang.String description,
Notification.Type type)
Creates a notification message of the specified type, with a bigger caption and smaller description. |
|
Notification(java.lang.String caption,
java.lang.String description,
Notification.Type type,
boolean htmlContentAllowed)
Creates a notification message of the specified type, with a bigger caption and smaller description. |
Method Summary | |
---|---|
java.lang.String |
getCaption()
Gets the caption part of the notification message. |
int |
getDelayMsec()
Gets the delay before the notification disappears. |
java.lang.String |
getDescription()
Gets the description part of the notification message. |
Resource |
getIcon()
Gets the icon part of the notification message. |
com.vaadin.shared.Position |
getPosition()
Gets the position of the notification message. |
java.lang.String |
getStyleName()
Gets the style name for the notification message. |
boolean |
isHtmlContentAllowed()
Checks whether caption and description are interpreted as html or plain text. |
void |
setCaption(java.lang.String caption)
Sets the caption part of the notification message |
void |
setDelayMsec(int delayMsec)
Sets the delay before the notification disappears. |
void |
setDescription(java.lang.String description)
Sets the description part of the notification message. |
void |
setHtmlContentAllowed(boolean htmlContentAllowed)
Sets whether html is allowed in the caption and description. |
void |
setIcon(Resource icon)
Sets the icon part of the notification message. |
void |
setPosition(com.vaadin.shared.Position position)
Sets the position of the notification message. |
void |
setStyleName(java.lang.String styleName)
Sets the style name for the notification message. |
void |
show(Page page)
Shows this notification on a Page. |
static void |
show(java.lang.String caption)
Shows a notification message on the middle of the current page. |
static void |
show(java.lang.String caption,
Notification.Type type)
Shows a notification message the current page. |
static void |
show(java.lang.String caption,
java.lang.String description,
Notification.Type type)
Shows a notification message the current page. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
@Deprecated public static final Notification.Type TYPE_HUMANIZED_MESSAGE
@Deprecated public static final Notification.Type TYPE_WARNING_MESSAGE
@Deprecated public static final Notification.Type TYPE_ERROR_MESSAGE
@Deprecated public static final Notification.Type TYPE_TRAY_NOTIFICATION
@Deprecated public static final com.vaadin.shared.Position POSITION_CENTERED
@Deprecated public static final com.vaadin.shared.Position POSITION_CENTERED_TOP
@Deprecated public static final com.vaadin.shared.Position POSITION_CENTERED_BOTTOM
@Deprecated public static final com.vaadin.shared.Position POSITION_TOP_LEFT
@Deprecated public static final com.vaadin.shared.Position POSITION_TOP_RIGHT
@Deprecated public static final com.vaadin.shared.Position POSITION_BOTTOM_LEFT
@Deprecated public static final com.vaadin.shared.Position POSITION_BOTTOM_RIGHT
public static final int DELAY_FOREVER
public static final int DELAY_NONE
Constructor Detail |
---|
public Notification(java.lang.String caption)
caption
- The message to showpublic Notification(java.lang.String caption, Notification.Type type)
caption
- The message to showtype
- The type of messagepublic Notification(java.lang.String caption, java.lang.String description)
caption
- The message captiondescription
- The message descriptionpublic Notification(java.lang.String caption, java.lang.String description, Notification.Type type)
caption
- The message captiondescription
- The message descriptiontype
- The type of messagepublic Notification(java.lang.String caption, java.lang.String description, Notification.Type type, boolean htmlContentAllowed)
caption
- The message captiondescription
- The message descriptiontype
- The type of messagehtmlContentAllowed
- Whether html in the caption and description should be
displayed as html or as plain textMethod Detail |
---|
public java.lang.String getCaption()
public void setCaption(java.lang.String caption)
caption
- The message captionpublic java.lang.String getDescription()
public void setDescription(java.lang.String description)
description
- public com.vaadin.shared.Position getPosition()
public void setPosition(com.vaadin.shared.Position position)
position
- The desired notification positionpublic Resource getIcon()
public void setIcon(Resource icon)
icon
- The desired message iconpublic int getDelayMsec()
public void setDelayMsec(int delayMsec)
delayMsec
- the desired delay in msec, -1 to require the user to click the
messagepublic void setStyleName(java.lang.String styleName)
styleName
- The desired style name.public java.lang.String getStyleName()
public void setHtmlContentAllowed(boolean htmlContentAllowed)
htmlContentAllowed
- true if the texts are used as html, false if used as plain
textpublic boolean isHtmlContentAllowed()
setHtmlContentAllowed(boolean)
public void show(Page page)
page
- The page on which the notification should be shownpublic static void show(java.lang.String caption)
caption
- The messageNotification(String)
,
show(Page)
public static void show(java.lang.String caption, Notification.Type type)
Notification
, for instance
Notification.TYPE_WARNING_MESSAGE.
The caption is rendered as plain text with HTML automatically escaped.
caption
- The messagetype
- The message type#Notification(String, int)
,
show(Page)
public static void show(java.lang.String caption, java.lang.String description, Notification.Type type)
Notification
, for instance
Notification.TYPE_WARNING_MESSAGE.
The caption is rendered as plain text with HTML automatically escaped.
caption
- The messagedescription
- The message descriptiontype
- The message typeNotification(String, Type)
,
show(Page)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |