package com.vaadin.terminal.gwt.client;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
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>();
* 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
*/
* 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() {
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;
+ }
}
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);
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 {
/**
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
}
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
}
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);
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();
}
/**
* GWT generator to build WidgetMapImpl dynamically based on
* {@link ClientWidget} annotations available in workspace.
- *
+ *
*/
public class WidgetMapGenerator extends Generator {
/**
* Generate source code for WidgetMapImpl
- *
+ *
* @param logger
* Logger object
* @param context
/**
* Verifies that all client side components are available for client side
* GWT module.
- *
+ *
* @param logger
* @param context
* @param paintablesHavingWidgetAnnotation
* 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
*/
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