From: Matti Tahvonen Date: Mon, 14 Dec 2009 15:46:19 +0000 (+0000) Subject: more information for VUnknownComponent (and uidl browser). Fixes #3831 X-Git-Tag: 6.7.0.beta1~2157 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=07a0172e0aa13e52ae58cb5a435d011a6cab9d42;p=vaadin-framework.git more information for VUnknownComponent (and uidl browser). Fixes #3831 svn changeset:10290/svn branch:6.2 --- diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java b/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java index 8a496d4631..4700451543 100644 --- a/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java +++ b/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java @@ -1,6 +1,7 @@ package com.vaadin.terminal.gwt.client; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -27,6 +28,8 @@ public class ApplicationConfiguration { private boolean usePortletURLs = false; private String portletUidlURLBase; + private HashMap unknownComponents; + private Class[] classes = new Class[1024]; private static ArrayList unstartedApplications = new ArrayList(); @@ -133,7 +136,7 @@ public class ApplicationConfiguration { * Inits the ApplicationConfiguration by reading the DOM and instantiating * ApplicationConnections accordingly. Call {@link #startNextApplication()} * to actually start the applications. - * + * * @param widgetset * the widgetset that is running the apps */ @@ -177,7 +180,7 @@ public class ApplicationConfiguration { * once to start the first application; after that, each application should * call this once it has started. This ensures that the applications are * started synchronously, which is neccessary to avoid session-id problems. - * + * * @return true if an unstarted application was found */ public static boolean startNextApplication() { @@ -240,7 +243,19 @@ public class ApplicationConfiguration { String key = keyArray.get(i); int value = valueMap.getInt(key); classes[value] = widgetSet.getImplementationByClassName(key); + if (classes[value] == VUnknownComponent.class) { + if (unknownComponents == null) { + unknownComponents = new HashMap(); + } + unknownComponents.put("" + value, key); + } } } + String getUnknownServerClassNameByEncodedTagName(String tag) { + if (unknownComponents != null) { + return unknownComponents.get(tag); + } + return null; + } } diff --git a/src/com/vaadin/terminal/gwt/client/DefaultWidgetSet.java b/src/com/vaadin/terminal/gwt/client/DefaultWidgetSet.java index 9c54e4c5f2..919c267eb0 100644 --- a/src/com/vaadin/terminal/gwt/client/DefaultWidgetSet.java +++ b/src/com/vaadin/terminal/gwt/client/DefaultWidgetSet.java @@ -45,8 +45,10 @@ public class DefaultWidgetSet implements WidgetSet { public Paintable createWidget(UIDL uidl, ApplicationConfiguration conf) { final Class classType = resolveWidgetType(uidl, conf); - if (classType == null) { - return new VUnknownComponent(); + if (classType == null || classType == VUnknownComponent.class) { + String serverSideName = conf + .getUnknownServerClassNameByEncodedTagName(uidl.getTag()); + return new VUnknownComponent(serverSideName); } return map.instantiate(classType); diff --git a/src/com/vaadin/terminal/gwt/client/VUIDLBrowser.java b/src/com/vaadin/terminal/gwt/client/VUIDLBrowser.java index a8a5bea94d..757ed1300b 100644 --- a/src/com/vaadin/terminal/gwt/client/VUIDLBrowser.java +++ b/src/com/vaadin/terminal/gwt/client/VUIDLBrowser.java @@ -12,6 +12,7 @@ import com.google.gwt.event.logical.shared.OpenHandler; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.ui.Tree; import com.google.gwt.user.client.ui.TreeItem; +import com.vaadin.terminal.gwt.client.ui.VUnknownComponent; public class VUIDLBrowser extends Tree { /** @@ -55,7 +56,13 @@ public class VUIDLBrowser extends Tree { Integer.parseInt(name); Class widgetClassByDecodedTag = conf .getWidgetClassByEncodedTag(name); - name = widgetClassByDecodedTag.getName(); + if (widgetClassByDecodedTag == VUnknownComponent.class) { + name = conf + .getUnknownServerClassNameByEncodedTagName(name) + + "(NO CLIENT IMPLEMENTATION FOUND)"; + } else { + name = widgetClassByDecodedTag.getName(); + } } catch (Exception e) { // NOP } @@ -75,7 +82,13 @@ public class VUIDLBrowser extends Tree { Integer.parseInt(nodeName); Class widgetClassByDecodedTag = conf .getWidgetClassByEncodedTag(nodeName); - nodeName = widgetClassByDecodedTag.getName(); + if (widgetClassByDecodedTag == VUnknownComponent.class) { + nodeName = conf + .getUnknownServerClassNameByEncodedTagName(nodeName) + + "(NO CLIENT IMPLEMENTATION FOUND)"; + } else { + nodeName = widgetClassByDecodedTag.getName(); + } } catch (Exception e) { // NOP } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VUnknownComponent.java b/src/com/vaadin/terminal/gwt/client/ui/VUnknownComponent.java index cd9d2cd40c..e778316c5d 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VUnknownComponent.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VUnknownComponent.java @@ -17,8 +17,10 @@ public class VUnknownComponent extends Composite implements Paintable { com.google.gwt.user.client.ui.Label caption = new com.google.gwt.user.client.ui.Label();; Tree uidlTree; private VerticalPanel panel; + private String serverClassName; - public VUnknownComponent() { + public VUnknownComponent(String serverClassName) { + this.serverClassName = serverClassName; panel = new VerticalPanel(); panel.add(caption); initWidget(panel); @@ -30,7 +32,9 @@ public class VUnknownComponent extends Composite implements Paintable { if (client.updateComponent(this, uidl, false)) { return; } - setCaption("Client faced an unknown component type. Unrendered UIDL:"); + setCaption("Widgetset does not contain implementation for " + + serverClassName + + ". Check its @ClientWidget mapping, widgetsets GWT module descrioption file and re-compile your widgetset. Unrendered UIDL:"); if (uidlTree != null) { uidlTree.removeFromParent(); } diff --git a/src/com/vaadin/terminal/gwt/widgetsetutils/WidgetMapGenerator.java b/src/com/vaadin/terminal/gwt/widgetsetutils/WidgetMapGenerator.java index fa55c7c2ff..cd86682a4d 100644 --- a/src/com/vaadin/terminal/gwt/widgetsetutils/WidgetMapGenerator.java +++ b/src/com/vaadin/terminal/gwt/widgetsetutils/WidgetMapGenerator.java @@ -21,7 +21,7 @@ import com.vaadin.ui.ClientWidget; /** * GWT generator to build WidgetMapImpl dynamically based on * {@link ClientWidget} annotations available in workspace. - * + * */ public class WidgetMapGenerator extends Generator { @@ -50,7 +50,7 @@ public class WidgetMapGenerator extends Generator { /** * Generate source code for WidgetMapImpl - * + * * @param logger * Logger object * @param context @@ -100,7 +100,7 @@ public class WidgetMapGenerator extends Generator { /** * Verifies that all client side components are available for client side * GWT module. - * + * * @param logger * @param context * @param paintablesHavingWidgetAnnotation @@ -143,7 +143,7 @@ public class WidgetMapGenerator extends Generator { * from widgetset. Properties in gwt.xml is one option. Now only possible by * extending this class, overriding getUsedPaintables() method and * redefining deferred binding rule. - * + * * @return a collections of Vaadin components that will be added to * widgetset */ @@ -176,14 +176,13 @@ public class WidgetMapGenerator extends Generator { sourceWriter.println(".class );"); sourceWriter.print("else "); } - sourceWriter - .println("return GWT.create( com.vaadin.terminal.gwt.client.ui.VUnknownComponent.class );"); + sourceWriter.println("return null;"); sourceWriter.outdent(); sourceWriter.println("}"); } /** - * + * * @param sourceWriter * Source writer to output source code * @param paintablesHavingWidgetAnnotation