From 6490e96cfa722fdc1360bbea16582390d4694ba4 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Tue, 12 Jan 2010 15:37:32 +0000 Subject: [PATCH] Merged [10686]-[10689] from 6.2 svn changeset:10697/svn branch:6.3 --- .../gwt/client/ApplicationConfiguration.java | 14 +++++++++- .../gwt/client/ApplicationConnection.java | 3 +- .../server/AbstractCommunicationManager.java | 20 ++++++------- .../gwt/server/CommunicationManager.java | 28 +++++++++---------- .../terminal/gwt/server/JsonPaintTarget.java | 2 +- .../gwt/server/WebApplicationContext.java | 16 +++++------ 6 files changed, 47 insertions(+), 36 deletions(-) diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java b/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java index 4ea806e29e..39f4e845f7 100644 --- a/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java +++ b/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java @@ -32,6 +32,8 @@ public class ApplicationConfiguration { private Class[] classes = new Class[1024]; + private String windowId; + private static ArrayList unstartedApplications = new ArrayList(); private static ArrayList runningApplications = new ArrayList(); @@ -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(); } 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); diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java index a523e8b00e..70cb99bc23 100755 --- a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java +++ b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java @@ -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() diff --git a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java index dc2973ebe5..63991b8b5b 100644 --- a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java +++ b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java @@ -1841,18 +1841,16 @@ public abstract class AbstractCommunicationManager implements } } - private static HashMap, Integer> typeToKey = new HashMap, Integer>(); - private static int nextTypeKey = 0; - - static String getTagForType(Class class1) { - synchronized (typeToKey) { - Integer object = typeToKey.get(class1); - if (object == null) { - object = nextTypeKey++; - typeToKey.put(class1, object); - } - return object.toString(); + private HashMap, Integer> typeToKey = new HashMap, Integer>(); + private int nextTypeKey = 0; + + String getTagForType(Class class1) { + Integer object = typeToKey.get(class1); + if (object == null) { + object = nextTypeKey++; + typeToKey.put(class1, object); } + return object.toString(); } /** diff --git a/src/com/vaadin/terminal/gwt/server/CommunicationManager.java b/src/com/vaadin/terminal/gwt/server/CommunicationManager.java index 7e9afd358f..8799e37899 100644 --- a/src/com/vaadin/terminal/gwt/server/CommunicationManager.java +++ b/src/com/vaadin/terminal/gwt/server/CommunicationManager.java @@ -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 diff --git a/src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java b/src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java index 649a5e129d..54695fd3db 100644 --- a/src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java +++ b/src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java @@ -1041,7 +1041,7 @@ public class JsonPaintTarget implements PaintTarget { } usedPaintableTypes.add(class1); - return AbstractCommunicationManager.getTagForType(class1); + return manager.getTagForType(class1); } diff --git a/src/com/vaadin/terminal/gwt/server/WebApplicationContext.java b/src/com/vaadin/terminal/gwt/server/WebApplicationContext.java index a4a96500b1..1f3ff8befc 100644 --- a/src/com/vaadin/terminal/gwt/server/WebApplicationContext.java +++ b/src/com/vaadin/terminal/gwt/server/WebApplicationContext.java @@ -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 */ -- 2.39.5