james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r834463 - in /james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp: AppPresenter.java IMAPMessageListPresenter.java IMAPMessageListView.java IMAPMessagePresenter.java MainPresenter.java MessageSendPresenter.java
Date Tue, 10 Nov 2009 13:49:03 GMT
Author: norman
Date: Tue Nov 10 13:49:03 2009
New Revision: 834463

URL: http://svn.apache.org/viewvc?rev=834463&view=rev
Log:
Better handling of history

Modified:
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/AppPresenter.java
    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/IMAPMessageListView.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/AppPresenter.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/AppPresenter.java?rev=834463&r1=834462&r2=834463&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/AppPresenter.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/AppPresenter.java Tue
Nov 10 13:49:03 2009
@@ -22,8 +22,6 @@
 
 import net.customware.gwt.dispatch.client.DispatchAsync;
 import net.customware.gwt.presenter.client.EventBus;
-import net.customware.gwt.presenter.client.place.PlaceRequest;
-import net.customware.gwt.presenter.client.place.PlaceRequestEvent;
 import net.customware.gwt.presenter.client.widget.WidgetContainerDisplay;
 import net.customware.gwt.presenter.client.widget.WidgetContainerPresenter;
 
@@ -78,30 +76,26 @@
     private DispatchAsync dispatcher;
     private User user;
     private ServerStatus serverStatus = ServerStatus.Available;
-
+    private MainPresenter mainPresenter;
+    private LoginPresenter loginPresenter;
+    
     @Inject
     public AppPresenter(Display display, DispatchAsync dispatcher,final EventBus bus, LoginPresenter
loginPresenter, MainPresenter mainPresenter) {
         super(display,bus, loginPresenter, mainPresenter);
+        this.mainPresenter = mainPresenter;
+        this.loginPresenter = loginPresenter;
         this.dispatcher = dispatcher;  
     }
 
     private void showMain(User user) {
         display.showTopNavigation(true);
-        PlaceRequest request = new PlaceRequest("Main");
-        request = request.with("user", user.getName());
-        
-        eventBus.fireEvent(new PlaceRequestEvent(request));
+        mainPresenter.revealDisplay(user);
     }
     
     
     private void showLogin(String username) {
         display.showTopNavigation(false);
-        PlaceRequest request = new PlaceRequest("Login");
-        if (username != null) {
-            request = request.with("user", username);
-        }
-        
-        eventBus.fireEvent(new PlaceRequestEvent(request));
+        loginPresenter.revealDisplay();
     }
 
     @Override

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=834463&r1=834462&r2=834463&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
Tue Nov 10 13:49:03 2009
@@ -34,6 +34,8 @@
 import org.apache.hupa.shared.data.Message.IMAPFlag;
 import org.apache.hupa.shared.events.DecreaseUnseenEvent;
 import org.apache.hupa.shared.events.ExpandMessageEvent;
+import org.apache.hupa.shared.events.FolderSelectionEvent;
+import org.apache.hupa.shared.events.FolderSelectionEventHandler;
 import org.apache.hupa.shared.events.IncreaseUnseenEvent;
 import org.apache.hupa.shared.events.MoveMessageEvent;
 import org.apache.hupa.shared.events.MoveMessageEventHandler;
@@ -47,7 +49,6 @@
 import org.apache.hupa.shared.rpc.SetFlag;
 import org.apache.hupa.widgets.ui.HasEnable;
 
-import com.google.gwt.core.client.GWT;
 import com.google.gwt.event.dom.client.ClickEvent;
 import com.google.gwt.event.dom.client.ClickHandler;
 import com.google.gwt.event.dom.client.HasClickHandlers;
@@ -75,7 +76,7 @@
         public HasClickHandlers getDeleteAllClick();
         public HasEnable getDeleteEnable();
 
-        public void reloadData(User user, IMAPFolder folder,String searchValue);
+        public void reloadData();
         public void removeMessages(ArrayList<Message> messages);
         public ArrayList<Message> getSelectedMessages();
         public void reset();
@@ -98,7 +99,6 @@
     private ArrayList<HandlerRegistration> regList = new ArrayList<HandlerRegistration>();
     private User user;
     private IMAPFolder folder;
-    private String searchValue;
     private DispatchAsync dispatcher;
     private ShowMessageTableListener tableListener = new ShowMessageTableListener();
     
@@ -205,7 +205,6 @@
                 }
                 dispatcher.execute(new SetFlag(folder, IMAPFlag.SEEN, true, uids), new HupaCallback<GenericResult>(dispatcher,
eventBus) {
                     public void callback(GenericResult result) {
-                        GWT.log("S="+selectedMessages.size(), null);
                         for (int i = 0; i < selectedMessages.size(); i++) {
                             Message m = selectedMessages.get(i);
                             if (m.getFlags().contains(IMAPFlag.SEEN) == false) {
@@ -250,7 +249,15 @@
             
             
         }));
-        
+        registerHandler(eventBus.addHandler(FolderSelectionEvent.TYPE, new FolderSelectionEventHandler()
{
+
+            public void onFolderSelectionEvent(FolderSelectionEvent event) {
+                folder = event.getFolder();
+                user = event.getUser();
+                firePresenterRevealedEvent(true);
+            }
+            
+        }));
         regList.add(display.getDataTableSelection().addRowSelectionHandler(new RowSelectionHandler()
{
                 public void onRowSelection(RowSelectionEvent event) {
                     if (event.getSelectedRows().size() == 0) {
@@ -325,17 +332,21 @@
 
     @Override
     protected void onRevealDisplay() {
-        display.reset();
-        display.deselectAllMessages();
-        display.reloadData(user, folder, searchValue);
+        //display.reset();
+        //display.deselectAllMessages();
+        display.reloadData();
         
     }
     
-    public void reveal(User user, IMAPFolder folder, String searchValue) {
+    public void revealDisplay(User user, IMAPFolder folder) {
         this.user = user;
+        if (this.folder == null || this.folder.getFullName().equals(folder.getFullName())
== false) {
+            display.reset();
+            display.deselectAllMessages();
+        }
         this.folder = folder;
-        this.searchValue = searchValue;
         firePresenterChangedEvent();
+        revealDisplay();
     }
 
 }

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListView.java?rev=834463&r1=834462&r2=834463&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListView.java
(original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListView.java
Tue Nov 10 13:49:03 2009
@@ -34,9 +34,7 @@
 import org.apache.hupa.client.widgets.EnableButton;
 import org.apache.hupa.client.widgets.PagingOptions;
 import org.apache.hupa.client.widgets.DragRefetchPagingScrollTable.DragHandlerFactory;
-import org.apache.hupa.shared.data.IMAPFolder;
 import org.apache.hupa.shared.data.Message;
-import org.apache.hupa.shared.data.User;
 import org.apache.hupa.shared.data.Message.IMAPFlag;
 import org.apache.hupa.widgets.ui.HasEnable;
 import org.cobogw.gwt.user.client.ui.Button;
@@ -426,13 +424,8 @@
         return mailTable.getDataTable();
     }
     
-    /*
-     * (non-Javadoc)
-     * @see org.apache.hupa.client.mvp.IMAPMessageListPresenter.Display#reloadData(org.apache.hupa.shared.data.User,
org.apache.hupa.shared.data.IMAPFolder, java.lang.String)
-     */
-    public void reloadData(User user, IMAPFolder folder,String searchValue) {
-        cTableModel.clearCache();
-        mailTable.getTableModel().setRowCount(MutableTableModel.UNKNOWN_ROW_COUNT);
+
+    public void reloadData() {
         mailTable.reloadPage();
     }
     
@@ -443,9 +436,8 @@
     public void reset() {
         pageBox.setSelectedIndex(0);
         cTableModel.clearCache();
-        cTableModel.setRowCount(0);
-        mailTable.reloadPage();
-        options.reset();
+        cTableModel.setRowCount(CachedTableModel.UNKNOWN_ROW_COUNT);
+        mailTable.gotoFirstPage();
     }
 
     /*
@@ -467,25 +459,6 @@
 
     /*
      * (non-Javadoc)
-     * @see net.customware.gwt.presenter.client.Display#startProcessing()
-     */
-    public void startProcessing() {
-        // TODO Auto-generated method stub
-        
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see net.customware.gwt.presenter.client.Display#stopProcessing()
-     */
-    public void stopProcessing() {
-        // TODO Auto-generated method stub
-        
-    }
-
-
-    /*
-     * (non-Javadoc)
      * @see org.apache.hupa.client.mvp.IMAPMessageListPresenter.Display#getDeleteClick()
      */
     public HasClickHandlers getDeleteClick() {

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=834463&r1=834462&r2=834463&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
Tue Nov 10 13:49:03 2009
@@ -86,13 +86,14 @@
     }
 
     
-    public void reveal(User user, IMAPFolder folder, Message message, MessageDetails messageDetails)
{
+    public void revealDisplay(User user, IMAPFolder folder, Message message, MessageDetails
messageDetails) {
         this.message = message;
         this.messageDetails = messageDetails;
         this.folder = folder;
         this.user = user;
         updateDisplay();
         firePresenterChangedEvent();
+        revealDisplay();
     }
 
     private void 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=834463&r1=834462&r2=834463&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 Tue
Nov 10 13:49:03 2009
@@ -24,8 +24,6 @@
 import java.util.Comparator;
 
 import net.customware.gwt.presenter.client.EventBus;
-import net.customware.gwt.presenter.client.place.PlaceRequest;
-import net.customware.gwt.presenter.client.place.PlaceRequestEvent;
 import net.customware.gwt.presenter.client.widget.WidgetContainerDisplay;
 import net.customware.gwt.presenter.client.widget.WidgetContainerPresenter;
 
@@ -139,7 +137,6 @@
     private CachingDispatchAsync cachingDispatcher;
     private User user;
     private IMAPFolder folder;
-    private String searchValue;
     private IMAPMessageListPresenter messageListPresenter;
     private IMAPMessagePresenter messagePresenter;
     private MessageSendPresenter sendPresenter;
@@ -233,42 +230,32 @@
         return tList;
     }
 
-    private void showMessageTable(User user, IMAPFolder folder, String searchValue, boolean
refresh) {
+    private void showMessageTable(User user, IMAPFolder folder) {
         this.user = user;
         this.folder = folder;
-        this.searchValue = searchValue;
-        messageListPresenter.reveal(user, folder, searchValue);
-        PlaceRequest request = new PlaceRequest("MessageList");
-        eventBus.fireEvent(new PlaceRequestEvent(request));
+        messageListPresenter.revealDisplay(user, folder);
     }
 
     private void showMessage(User user, IMAPFolder folder, Message message, MessageDetails
details) {
-        messagePresenter.reveal(user, folder, message, details);
-        PlaceRequest request = new PlaceRequest("IMAPMessage");
-        eventBus.fireEvent(new PlaceRequestEvent(request));
+        messagePresenter.revealDisplay(user, folder, message, details);
     }
 
     private void showNewMessage() {
-        sendPresenter.reveal(user);
-        PlaceRequest request = new PlaceRequest("MessageSend");
-        eventBus.fireEvent(new PlaceRequestEvent(request));
+        sendPresenter.revealDisplay(user);
     }
 
     private void showForwardMessage(ForwardMessageEvent event) {
-        sendPresenter.reveal(event.getUser(), event.getFolder(), event.getMessage(), event.getMessageDetails(),
Type.FORWARD);
-        PlaceRequest request = new PlaceRequest("MessageSend");
-        eventBus.fireEvent(new PlaceRequestEvent(request));
+        sendPresenter.revealDisplay(event.getUser(), event.getFolder(), event.getMessage(),
event.getMessageDetails(), Type.FORWARD);
     }
 
     private void showReplyMessage(ReplyMessageEvent event) {
         if (event.getReplyAll()) {
-            sendPresenter.reveal(event.getUser(), event.getFolder(), event.getMessage(),
event.getMessageDetails(), Type.REPLY_ALL);
+            sendPresenter.revealDisplay(event.getUser(), event.getFolder(), event.getMessage(),
event.getMessageDetails(), Type.REPLY_ALL);
         } else {
-            sendPresenter.reveal(event.getUser(), event.getFolder(), event.getMessage(),
event.getMessageDetails(), Type.REPLY);
+            sendPresenter.revealDisplay(event.getUser(), event.getFolder(), event.getMessage(),
event.getMessageDetails(), Type.REPLY);
 
         }
-        PlaceRequest request = new PlaceRequest("MessageSend");
-        eventBus.fireEvent(new PlaceRequestEvent(request));
+        sendPresenter.revealDisplay();
     }
 
     /**
@@ -287,7 +274,7 @@
         registerHandler(eventBus.addHandler(LoadMessagesEvent.TYPE, new LoadMessagesEventHandler()
{
 
             public void onLoadMessagesEvent(LoadMessagesEvent loadMessagesEvent) {
-                showMessageTable(loadMessagesEvent.getUser(), loadMessagesEvent.getFolder(),
loadMessagesEvent.getSearchValue(), true);
+                showMessageTable(loadMessagesEvent.getUser(), loadMessagesEvent.getFolder());
             }
 
         }));
@@ -337,7 +324,7 @@
         registerHandler(eventBus.addHandler(SentMessageEvent.TYPE, new SentMessageEventHandler()
{
 
             public void onSentMessageEvent(SentMessageEvent ev) {
-                showMessageTable(user, folder, searchValue, false);
+                showMessageTable(user, folder);
             }
 
         }));
@@ -361,7 +348,7 @@
             public void onFolderSelectionEvent(FolderSelectionEvent event) {
                 user = event.getUser();
                 folder = event.getFolder();
-                showMessageTable(user, event.getFolder(), searchValue, true);
+                showMessageTable(user, event.getFolder());
             }
 
         }));
@@ -381,7 +368,7 @@
         registerHandler(eventBus.addHandler(BackEvent.TYPE, new BackEventHandler() {
 
             public void onBackEvent(BackEvent event) {
-                showMessageTable(user, folder, searchValue, false);
+                showMessageTable(user, folder);
             }
 
         }));
@@ -535,11 +522,17 @@
         super.onUnbind();
     }
 
+    
+    public void revealDisplay(User user) {
+        this.user = user;
+        loadTreeItems();  
+        firePresenterChangedEvent();
+        revealDisplay();
+    }
+    
     @Override
     protected void onRevealDisplay() {
-        // load IMAPFolder and the message table
-        loadTreeItems();
-        showMessageTable(user, folder, null, true);
+        showMessageTable(user, folder);
 
         super.onRevealDisplay();
     }

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=834463&r1=834462&r2=834463&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
Tue Nov 10 13:49:03 2009
@@ -327,7 +327,7 @@
      * @param oldDetails the olddetails ( if there are any)
      * @param type the type 
      */
-    public void reveal(User user, IMAPFolder folder, Message oldmessage, MessageDetails oldDetails,
Type type) {
+    public void revealDisplay(User user, IMAPFolder folder, Message oldmessage, MessageDetails
oldDetails, Type type) {
         this.oldmessage = oldmessage;
         this.oldDetails = oldDetails;
         this.folder = folder;
@@ -366,6 +366,7 @@
             }
         }
         firePresenterChangedEvent();
+        revealDisplay();
     }
     
     /**
@@ -373,8 +374,8 @@
      * 
      * @param user
      */
-    public void reveal(User user) {
-        reveal(user,null,null,null, Type.NEW);
+    public void revealDisplay(User user) {
+        revealDisplay(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