changeset 5488:6ec7c8ebb2c9

DatacageWidget: Use ScreenLock when loading dc data, solves flys/issue1152 .
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 28 Mar 2013 09:29:42 +0100
parents a87fe0d2c928
children 2c6f4a3c5a25 35cd6286da2d
files flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageWidget.java
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageWidget.java	Thu Mar 28 09:25:38 2013 +0100
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageWidget.java	Thu Mar 28 09:29:42 2013 +0100
@@ -24,6 +24,7 @@
 import de.intevation.flys.client.client.event.DatacageHandler;
 import de.intevation.flys.client.client.services.MetaDataService;
 import de.intevation.flys.client.client.services.MetaDataServiceAsync;
+import de.intevation.flys.client.client.ui.ScreenLock;
 import de.intevation.flys.client.shared.model.Artifact;
 import de.intevation.flys.client.shared.model.AttrList;
 import de.intevation.flys.client.shared.model.DataCageNode;
@@ -65,6 +66,9 @@
     protected List<DatacageHandler>            handlers;
     protected List<DatacageDoubleClickHandler> doubleHandlers;
 
+    /** Layout to show spinning wheel of joy. */
+    protected VLayout lockScreen;
+
 
     public DatacageWidget() {
         handlers       = new ArrayList<DatacageHandler>();
@@ -168,6 +172,14 @@
         triggerTreeBuilding();
     }
 
+    public void lockUI() {
+        lockScreen = ScreenLock.lockUI(this, lockScreen);
+    }
+
+    /** Enable input, remove grey, remove spinning wheel of joy. */
+    public void unlockUI() {
+        ScreenLock.unlockUI(this, lockScreen);
+    }
 
     /**
      * @param handler Handler to be added (notified on add-action).
@@ -382,6 +394,8 @@
         String artifactId = artifact.getUuid();
         String userId     = (user != null) ? user.identifier() : null;
 
+        lockUI();
+
         metaDataService.getMetaData(
             locale,
             artifactId,
@@ -393,6 +407,7 @@
                 public void onFailure(Throwable caught) {
                     GWT.log("Could not load meta data.");
                     SC.warn(caught.getMessage());
+                    unlockUI();
                 }
 
                 @Override
@@ -416,6 +431,7 @@
                         tree.openAll();
                     }
                     treeGrid.setData(tree);
+                    unlockUI();
                 }
             });
     }

http://dive4elements.wald.intevation.org