james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r834110 - in /james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp: IMAPMessageListPresenter.java IMAPMessageListPresenterPlace.java IMAPMessagePresenter.java MainPresenter.java MessageSendPresenter.java
Date Mon, 09 Nov 2009 15:42:05 GMT
Author: norman
Date: Mon Nov  9 15:41:59 2009
New Revision: 834110

URL: http://svn.apache.org/viewvc?rev=834110&view=rev
Log:
Correct usage of gwt-presenter for supporting history ( Back/ Forward Button )

Modified:
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListPresenter.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListPresenterPlace.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessagePresenter.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MainPresenter.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendPresenter.java

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListPresenter.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListPresenter.java?rev=834110&r1=834109&r2=834110&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListPresenter.java
(original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListPresenter.java
Mon Nov  9 15:41:59 2009
@@ -287,16 +287,7 @@
             }
         }); 
     }
-    
-    public void setUser(User user) {
-        this.user = user;
-    }
-
-    public void setFolder(IMAPFolder folder) {
-        this.folder = folder;
-    }
-    
-   
+ 
 
     /*
      * (non-Javadoc)
@@ -339,11 +330,12 @@
         display.reloadData(user, folder, searchValue);
         
     }
-
-    public void setSearchValue(String searchValue) {
+    
+    public void reveal(User user, IMAPFolder folder, String searchValue) {
+        this.user = user;
+        this.folder = folder;
         this.searchValue = searchValue;
+        firePresenterChangedEvent();
     }
-    
-  
 
 }

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListPresenterPlace.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListPresenterPlace.java?rev=834110&r1=834109&r2=834110&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListPresenterPlace.java
(original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListPresenterPlace.java
Mon Nov  9 15:41:59 2009
@@ -18,14 +18,10 @@
  ****************************************************************/
 package org.apache.hupa.client.mvp;
 
-import org.apache.hupa.shared.data.IMAPFolder;
-import org.apache.hupa.shared.data.User;
-
 import com.google.inject.Inject;
 import com.google.inject.Provider;
 
 import net.customware.gwt.presenter.client.gin.ProvidedPresenterPlace;
-import net.customware.gwt.presenter.client.place.PlaceRequest;
 
 public class IMAPMessageListPresenterPlace extends ProvidedPresenterPlace<IMAPMessageListPresenter>{
 
@@ -38,17 +34,4 @@
     public String getName() {
         return "MessageList";
     }
-
-    @Override
-    protected void preparePresenter(PlaceRequest request, IMAPMessageListPresenter presenter)
{
-        String username = request.getParameter("user", "unknown");
-        String folder = request.getParameter("folder", "INBOX");
-        String searchValue = request.getParameter("search", null);
-        User user = new User();
-        user.setName(username);
-        presenter.setUser(user);
-        presenter.setFolder(new IMAPFolder(folder));
-        presenter.setSearchValue(searchValue);
-    }    
-
 }

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessagePresenter.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessagePresenter.java?rev=834110&r1=834109&r2=834110&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessagePresenter.java
(original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessagePresenter.java
Mon Nov  9 15:41:59 2009
@@ -86,11 +86,13 @@
     }
 
     
-    public void bind(User user, IMAPFolder folder, Message message, MessageDetails messageDetails)
{
+    public void reveal(User user, IMAPFolder folder, Message message, MessageDetails messageDetails)
{
         this.message = message;
         this.messageDetails = messageDetails;
         this.folder = folder;
-        this.user = user;        
+        this.user = user;
+        updateDisplay();
+        firePresenterChangedEvent();
     }
 
     private void updateDisplay() {
@@ -173,6 +175,6 @@
 
     @Override
     protected void onRevealDisplay() {
-        updateDisplay();
+
     }
 }

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MainPresenter.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MainPresenter.java?rev=834110&r1=834109&r2=834110&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MainPresenter.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MainPresenter.java Mon
Nov  9 15:41:59 2009
@@ -88,6 +88,9 @@
 import com.google.gwt.user.client.ui.TreeItem;
 import com.google.inject.Inject;
 
+/**
+ *
+ */
 public class MainPresenter extends WidgetContainerPresenter<MainPresenter.Display>
{
 
     public interface Display extends WidgetContainerDisplay {
@@ -234,44 +237,46 @@
         this.user = user;
         this.folder = folder;
         this.searchValue = searchValue;
-
-        PlaceRequest request = new PlaceRequest("MessageList").with("user", user.getName()).with("folder",
folder.getFullName()).with("search", searchValue);
-       
+        messageListPresenter.reveal(user, folder, searchValue);
+        PlaceRequest request = new PlaceRequest("MessageList");
         eventBus.fireEvent(new PlaceRequestEvent(request));
     }
 
     private void showMessage(User user, IMAPFolder folder, Message message, MessageDetails
details) {
-        messagePresenter.bind(user, folder, message, details);
+        messagePresenter.reveal(user, folder, message, details);
         PlaceRequest request = new PlaceRequest("IMAPMessage");
         eventBus.fireEvent(new PlaceRequestEvent(request));
     }
 
     private void showNewMessage() {
-        sendPresenter.bind(user);
+        sendPresenter.reveal(user);
         PlaceRequest request = new PlaceRequest("MessageSend");
         eventBus.fireEvent(new PlaceRequestEvent(request));
-        //display.setCenter(sendPresenter.getDisplay().asWidget());
     }
 
     private void showForwardMessage(ForwardMessageEvent event) {
-        sendPresenter.bind(event.getUser(), event.getFolder(), event.getMessage(), event.getMessageDetails(),
Type.FORWARD);
+        sendPresenter.reveal(event.getUser(), event.getFolder(), event.getMessage(), event.getMessageDetails(),
Type.FORWARD);
         PlaceRequest request = new PlaceRequest("MessageSend");
         eventBus.fireEvent(new PlaceRequestEvent(request));
     }
 
     private void showReplyMessage(ReplyMessageEvent event) {
         if (event.getReplyAll()) {
-            sendPresenter.bind(event.getUser(), event.getFolder(), event.getMessage(), event.getMessageDetails(),
Type.REPLY_ALL);
+            sendPresenter.reveal(event.getUser(), event.getFolder(), event.getMessage(),
event.getMessageDetails(), Type.REPLY_ALL);
         } else {
-            sendPresenter.bind(event.getUser(), event.getFolder(), event.getMessage(), event.getMessageDetails(),
Type.REPLY);
+            sendPresenter.reveal(event.getUser(), event.getFolder(), event.getMessage(),
event.getMessageDetails(), Type.REPLY);
 
         }
         PlaceRequest request = new PlaceRequest("MessageSend");
         eventBus.fireEvent(new PlaceRequestEvent(request));
     }
 
+    /**
+     * Reset the presenter and display
+     */
     private void reset() {
         display.getSearchValue().setValue("");
+        // clear the cache
         cachingDispatcher.clear();
     }
 
@@ -529,6 +534,7 @@
 
     @Override
     protected void onRevealDisplay() {
+        // load IMAPFolder and the message table
         loadTreeItems();
         showMessageTable(user, folder, null, true);
 

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=834110&r1=834109&r2=834110&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
Mon Nov  9 15:41:59 2009
@@ -326,7 +326,7 @@
      * @param oldDetails the olddetails ( if there are any)
      * @param type the type 
      */
-    public void bind(User user, IMAPFolder folder, Message oldmessage, MessageDetails oldDetails,
Type type) {
+    public void reveal(User user, IMAPFolder folder, Message oldmessage, MessageDetails oldDetails,
Type type) {
         this.oldmessage = oldmessage;
         this.oldDetails = oldDetails;
         this.folder = folder;
@@ -364,6 +364,7 @@
 
             }
         }
+        firePresenterChangedEvent();
     }
     
     /**
@@ -371,8 +372,8 @@
      * 
      * @param user
      */
-    public void bind(User user) {
-        bind(user,null,null,null, Type.NEW);
+    public void reveal(User user) {
+        reveal(user,null,null,null, Type.NEW);
     }
 
     @Override



---------------------------------------------------------------------
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