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;
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;
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);
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("}");
}
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) {
+++ /dev/null
-/*
-@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;
- }
-}