aboutsummaryrefslogtreecommitdiffstats
path: root/shared
diff options
context:
space:
mode:
authorAhmed Ashour <asashour@yahoo.com>2017-09-27 12:44:01 +0200
committerHenri Sara <henri.sara@gmail.com>2017-09-27 13:44:01 +0300
commit9f9efe0058397992fda43e104c90b79039d41c0f (patch)
tree6903fb464d96fb1f8f6a4e92c1308833388fd210 /shared
parent94c57dea3848635e0ae42fae464e23301f9e7c2c (diff)
downloadvaadin-framework-9f9efe0058397992fda43e104c90b79039d41c0f.tar.gz
vaadin-framework-9f9efe0058397992fda43e104c90b79039d41c0f.zip
Support addCloseListener for Notification (#10027)
Converts Notification to an Extension and adds support for listening to the closing of notifications. Fixes #888
Diffstat (limited to 'shared')
-rw-r--r--shared/src/main/java/com/vaadin/shared/ui/notification/NotificationServerRpc.java30
-rw-r--r--shared/src/main/java/com/vaadin/shared/ui/notification/NotificationState.java61
-rw-r--r--shared/src/main/java/com/vaadin/shared/ui/ui/UIConstants.java16
3 files changed, 91 insertions, 16 deletions
diff --git a/shared/src/main/java/com/vaadin/shared/ui/notification/NotificationServerRpc.java b/shared/src/main/java/com/vaadin/shared/ui/notification/NotificationServerRpc.java
new file mode 100644
index 0000000000..bf10a8c879
--- /dev/null
+++ b/shared/src/main/java/com/vaadin/shared/ui/notification/NotificationServerRpc.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2000-2016 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.shared.ui.notification;
+
+import com.vaadin.shared.communication.ServerRpc;
+
+/**
+ * Client to server RPC interface for Notification.
+ *
+ * @author Vaadin Ltd.
+ *
+ * @since
+ */
+public interface NotificationServerRpc extends ServerRpc {
+
+ void closed();
+}
diff --git a/shared/src/main/java/com/vaadin/shared/ui/notification/NotificationState.java b/shared/src/main/java/com/vaadin/shared/ui/notification/NotificationState.java
new file mode 100644
index 0000000000..19f923ee87
--- /dev/null
+++ b/shared/src/main/java/com/vaadin/shared/ui/notification/NotificationState.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2000-2016 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.shared.ui.notification;
+
+import com.vaadin.shared.Position;
+import com.vaadin.shared.communication.SharedState;
+
+/**
+ * Shared state for {@link com.vaadin.ui.Notification}.
+ *
+ * @author Vaadin Ltd.
+ *
+ * @since
+ */
+public class NotificationState extends SharedState {
+
+ /**
+ * The {@link com.vaadin.ui.Notification} caption, can be {@code null}.
+ */
+ public String caption;
+
+ /**
+ * The description, can be {@code null}.
+ */
+ public String description;
+
+ /**
+ * Whether texts are interpreted as HTML ({@code true}) or not ({@code false}).
+ */
+ public boolean htmlContentAllowed;
+
+ /**
+ * The style name, can be {@code null}.
+ */
+ public String styleName;
+
+ /**
+ * The {@link Position} of the {@link com.vaadin.ui.Notification},
+ * can not be {@code null}.
+ */
+ public Position position = Position.MIDDLE_CENTER;
+
+ /**
+ * The delay in milliseconds before disappearing, {@code -1} for forever.
+ */
+ public int delay;
+}
diff --git a/shared/src/main/java/com/vaadin/shared/ui/ui/UIConstants.java b/shared/src/main/java/com/vaadin/shared/ui/ui/UIConstants.java
index 086164e750..54da337189 100644
--- a/shared/src/main/java/com/vaadin/shared/ui/ui/UIConstants.java
+++ b/shared/src/main/java/com/vaadin/shared/ui/ui/UIConstants.java
@@ -25,27 +25,11 @@ public class UIConstants implements Serializable {
public static final String RESIZE_LAZY = "rL";
@Deprecated
- public static final String NOTIFICATION_HTML_CONTENT_NOT_ALLOWED = "useplain";
-
- @Deprecated
public static final String ATTRIBUTE_PUSH_STATE = "ps";
@Deprecated
public static final String ATTRIBUTE_REPLACE_STATE = "rs";
- @Deprecated
- public static final String ATTRIBUTE_NOTIFICATION_STYLE = "style";
- @Deprecated
- public static final String ATTRIBUTE_NOTIFICATION_CAPTION = "caption";
- @Deprecated
- public static final String ATTRIBUTE_NOTIFICATION_MESSAGE = "message";
- @Deprecated
- public static final String ATTRIBUTE_NOTIFICATION_ICON = "icon";
- @Deprecated
- public static final String ATTRIBUTE_NOTIFICATION_POSITION = "position";
- @Deprecated
- public static final String ATTRIBUTE_NOTIFICATION_DELAY = "delay";
-
/**
* Name of the parameter used to transmit UI ids back and forth
*/