]> source.dussan.org Git - vaadin-framework.git/commitdiff
Renders Notifications.
authorMarc Englund <marc.englund@itmill.com>
Mon, 5 Nov 2007 15:28:11 +0000 (15:28 +0000)
committerMarc Englund <marc.englund@itmill.com>
Mon, 5 Nov 2007 15:28:11 +0000 (15:28 +0000)
svn changeset:2713/svn branch:trunk

src/com/itmill/toolkit/terminal/gwt/client/ui/IView.java

index 3217d6f2d497fe87da24f4d43848eda8b96f6c64..30fe2a3d4e5b5630e8456c81604450462c96be65 100644 (file)
@@ -28,7 +28,7 @@ public class IView extends SimplePanel implements Paintable,
 
        private Paintable layout;
 
-       private HashSet subWindows = new HashSet();
+       private final HashSet subWindows = new HashSet();
 
        private String id;
 
@@ -73,7 +73,7 @@ public class IView extends SimplePanel implements Paintable,
                // Draw this application level window
                UIDL childUidl = uidl.getChildUIDL(childIndex);
                Paintable lo = (Paintable) client.getWidget(childUidl);
-               
+
                if (layout != null) {
                        if (layout != lo) {
                                // remove old
@@ -106,6 +106,28 @@ public class IView extends SimplePanel implements Paintable,
                                        actionHandler = new ShortcutActionHandler(id, client);
                                }
                                actionHandler.updateActionMap(childUidl);
+                       } else if (childUidl.getTag().equals("notifications")) {
+                               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);
+                               }
                        }
                }