]> source.dussan.org Git - vaadin-framework.git/commitdiff
Merged [10686]-[10689] from 6.2
authorArtur Signell <artur.signell@itmill.com>
Tue, 12 Jan 2010 15:37:32 +0000 (15:37 +0000)
committerArtur Signell <artur.signell@itmill.com>
Tue, 12 Jan 2010 15:37:32 +0000 (15:37 +0000)
svn changeset:10697/svn branch:6.3

src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java
src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java
src/com/vaadin/terminal/gwt/server/CommunicationManager.java
src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java
src/com/vaadin/terminal/gwt/server/WebApplicationContext.java

index 4ea806e29e3c93655118a811f8908e72243617d1..39f4e845f7b69ab5bcf990fac888bfe12e797814 100644 (file)
@@ -32,6 +32,8 @@ public class ApplicationConfiguration {
 
     private Class<? extends Paintable>[] classes = new Class[1024];
 
+    private String windowId;
+
     private static ArrayList<ApplicationConnection> unstartedApplications = new ArrayList<ApplicationConnection>();
     private static ArrayList<ApplicationConnection> runningApplications = new ArrayList<ApplicationConnection>();
 
@@ -239,7 +241,7 @@ public class ApplicationConfiguration {
     public void addComponentMappings(ValueMap valueMap, WidgetSet widgetSet) {
         JsArrayString keyArray = valueMap.getKeyArray();
         for (int i = 0; i < keyArray.length(); i++) {
-            String key = keyArray.get(i);
+            String key = keyArray.get(i).intern();
             int value = valueMap.getInt(key);
             classes[value] = widgetSet.getImplementationByClassName(key);
             if (classes[value] == VUnknownComponent.class) {
@@ -247,10 +249,20 @@ public class ApplicationConfiguration {
                     unknownComponents = new HashMap<String, String>();
                 }
                 unknownComponents.put("" + value, key);
+            } else if (key == "com.vaadin.ui.Window") {
+                windowId = "" + value;
             }
         }
     }
 
+    /**
+     * @return the integer value that is used to code top level windows
+     *         "com.vaadin.ui.Window"
+     */
+    String getEncodedWindowTag() {
+        return windowId;
+    }
+
     String getUnknownServerClassNameByEncodedTagName(String tag) {
         if (unknownComponents != null) {
             return unknownComponents.get(tag);
index a523e8b00eb5e16b221c7d5bc18f63dde0b5e8d2..70cb99bc233617e69ea7ec8a3fbac6ca6c9c83a2 100755 (executable)
@@ -789,7 +789,8 @@ public class ApplicationConnection {
                     updatedWidgets.add(idToPaintableDetail.get(uidl.getId())
                             .getComponent());
                 } else {
-                    if (!uidl.getTag().equals("0")) {
+                    if (!uidl.getTag().equals(
+                            configuration.getEncodedWindowTag())) {
                         ClientExceptionHandler
                                 .displayError("Received update for "
                                         + uidl.getTag()
index dc2973ebe525925fd2e6e1cb0d060747eb8e67a3..63991b8b5bbaa3145153d519dfbd79f2d18c9a94 100644 (file)
@@ -1841,18 +1841,16 @@ public abstract class AbstractCommunicationManager implements
         }
     }
 
-    private static HashMap<Class<? extends Paintable>, Integer> typeToKey = new HashMap<Class<? extends Paintable>, Integer>();
-    private static int nextTypeKey = 0;
-
-    static String getTagForType(Class<? extends Paintable> class1) {
-        synchronized (typeToKey) {
-            Integer object = typeToKey.get(class1);
-            if (object == null) {
-                object = nextTypeKey++;
-                typeToKey.put(class1, object);
-            }
-            return object.toString();
+    private HashMap<Class<? extends Paintable>, Integer> typeToKey = new HashMap<Class<? extends Paintable>, Integer>();
+    private int nextTypeKey = 0;
+
+    String getTagForType(Class<? extends Paintable> class1) {
+        Integer object = typeToKey.get(class1);
+        if (object == null) {
+            object = nextTypeKey++;
+            typeToKey.put(class1, object);
         }
+        return object.toString();
     }
 
     /**
index 7e9afd358f1293294ced0917503eeb746a033437..8799e3789927474079c10365930486367a1e413b 100644 (file)
@@ -25,11 +25,11 @@ import com.vaadin.ui.Window;
 /**
  * Application manager processes changes and paints for single application
  * instance.
- *
+ * 
  * This class handles applications running as servlets.
  * 
  * @see AbstractCommunicationManager
- *
+ * 
  * @author IT Mill Ltd.
  * @version
  * @VERSION@
@@ -40,7 +40,7 @@ public class CommunicationManager extends AbstractCommunicationManager {
 
     /**
      * Concrete wrapper class for {@link HttpServletRequest}.
-     *
+     * 
      * @see Request
      */
     private static class HttpServletRequestWrapper implements Request {
@@ -90,7 +90,7 @@ public class CommunicationManager extends AbstractCommunicationManager {
 
     /**
      * Concrete wrapper class for {@link HttpServletResponse}.
-     *
+     * 
      * @see Response
      */
     private static class HttpServletResponseWrapper implements Response {
@@ -117,7 +117,7 @@ public class CommunicationManager extends AbstractCommunicationManager {
 
     /**
      * Concrete wrapper class for {@link HttpSession}.
-     *
+     * 
      * @see Session
      */
     private static class HttpSessionWrapper implements Session {
@@ -194,7 +194,7 @@ public class CommunicationManager extends AbstractCommunicationManager {
 
     /**
      * TODO New constructor - document me!
-     *
+     * 
      * @param application
      */
     public CommunicationManager(Application application) {
@@ -216,9 +216,9 @@ public class CommunicationManager extends AbstractCommunicationManager {
 
     /**
      * Handles file upload request submitted via Upload component.
-     *
+     * 
      * TODO document
-     *
+     * 
      * @param request
      * @param response
      * @throws IOException
@@ -233,9 +233,9 @@ public class CommunicationManager extends AbstractCommunicationManager {
 
     /**
      * Handles UIDL request
-     *
+     * 
      * TODO document
-     *
+     * 
      * @param request
      * @param response
      * @throws IOException
@@ -253,7 +253,7 @@ public class CommunicationManager extends AbstractCommunicationManager {
     /**
      * Gets the existing application or creates a new one. Get a window within
      * an application based on the requested URI.
-     *
+     * 
      * @param request
      *            the HTTP Request.
      * @param application
@@ -278,15 +278,15 @@ public class CommunicationManager extends AbstractCommunicationManager {
     /**
      * Calls the Window URI handler for a request and returns the
      * {@link DownloadStream} returned by the handler.
-     *
+     * 
      * If the window is the main window of an application, the deprecated
      * {@link Application#handleURI(java.net.URL, String)} is called first to
      * handle {@link ApplicationResource}s and the window handler is only called
      * if it returns null.
-     *
+     * 
      * @see AbstractCommunicationManager#handleURI(Window, Request, Response,
      *      Callback)
-     *
+     * 
      * @param window
      * @param request
      * @param response
index 649a5e129db94c6279a7ad81ac877ec02feb9e07..54695fd3dbb2b87dd80f115aeea08ca4000babb9 100644 (file)
@@ -1041,7 +1041,7 @@ public class JsonPaintTarget implements PaintTarget {
         }
 
         usedPaintableTypes.add(class1);
-        return AbstractCommunicationManager.getTagForType(class1);
+        return manager.getTagForType(class1);
 
     }
 
index a4a96500b144d50ad177720709e4b9cf5c846e65..1f3ff8befca2025bb8c59721e959ab51ed6c704b 100644 (file)
@@ -13,10 +13,10 @@ import com.vaadin.Application;
 
 /**
  * Web application context for Vaadin applications.
- *
+ * 
  * This is automatically added as a {@link HttpSessionBindingListener} when
  * added to a {@link HttpSession}.
- *
+ * 
  * @author IT Mill Ltd.
  * @version
  * @VERSION@
@@ -29,7 +29,7 @@ public class WebApplicationContext extends AbstractWebApplicationContext {
 
     /**
      * Creates a new Web Application Context.
-     *
+     * 
      */
     WebApplicationContext() {
 
@@ -37,7 +37,7 @@ public class WebApplicationContext extends AbstractWebApplicationContext {
 
     /**
      * Gets the application context base directory.
-     *
+     * 
      * @see com.vaadin.service.ApplicationContext#getBaseDirectory()
      */
     public File getBaseDirectory() {
@@ -51,7 +51,7 @@ public class WebApplicationContext extends AbstractWebApplicationContext {
 
     /**
      * Gets the http-session application is running in.
-     *
+     * 
      * @return HttpSession this application context resides in.
      */
     public HttpSession getHttpSession() {
@@ -60,7 +60,7 @@ public class WebApplicationContext extends AbstractWebApplicationContext {
 
     /**
      * Gets the application context for an HttpSession.
-     *
+     * 
      * @param session
      *            the HTTP session.
      * @return the application context for HttpSession.
@@ -85,10 +85,10 @@ public class WebApplicationContext extends AbstractWebApplicationContext {
 
     /**
      * Gets communication manager for an application.
-     *
+     * 
      * If this application has not been running before, a new manager is
      * created.
-     *
+     * 
      * @param application
      * @return CommunicationManager
      */