]> source.dussan.org Git - vaadin-framework.git/commitdiff
subwindows now working in 6.2, cleaned some code and docs
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Mon, 19 Oct 2009 14:14:29 +0000 (14:14 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Mon, 19 Oct 2009 14:14:29 +0000 (14:14 +0000)
svn changeset:9246/svn branch:6.2

src/com/vaadin/terminal/gwt/client/ui/VView.java

index e9a7588d932681f254a9734fff22a2a3cda3e55c..422583cb19b6e0985311b25624677e62a764dc0b 100644 (file)
@@ -241,26 +241,19 @@ public class VView extends SimplePanel implements Container, ResizeHandler,
             updateParentFrameSize();
         }
 
-        // Update subwindows
+        // Save currently open subwindows to track which will need to be closed
         final HashSet<VWindow> removedSubWindows = new HashSet<VWindow>(
                 subWindows);
 
-        // Open new windows
-        while ((childUidl = uidl.getChildUIDL(childIndex++)) != null) {
-            if ("window".equals(childUidl.getTag())) {
-                final Paintable w = client.getPaintable(childUidl);
-                if (subWindows.contains(w)) {
-                    removedSubWindows.remove(w);
-                } else {
-                    subWindows.add((VWindow) w);
-                }
-                w.updateFromUIDL(childUidl, client);
-            } else if ("actions".equals(childUidl.getTag())) {
+        // Handle other UIDL children
+        while ((childUidl = uidl.getChildUIDL(++childIndex)) != null) {
+            String tag = childUidl.getTag().intern();
+            if (tag == "actions") {
                 if (actionHandler == null) {
                     actionHandler = new ShortcutActionHandler(id, client);
                 }
                 actionHandler.updateActionMap(childUidl);
-            } else if (childUidl.getTag().equals("notifications")) {
+            } else if (tag == "notifications") {
                 for (final Iterator it = childUidl.getChildIterator(); it
                         .hasNext();) {
                     final UIDL notification = (UIDL) it.next();
@@ -269,12 +262,12 @@ public class VView extends SimplePanel implements Container, ResizeHandler,
                         final String parsedUri = client
                                 .translateVaadinUri(notification
                                         .getStringAttribute("icon"));
-                        html += "<IMG src=\"" + parsedUri + "\" />";
+                        html += "<img src=\"" + parsedUri + "\" />";
                     }
                     if (notification.hasAttribute("caption")) {
-                        html += "<H1>"
+                        html += "<h1>"
                                 + notification.getStringAttribute("caption")
-                                + "</H1>";
+                                + "</h1>";
                     }
                     if (notification.hasAttribute("message")) {
                         html += "<p>"
@@ -290,10 +283,19 @@ public class VView extends SimplePanel implements Container, ResizeHandler,
                     final int delay = notification.getIntAttribute("delay");
                     new VNotification(delay).show(html, position, style);
                 }
+            } else {
+                // subwindows
+                final Paintable w = client.getPaintable(childUidl);
+                if (subWindows.contains(w)) {
+                    removedSubWindows.remove(w);
+                } else {
+                    subWindows.add((VWindow) w);
+                }
+                w.updateFromUIDL(childUidl, client);
             }
         }
 
-        // Close old windows
+        // Close old windows which where not in UIDL anymore
         for (final Iterator<VWindow> rem = removedSubWindows.iterator(); rem
                 .hasNext();) {
             final VWindow w = rem.next();