]> source.dussan.org Git - vaadin-framework.git/commitdiff
more information for VUnknownComponent (and uidl browser). Fixes #3831
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Mon, 14 Dec 2009 15:46:19 +0000 (15:46 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Mon, 14 Dec 2009 15:46:19 +0000 (15:46 +0000)
svn changeset:10290/svn branch:6.2

src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java
src/com/vaadin/terminal/gwt/client/DefaultWidgetSet.java
src/com/vaadin/terminal/gwt/client/VUIDLBrowser.java
src/com/vaadin/terminal/gwt/client/ui/VUnknownComponent.java
src/com/vaadin/terminal/gwt/widgetsetutils/WidgetMapGenerator.java

index 8a496d4631469c955fa399e9dd0b0d0b424bfbaf..470045154322ad0d010e8ef6fc482baa64c76fb3 100644 (file)
@@ -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<String, String> unknownComponents;
+
     private Class<? extends Paintable>[] classes = new Class[1024];
 
     private static ArrayList<ApplicationConnection> unstartedApplications = new ArrayList<ApplicationConnection>();
@@ -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<String, String>();
+                }
+                unknownComponents.put("" + value, key);
+            }
         }
     }
 
+    String getUnknownServerClassNameByEncodedTagName(String tag) {
+        if (unknownComponents != null) {
+            return unknownComponents.get(tag);
+        }
+        return null;
+    }
 }
index 9c54e4c5f25d06bcbda4dd221ca11b1ceda0d482..919c267eb009968f44f9864131531088e4446298 100644 (file)
@@ -45,8 +45,10 @@ public class DefaultWidgetSet implements WidgetSet {
     public Paintable createWidget(UIDL uidl, ApplicationConfiguration conf) {
         final Class<? extends Paintable> 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);
index a8a5bea94da19e0297db6223e1b447bdf53ede26..757ed1300b5ef35787512dd105386116dc96db09 100644 (file)
@@ -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<? extends Paintable> 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<? extends Paintable> 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
             }
index cd9d2cd40c90ebc3fc7964b8d4266a5bf365dd6c..e778316c5d8e1039cf114542d4e61f5d744ca757 100644 (file)
@@ -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();
         }
index fa55c7c2ff1491d524d1fc4647654756e8ee6df3..cd86682a4dd6df74eb7e6192fdc3efe3b6270839 100644 (file)
@@ -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