aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Englund <marc.englund@itmill.com>2007-11-28 15:01:09 +0000
committerMarc Englund <marc.englund@itmill.com>2007-11-28 15:01:09 +0000
commit5fa8a54f4097eda870e6206ca5d7416d412a293b (patch)
treec5ff90467e43e75d68d0f159787de5d23c81d44f
parent0ebd129947f4a5fda5a8a931e4edb7807e7344aa (diff)
downloadvaadin-framework-5fa8a54f4097eda870e6206ca5d7416d412a293b.tar.gz
vaadin-framework-5fa8a54f4097eda870e6206ca5d7416d412a293b.zip
IWindow now handles notifications, just as IView
svn changeset:3025/svn branch:trunk
-rw-r--r--src/com/itmill/toolkit/terminal/gwt/client/ui/IWindow.java42
1 files changed, 36 insertions, 6 deletions
diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/IWindow.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/IWindow.java
index 1545dc113f..8223cffaa2 100644
--- a/src/com/itmill/toolkit/terminal/gwt/client/ui/IWindow.java
+++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/IWindow.java
@@ -1,5 +1,6 @@
package com.itmill.toolkit.terminal.gwt.client.ui;
+import java.util.Iterator;
import java.util.Vector;
import com.google.gwt.user.client.DOM;
@@ -258,14 +259,43 @@ public class IWindow extends PopupPanel implements Paintable, ScrollListener {
lo.updateFromUIDL(childUidl, client);
}
- // we may have actions
+ // we may have actions and notifications
if (uidl.getChidlCount() > 1) {
- childUidl = uidl.getChildUIDL(1);
- if (childUidl.getTag().equals("actions")) {
- if (shortcutHandler == null) {
- shortcutHandler = new ShortcutActionHandler(id, client);
+ int cnt = uidl.getChidlCount();
+ for (int i = 1; i < cnt; i++) {
+ childUidl = uidl.getChildUIDL(i);
+ if (childUidl.getTag().equals("actions")) {
+ if (shortcutHandler == null) {
+ shortcutHandler = new ShortcutActionHandler(id, client);
+ }
+ shortcutHandler.updateActionMap(childUidl);
+ } else if (childUidl.getTag().equals("notifications")) {
+ // TODO needed? move ->
+ for (Iterator it = childUidl.getChildIterator(); it
+ .hasNext();) {
+ UIDL notification = (UIDL) it.next();
+ String html = "";
+ if (notification.hasAttribute("caption")) {
+ html += "<H1>"
+ + notification
+ .getStringAttribute("caption")
+ + "</H1>";
+ }
+ if (notification.hasAttribute("message")) {
+ html += "<p>"
+ + notification
+ .getStringAttribute("message")
+ + "</p>";
+ }
+
+ String style = notification.hasAttribute("style") ? notification
+ .getStringAttribute("style")
+ : null;
+ int position = notification.getIntAttribute("position");
+ int delay = notification.getIntAttribute("delay");
+ new Notification(delay).show(html, position, style);
+ }
}
- shortcutHandler.updateActionMap(childUidl);
}
}