Author: dward
Date: 2007-10-15 21:15:56 +0200 (Mon, 15 Oct 2007)
New Revision: 5395

Modified:
   
xwiki-products/curriki/trunk/gwt/src/main/java/org/curriki/gwt/client/Main.java
   xwiki-products/curriki/trunk/web/src/main/webapp/gwt2.js
   xwiki-products/curriki/trunk/web/src/main/webapp/skins/curriki8/style.css
Log:
- CURRIKI-1009
 - Bring up a "Loading" dialogue box when starting GWT (before GWT loads and 
close it before GWT starts)

Modified: 
xwiki-products/curriki/trunk/gwt/src/main/java/org/curriki/gwt/client/Main.java
===================================================================
--- 
xwiki-products/curriki/trunk/gwt/src/main/java/org/curriki/gwt/client/Main.java 
    2007-10-15 14:07:26 UTC (rev 5394)
+++ 
xwiki-products/curriki/trunk/gwt/src/main/java/org/curriki/gwt/client/Main.java 
    2007-10-15 19:15:56 UTC (rev 5395)
@@ -109,6 +109,8 @@
             }
         }
 
+        hideLoadingMessage();
+
         if (dosearch != null){
             // Bring up Site search app
             callSiteAddJSAPI(singleton); // Need to makes sure other GWT links 
still work
@@ -294,6 +296,8 @@
         $wnd.nominateAsset = function(assetName) {
             [EMAIL PROTECTED]::nominateAsset(Ljava/lang/String;)(assetName);
         };
+
+        $wnd.currikiGWTLoaded = true;
     }-*/;
 
     /**
@@ -559,6 +563,13 @@
      * Native method in JavaScript to access gwt:property
      */
     public static native String getProperty(String name) /*-{
-        return $wnd.__gwt_getMetaProperty(name);
-     }-*/;
+        return $wnd.__gwt_getMetaProperty(name);
+    }-*/;
+
+    /**
+     * Native method in JavaScript to turn off the pre-GWT loading message
+     */
+    public static native void hideLoadingMessage() /*-{
+        if ($wnd.hideLoadingMsg) $wnd.hideLoadingMsg();
+    }-*/;
 }

Modified: xwiki-products/curriki/trunk/web/src/main/webapp/gwt2.js
===================================================================
--- xwiki-products/curriki/trunk/web/src/main/webapp/gwt2.js    2007-10-15 
14:07:26 UTC (rev 5394)
+++ xwiki-products/curriki/trunk/web/src/main/webapp/gwt2.js    2007-10-15 
19:15:56 UTC (rev 5395)
@@ -587,18 +587,40 @@
   __gwt_loadModules();
 }
 
-var gwtLoaded = false; 
+// Uses prototype.js (should be loaded)
+function displayLoadingMsg() {
+    $('loadingGWT').show();
+}
+
+function hideLoadingMsg() {
+   $('loadingGWT').hide();
+
+    return true;
+}
+
+// Put the dialogue box up
+//This is a translated string (which means it cannot be sent by apache)
+document.write("<div id='loadingGWT' class='tk-ModalDialog 
dialog-loading'><div 
id='loadingGWTMsg'>${msg.get('loading.loading_msg')}</div><div 
id='loadingGWTImg'><img src='/xwiki/skins/curriki8/icons/spinner.gif' 
/></div></div>");
+hideLoadingMsg();
+
+
+function isGWTLoaded() {
+    return (__gwt_moduleControlBlocks.isReady() && __gwt_isHostPageLoaded && 
window.currikiGWTLoaded);
+}
+
+var gwtLoaded = false;
 function loadGWT() {
   if (gwtLoaded==false) {
    gwtLoaded = true;
    __gwt_isHostPageLoaded = true;
-   __gwt_bootstrap();   
+   __gwt_bootstrap();
+   displayLoadingMsg();
   }
 }
 
 function addFile2() {
   loadGWT();
-  if (__gwt_moduleControlBlocks.isReady())
+  if (isGWTLoaded())
    addFile();
   else
    window.setTimeout(addFile2, __gwt_retryWaitMillis);
@@ -606,7 +628,7 @@
 
 function addCollection2() {
   loadGWT();
-  if (__gwt_moduleControlBlocks.isReady())
+  if (isGWTLoaded())
    addCollection();
   else
    window.setTimeout(addCollection2, __gwt_retryWaitMillis);
@@ -614,7 +636,7 @@
 
 function addFromTemplate2() {
   loadGWT();
-  if (__gwt_moduleControlBlocks.isReady())
+  if (isGWTLoaded())
    addFromTemplate();
   else
    window.setTimeout(addFromTemplate2, __gwt_retryWaitMillis);
@@ -629,7 +651,7 @@
 }
 function findPopup3() {
   loadGWT();
-  if (__gwt_moduleControlBlocks.isReady()){
+  if (isGWTLoaded()){
     findPopup();
     findCalled=false;
   } else
@@ -645,7 +667,7 @@
 
 function addExistingResource3() {
   loadGWT();
-  if (__gwt_moduleControlBlocks.isReady())
+  if (isGWTLoaded())
    addExistingResource(addExistingResourceResource);
   else
    window.setTimeout(addExistingResource3, __gwt_retryWaitMillis);
@@ -659,7 +681,7 @@
 
 function addFileToCollection3() {
   loadGWT();
-  if (__gwt_moduleControlBlocks.isReady())
+  if (isGWTLoaded())
    addFileToCollection(addFileToCollectionCollection);
   else
    window.setTimeout(addFileToCollection3, __gwt_retryWaitMillis);
@@ -677,7 +699,7 @@
 
 function createCollection3() {
   loadGWT();
-  if (__gwt_moduleControlBlocks.isReady())
+  if (isGWTLoaded())
    
createCollection(createCollectionSpace,createCollectionPageName,createCollectionPageTitle);
   else
    window.setTimeout(createCollection3, __gwt_retryWaitMillis);
@@ -691,7 +713,7 @@
 
 function addResourceToCollection3() {
     loadGWT();
-    if (__gwt_moduleControlBlocks.isReady())
+    if (isGWTLoaded())
         addResourceToCollection(addResourceToCollectionCollection);
     else
         window.setTimeout(addResourceToCollection3, __gwt_retryWaitMillis);
@@ -705,7 +727,7 @@
 
 function nominateAsset3() {
   loadGWT();
-  if (__gwt_moduleControlBlocks.isReady())
+  if (isGWTLoaded())
    nominateAsset(nominateAssetName);
   else
    window.setTimeout(nominateAsset3, __gwt_retryWaitMillis);

Modified: 
xwiki-products/curriki/trunk/web/src/main/webapp/skins/curriki8/style.css
===================================================================
--- xwiki-products/curriki/trunk/web/src/main/webapp/skins/curriki8/style.css   
2007-10-15 14:07:26 UTC (rev 5394)
+++ xwiki-products/curriki/trunk/web/src/main/webapp/skins/curriki8/style.css   
2007-10-15 19:15:56 UTC (rev 5395)
@@ -4273,3 +4273,15 @@
 margin:10px auto 30px;
 width:100%;
 }
+
+/* Loading message when starting GWT */
+#loadingGWT {
+       width: 200px;
+       height: 100px;
+       position: absolute;
+       left: 50%;
+       top: 50%;
+       margin-top: -50px;
+       margin-left: -100px;
+       text-align: center;
+}

_______________________________________________
notifications mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/notifications

Reply via email to