diff options
3 files changed, 26 insertions, 42 deletions
diff --git a/client-compiler/src/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java b/client-compiler/src/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java index 652eb38b5c..9d833f51bb 100644 --- a/client-compiler/src/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java +++ b/client-compiler/src/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java @@ -16,6 +16,7 @@ import java.util.Map.Entry; import java.util.Set; import com.google.gwt.core.client.GWT; +import com.google.gwt.core.client.RunAsyncCallback; import com.google.gwt.core.ext.Generator; import com.google.gwt.core.ext.GeneratorContext; import com.google.gwt.core.ext.TreeLogger; @@ -34,7 +35,6 @@ import com.vaadin.client.metadata.ConnectorBundleLoader; import com.vaadin.client.metadata.InvokationHandler; import com.vaadin.client.metadata.ProxyHandler; import com.vaadin.client.metadata.TypeData; -import com.vaadin.client.metadata.TypeDataBundle; import com.vaadin.client.metadata.TypeDataStore; import com.vaadin.client.ui.UnknownComponentConnector; import com.vaadin.server.widgetsetutils.metadata.ClientRpcVisitor; @@ -131,12 +131,21 @@ public class ConnectorBundleLoaderFactory extends Generator { w.print(".runAsync("); } - w.print("new "); - w.print(TypeDataBundle.class.getName()); - w.println("(getName()) {"); + w.println("new %s() {", RunAsyncCallback.class.getName()); w.indent(); - w.println("public void load() {"); + w.println("public void onSuccess() {"); + w.indent(); + + w.println("load();"); + w.println("%s.get().setLoaded(getName());", + ConnectorBundleLoader.class.getName()); + + // Close onSuccess method + w.outdent(); + w.println("}"); + + w.println("private void load() {"); w.indent(); printBundleData(logger, w, bundle); @@ -145,7 +154,16 @@ public class ConnectorBundleLoaderFactory extends Generator { w.outdent(); w.println("}"); - // Close new TypeDataBundle() {} + w.println("public void onFailure(Throwable reason) {"); + w.indent(); + + w.println("%s.get().setLoadFailure(getName(), reason);", + ConnectorBundleLoader.class.getName()); + + w.outdent(); + w.println("}"); + + // Close new RunAsyncCallback() {} w.outdent(); w.print("}"); diff --git a/client/src/com/vaadin/client/metadata/ConnectorBundleLoader.java b/client/src/com/vaadin/client/metadata/ConnectorBundleLoader.java index 0549547e38..8c42bdfc4d 100644 --- a/client/src/com/vaadin/client/metadata/ConnectorBundleLoader.java +++ b/client/src/com/vaadin/client/metadata/ConnectorBundleLoader.java @@ -78,6 +78,8 @@ public abstract class ConnectorBundleLoader { } public void setLoadFailure(String bundleName, Throwable reason) { + reason = new RuntimeException("Failed to load bundle " + bundleName + + ": " + reason.getMessage(), reason); List<BundleLoadCallback> callbacks = asyncBlockLoaders.get(bundleName) .setError(reason); for (BundleLoadCallback callback : callbacks) { diff --git a/client/src/com/vaadin/client/metadata/TypeDataBundle.java b/client/src/com/vaadin/client/metadata/TypeDataBundle.java deleted file mode 100644 index 96f4884d52..0000000000 --- a/client/src/com/vaadin/client/metadata/TypeDataBundle.java +++ /dev/null @@ -1,36 +0,0 @@ -/* -@VaadinApache2LicenseForJavaFiles@ - */ - -package com.vaadin.client.metadata; - -import com.google.gwt.core.client.RunAsyncCallback; - -public abstract class TypeDataBundle implements RunAsyncCallback { - private final String name; - - public TypeDataBundle(String name) { - this.name = name; - } - - @Override - public void onSuccess() { - ConnectorBundleLoader loader = ConnectorBundleLoader.get(); - load(); - loader.setLoaded(getName()); - } - - @Override - public void onFailure(Throwable reason) { - ConnectorBundleLoader.get().setLoadFailure( - getName(), - new RuntimeException("Failed to load bundle " + getName() - + ": " + reason.getMessage(), reason)); - } - - public abstract void load(); - - public String getName() { - return name; - } -} |