]> source.dussan.org Git - vaadin-framework.git/commitdiff
Made Window work again (connectors are now children of Root, attach for
authorArtur Signell <artur@vaadin.com>
Mon, 19 Mar 2012 11:33:39 +0000 (13:33 +0200)
committerArtur Signell <artur@vaadin.com>
Wed, 21 Mar 2012 13:27:42 +0000 (15:27 +0200)
Panel/Window calls Root attach methods, Window uses WindowState)

src/com/vaadin/terminal/gwt/client/ui/WindowConnector.java
src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java
src/com/vaadin/ui/DirtyConnectorTracker.java
src/com/vaadin/ui/Panel.java

index a39ce5e335d13b1b24fc04cab0560888879523fa..943c2e196789d0a5f436400b161a6de52e50f09d 100644 (file)
@@ -315,4 +315,9 @@ public class WindowConnector extends AbstractComponentContainerConnector
     public WindowState getState() {
         return (WindowState) super.getState();
     }
+
+    @Override
+    protected WindowState createState() {
+        return GWT.create(WindowState.class);
+    }
 }
index 13bce26c1293b4b41abd19a3c819ea74d53f1d4f..ac0cc7c46d668a583f041693266054fcde40fa6a 100644 (file)
@@ -1188,8 +1188,18 @@ public abstract class AbstractCommunicationManager implements
 
     }
 
-    private Iterable<Component> getChildComponents(HasComponents cc) {
-        if (cc instanceof Panel) {
+    public static Iterable<Component> getChildComponents(HasComponents cc) {
+        if (cc instanceof Root) {
+            Root root = (Root) cc;
+            List<Component> children = new ArrayList<Component>();
+            if (root.getContent() != null) {
+                children.add(root.getContent());
+            }
+            for (Window w : root.getWindows()) {
+                children.add(w);
+            }
+            return children;
+        } else if (cc instanceof Panel) {
             // This is so wrong.. (#2924)
             if (((Panel) cc).getContent() == null) {
                 return Collections.emptyList();
index dc9c72ba0defc4550d9090b79d223c1b9f96b001..1225b5f84f1d9083f0c9200e54cc09979f63dd30 100644 (file)
@@ -7,6 +7,7 @@ import java.util.logging.Logger;
 
 import com.vaadin.terminal.Paintable.RepaintRequestEvent;
 import com.vaadin.terminal.Paintable.RepaintRequestListener;
+import com.vaadin.terminal.gwt.server.AbstractCommunicationManager;
 import com.vaadin.terminal.gwt.server.ClientConnector;
 
 /**
@@ -103,7 +104,8 @@ public class DirtyConnectorTracker implements RepaintRequestListener {
         markDirty(c);
         if (c instanceof HasComponents) {
             HasComponents container = (HasComponents) c;
-            for (Component child : container) {
+            for (Component child : AbstractCommunicationManager
+                    .getChildComponents(container)) {
                 markComponentsDirtyRecursively(child);
             }
         }
index b6c08da86c25d15fb23ba7e851e0c48b90dd8a0e..4d8e5066a57907f480d43bc577180aa06d44fd19 100644 (file)
@@ -403,6 +403,7 @@ public class Panel extends AbstractComponentContainer implements Scrollable,
      */
     @Override
     public void attach() {
+        getRoot().componentAttached(this);
         // can't call parent here as this is Panels hierarchy is a hack
         requestRepaint();
         if (content != null) {
@@ -421,6 +422,7 @@ public class Panel extends AbstractComponentContainer implements Scrollable,
         if (content != null) {
             content.detach();
         }
+        getRoot().componentDetached(this);
     }
 
     /**