james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r834037 - in /james/hupa/trunk/client/src/main/java/org/apache/hupa/client: ./ gin/ mvp/
Date Mon, 09 Nov 2009 12:44:46 GMT
Author: norman
Date: Mon Nov  9 12:44:44 2009
New Revision: 834037

URL: http://svn.apache.org/viewvc?rev=834037&view=rev
Log:
Work in progress for using PageRequestEvent for navigating

Added:
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/HupaPlaceManager.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/IMAPMessagePresenterPlace.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/LoginPresenterPlace.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MainPresenterPlace.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendPresenterPlace.java
Modified:
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaCallback.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/gin/HupaClientModule.java
    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/AppView.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/IMAPMessagePresenter.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/LoginPresenter.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/MessageTableModel.java

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaCallback.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaCallback.java?rev=834037&r1=834036&r2=834037&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaCallback.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaCallback.java Mon Nov
 9 12:44:44 2009
@@ -20,6 +20,7 @@
 package org.apache.hupa.client;
 
 import net.customware.gwt.dispatch.client.DispatchAsync;
+import net.customware.gwt.presenter.client.Display;
 import net.customware.gwt.presenter.client.EventBus;
 
 import org.apache.hupa.shared.events.LogoutEvent;
@@ -38,14 +39,14 @@
     private EventBus eventBus = null;
     private ServerStatusEvent available = new ServerStatusEvent(ServerStatus.Available);

     private ServerStatusEvent unavailable = new ServerStatusEvent(ServerStatus.Unavailable);

-    private HupaWidgetDisplay display = null;
+    private Display display = null;
 
     @Inject
-    public HupaCallback(DispatchAsync dispatcher, EventBus bus, HupaWidgetDisplay display)
{
+    public HupaCallback(DispatchAsync dispatcher, EventBus bus, Display display) {
         this(dispatcher, bus);
         this.display = display;
         
-        this.display.startProcessing();
+        //this.display.startProcessing();
     }
     
     @Inject
@@ -84,8 +85,8 @@
 
             private void finish() {
                 callbackError(originalCaught);
-                if (display != null)
-                    display.stopProcessing();
+                //if (display != null)
+                    //display.stopProcessing();
             }
         });
     }
@@ -99,8 +100,8 @@
         // Execute the original method
         callback(result);
         // If display is being used, stop it
-        if (display != null)
-            display.stopProcessing();
+        //if (display != null)
+            //display.stopProcessing();
     }
     
     /**

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/gin/HupaClientModule.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/gin/HupaClientModule.java?rev=834037&r1=834036&r2=834037&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/gin/HupaClientModule.java
(original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/gin/HupaClientModule.java
Mon Nov  9 12:44:44 2009
@@ -28,9 +28,13 @@
 import org.apache.hupa.client.dnd.PagingScrollTableRowDragController;
 import org.apache.hupa.client.mvp.AppPresenter;
 import org.apache.hupa.client.mvp.AppView;
+import org.apache.hupa.client.mvp.HupaPlaceManager;
 import org.apache.hupa.client.mvp.IMAPMessageListPresenter;
+import org.apache.hupa.client.mvp.IMAPMessageListPresenterPlace;
 import org.apache.hupa.client.mvp.IMAPMessageListView;
 import org.apache.hupa.client.mvp.IMAPMessagePresenter;
+import org.apache.hupa.client.mvp.LoginPresenterPlace;
+import org.apache.hupa.client.mvp.MainPresenterPlace;
 import org.apache.hupa.client.mvp.MessageSendPresenter;
 import org.apache.hupa.client.mvp.MessageSendView;
 import org.apache.hupa.client.mvp.IMAPMessageView;
@@ -47,7 +51,7 @@
     @Override
     protected void configure() {        
         bind(EventBus.class).to(DefaultEventBus.class).in(Singleton.class);
-        bind(PlaceManager.class).in(Singleton.class);
+        bind(PlaceManager.class).to(HupaPlaceManager.class);
         bindPresenter(LoginPresenter.class,LoginPresenter.Display.class, LoginView.class);
         bindPresenter(IMAPMessageListPresenter.class,IMAPMessageListPresenter.Display.class,IMAPMessageListView.class);
         bindPresenter(IMAPMessagePresenter.class,IMAPMessagePresenter.Display.class,IMAPMessageView.class);
@@ -57,6 +61,9 @@
         bind(CachingDispatchAsync.class);
         bind(PagingScrollTableRowDragController.class).in(Singleton.class);
         bind(MessageTableModel.class).in(Singleton.class);
+        bind(LoginPresenterPlace.class).in(Singleton.class);
+        bind(MainPresenterPlace.class).in(Singleton.class);
+        bind(IMAPMessageListPresenterPlace.class).in(Singleton.class);
     }
 
 }

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=834037&r1=834036&r2=834037&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 Mon
Nov  9 12:44:44 2009
@@ -22,8 +22,10 @@
 
 import net.customware.gwt.dispatch.client.DispatchAsync;
 import net.customware.gwt.presenter.client.EventBus;
-import net.customware.gwt.presenter.client.widget.WidgetDisplay;
-import net.customware.gwt.presenter.client.widget.WidgetPresenter;
+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;
 
 import org.apache.hupa.client.HupaCallback;
 import org.apache.hupa.shared.data.User;
@@ -53,23 +55,21 @@
 import com.google.gwt.user.client.Window.ClosingHandler;
 import com.google.gwt.user.client.rpc.AsyncCallback;
 import com.google.gwt.user.client.ui.HasText;
-import com.google.gwt.user.client.ui.Widget;
 import com.google.inject.Inject;
 
-public class AppPresenter extends WidgetPresenter<AppPresenter.Display>{
+public class AppPresenter extends WidgetContainerPresenter<AppPresenter.Display>{
 
     private static final int NOOP_INTERVAL = 15000;
 
-    public interface Display extends WidgetDisplay {
+    public interface Display extends WidgetContainerDisplay {
         public HasClickHandlers getLogoutClick();
         public void showTopNavigation(boolean show);
-        public void setMain(Widget w);
         public HasText getUserText();
         public void setServerStatus(ServerStatus status);
     }
     
-    private LoginPresenter loginPresenter;
-    private MainPresenter mainPresenter;
+    //private LoginPresenter loginPresenter;
+    //private MainPresenter mainPresenter;
     private Timer noopTimer = new NoopTimer();
 
     private DispatchAsync dispatcher;
@@ -78,29 +78,32 @@
 
     @Inject
     public AppPresenter(Display display, DispatchAsync dispatcher,final EventBus bus, LoginPresenter
loginPresenter, MainPresenter mainPresenter) {
-        super(display,bus);
-        this.dispatcher = dispatcher;
-        this.loginPresenter = loginPresenter;
-        this.mainPresenter = mainPresenter;        
+        super(display,bus, loginPresenter, mainPresenter);
+        this.dispatcher = dispatcher;  
     }
 
     private void showMain(User user) {
-        loginPresenter.unbind();
-        mainPresenter.bind(user);
         display.showTopNavigation(true);
-        display.setMain(mainPresenter.getDisplay().asWidget());
+        PlaceRequest request = new PlaceRequest("Main");
+        request = request.with("user", user.getName());
+        
+        eventBus.fireEvent(new PlaceRequestEvent(request));
     }
     
     
-    private void showLogin() {
-        mainPresenter.unbind();
-        loginPresenter.bind();
+    private void showLogin(String username) {
         display.showTopNavigation(false);
-        display.setMain(loginPresenter.getDisplay().asWidget());
+        PlaceRequest request = new PlaceRequest("Login");
+        if (username != null) {
+            request = request.with("user", username);
+        }
+        
+        eventBus.fireEvent(new PlaceRequestEvent(request));
     }
 
     @Override
     protected void onBind() {
+        super.onBind();
         registerHandler(eventBus.addHandler(LoginEvent.TYPE, new LoginEventHandler() {
 
             public void onLogin(LoginEvent event) {
@@ -115,7 +118,12 @@
         registerHandler(eventBus.addHandler(LogoutEvent.TYPE, new LogoutEventHandler() {
 
             public void onLogout(LogoutEvent event) {
-                showLogin();
+                User u = event.getUser();
+                String username = null;
+                if (u != null) {
+                    username = u.getName();
+                }
+                showLogin(username);
                 noopTimer.cancel();
             }
             
@@ -161,12 +169,6 @@
     }
     
 
-    @Override
-    protected void onUnbind() {
-        loginPresenter.unbind();
-        mainPresenter.unbind();
-    }
-
     private void doLogout() {
         if (user != null) {
             dispatcher.execute(new LogoutUser(), new HupaCallback<LogoutUserResult>(dispatcher,
eventBus) {
@@ -182,7 +184,7 @@
             public void onFailure(Throwable caught) {
                 serverStatus = ServerStatus.Unavailable;
                 display.setServerStatus(serverStatus);
-                showLogin();
+                showLogin(null);
             }
             public void onSuccess(CheckSessionResult result) {
                 serverStatus = ServerStatus.Available;
@@ -190,7 +192,7 @@
                 if (result.isValid()) {
                     eventBus.fireEvent(new LoginEvent(result.getUser()));
                 } else {
-                    showLogin();
+                    showLogin(null);
                 }
             }
         });
@@ -212,10 +214,5 @@
         }
     }
 
-    @Override
-    protected void onRevealDisplay() {
-        // TODO Auto-generated method stub
-        
-    };
-
+    
 }

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/AppView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/AppView.java?rev=834037&r1=834036&r2=834037&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/AppView.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/AppView.java Mon Nov
 9 12:44:44 2009
@@ -111,7 +111,6 @@
     }
 
     public void setMain(Widget w) {
-        mainPanel.setWidget(w);
     }
 
     public Widget asWidget() {
@@ -161,8 +160,36 @@
         return userName;
     }
 
+    /*
+     * (non-Javadoc)
+     * @see org.apache.hupa.client.mvp.AppPresenter.Display#setServerStatus(org.apache.hupa.shared.events.ServerStatusEvent.ServerStatus)
+     */
     public void setServerStatus(ServerStatus status) {
         serverStatusPanel.setStatus(status);
     }
 
+    /*
+     * (non-Javadoc)
+     * @see net.customware.gwt.presenter.client.widget.WidgetContainerDisplay#addWidget(com.google.gwt.user.client.ui.Widget)
+     */
+    public void addWidget(Widget widget) {
+        mainPanel.setWidget(widget);
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see net.customware.gwt.presenter.client.widget.WidgetContainerDisplay#removeWidget(com.google.gwt.user.client.ui.Widget)
+     */
+    public void removeWidget(Widget widget) {
+        mainPanel.remove(widget);
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see net.customware.gwt.presenter.client.widget.WidgetContainerDisplay#showWidget(com.google.gwt.user.client.ui.Widget)
+     */
+    public void showWidget(Widget widget) {
+        mainPanel.setWidget(widget);
+    }
+
 }

Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/HupaPlaceManager.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/HupaPlaceManager.java?rev=834037&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/HupaPlaceManager.java
(added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/HupaPlaceManager.java
Mon Nov  9 12:44:44 2009
@@ -0,0 +1,34 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.hupa.client.mvp;
+
+import com.google.inject.Inject;
+
+import net.customware.gwt.presenter.client.EventBus;
+import net.customware.gwt.presenter.client.place.DefaultPlaceManager;
+
+public class HupaPlaceManager extends DefaultPlaceManager{
+
+    @Inject
+    public HupaPlaceManager(EventBus eventBus, LoginPresenterPlace loginPresenterPlace, MainPresenterPlace
mainPresenterPlace,IMAPMessageListPresenterPlace messageListPresenterPlace, IMAPMessagePresenterPlace
imapMessagePresenterPlace) {
+        super(eventBus, loginPresenterPlace, mainPresenterPlace, messageListPresenterPlace,
imapMessagePresenterPlace );
+    }
+
+}

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=834037&r1=834036&r2=834037&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 12:44:44 2009
@@ -101,7 +101,6 @@
     private String searchValue;
     private DispatchAsync dispatcher;
     private ShowMessageTableListener tableListener = new ShowMessageTableListener();
-    private boolean isBound = false;    
     
     @Inject
     public IMAPMessageListPresenter(IMAPMessageListPresenter.Display display,EventBus bus,DispatchAsync
dispatcher) {
@@ -268,8 +267,8 @@
             
             
         }));
+        
         display.addTableListener(tableListener);
-        isBound = true;
     }
 
     
@@ -289,18 +288,15 @@
         }); 
     }
     
-    public void bind(User user, IMAPFolder folder) {
+    public void setUser(User user) {
         this.user = user;
-        this.folder = folder;
-        display.setPostFetchMessageCount(user.getSettings().getPostFetchMessageCount());
-        // workaround
-        if (isBound == false) {
-            bind();
-        }
-        
-        //refreshDisplay();
     }
 
+    public void setFolder(IMAPFolder folder) {
+        this.folder = folder;
+    }
+    
+   
 
     /*
      * (non-Javadoc)
@@ -311,7 +307,6 @@
         for (int i = 0; i < regList.size(); i++) {
             regList.get(i).removeHandler();
         }
-        isBound = false;
     }
 
     
@@ -341,10 +336,12 @@
     protected void onRevealDisplay() {
         display.reset();
         display.deselectAllMessages();
-
         display.reloadData(user, folder, searchValue);
-        display.redraw();      
         
+    }
+
+    public void setSearchValue(String searchValue) {
+        this.searchValue = searchValue;
     };
     
   

Added: 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=834037&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListPresenterPlace.java
(added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessageListPresenterPlace.java
Mon Nov  9 12:44:44 2009
@@ -0,0 +1,54 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+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>{
+
+    @Inject
+    public IMAPMessageListPresenterPlace(Provider<IMAPMessageListPresenter> presenter)
{
+        super(presenter);
+    }
+
+    @Override
+    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=834037&r1=834036&r2=834037&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 12:44:44 2009
@@ -78,7 +78,6 @@
     private CachingDispatchAsync dispatcher;
     private IMAPFolder folder;
     private User user;
-    private boolean isBound = false;
 
     @Inject
     private IMAPMessagePresenter(IMAPMessagePresenter.Display display,EventBus bus, CachingDispatchAsync
dispatcher) {
@@ -91,11 +90,7 @@
         this.message = message;
         this.messageDetails = messageDetails;
         this.folder = folder;
-        this.user = user;
-        if (isBound == false) { 
-            bind();
-        }
-        updateDisplay();
+        this.user = user;        
     }
 
     private void updateDisplay() {
@@ -168,19 +163,16 @@
             }
             
         }));
-        isBound = true;
     }
 
 
     @Override
     protected void onUnbind() {
-        isBound = false;
     }
 
 
     @Override
     protected void onRevealDisplay() {
-        // TODO Auto-generated method stub
-        
+        updateDisplay();
     }
 }

Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessagePresenterPlace.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessagePresenterPlace.java?rev=834037&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessagePresenterPlace.java
(added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/IMAPMessagePresenterPlace.java
Mon Nov  9 12:44:44 2009
@@ -0,0 +1,38 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+package org.apache.hupa.client.mvp;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+import net.customware.gwt.presenter.client.gin.ProvidedPresenterPlace;
+
+public class IMAPMessagePresenterPlace extends ProvidedPresenterPlace<IMAPMessagePresenter>{
+
+    @Inject
+    public IMAPMessagePresenterPlace(Provider<IMAPMessagePresenter> presenter) {
+        super(presenter);
+    }
+
+    @Override
+    public String getName() {
+        return "IMAPMessage";
+    }
+
+}

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/LoginPresenter.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/LoginPresenter.java?rev=834037&r1=834036&r2=834037&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/LoginPresenter.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/LoginPresenter.java Mon
Nov  9 12:44:44 2009
@@ -60,7 +60,6 @@
         super(display,bus);
         this.dispatcher = dispatcher;
     }
-
     
     /**
      * Try to login the user

Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/LoginPresenterPlace.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/LoginPresenterPlace.java?rev=834037&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/LoginPresenterPlace.java
(added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/LoginPresenterPlace.java
Mon Nov  9 12:44:44 2009
@@ -0,0 +1,48 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.hupa.client.mvp;
+
+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 LoginPresenterPlace extends ProvidedPresenterPlace<LoginPresenter>{
+
+    @Inject
+    public LoginPresenterPlace(Provider<LoginPresenter> presenter) {
+        super(presenter);
+    }
+
+    @Override
+    public String getName() {
+        return "Login";
+    }
+
+    @Override
+    protected void preparePresenter(PlaceRequest request, LoginPresenter presenter) {
+        String user = request.getParameter("user", null);
+        if (user != null) {
+            presenter.getDisplay().getUserNameValue().setValue(user);
+        }
+    }
+
+}

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=834037&r1=834036&r2=834037&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 12:44:44 2009
@@ -25,6 +25,10 @@
 import java.util.List;
 
 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;
 import net.customware.gwt.presenter.client.widget.WidgetPresenter;
 
 import org.apache.hupa.client.CachingDispatchAsync;
@@ -52,6 +56,8 @@
 import org.apache.hupa.shared.events.IncreaseUnseenEventHandler;
 import org.apache.hupa.shared.events.LoadMessagesEvent;
 import org.apache.hupa.shared.events.LoadMessagesEventHandler;
+import org.apache.hupa.shared.events.LoginEvent;
+import org.apache.hupa.shared.events.LoginEventHandler;
 import org.apache.hupa.shared.events.MessagesReceivedEvent;
 import org.apache.hupa.shared.events.MessagesReceivedEventHandler;
 import org.apache.hupa.shared.events.NewMessageEvent;
@@ -80,23 +86,22 @@
 import com.google.gwt.event.logical.shared.HasSelectionHandlers;
 import com.google.gwt.event.logical.shared.SelectionEvent;
 import com.google.gwt.event.logical.shared.SelectionHandler;
+import com.google.gwt.gen2.table.client.TableModelHelper.Request;
 import com.google.gwt.user.client.rpc.AsyncCallback;
 import com.google.gwt.user.client.ui.HasValue;
 import com.google.gwt.user.client.ui.TreeItem;
 import com.google.gwt.user.client.ui.Widget;
 import com.google.inject.Inject;
 
-public class MainPresenter extends WidgetPresenter<MainPresenter.Display> {
+public class MainPresenter extends WidgetContainerPresenter<MainPresenter.Display>
{
 
-    public interface Display extends HupaWidgetDisplay {
+    public interface Display extends WidgetContainerDisplay {
         public HasClickHandlers getSearchClick();
 
         public HasValue<String> getSearchValue();
 
         public void fillOracle(ArrayList<Message> messages);
 
-        public void setCenter(Widget widget);
-
         public HasSelectionHandlers<TreeItem> getTree();
 
         public void bindTreeItems(List<IMAPTreeItem> treeList);
@@ -126,6 +131,8 @@
         public void increaseUnseenMessageCount(IMAPFolder folder, int amount);
 
         public void decreaseUnseenMessageCount(IMAPFolder folder, int amount);
+        public void startProcessing();
+        public void stopProcessing();
     }
 
     private CachingDispatchAsync cachingDispatcher;
@@ -141,7 +148,7 @@
     @Inject
     public MainPresenter(MainPresenter.Display display, EventBus bus, CachingDispatchAsync
cachingDispatcher, IMAPMessageListPresenter messageListPresenter, IMAPMessagePresenter messagePresenter,
             MessageSendPresenter sendPresenter) {
-        super(display, bus);
+        super(display, bus, messageListPresenter, messagePresenter, sendPresenter);
         this.cachingDispatcher = cachingDispatcher;
         this.messageListPresenter = messageListPresenter;
         this.messagePresenter = messagePresenter;
@@ -149,12 +156,15 @@
     }
 
     protected void loadTreeItems() {
+        display.startProcessing();
         cachingDispatcher.execute(new FetchFolders(), new HupaCallback<FetchFoldersResult>(cachingDispatcher,
eventBus, display) {
             public void callback(FetchFoldersResult result) {
                 display.bindTreeItems(createTreeNodes(result.getFolders()));
                 // disable
                 display.getDeleteEnable().setEnabled(false);
                 display.getRenameEnable().setEnabled(false);
+                display.stopProcessing();
+
             }
         });
     }
@@ -227,22 +237,20 @@
         this.folder = folder;
         this.searchValue = searchValue;
 
-        messagePresenter.unbind();
-        sendPresenter.unbind();
-
-        messageListPresenter.bind(user, folder);
-        if (refresh) {
-            messageListPresenter.revealDisplay();
-        }
-        display.setCenter(messageListPresenter.getDisplay().asWidget());
+        PlaceRequest request = new PlaceRequest("MessageList").with("user", user.getName()).with("folder",
folder.getFullName()).with("search", searchValue);
+       
+        eventBus.fireEvent(new PlaceRequestEvent(request));
     }
 
     private void showMessage(User user, IMAPFolder folder, Message message, MessageDetails
details) {
-        sendPresenter.unbind();
-        messageListPresenter.unbind();
+        //sendPresenter.unbind();
+        //messageListPresenter.unbind();
 
         messagePresenter.bind(user, folder, message, details);
-        display.setCenter(messagePresenter.getDisplay().asWidget());
+        PlaceRequest request = new PlaceRequest("IMAPMessage");
+        eventBus.fireEvent(new PlaceRequestEvent(request));
+
+        //display.setCenter(messagePresenter.getDisplay().asWidget());
     }
 
     private void showNewMessage() {
@@ -250,7 +258,7 @@
         messageListPresenter.unbind();
 
         sendPresenter.bind(user, Type.NEW);
-        display.setCenter(sendPresenter.getDisplay().asWidget());
+        //display.setCenter(sendPresenter.getDisplay().asWidget());
     }
 
     private void showForwardMessage(ForwardMessageEvent event) {
@@ -258,7 +266,7 @@
         messageListPresenter.unbind();
 
         sendPresenter.bind(event.getUser(), event.getFolder(), event.getMessage(), event.getMessageDetails(),
Type.FORWARD);
-        display.setCenter(sendPresenter.getDisplay().asWidget());
+        //display.setCenter(sendPresenter.getDisplay().asWidget());
     }
 
     private void showReplyMessage(ReplyMessageEvent event) {
@@ -271,7 +279,7 @@
             sendPresenter.bind(event.getUser(), event.getFolder(), event.getMessage(), event.getMessageDetails(),
Type.REPLY);
 
         }
-        display.setCenter(sendPresenter.getDisplay().asWidget());
+        //display.setCenter(sendPresenter.getDisplay().asWidget());
     }
 
     private void reset() {
@@ -280,17 +288,9 @@
     }
 
 
-    public void bind(User user) {
-        this.user = user;
-        folder = new IMAPFolder(user.getSettings().getInboxFolderName());
-
-        bind();
-        revealDisplay();
-    }
-
     @Override
     protected void onBind() {
-
+        super.onBind();
         registerHandler(eventBus.addHandler(LoadMessagesEvent.TYPE, new LoadMessagesEventHandler()
{
 
             public void onLoadMessagesEvent(LoadMessagesEvent loadMessagesEvent) {
@@ -363,6 +363,8 @@
         registerHandler(eventBus.addHandler(FolderSelectionEvent.TYPE, new FolderSelectionEventHandler()
{
 
             public void onFolderSelectionEvent(FolderSelectionEvent event) {
+                user = event.getUser();
+                folder = event.getFolder();
                 showMessageTable(user, event.getFolder(), searchValue, true);
             }
 
@@ -517,15 +519,22 @@
             }
 
         }));
+        
+        registerHandler(eventBus.addHandler(LoginEvent.TYPE,  new LoginEventHandler() {
+
+            public void onLogin(LoginEvent event) {
+                user = event.getUser();
+                folder = new IMAPFolder(user.getSettings().getInboxFolderName());
+            }
+            
+        }));
 
     }
 
 
     @Override
     protected void onUnbind() {
-        messagePresenter.unbind();
-        sendPresenter.unbind();
-        messageListPresenter.unbind();
+        super.onUnbind();
         reset();
 
     }
@@ -534,5 +543,7 @@
     protected void onRevealDisplay() {
         loadTreeItems();
         showMessageTable(user, folder, null, true);
+
+        super.onRevealDisplay();
     }
 }

Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MainPresenterPlace.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MainPresenterPlace.java?rev=834037&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MainPresenterPlace.java
(added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MainPresenterPlace.java
Mon Nov  9 12:44:44 2009
@@ -0,0 +1,38 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+package org.apache.hupa.client.mvp;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+import net.customware.gwt.presenter.client.gin.ProvidedPresenterPlace;
+
+public class MainPresenterPlace extends ProvidedPresenterPlace<MainPresenter>{
+
+    @Inject
+    public MainPresenterPlace(Provider<MainPresenter> presenter) {
+        super(presenter);
+    }
+
+    @Override
+    public String getName() {
+        return "Main";
+    }
+
+}

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=834037&r1=834036&r2=834037&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 Mon Nov
 9 12:44:44 2009
@@ -139,13 +139,10 @@
         RoundedPanel buttonPanel = new RoundedPanel(RoundedPanel.ALL, 1);
         buttonPanel.setBorder();
         buttonPanel.add(folderButtonBar);
-
         folderPanel.add(buttonPanel);
         folderPanel.add(folderTree);
-
         panel.add(loader);
         confirmFolderDeleteBox.setText(messages.confirmDeleteFolder());
-
         bus.addHandler(LoginEvent.TYPE, new LoginEventHandler() {
 
             public void onLogin(LoginEvent event) {
@@ -229,11 +226,6 @@
         searchBox.setText("");
     }
 
-    public void setCenter(Widget widget) {
-        centerWidget = widget;
-        center.setWidget(centerWidget);
-    }
-
     /*
      * (non-Javadoc)
      * 
@@ -584,4 +576,18 @@
             }
         }
     }
+
+    public void addWidget(Widget widget) {
+        showWidget(widget);
+    }
+
+    public void removeWidget(Widget widget) {
+        centerWidget = null;
+        center.remove(widget); 
+    }
+
+    public void showWidget(Widget widget) {
+        centerWidget = widget;
+        center.setWidget(centerWidget); 
+    }
 }

Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendPresenterPlace.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendPresenterPlace.java?rev=834037&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendPresenterPlace.java
(added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendPresenterPlace.java
Mon Nov  9 12:44:44 2009
@@ -0,0 +1,36 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+package org.apache.hupa.client.mvp;
+
+import com.google.inject.Provider;
+
+import net.customware.gwt.presenter.client.gin.ProvidedPresenterPlace;
+
+public class MessageSendPresenterPlace extends ProvidedPresenterPlace<MessageSendPresenter>{
+
+    public MessageSendPresenterPlace(Provider<MessageSendPresenter> presenter) {
+        super(presenter);
+    }
+
+    @Override
+    public String getName() {
+        return "MessageSend";
+    }
+
+}

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageTableModel.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageTableModel.java?rev=834037&r1=834036&r2=834037&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageTableModel.java
(original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageTableModel.java
Mon Nov  9 12:44:44 2009
@@ -83,7 +83,7 @@
 			
 			public void onLogin(LoginEvent event) {
 				user = event.getUser();
-				folder = null;
+				folder = new IMAPFolder(user.getSettings().getInboxFolderName());
 				searchValue = null;
 			}
 		});
@@ -126,7 +126,11 @@
                 TableModelHelper.Response<Message> response = new TableModelHelper.Response<Message>()
{
                     @Override
                     public Iterator<Message> getRowValues() {
-                        return result.getMessages().iterator();
+                        if (result != null && result.getMessages() != null) {
+                            return result.getMessages().iterator();
+                        } else {
+                            return new ArrayList<Message>().iterator();
+                        }
                     }
                 };
                 setRowCount(result.getRealCount());



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