]> source.dussan.org Git - vaadin-framework.git/commitdiff
Rename widget -> dependency in delayed load handling (#9044)
authorLeif Åstrand <leif@vaadin.com>
Wed, 27 Jun 2012 14:08:38 +0000 (17:08 +0300)
committerLeif Åstrand <leif@vaadin.com>
Wed, 27 Jun 2012 14:08:38 +0000 (17:08 +0300)
src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java
src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
src/com/vaadin/terminal/gwt/client/WidgetLoader.java

index 960b0a8b0efcbedf1fea8b2243b01560cd5baadd..540841a6ae35fbf484c663f1453dabe8499615e9 100644 (file)
@@ -218,7 +218,7 @@ public class ApplicationConfiguration implements EntryPoint {
     static// TODO consider to make this hashmap per application
     LinkedList<Command> callbacks = new LinkedList<Command>();
 
-    private static int widgetsLoading;
+    private static int dependenciesLoading;
 
     private static ArrayList<ApplicationConnection> runningApplications = new ArrayList<ApplicationConnection>();
 
@@ -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;
             }
index 3ec4233c59b858f9d13fc35592a98c1752980d14..ab9520240c09ef68deb98fbe50682144056eda10 100644 (file)
@@ -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
index 16e99716a0bc45e03a7b54f24866f12a19b4b392..491e56941104516f93f125679c2e8c1d26f5fe17 100644 (file)
@@ -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();