show an html label below spinner describing the operation that is being executed...
authorkoutsoub <devnull@localhost>
Tue, 26 Apr 2011 13:03:34 +0000 (16:03 +0300)
committerkoutsoub <devnull@localhost>
Tue, 26 Apr 2011 13:03:34 +0000 (16:03 +0300)
src/gr/ebs/gss/web/client/GSS.java
src/gr/ebs/gss/web/client/LoadingIndicator.java
src/gr/ebs/gss/web/client/SearchResults.java
src/gr/ebs/gss/web/client/rest/DeleteCommand.java
src/gr/ebs/gss/web/client/rest/GetCommand.java
src/gr/ebs/gss/web/client/rest/HeadCommand.java
src/gr/ebs/gss/web/client/rest/MultipleDeleteCommand.java
src/gr/ebs/gss/web/client/rest/MultipleGetCommand.java
src/gr/ebs/gss/web/client/rest/MultipleHeadCommand.java
src/gr/ebs/gss/web/client/rest/MultiplePostCommand.java
src/gr/ebs/gss/web/client/rest/PostCommand.java

index ddc5514..d365c6a 100644 (file)
@@ -44,6 +44,7 @@ import com.google.gwt.event.logical.shared.SelectionEvent;
 import com.google.gwt.event.logical.shared.SelectionHandler;
 import com.google.gwt.event.logical.shared.ValueChangeEvent;
 import com.google.gwt.event.logical.shared.ValueChangeHandler;
+import com.google.gwt.http.client.URL;
 import com.google.gwt.i18n.client.DateTimeFormat;
 import com.google.gwt.resources.client.ClientBundle;
 import com.google.gwt.resources.client.ImageResource;
@@ -568,15 +569,19 @@ public class GSS implements EntryPoint, ResizeHandler {
        /**
         * Display the 'loading' indicator.
         */
-       public void showLoadingIndicator() {
-               topPanel.getLoading().setVisible(true);
+       public void showLoadingIndicator(String message, String path) {
+               if(path!=null){
+                       String[] split = path.split("/");
+                       message = message +" "+URL.decode(split[split.length-1]);
+               }
+               topPanel.getLoading().show(message);
        }
 
        /**
         * Hide the 'loading' indicator.
         */
        public void hideLoadingIndicator() {
-               topPanel.getLoading().setVisible(false);
+               topPanel.getLoading().hide();
        }
 
        /**
index 8a1d48b..eccc1b5 100644 (file)
@@ -23,12 +23,16 @@ import com.google.gwt.resources.client.ImageResource;
 import com.google.gwt.user.client.ui.AbstractImagePrototype;\r
 import com.google.gwt.user.client.ui.Composite;\r
 import com.google.gwt.user.client.ui.HTML;\r
+import com.google.gwt.user.client.ui.HasHorizontalAlignment;\r
+import com.google.gwt.user.client.ui.VerticalPanel;\r
 \r
 /**\r
  * The 'loading' indicator widget implementation.\r
  */\r
 public class LoadingIndicator extends Composite {\r
-\r
+       public static final String DEFAULT_MESSAGE="Please Wait";\r
+       \r
+       HTML messageLabel;\r
        /**\r
         * An image bundle for this widgets images.\r
         */\r
@@ -41,7 +45,40 @@ public class LoadingIndicator extends Composite {
         * The widget's constructor that creates a spinning indicator image.\r
         */\r
        public LoadingIndicator(Images images) {\r
+               VerticalPanel vp = new VerticalPanel();\r
+               //vp.setHorizontalAlignment(HorizontalAlignmentConstant.CENTER);\r
                HTML inner = new HTML(AbstractImagePrototype.create(images.loading()).getHTML());\r
-               initWidget(inner);\r
+               vp.add(inner);\r
+               vp.add(messageLabel = new HTML(DEFAULT_MESSAGE) );\r
+               vp.setCellHorizontalAlignment(inner, HasHorizontalAlignment.ALIGN_CENTER);\r
+               vp.setCellHorizontalAlignment(messageLabel, HasHorizontalAlignment.ALIGN_CENTER);\r
+               initWidget(vp);\r
+       }\r
+       \r
+       \r
+       /**\r
+        * Modify the message.\r
+        *\r
+        * @param message the message to set\r
+        */\r
+       public void setMessage(String message) {\r
+               messageLabel.setHTML(message);\r
+       }\r
+       \r
+       public void clearMessage(){\r
+               setMessage(DEFAULT_MESSAGE);\r
+       }\r
+       \r
+       public void show(String msg){\r
+               if(msg==null)\r
+                       setMessage(DEFAULT_MESSAGE);\r
+               else\r
+                       setMessage(msg);\r
+               this.setVisible(true);\r
+       }\r
+       \r
+       public void hide(){\r
+               setMessage(DEFAULT_MESSAGE);\r
+               this.setVisible(false);\r
        }\r
 }\r
index 1af9973..ac4cbc1 100644 (file)
@@ -576,7 +576,7 @@ public class SearchResults extends Composite{
                clearSelectedRows();
                //clearLabels();
                startIndex = 0;
-               app.showLoadingIndicator();
+               app.showLoadingIndicator("Getting Search Results",null);
                if (query == null || query.trim().equals("")) {
                        searchResults.setHTML("You must specify a query.");
                        setFiles(new ArrayList());
index e63f91f..c9b61c9 100644 (file)
@@ -43,7 +43,7 @@ public abstract class DeleteCommand extends RestCommand{
        public DeleteCommand(String pathToDelete, boolean showLoading){
                setShowLoadingIndicator(showLoading);
                if(isShowLoadingIndicator())
-                       GSS.get().showLoadingIndicator();
+                       GSS.get().showLoadingIndicator("Deleting ",pathToDelete);
                final String path;
                if(pathToDelete.endsWith("/"))
                        path = pathToDelete;
index 09cbf05..6911ba5 100644 (file)
@@ -119,7 +119,7 @@ public abstract class GetCommand<T extends RestResource> extends RestCommand{
        public GetCommand(Class<T> theclass, String pathToGet, boolean showLoading, T theCached){
                setShowLoadingIndicator(showLoading);
                if(isShowLoadingIndicator())
-                       GSS.get().showLoadingIndicator();
+                       GSS.get().showLoadingIndicator("Getting ",pathToGet);
                this.aclass = theclass;
                if(pathToGet.indexOf("?") != -1)
                        path = pathToGet;
@@ -135,7 +135,7 @@ public abstract class GetCommand<T extends RestResource> extends RestCommand{
        public GetCommand(Class<T> theclass, String aUsername , String pathToGet, boolean showLoading, T theCached){
                setShowLoadingIndicator(showLoading);
                if(isShowLoadingIndicator())
-                       GSS.get().showLoadingIndicator();
+                       GSS.get().showLoadingIndicator("Getting ",pathToGet);
                this.aclass = theclass;
                path = fixPath(pathToGet);
                this.username = aUsername;
index 5bfc3c7..1e3beb1 100644 (file)
@@ -57,7 +57,7 @@ public  abstract class HeadCommand<T extends RestResource> extends RestCommand{
                setShowLoadingIndicator(showLoading);
                this.aclass = theClass;
                if(isShowLoadingIndicator())
-                       GSS.get().showLoadingIndicator();
+                       GSS.get().showLoadingIndicator("Getting ",pathToGet);
 
                if(theClass.equals(FileResource.class))
                        path = pathToGet;
index b136890..a5d4378 100644 (file)
@@ -51,7 +51,7 @@ public abstract class MultipleDeleteCommand extends RestCommand {
        public MultipleDeleteCommand(String[] pathToDelete, boolean showLoading){
                setShowLoadingIndicator(showLoading);
                if(isShowLoadingIndicator())
-                       GSS.get().showLoadingIndicator();
+                       GSS.get().showLoadingIndicator("Deleting "+pathToDelete.length+" items",null);
                paths = pathToDelete;
                for (final String pathg : pathToDelete) {
                        GWT.log("[DEL]"+pathg, null);
index 75cd7e2..c91ebed 100644 (file)
@@ -61,7 +61,7 @@ public abstract class MultipleGetCommand<T extends RestResource> extends RestCom
        public MultipleGetCommand(Class<T> aNewClass, String[] pathToGet, boolean showLoading, Cached[] theCached) {
                setShowLoadingIndicator(showLoading);
                if (isShowLoadingIndicator())
-                       GSS.get().showLoadingIndicator();
+                       GSS.get().showLoadingIndicator("Getting "+pathToGet.length+" items", null);
                aclass = aNewClass;
                paths = pathToGet;
                this.cached = theCached;
index 9172a78..3b83f7d 100644 (file)
@@ -59,7 +59,7 @@ public abstract class MultipleHeadCommand <T extends RestResource> extends RestC
        public MultipleHeadCommand(Class<T> theClass, String[] pathToGet, boolean showLoading, Cached[] theCached) {
                setShowLoadingIndicator(showLoading);
                if(isShowLoadingIndicator())
-                       GSS.get().showLoadingIndicator();
+                       GSS.get().showLoadingIndicator("Getting "+pathToGet.length+" items", null);
                paths = pathToGet;
                this.aclass = theClass;
                this.cached = theCached;
index cf9fce2..274f345 100644 (file)
@@ -61,7 +61,7 @@ public abstract class MultiplePostCommand extends RestCommand {
        public MultiplePostCommand(String[] pathToDelete, String data, final int okStatusCode, boolean showLoading){
                setShowLoadingIndicator(showLoading);
                if(isShowLoadingIndicator())
-                       GSS.get().showLoadingIndicator();
+                       GSS.get().showLoadingIndicator("Updating "+pathToDelete.length+" items", null);
                paths = pathToDelete;
                for (final String pathg : pathToDelete) {
                        GWT.log("[DEL]"+pathg, null);
index 11998c7..22ab5ed 100644 (file)
@@ -41,7 +41,7 @@ public abstract class PostCommand extends RestCommand{
        public PostCommand(final String path, String data, final int okStatusCode, boolean showLoading) {
                setShowLoadingIndicator(showLoading);
                if(isShowLoadingIndicator())
-                       GSS.get().showLoadingIndicator();
+                       GSS.get().showLoadingIndicator("Updating ",path);
 
                RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, path);