From: Leif Åstrand Date: Wed, 27 Jun 2012 14:08:38 +0000 (+0300) Subject: Rename widget -> dependency in delayed load handling (#9044) X-Git-Tag: 7.0.0.alpha3~52 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=236fd821354b6906c9100c13f7912738ac19c70a;p=vaadin-framework.git Rename widget -> dependency in delayed load handling (#9044) --- diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java b/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java index 960b0a8b0e..540841a6ae 100644 --- a/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java +++ b/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java @@ -218,7 +218,7 @@ public class ApplicationConfiguration implements EntryPoint { static// TODO consider to make this hashmap per application LinkedList callbacks = new LinkedList(); - private static int widgetsLoading; + private static int dependenciesLoading; private static ArrayList runningApplications = new ArrayList(); @@ -454,26 +454,26 @@ public class ApplicationConfiguration implements EntryPoint { * * @param c */ - static void runWhenWidgetsLoaded(Command c) { - if (widgetsLoading == 0) { + static void runWhenDependenciesLoaded(Command c) { + if (dependenciesLoading == 0) { c.execute(); } else { callbacks.add(c); } } - static void startWidgetLoading() { - widgetsLoading++; + static void startDependencyLoading() { + dependenciesLoading++; } - static void endWidgetLoading() { - widgetsLoading--; - if (widgetsLoading == 0 && !callbacks.isEmpty()) { + static void endDependencyLoading() { + dependenciesLoading--; + if (dependenciesLoading == 0 && !callbacks.isEmpty()) { for (Command cmd : callbacks) { cmd.execute(); } callbacks.clear(); - } else if (widgetsLoading == 0 && deferredWidgetLoader != null) { + } else if (dependenciesLoading == 0 && deferredWidgetLoader != null) { deferredWidgetLoader.trigger(); } @@ -534,7 +534,7 @@ public class ApplicationConfiguration implements EntryPoint { } private boolean isBusy() { - if (widgetsLoading > 0) { + if (dependenciesLoading > 0) { communicationFree = 0; return true; } diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java index 3ec4233c59..ab9520240c 100644 --- a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java +++ b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java @@ -1618,19 +1618,19 @@ public class ApplicationConnection { } }; - ApplicationConfiguration.runWhenWidgetsLoaded(c); + ApplicationConfiguration.runWhenDependenciesLoaded(c); } private static void loadStyleDependencies(JsArrayString dependencies) { // Assuming no reason to interpret in a defined order ResourceLoadListener resourceLoadListener = new ResourceLoadListener() { public void onResourceLoad(ResourceLoadEvent event) { - ApplicationConfiguration.endWidgetLoading(); + ApplicationConfiguration.endDependencyLoading(); } }; ResourceLoader loader = ResourceLoader.get(); for (int i = 0; i < dependencies.length(); i++) { - ApplicationConfiguration.startWidgetLoading(); + ApplicationConfiguration.startDependencyLoading(); loader.loadStylesheet(dependencies.get(i), resourceLoadListener); } } @@ -1644,20 +1644,20 @@ public class ApplicationConnection { ResourceLoadListener resourceLoadListener = new ResourceLoadListener() { public void onResourceLoad(ResourceLoadEvent event) { if (dependencies.length() != 0) { - ApplicationConfiguration.startWidgetLoading(); + ApplicationConfiguration.startDependencyLoading(); // Load next in chain (hopefully already preloaded) event.getResourceLoader().loadScript(dependencies.shift(), this); } // Call start for next before calling end for current - ApplicationConfiguration.endWidgetLoading(); + ApplicationConfiguration.endDependencyLoading(); } }; ResourceLoader loader = ResourceLoader.get(); // Start chain by loading first - ApplicationConfiguration.startWidgetLoading(); + ApplicationConfiguration.startDependencyLoading(); loader.loadScript(dependencies.shift(), resourceLoadListener); // Preload all remaining diff --git a/src/com/vaadin/terminal/gwt/client/WidgetLoader.java b/src/com/vaadin/terminal/gwt/client/WidgetLoader.java index 16e99716a0..491e569411 100644 --- a/src/com/vaadin/terminal/gwt/client/WidgetLoader.java +++ b/src/com/vaadin/terminal/gwt/client/WidgetLoader.java @@ -9,12 +9,12 @@ import com.google.gwt.core.client.RunAsyncCallback; abstract class WidgetLoader implements RunAsyncCallback { public void onFailure(Throwable reason) { - ApplicationConfiguration.endWidgetLoading(); + ApplicationConfiguration.endDependencyLoading(); } public void onSuccess() { addInstantiator(); - ApplicationConfiguration.endWidgetLoading(); + ApplicationConfiguration.endDependencyLoading(); } abstract void addInstantiator();