]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fixed problem with delete DOM attribute in IE8 and split browser
authorArtur Signell <artur@vaadin.com>
Wed, 21 Mar 2012 15:39:38 +0000 (17:39 +0200)
committerArtur Signell <artur@vaadin.com>
Wed, 21 Mar 2012 15:53:58 +0000 (17:53 +0200)
specific overrides to a separate GWT module

src/com/vaadin/terminal/gwt/DefaultWidgetSet.gwt.xml
src/com/vaadin/terminal/gwt/DefaultWidgetSetBrowserSpecificOverrides.gwt.xml [new file with mode: 0644]
src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
src/com/vaadin/terminal/gwt/client/LayoutManager.java
src/com/vaadin/terminal/gwt/client/LayoutManagerIE8.java [new file with mode: 0644]

index 98032aa30815ed68c3f49887a45540b2002d489a..db273271e9827ddc0e8e4b8d2c295a2903c02aee 100644 (file)
@@ -12,6 +12,9 @@
 
        <inherits name="com.google.gwt.json.JSON" />
 
+       <inherits
+               name="com.vaadin.terminal.gwt.DefaultWidgetSetBrowserSpecificOverrides" />
+
        <source path="client" />
 
        <!-- Use own Scheduler implementation to be able to track if commands are 
@@ -20,6 +23,9 @@
                <when-type-is class="com.google.gwt.core.client.impl.SchedulerImpl" />
        </replace-with>
 
+
+       <!-- Generators for serializators for classes used in communication between 
+               server and client -->
        <generate-with
                class="com.vaadin.terminal.gwt.widgetsetutils.SerializerMapGenerator">
                <when-type-is
                        class="com.vaadin.terminal.gwt.client.communication.RpcManager" />
        </generate-with>
 
-       <!-- Fall through to this rule for everything but IE -->
-       <replace-with
-               class="com.vaadin.terminal.gwt.client.ui.UploadIFrameOnloadStrategy">
-               <when-type-is
-                       class="com.vaadin.terminal.gwt.client.ui.UploadIFrameOnloadStrategy" />
-       </replace-with>
-
-       <replace-with
-               class="com.vaadin.terminal.gwt.client.ui.UploadIFrameOnloadStrategyIE">
-               <when-type-is
-                       class="com.vaadin.terminal.gwt.client.ui.UploadIFrameOnloadStrategy" />
-               <any>
-                       <when-property-is name="user.agent" value="ie6" />
-                       <when-property-is name="user.agent" value="ie8" />
-               </any>
-       </replace-with>
-
-       <!-- Fall through to this rule for everything but IE -->
-       <replace-with class="com.vaadin.terminal.gwt.client.ui.VDragAndDropWrapper">
-               <when-type-is class="com.vaadin.terminal.gwt.client.ui.VDragAndDropWrapper" />
-       </replace-with>
-
-       <replace-with class="com.vaadin.terminal.gwt.client.ui.VDragAndDropWrapperIE">
-               <when-type-is class="com.vaadin.terminal.gwt.client.ui.VDragAndDropWrapper" />
-               <any>
-                       <when-property-is name="user.agent" value="ie8" />
-               </any>
-       </replace-with>
-
-       <!-- Workaround for #6682. Remove when fixed in GWT. -->
-       <replace-with class="com.google.gwt.dom.client.VaadinDOMImplSafari">
-               <when-type-is class="com.google.gwt.dom.client.DOMImpl" />
-               <when-property-is name="user.agent" value="safari" />
-       </replace-with>
-
        <entry-point class="com.vaadin.terminal.gwt.client.ApplicationConfiguration" />
 
        <!-- Use the new cross site linker to get a nocache.js without document.write -->
diff --git a/src/com/vaadin/terminal/gwt/DefaultWidgetSetBrowserSpecificOverrides.gwt.xml b/src/com/vaadin/terminal/gwt/DefaultWidgetSetBrowserSpecificOverrides.gwt.xml
new file mode 100644 (file)
index 0000000..82c9f2c
--- /dev/null
@@ -0,0 +1,53 @@
+<module>
+       <!-- This GWT module defines the browser specific overrides used by Vaadin -->
+
+       <!-- Hint for WidgetSetBuilder not to automatically update the file -->
+       <!-- WS Compiler: manually edited -->
+
+       <!-- Fall through to this rule for everything but IE -->
+       <replace-with
+               class="com.vaadin.terminal.gwt.client.ui.UploadIFrameOnloadStrategy">
+               <when-type-is
+                       class="com.vaadin.terminal.gwt.client.ui.UploadIFrameOnloadStrategy" />
+       </replace-with>
+
+       <replace-with
+               class="com.vaadin.terminal.gwt.client.ui.UploadIFrameOnloadStrategyIE">
+               <when-type-is
+                       class="com.vaadin.terminal.gwt.client.ui.UploadIFrameOnloadStrategy" />
+               <any>
+                       <when-property-is name="user.agent" value="ie8" />
+               </any>
+       </replace-with>
+
+       <!-- Fall through to this rule for everything but IE -->
+       <replace-with class="com.vaadin.terminal.gwt.client.ui.VDragAndDropWrapper">
+               <when-type-is class="com.vaadin.terminal.gwt.client.ui.VDragAndDropWrapper" />
+       </replace-with>
+
+       <replace-with class="com.vaadin.terminal.gwt.client.ui.VDragAndDropWrapperIE">
+               <when-type-is class="com.vaadin.terminal.gwt.client.ui.VDragAndDropWrapper" />
+               <any>
+                       <when-property-is name="user.agent" value="ie8" />
+               </any>
+       </replace-with>
+
+       <!-- Fall through to this rule for everything but IE -->
+       <replace-with class="com.vaadin.terminal.gwt.client.LayoutManager">
+               <when-type-is class="com.vaadin.terminal.gwt.client.LayoutManager" />
+       </replace-with>
+
+       <replace-with class="com.vaadin.terminal.gwt.client.LayoutManagerIE8">
+               <when-type-is class="com.vaadin.terminal.gwt.client.LayoutManager" />
+               <any>
+                       <when-property-is name="user.agent" value="ie8" />
+               </any>
+       </replace-with>
+
+       <!-- Workaround for #6682. Remove when fixed in GWT. -->
+       <replace-with class="com.google.gwt.dom.client.VaadinDOMImplSafari">
+               <when-type-is class="com.google.gwt.dom.client.DOMImpl" />
+               <when-property-is name="user.agent" value="safari" />
+       </replace-with>
+
+</module>
index b74200d195ffefaf1871448bc0b80af4b05ad071..ff5244a3c10b0d34c1615b7a9db9185fb5b28689 100644 (file)
@@ -170,12 +170,15 @@ public class ApplicationConnection {
 
     private Set<ComponentConnector> zeroHeightComponents = null;
 
-    private final LayoutManager layoutManager = new LayoutManager(this);
+    private final LayoutManager layoutManager;
 
-    private final RpcManager rpcManager = GWT.create(RpcManager.class);
+    private final RpcManager rpcManager;
 
     public ApplicationConnection() {
         view = GWT.create(RootConnector.class);
+        rpcManager = GWT.create(RpcManager.class);
+        layoutManager = GWT.create(LayoutManager.class);
+        layoutManager.setConnection(this);
     }
 
     public void init(WidgetSet widgetSet, ApplicationConfiguration cnf) {
@@ -2168,8 +2171,7 @@ public class ApplicationConnection {
      *            The identifier for the event
      * @return true if at least one listener has been registered on server side
      *         for the event identified by eventIdentifier.
-     * @deprecated Use {@link ComponentState#hasEventListener(String)}
-     *             instead
+     * @deprecated Use {@link ComponentState#hasEventListener(String)} instead
      */
     @Deprecated
     public boolean hasEventListeners(ComponentConnector paintable,
index a593754c17c03d5f6cefc09d6528628b1cd8dbde..78709a7134a587b1dacbc182d54dc02ed65981f5 100644 (file)
@@ -16,12 +16,16 @@ import com.vaadin.terminal.gwt.client.ui.VNotification;
 
 public class LayoutManager {
     private static final String LOOP_ABORT_MESSAGE = "Aborting layout after 100 passes. This would probably be an infinite loop.";
-    private final ApplicationConnection connection;
+    private ApplicationConnection connection;
     private final Set<Element> nonPaintableElements = new HashSet<Element>();
     private final MeasuredSize nullSize = new MeasuredSize();
     private boolean layoutRunning = false;
 
-    public LayoutManager(ApplicationConnection connection) {
+    public void setConnection(ApplicationConnection connection) {
+        if (this.connection != null) {
+            throw new RuntimeException(
+                    "LayoutManager connection can never be changed");
+        }
         this.connection = connection;
     }
 
@@ -65,7 +69,7 @@ public class LayoutManager {
         }
     }
 
-    private static native void setMeasuredSize(Element element,
+    protected native void setMeasuredSize(Element element,
             MeasuredSize measuredSize)
     /*-{
         if (measuredSize) {
@@ -81,8 +85,7 @@ public class LayoutManager {
         return element.vMeasuredSize || defaultSize;
     }-*/;
 
-    private static final MeasuredSize getMeasuredSize(
-            ComponentConnector paintable) {
+    private final MeasuredSize getMeasuredSize(ComponentConnector paintable) {
         Element element = paintable.getWidget().getElement();
         MeasuredSize measuredSize = getMeasuredSize(element, null);
         if (measuredSize == null) {
diff --git a/src/com/vaadin/terminal/gwt/client/LayoutManagerIE8.java b/src/com/vaadin/terminal/gwt/client/LayoutManagerIE8.java
new file mode 100644 (file)
index 0000000..88769bf
--- /dev/null
@@ -0,0 +1,20 @@
+package com.vaadin.terminal.gwt.client;
+
+import com.google.gwt.dom.client.Element;
+
+public class LayoutManagerIE8 extends LayoutManager {
+
+    @Override
+    protected native void setMeasuredSize(Element element,
+            MeasuredSize measuredSize)
+    // IE8 cannot do delete element.vMeasuredSize, at least in the case when
+    // element is not attached to the document (e.g. when a caption is removed)
+    /*-{
+        if (measuredSize) {
+            element.vMeasuredSize = measuredSize;
+        } else {
+            element.vMeasuredSize = undefined;
+        }
+    }-*/;
+
+}