james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r836369 - in /james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp: IMAPMessageListPresenter.java MainPresenter.java MainView.java place/HupaPlaceManager.java place/MainPresenterPlace.java
Date Sun, 15 Nov 2009 14:56:44 GMT
Author: norman
Date: Sun Nov 15 14:56:44 2009
New Revision: 836369

URL: http://svn.apache.org/viewvc?rev=836369&view=rev
Log:
Fix searching in messages

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/MainPresenter.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MainView.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/place/HupaPlaceManager.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/place/MainPresenterPlace.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=836369&r1=836368&r2=836369&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
Sun Nov 15 14:56:44 2009
@@ -109,6 +109,7 @@
         public HasChangeHandlers getRowsPerPageChange();
     }
 
+    private String searchValue;
     private User user;
     private IMAPFolder folder;
     private DispatchAsync dispatcher;
@@ -376,14 +377,15 @@
         display.reloadData();  
     }
     
-    public void revealDisplay(User user, IMAPFolder folder) {
+    public void revealDisplay(User user, IMAPFolder folder, String searchValue) {
         this.user = user;
        
-        if (this.folder == null || this.folder.getFullName().equals(folder.getFullName())
== false) {
+        if (this.folder == null || this.folder.getFullName().equals(folder.getFullName())
== false 
+                || (searchValue == null && this.searchValue != null) || (searchValue
!= null && searchValue.equals(this.searchValue) == false)) {
             display.reset();
             display.deselectAllMessages();
         }
-        
+        this.searchValue = searchValue;
         this.folder = folder;
         revealDisplay();
     }

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=836369&r1=836368&r2=836369&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 Sun
Nov 15 14:56:44 2009
@@ -138,6 +138,7 @@
     private CachingDispatchAsync cachingDispatcher;
     private User user;
     private IMAPFolder folder;
+    private String searchValue;
     private IMAPMessageListPresenter messageListPresenter;
     private IMAPMessagePresenter messagePresenter;
     private MessageSendPresenter sendPresenter;
@@ -232,10 +233,13 @@
         return tList;
     }
 
-    private void showMessageTable(User user, IMAPFolder folder) {
+    private void showMessageTable(User user, IMAPFolder folder, String searchValue) {
         this.user = user;
         this.folder = folder;
-        messageListPresenter.revealDisplay(user, folder);
+        this.searchValue = searchValue;
+        firePresenterChangedEvent();
+
+        messageListPresenter.revealDisplay(user, folder, searchValue);
     }
 
     private void showMessage(User user, IMAPFolder folder, Message message, MessageDetails
details) {
@@ -276,7 +280,7 @@
         registerHandler(eventBus.addHandler(LoadMessagesEvent.TYPE, new LoadMessagesEventHandler()
{
 
             public void onLoadMessagesEvent(LoadMessagesEvent loadMessagesEvent) {
-                showMessageTable(loadMessagesEvent.getUser(), loadMessagesEvent.getFolder());
+                showMessageTable(loadMessagesEvent.getUser(), loadMessagesEvent.getFolder(),
loadMessagesEvent.getSearchValue());
             }
 
         }));
@@ -326,7 +330,7 @@
         registerHandler(eventBus.addHandler(SentMessageEvent.TYPE, new SentMessageEventHandler()
{
 
             public void onSentMessageEvent(SentMessageEvent ev) {
-                showMessageTable(user, folder);
+                showMessageTable(user, folder, searchValue);
             }
 
         }));
@@ -350,7 +354,7 @@
             public void onFolderSelectionEvent(FolderSelectionEvent event) {
                 user = event.getUser();
                 folder = event.getFolder();
-                showMessageTable(user, event.getFolder());
+                showMessageTable(user, event.getFolder(), searchValue);
             }
 
         }));
@@ -370,7 +374,7 @@
         registerHandler(eventBus.addHandler(BackEvent.TYPE, new BackEventHandler() {
 
             public void onBackEvent(BackEvent event) {
-                showMessageTable(user, folder);
+                showMessageTable(user, folder, searchValue);
             }
 
         }));
@@ -537,7 +541,7 @@
     
     @Override
     protected void onRevealDisplay() {
-        showMessageTable(user, folder);
+        showMessageTable(user, folder, searchValue);
         super.onRevealDisplay();
     }
     

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MainView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MainView.java?rev=836369&r1=836368&r2=836369&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MainView.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MainView.java Sun Nov
15 14:56:44 2009
@@ -242,7 +242,7 @@
                 oracle.add(from.trim());
             }
         }
-        searchBox.setText("");
+        //searchBox.setText("");
     }
 
     /*

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/place/HupaPlaceManager.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/place/HupaPlaceManager.java?rev=836369&r1=836368&r2=836369&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/place/HupaPlaceManager.java
(original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/place/HupaPlaceManager.java
Sun Nov 15 14:56:44 2009
@@ -33,7 +33,7 @@
 
     @Inject
     public HupaPlaceManager(EventBus eventBus, LoginPresenterPlace loginPresenterPlace, MainPresenterPlace
mainPresenterPlace,IMAPMessageListPresenterPlace messageListPresenterPlace, IMAPMessagePresenterPlace
imapMessagePresenterPlace, MessageSendPresenterPlace sendPresenterPlace) {
-        super(eventBus, loginPresenterPlace, messageListPresenterPlace, imapMessagePresenterPlace,
sendPresenterPlace);
+        super(eventBus, loginPresenterPlace, mainPresenterPlace, messageListPresenterPlace,
imapMessagePresenterPlace, sendPresenterPlace);
     }
 
 }

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/place/MainPresenterPlace.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/place/MainPresenterPlace.java?rev=836369&r1=836368&r2=836369&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/place/MainPresenterPlace.java
(original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/place/MainPresenterPlace.java
Sun Nov 15 14:56:44 2009
@@ -19,7 +19,10 @@
 package org.apache.hupa.client.mvp.place;
 
 import org.apache.hupa.client.mvp.MainPresenter;
+import org.eclipse.swt.widgets.Display;
 
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.ClickEvent;
 import com.google.inject.Inject;
 import com.google.inject.Provider;
 
@@ -28,6 +31,8 @@
 
 public class MainPresenterPlace extends ProvidedPresenterPlace<MainPresenter>{
 
+    private static String FOLDER = "folder";
+    private static String SEARCH = "search";
     @Inject
     public MainPresenterPlace(Provider<MainPresenter> presenter) {
         super(presenter);
@@ -40,13 +45,21 @@
 
     @Override
     protected void preparePresenter(PlaceRequest request, MainPresenter presenter) {
-        // TODO Auto-generated method stub
+        String searchValue = request.getParameter(SEARCH, "");
+        presenter.getDisplay().getSearchValue().setValue(searchValue);
+        GWT.log("Pres=" + request.toString(),null);
         super.preparePresenter(request, presenter);
     }
 
     @Override
     protected PlaceRequest prepareRequest(PlaceRequest request, MainPresenter presenter)
{
-        // TODO Auto-generated method stub
+        String searchValue = presenter.getDisplay().getSearchValue().getValue();
+        if (searchValue != null && searchValue.length() > 0) {
+            request = request.with(SEARCH, searchValue);
+
+        }
+        GWT.log("Req=" + request.toString(),null);
+
         return super.prepareRequest(request, presenter);
     }
     



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