summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2013-11-05 15:41:45 +0200
committerLeif Åstrand <leif@vaadin.com>2013-11-05 15:41:45 +0200
commite0e00befc848c242f986ba5cd993ae8610a7fa83 (patch)
treef45826d089932e534add7f91fb267eeaceed9c34 /client
parenta2f255448e6a755892a97b7df9fc2b65efc5dccc (diff)
downloadvaadin-framework-e0e00befc848c242f986ba5cd993ae8610a7fa83.tar.gz
vaadin-framework-e0e00befc848c242f986ba5cd993ae8610a7fa83.zip
Improve error message in createWidget() (#12901)
Change-Id: If456a2be242754bcd1e0a8c5be00062a4355af35
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/ui/AbstractComponentConnector.java19
1 files changed, 15 insertions, 4 deletions
diff --git a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java
index 6f98e29d03..8fdaf0a5be 100644
--- a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java
+++ b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java
@@ -15,6 +15,7 @@
*/
package com.vaadin.client.ui;
+import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.JsArrayString;
import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.ui.Focusable;
@@ -68,8 +69,16 @@ public abstract class AbstractComponentConnector extends AbstractConnector
/**
* Creates and returns the widget for this VPaintableWidget. This method
* should only be called once when initializing the paintable.
+ * <p>
+ * You should typically not override this method since the framework by
+ * default generates an implementation that uses {@link GWT#create(Class)}
+ * to create a widget of the same type as returned by the most specific
+ * override of {@link #getWidget()}. If you do override the method, you
+ * can't call <code>super.createWidget()</code> since the metadata needed
+ * for that implementation is not generated if there's an override of the
+ * method.
*
- * @return
+ * @return a new widget instance to use for this component connector
*/
protected Widget createWidget() {
Type type = TypeData.getType(getClass());
@@ -79,10 +88,12 @@ public abstract class AbstractComponentConnector extends AbstractConnector
return (Widget) instance;
} catch (NoDataException e) {
throw new IllegalStateException(
- "There is no information about the widget for "
+ "Default implementation of createWidget() does not work for "
+ Util.getSimpleName(this)
- + ". Did you remember to compile the right widgetset?",
- e);
+ + ". This might be caused by explicitely using "
+ + "super.createWidget(), using a widget type with "
+ + "generics or some unspecified problem with the "
+ + "widgetset compilation.", e);
}
}