From: Marc Englund Date: Wed, 28 Nov 2007 15:01:09 +0000 (+0000) Subject: IWindow now handles notifications, just as IView X-Git-Tag: 6.7.0.beta1~5403 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5fa8a54f4097eda870e6206ca5d7416d412a293b;p=vaadin-framework.git IWindow now handles notifications, just as IView svn changeset:3025/svn branch:trunk --- 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 += "

" + + notification + .getStringAttribute("caption") + + "

"; + } + if (notification.hasAttribute("message")) { + html += "

" + + notification + .getStringAttribute("message") + + "

"; + } + + 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); } }