summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-06-25 15:31:29 +0300
committerLeif Åstrand <leif@vaadin.com>2012-06-25 15:31:29 +0300
commitfee6f306961ffff67809c33715c719075ba2c450 (patch)
treeba30d7ca2cd690b4af032f2062b7c260b9343989 /src
parentaa17a44582ade2a22578da1d3bde68a174102a4b (diff)
downloadvaadin-framework-fee6f306961ffff67809c33715c719075ba2c450.tar.gz
vaadin-framework-fee6f306961ffff67809c33715c719075ba2c450.zip
Use Notification.show(Page) as the official entry point (#8907)
Also remove some static shorthands
Diffstat (limited to 'src')
-rw-r--r--src/com/vaadin/terminal/Page.java7
-rw-r--r--src/com/vaadin/ui/Notification.java95
2 files changed, 18 insertions, 84 deletions
diff --git a/src/com/vaadin/terminal/Page.java b/src/com/vaadin/terminal/Page.java
index 65fa500d27..8506e17898 100644
--- a/src/com/vaadin/terminal/Page.java
+++ b/src/com/vaadin/terminal/Page.java
@@ -603,14 +603,13 @@ public class Page implements Serializable {
* Shows a notification message.
*
* @see Notification
- * @see #showNotification(String)
- * @see #showNotification(String, int)
- * @see #showNotification(String, String)
- * @see #showNotification(String, String, int)
*
* @param notification
* The notification message to show
+ *
+ * @deprecated Use Notification.show(Page) instead.
*/
+ @Deprecated
public void showNotification(Notification notification) {
addNotification(notification);
}
diff --git a/src/com/vaadin/ui/Notification.java b/src/com/vaadin/ui/Notification.java
index 075ab50196..0358283cb4 100644
--- a/src/com/vaadin/ui/Notification.java
+++ b/src/com/vaadin/ui/Notification.java
@@ -320,8 +320,15 @@ public class Notification implements Serializable {
return htmlContentAllowed;
}
- public void show() {
- Page.getCurrent().showNotification(this);
+ /**
+ * Shows this notification on a Page.
+ *
+ * @param page
+ * The page on which the notification should be shown
+ */
+ public void show(Page page) {
+ // TODO Can avoid deprecated API when Notification extends Extension
+ page.showNotification(this);
}
/**
@@ -331,14 +338,14 @@ public class Notification implements Serializable {
* Care should be taken to to avoid XSS vulnerabilities as the caption is
* rendered as html.
*
- * @see #showNotification(Notification)
- * @see Notification
+ * @see #Notification(String)
+ * @see #show(Page)
*
* @param caption
* The message
*/
public static void show(String caption) {
- new Notification(caption).show();
+ new Notification(caption).show(Page.getCurrent());
}
/**
@@ -350,8 +357,8 @@ public class Notification implements Serializable {
* Care should be taken to to avoid XSS vulnerabilities as the caption is
* rendered as html.
*
- * @see #showNotification(Notification)
- * @see Notification
+ * @see #Notification(String, int)
+ * @see #show(Page)
*
* @param caption
* The message
@@ -359,78 +366,6 @@ public class Notification implements Serializable {
* The message type
*/
public static void show(String caption, int type) {
- new Notification(caption, type).show();
- }
-
- /**
- * Shows a notification consisting of a bigger caption and a smaller
- * description on the middle of the current page. The message automatically
- * disappears ("humanized message").
- *
- * Care should be taken to to avoid XSS vulnerabilities as the caption and
- * description are rendered as html.
- *
- * @see #showNotification(Notification)
- * @see Notification
- *
- * @param caption
- * The caption of the message
- * @param description
- * The message description
- *
- */
- public static void show(String caption, String description) {
- new Notification(caption, description).show();
- }
-
- /**
- * Shows a notification consisting of a bigger caption and a smaller
- * description. The position and behavior of the message depends on the
- * type, which is one of the basic types defined in {@link Notification},
- * for instance Notification.TYPE_WARNING_MESSAGE.
- *
- * Care should be taken to to avoid XSS vulnerabilities as the caption and
- * description are rendered as html.
- *
- * @see #showNotification(Notification)
- * @see Notification
- *
- * @param caption
- * The caption of the message
- * @param description
- * The message description
- * @param type
- * The message type
- */
- public static void show(String caption, String description, int type) {
-
- new Notification(caption, description, type).show();
- }
-
- /**
- * Shows a notification consisting of a bigger caption and a smaller
- * description. The position and behavior of the message depends on the
- * type, which is one of the basic types defined in {@link Notification},
- * for instance Notification.TYPE_WARNING_MESSAGE.
- *
- * Care should be taken to avoid XSS vulnerabilities if html content is
- * allowed.
- *
- * @see #showNotification(Notification)
- * @see Notification
- *
- * @param caption
- * The message caption
- * @param description
- * The message description
- * @param type
- * The type of message
- * @param htmlContentAllowed
- * Whether html in the caption and description should be
- * displayed as html or as plain text
- */
- public static void show(String caption, String description, int type,
- boolean htmlContentAllowed) {
- new Notification(caption, description, type, htmlContentAllowed).show();
+ new Notification(caption, type).show(Page.getCurrent());
}
} \ No newline at end of file