james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r833713 - in /james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp: MessageSendPresenter.java MessageSendView.java
Date Sat, 07 Nov 2009 16:56:23 GMT
Author: norman
Date: Sat Nov  7 16:56:23 2009
New Revision: 833713

URL: http://svn.apache.org/viewvc?rev=833713&view=rev
Log:
Show some loading widget while sending message

Modified:
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendPresenter.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendView.java

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendPresenter.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendPresenter.java?rev=833713&r1=833712&r2=833713&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendPresenter.java
(original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendPresenter.java
Sat Nov  7 16:56:23 2009
@@ -224,7 +224,10 @@
                     message.setMessageAttachments(attachments);
 
                     // TODO: good handling of error messages, and use an error widget instead
of Window.alert
+                    
                     if (type.equals(Type.NEW)) {
+                        display.startProcessing();
+
                         dispatcher.execute(new SendMessage(message), new HupaCallback<GenericResult>(dispatcher,
eventBus) {
                             public void callback(GenericResult result) {
                                 if (result.isSuccess()) {
@@ -233,9 +236,13 @@
                                 } else {
                                     Window.alert(result.getMessage());
                                 }    
+                                display.stopProcessing();
+
                             }
                         });
                     } else if(type.equals(Type.FORWARD)) {
+                        display.startProcessing();
+
                         dispatcher.execute(new ForwardMessage(message, folder, oldmessage.getUid()),
new HupaCallback<GenericResult>(dispatcher, eventBus) {
                             public void callback(GenericResult result) {
                                 if (result.isSuccess()) {
@@ -244,9 +251,13 @@
                                 } else {
                                     Window.alert(result.getMessage());
                                 }    
+                                display.stopProcessing();
+
                             }
                         });
                     } else if(type.equals(Type.REPLY) || type.equals(Type.REPLY_ALL)) {
+                        display.startProcessing();
+
                         boolean replyAll = type.equals(Type.REPLY_ALL);
                         dispatcher.execute(new ReplyMessage(message, folder, oldmessage.getUid(),
replyAll), new HupaCallback<GenericResult>(dispatcher, eventBus) {
                             public void callback(GenericResult result) {
@@ -256,6 +267,7 @@
                                 } else {
                                     Window.alert(result.getMessage());
                                 }    
+                                display.stopProcessing();
                             }
                         });
                     }

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendView.java?rev=833713&r1=833712&r2=833713&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendView.java
(original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendView.java
Sat Nov  7 16:56:23 2009
@@ -25,7 +25,9 @@
 import gwtupload.client.MultiUploader;
 
 import org.apache.hupa.client.HupaConstants;
+import org.apache.hupa.client.widgets.Loading;
 import org.apache.hupa.client.widgets.MyButton;
+import org.apache.hupa.widgets.ui.EnableHyperlink;
 import org.apache.hupa.widgets.ui.HasEnable;
 
 import com.google.gwt.core.client.GWT;
@@ -57,8 +59,8 @@
     private MultiUploader uploader = new MultiUploader(uploadStatus);
     private TextArea text = new TextArea();
     private MyButton sendButton = new MyButton(constants.sendButton());
-    private Hyperlink backButton = new Hyperlink(constants.backButton(),"");
-
+    private EnableHyperlink backButton = new EnableHyperlink(constants.backButton(),"");
+    private Loading sendProgress = new Loading(true);
 
     public MessageSendView() {
         final VerticalPanel mPanel = new VerticalPanel();
@@ -161,6 +163,7 @@
         buttonBar.setWidth("100%");
         buttonBar.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT);
         buttonBar.add(sendButton);
+        buttonBar.add(sendProgress);
         buttonBar.add(backButton);
         buttonBar.setCellHorizontalAlignment(backButton, HorizontalPanel.ALIGN_RIGHT);
 
@@ -184,8 +187,9 @@
      * @see net.customware.gwt.presenter.client.Display#startProcessing()
      */
     public void startProcessing() {
-        // TODO Auto-generated method stub
-
+        sendProgress.show();
+        sendButton.setEnabled(false);
+        backButton.setEnabled(false);
     }
 
     /*
@@ -193,8 +197,9 @@
      * @see net.customware.gwt.presenter.client.Display#stopProcessing()
      */
     public void stopProcessing() {
-        // TODO Auto-generated method stub
-
+        sendProgress.hide();
+        sendButton.setEnabled(true);
+        backButton.setEnabled(true);
     }
 
     /*



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message