summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-08-23 10:41:24 +0300
committerArtur Signell <artur@vaadin.com>2012-08-23 18:14:33 +0300
commit52986fdf881260994e5465012af2afd80447b8b6 (patch)
tree59c19ffa0e31b5147c0f95974c6c6febca3f64a3 /client
parentf4f3a563942a9264fada9275991b5fd9dce73868 (diff)
downloadvaadin-framework-52986fdf881260994e5465012af2afd80447b8b6.tar.gz
vaadin-framework-52986fdf881260994e5465012af2afd80447b8b6.zip
Changed Notification type and position to enum (#9072)
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/terminal/gwt/client/ui/notification/VNotification.java36
1 files changed, 20 insertions, 16 deletions
diff --git a/client/src/com/vaadin/terminal/gwt/client/ui/notification/VNotification.java b/client/src/com/vaadin/terminal/gwt/client/ui/notification/VNotification.java
index 6e253c9137..b4cea2dc72 100644
--- a/client/src/com/vaadin/terminal/gwt/client/ui/notification/VNotification.java
+++ b/client/src/com/vaadin/terminal/gwt/client/ui/notification/VNotification.java
@@ -29,6 +29,7 @@ import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.shared.Position;
import com.vaadin.shared.ui.root.RootConstants;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.BrowserInfo;
@@ -38,13 +39,13 @@ import com.vaadin.terminal.gwt.client.ui.VOverlay;
public class VNotification extends VOverlay {
- public static final int CENTERED = 1;
- public static final int CENTERED_TOP = 2;
- public static final int CENTERED_BOTTOM = 3;
- public static final int TOP_LEFT = 4;
- public static final int TOP_RIGHT = 5;
- public static final int BOTTOM_LEFT = 6;
- public static final int BOTTOM_RIGHT = 7;
+ public static final Position CENTERED = Position.MIDDLE_CENTER;
+ public static final Position CENTERED_TOP = Position.TOP_CENTER;
+ public static final Position CENTERED_BOTTOM = Position.BOTTOM_CENTER;
+ public static final Position TOP_LEFT = Position.TOP_LEFT;
+ public static final Position TOP_RIGHT = Position.TOP_RIGHT;
+ public static final Position BOTTOM_LEFT = Position.BOTTOM_LEFT;
+ public static final Position BOTTOM_RIGHT = Position.BOTTOM_RIGHT;
public static final int DELAY_FOREVER = -1;
public static final int DELAY_NONE = 0;
@@ -144,21 +145,21 @@ public class VNotification extends VOverlay {
show(CENTERED, style);
}
- public void show(int position) {
+ public void show(com.vaadin.shared.Position position) {
show(position, null);
}
- public void show(Widget widget, int position, String style) {
+ public void show(Widget widget, Position position, String style) {
setWidget(widget);
show(position, style);
}
- public void show(String html, int position, String style) {
+ public void show(String html, Position position, String style) {
setWidget(new HTML(html));
show(position, style);
}
- public void show(int position, String style) {
+ public void show(Position position, String style) {
setOpacity(getElement(), startOpacity);
if (style != null) {
temporaryStyle = style;
@@ -231,7 +232,7 @@ public class VNotification extends VOverlay {
}
}
- public void setPosition(int position) {
+ public void setPosition(com.vaadin.shared.Position position) {
final Element el = getElement();
DOM.setStyleAttribute(el, "top", "");
DOM.setStyleAttribute(el, "left", "");
@@ -260,17 +261,17 @@ public class VNotification extends VOverlay {
DOM.setStyleAttribute(el, "bottom", "0px");
DOM.setStyleAttribute(el, "left", "0px");
break;
- case CENTERED_TOP:
+ case TOP_CENTER:
center();
DOM.setStyleAttribute(el, "top", "0px");
break;
- case CENTERED_BOTTOM:
+ case BOTTOM_CENTER:
center();
DOM.setStyleAttribute(el, "top", "");
DOM.setStyleAttribute(el, "bottom", "0px");
break;
default:
- case CENTERED:
+ case MIDDLE_CENTER:
center();
break;
}
@@ -417,8 +418,11 @@ public class VNotification extends VOverlay {
.hasAttribute(RootConstants.ATTRIBUTE_NOTIFICATION_STYLE) ? notification
.getStringAttribute(RootConstants.ATTRIBUTE_NOTIFICATION_STYLE)
: null;
- final int position = notification
+
+ final int pos = notification
.getIntAttribute(RootConstants.ATTRIBUTE_NOTIFICATION_POSITION);
+ Position position = Position.values()[pos];
+
final int delay = notification
.getIntAttribute(RootConstants.ATTRIBUTE_NOTIFICATION_DELAY);
createNotification(delay).show(html, position, style);