You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by do...@apache.org on 2013/08/21 18:35:18 UTC

svn commit: r1516205 [1/9] - in /james/hupa/trunk: ./ client/src/main/java/org/apache/hupa/ client/src/main/java/org/apache/hupa/client/ client/src/main/java/org/apache/hupa/client/gin/ client/src/main/java/org/apache/hupa/client/mvp/ client/src/main/j...

Author: dongxu
Date: Wed Aug 21 16:35:16 2013
New Revision: 1516205

URL: http://svn.apache.org/r1516205
Log:
merge

Added:
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/CachingDispatchAsync.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HandlerRegistrationAdapter.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    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/gin/HupaGinjector.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.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/ContactsPresenter.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/ContactsView.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/IMAPMessageView.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/LoginView.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/MessageSendPresenter.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendView.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageTableModel.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/NameAwareWidgetDisplay.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/place/ContactsPresenterPlace.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/place/HupaPlaceManager.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/place/IMAPMessageListPresenterPlace.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/place/IMAPMessagePresenterPlace.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/place/LoginPresenterPlace.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/place/MessageSendPresenterPlace.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/rf/SubjectProxy.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/rf/SubjectRequest.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/widgets/DragRefetchPagingScrollTable.java
    james/hupa/trunk/client/src/test/java/org/apache/hupa/client/HupaMvpTestCase.java
    james/hupa/trunk/client/src/test/java/org/apache/hupa/client/guice/GuiceClientTestModule.java
    james/hupa/trunk/client/src/test/java/org/apache/hupa/client/guice/GuiceMvpTestModule.java
    james/hupa/trunk/client/src/test/java/org/apache/hupa/client/mvp/ContactsPresenterTest.java
    james/hupa/trunk/client/src/test/java/org/apache/hupa/client/mvp/MessageSendPresenterTest.java
    james/hupa/trunk/client/src/test/java/org/apache/hupa/client/rf/SubjectTest.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/DefaultUserSettingsProvider.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/GuiceServerModule.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/GuiceServletConfig.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/JavaMailSessionProvider.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/LogProvider.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/demo/DemoGuiceServerModule.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractDeleteMessageHandler.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractFetchMessagesHandler.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractSendMessageHandler.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractSessionHandler.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/CheckSessionHandler.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/ContactsHandler.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/CreateFolderHandler.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/DeleteAllMessagesHandler.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/DeleteFolderHandler.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/DeleteMessageByUidHandler.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/FetchFoldersHandler.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/FetchMessagesHandler.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/FetchRecentMessagesHandler.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/ForwardMessageHandler.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/GetMessageDetailsHandler.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/GetRawMessageHandler.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/IdleHandler.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/LoginUserHandler.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/LogoutUserHandler.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/MoveMessageHandler.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/PrepareNewMessageHandler.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/RenameFolderHandler.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/ReplyMessageHandler.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/SendMessageHandler.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/SetFlagsHandler.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/TagMessagesHandler.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/rf/Subject.java
    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/servlet/HupaDispatchServlet.java
    james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/AbtractSendMessageHandlerTest.java
    james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/ContactsHandlerTest.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/CreateFolderHandlerTest.java
    james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/DeleteFolderHandlerTest.java
    james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/DeleteMessageByUidHandlerTest.java
    james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/FetchFoldersHandlerTest.java
    james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/FetchMessagesHandlerTest.java
    james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/FowardMessageHandlerTest.java
    james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/GetMessageDetailsHandlerTest.java
    james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/HandlersTest.java
    james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/IdleHandlerTest.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/LoginUserHandlerTest.java
    james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/LogoutUserHandlerTest.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/ReplyMessageHandlerTest.java
    james/hupa/trunk/server/src/test/java/org/apache/hupa/server/mock/MockImapFolderTest.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/server/src/test/java/org/apache/hupa/server/preferences/InImapUserPreferencesStorageTest.java
    james/hupa/trunk/server/src/test/java/org/apache/hupa/server/preferences/InSessionUserPreferencesStorageTest.java
    james/hupa/trunk/server/src/test/java/org/apache/hupa/server/servlet/DownloadAttachmentServletTest.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/data/AbstractMessage.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/data/IMAPFolder.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/data/Message.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/data/MessageAttachment.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/data/MessageDetails.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/data/SMTPMessage.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/data/Settings.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/data/Tag.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/data/User.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/CheckSession.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/CheckSessionResult.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/Contacts.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/CreateFolder.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/DeleteAllMessages.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/DeleteFolder.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/DeleteMessage.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/DeleteMessageByUid.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/DeleteMessageResult.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/FetchFolders.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/FetchFoldersResult.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/FetchMessages.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/FetchMessagesResult.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/FetchRecentMessages.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/ForwardMessage.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/GenericResult.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/GetMessageDetails.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/GetMessageDetailsResult.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/Idle.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/IdleResult.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/LoginUser.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/LoginUserResult.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/LogoutUser.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/LogoutUserResult.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/MoveMessage.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/MoveMessageResult.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/RawMessage.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/RawMessageResult.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/RenameFolder.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/ReplyMessage.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/SendMessage.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/SetFlag.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/rpc/TagMessage.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/PagingOptions.java
    james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/RefetchPagingScrollTable.java
    james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/impl/RndPanelGeneratorImpl.java
      - copied, changed from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java
    james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/impl/RndPanelGeneratorImplIE.java
Modified:
    james/hupa/trunk/README.txt
    james/hupa/trunk/client/src/main/java/org/apache/hupa/Hupa.gwt.xml
    james/hupa/trunk/server/pom.xml
    james/hupa/trunk/server/src/test/java/org/apache/hupa/server/HupaGuiceTestCase.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/MoveMessageEvent.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java

Modified: james/hupa/trunk/README.txt
URL: http://svn.apache.org/viewvc/james/hupa/trunk/README.txt?rev=1516205&r1=1516204&r2=1516205&view=diff
==============================================================================
--- james/hupa/trunk/README.txt (original)
+++ james/hupa/trunk/README.txt Wed Aug 21 16:35:16 2013
@@ -13,7 +13,7 @@ There is an example configuration file i
 - Or in any other file if you start your application server with the parameter:
   -Dhupa.config.file=full_path_to_your_properties_file
 
-##### Running Hupa #####
+##### Running Hupa ##################
 Hupa comes packaged with a servlet-container, so once you have compiled the app just run:
 $ java -jar target/hupa-${version}.war
 
@@ -54,4 +54,5 @@ shared, mock, server, widget and client.
   >> 'GWT module hupa needs to be (re)compiled, please run a compile or use the Compile/Browse button in hosted mode'
  
   Configure the plugin to compile only the 'Hupa' module.
-  Properties -> Google -> Web Toolkit -> Entry Point Modules -> Hupa - org.apache.hupa 
+  Properties -> Google -> Web Toolkit -> Entry Point Modules -> Hupa - org.apache.hupa
+ 

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/Hupa.gwt.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/Hupa.gwt.xml?rev=1516205&r1=1516204&r2=1516205&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/Hupa.gwt.xml (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/Hupa.gwt.xml Wed Aug 21 16:35:16 2013
@@ -19,17 +19,6 @@
   <!-- Inherit the core Web Toolkit stuff.                        -->
   <inherits name='com.google.gwt.user.User'/>
   <inherits name="com.google.gwt.i18n.I18N"/> 
-  <!-- inherits Logging module -->
-  <inherits name="com.google.gwt.logging.Logging"/>
-  <set-property name="gwt.logging.enabled" value="TRUE"/>
-  <set-property name="gwt.logging.logLevel" value="FINE"/>
-  <set-property name="gwt.logging.consoleHandler" value="DISABLED"/>
-  <set-property name="gwt.logging.developmentModeHandler" value="ENABLED"/>
-  <set-property name="gwt.logging.firebugHandler" value="ENABLED"/>
-  <set-property name="gwt.logging.hasWidgetsHandler" value="DISABLED"/>
-  <set-property name="gwt.logging.popupHandler" value="DISABLED"/>
-  <set-property name="gwt.logging.systemHandler" value="ENABLED"/>
-  <set-property name="gwt.logging.simpleRemoteHandler" value="DISABLED"/>
   <!-- Hupa modules -->  
   <inherits name='org.apache.hupa.Shared'/> 
   <inherits name='org.apache.hupa.Widgets'/> 
@@ -39,14 +28,9 @@
   <inherits name='com.google.gwt.gen2.commonwidget.CommonWidget' />
   <inherits name='com.google.gwt.gen2.table.override.Override'/>
   <inherits name='com.google.gwt.gen2.table.ScrollTable'/>
-  <inherits name="com.google.gwt.activity.Activity"/>
-  <inherits name="com.google.gwt.place.Place"/>
+  <inherits name='net.customware.gwt.dispatch.Dispatch' />
+  <inherits name='net.customware.gwt.presenter.Presenter' />
   <inherits name="com.google.gwt.inject.Inject"/>
-  
-  <inherits name="com.google.gwt.cell.Cell"/>
-  <inherits name="com.google.gwt.editor.Editor"/>
-  <inherits name="com.google.gwt.resources.Resources" />
-  
   <inherits name="gwtupload.GWTUpload"/>
   <inherits name="eu.maydu.gwt.validation.ValidationLibrary"/>
   <inherits name='com.allen_sauer.gwt.dnd.gwt-dnd'/>
@@ -54,14 +38,13 @@
   <!-- <inherits name="com.google.gwt.junit.JUnit"/> -->
   
   <!-- Inherit the default GWT style sheet.                       -->
-<!--   <inherits name='com.google.gwt.user.theme.standard.Standard'/> -->
-<!--   <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
-<!--   <inherits name='com.google.gwt.user.theme.dark.Dark'/>     -->
- <!--  <inherits name='com.google.gwt.user.theme.clean.Clean'/>    --> 
-  
+  <inherits name='com.google.gwt.user.theme.standard.Standard'/>
+  <!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
+  <!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/>     -->
   
   <!-- CSS loaded asynchronously -->
-  <stylesheet src="../styles.css"/>
+  <stylesheet src="../Hupa.css"/>
+  <stylesheet src="Upload.css"/>
   
   <!--  xsiframe would be the default in gwt soon -->
   <add-linker name="xsiframe"/>

Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/CachingDispatchAsync.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/CachingDispatchAsync.java?rev=1516205&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/CachingDispatchAsync.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/CachingDispatchAsync.java Wed Aug 21 16:35:16 2013
@@ -0,0 +1,92 @@
+/****************************************************************
+ * 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;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.inject.Inject;
+
+import net.customware.gwt.dispatch.client.DispatchAsync;
+import net.customware.gwt.dispatch.shared.Action;
+import net.customware.gwt.dispatch.shared.Result;
+
+/**
+ * Dispatcher which support caching of data in memory
+ * 
+ */
+public class CachingDispatchAsync implements DispatchAsync {
+
+    private DispatchAsync dispatcher;
+    private Map<Action<Result>, Result> cache = new HashMap<Action<Result>, Result>();
+
+    @Inject
+    public CachingDispatchAsync(DispatchAsync dispatcher) {
+        this.dispatcher = dispatcher;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see net.customware.gwt.dispatch.client.DispatchAsync#execute(A, com.google.gwt.user.client.rpc.AsyncCallback)
+     */
+    public <A extends Action<R>, R extends Result> void execute(final A action,
+            final AsyncCallback<R> callback) {
+        dispatcher.execute(action, callback);
+    }
+
+    /**
+     * Execute the give Action. If the Action was executed before it will get fetched from the cache
+     * 
+     * @param <A> Action implementation
+     * @param <R> Result implementation
+     * @param action the action
+     * @param callback the callback
+     */
+    @SuppressWarnings("unchecked")
+    public <A extends Action<R>, R extends Result> void executeWithCache(
+            final A action, final AsyncCallback<R> callback) {
+        Result r = cache.get(action);
+        if (r != null) {
+            callback.onSuccess((R) r);
+        } else {
+            dispatcher.execute(action, new AsyncCallback<R>() {
+
+                public void onFailure(Throwable caught) {
+                    callback.onFailure(caught);
+                }
+
+                public void onSuccess(R result) {
+                    cache.put((Action<Result>) action, (Result) result);
+                    callback.onSuccess(result);
+                }
+
+            });
+        }
+    }
+
+    /**
+     * Clear the cache
+     */
+    public void clear() {
+        cache.clear();
+    }
+
+}

Copied: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HandlerRegistrationAdapter.java (from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java)
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HandlerRegistrationAdapter.java?p2=james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HandlerRegistrationAdapter.java&p1=james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java&r1=1516164&r2=1516205&rev=1516205&view=diff
==============================================================================
--- james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HandlerRegistrationAdapter.java Wed Aug 21 16:35:16 2013
@@ -17,13 +17,29 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.hupa.shared.exception;
+package org.apache.hupa.client;
 
-public class InvalidSessionException extends HupaException{
+import com.google.gwt.event.shared.HandlerRegistration;
 
-	private static final long serialVersionUID = 995112620968798947L;
 
-	public InvalidSessionException(String message) {
-        super(message);
+/**
+ * Class to act as Adapter between HandlerRegistration in gwt 1.6+ and gwt-incubator
+ *
+ */
+@SuppressWarnings("deprecation")
+public class HandlerRegistrationAdapter implements HandlerRegistration{
+    com.google.gwt.gen2.event.shared.HandlerRegistration registration;
+
+    public HandlerRegistrationAdapter(com.google.gwt.gen2.event.shared.HandlerRegistration registration) {
+        this.registration = registration;
+    }
+
+
+    /*
+     * (non-Javadoc)
+     * @see com.google.gwt.event.shared.HandlerRegistration#removeHandler()
+     */
+    public void removeHandler() {
+        registration.removeHandler();
     }
-}
+}
\ No newline at end of file

Added: 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=1516205&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaCallback.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaCallback.java Wed Aug 21 16:35:16 2013
@@ -0,0 +1,121 @@
+/****************************************************************
+ * 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;
+
+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;
+import org.apache.hupa.shared.events.ServerStatusEvent;
+import org.apache.hupa.shared.events.ServerStatusEvent.ServerStatus;
+import org.apache.hupa.shared.exception.InvalidSessionException;
+import org.apache.hupa.shared.rpc.CheckSession;
+import org.apache.hupa.shared.rpc.CheckSessionResult;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.inject.Inject;
+
+public abstract class HupaCallback<T> implements AsyncCallback<T> {
+    
+    private DispatchAsync dispatcher = null;
+    private EventBus eventBus = null;
+    private ServerStatusEvent available = new ServerStatusEvent(ServerStatus.Available); 
+    private ServerStatusEvent unavailable = new ServerStatusEvent(ServerStatus.Unavailable); 
+
+    @SuppressWarnings("unused")
+    private Display display = null;
+
+    @Inject
+    public HupaCallback(DispatchAsync dispatcher, EventBus bus, Display display) {
+        this(dispatcher, bus);
+        this.display = display;
+        
+        //this.display.startProcessing();
+    }
+    
+    @Inject
+    public HupaCallback(DispatchAsync dispatcher, EventBus bus) {
+        this.dispatcher = dispatcher;
+        this.eventBus = bus;
+    }
+
+    /**
+     * If you override this method, remember to call super.onFailure() 
+     */
+    public void onFailure(final Throwable originalCaught) {
+        // Server's response is invalid due to:
+        // server unaccessible, session error or server exception
+        dispatcher.execute(new CheckSession(), new AsyncCallback<CheckSessionResult>() {
+            public void onFailure(Throwable caught) {
+                if (caught instanceof InvalidSessionException) {
+                    eventBus.fireEvent(new LogoutEvent(null));
+                } else {
+                    // The server is unaccessible
+                    eventBus.fireEvent(unavailable);
+                }
+                finish();
+            }
+            public void onSuccess(CheckSessionResult result) {
+                if (!result.isValid()) {
+                    // Server's connection is fine, but the user has not a valid session
+                    eventBus.fireEvent(new LogoutEvent(null));
+                } else {
+                    // Server's connection is fine, and the user has a valid session
+                    // So the original action failed because a server's exception 
+                    eventBus.fireEvent(available);
+                }
+                finish();
+            }
+
+            private void finish() {
+                callbackError(originalCaught);
+                //if (display != null)
+                    //display.stopProcessing();
+            }
+        });
+    }
+    
+    /**
+     * If you override this method, remember to call super.onSuccess() 
+     */
+    public void onSuccess(T result) {
+        // Server's response is valid,
+        eventBus.fireEvent(available);
+        // Execute the original method
+        callback(result);
+        // If display is being used, stop it
+        //if (display != null)
+            //display.stopProcessing();
+    }
+    
+    /**
+     * The callback code which the user has to implement
+     */
+    public abstract void callback(T result); 
+
+    /**
+     * The callback code in the case of error
+     * Override this method, if you need this feature.
+     */
+    public void callbackError(Throwable caught) {
+        System.out.println("HupaCallBack Error: " + caught);
+    }
+}

Added: 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=1516205&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/gin/HupaClientModule.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/gin/HupaClientModule.java Wed Aug 21 16:35:16 2013
@@ -0,0 +1,97 @@
+/****************************************************************
+ * 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.gin;
+
+import net.customware.gwt.presenter.client.DefaultEventBus;
+import net.customware.gwt.presenter.client.EventBus;
+import net.customware.gwt.presenter.client.gin.AbstractPresenterModule;
+import net.customware.gwt.presenter.client.place.ParameterTokenFormatter;
+import net.customware.gwt.presenter.client.place.PlaceManager;
+import net.customware.gwt.presenter.client.place.TokenFormatter;
+
+import org.apache.hupa.client.CachingDispatchAsync;
+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.ContactsPresenter;
+import org.apache.hupa.client.mvp.ContactsView;
+import org.apache.hupa.client.mvp.IMAPMessageListPresenter;
+import org.apache.hupa.client.mvp.IMAPMessageListView;
+import org.apache.hupa.client.mvp.IMAPMessagePresenter;
+import org.apache.hupa.client.mvp.IMAPMessageView;
+import org.apache.hupa.client.mvp.LoginPresenter;
+import org.apache.hupa.client.mvp.LoginView;
+import org.apache.hupa.client.mvp.MainPresenter;
+import org.apache.hupa.client.mvp.MainView;
+import org.apache.hupa.client.mvp.MessageSendPresenter;
+import org.apache.hupa.client.mvp.MessageSendView;
+import org.apache.hupa.client.mvp.MessageTableModel;
+import org.apache.hupa.client.mvp.place.ContactsPresenterPlace;
+import org.apache.hupa.client.mvp.place.HupaPlaceManager;
+import org.apache.hupa.client.mvp.place.IMAPMessageListPresenterPlace;
+import org.apache.hupa.client.mvp.place.LoginPresenterPlace;
+import org.apache.hupa.client.mvp.place.MessageSendPresenterPlace;
+import org.apache.hupa.client.rf.HupaRequestFactory;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.shared.SimpleEventBus;
+import com.google.inject.Provider;
+import com.google.inject.Singleton;
+
+public class HupaClientModule extends AbstractPresenterModule {
+
+    @Override
+    protected void configure() {        
+        bind(EventBus.class).to(DefaultEventBus.class).in(Singleton.class);
+        bind(PlaceManager.class).to(HupaPlaceManager.class);
+        bind(TokenFormatter.class).to(ParameterTokenFormatter.class).in(Singleton.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);
+        bindPresenter(MainPresenter.class,MainPresenter.Display.class,MainView.class);
+        bindPresenter(MessageSendPresenter.class, MessageSendPresenter.Display.class, MessageSendView.class);
+        bindPresenter(AppPresenter.class, AppPresenter.Display.class, AppView.class);
+        bindPresenter(ContactsPresenter.class, ContactsPresenter.Display.class, ContactsView.class);
+        bind(CachingDispatchAsync.class);
+        bind(PagingScrollTableRowDragController.class).in(Singleton.class);
+        bind(MessageTableModel.class).in(Singleton.class);
+        bind(LoginPresenterPlace.class).in(Singleton.class);
+        bind(IMAPMessageListPresenterPlace.class).in(Singleton.class);
+        bind(MessageSendPresenterPlace.class).in(Singleton.class);
+        bind(ContactsPresenterPlace.class).in(Singleton.class);
+        
+        bind(com.google.gwt.event.shared.EventBus.class)
+            .to(SimpleEventBus.class)
+            .in(Singleton.class);
+        bind(HupaRequestFactory.class)
+            .toProvider(HupaClientModule.RequestFactoryProvider.class)
+            .in(Singleton.class);
+    }
+    
+    public static class RequestFactoryProvider implements Provider<HupaRequestFactory> {
+        private static final com.google.gwt.event.shared.EventBus eventBus = new SimpleEventBus();
+        public HupaRequestFactory get() {
+            HupaRequestFactory rf = GWT.create(HupaRequestFactory.class);
+            rf.initialize(eventBus);
+            return rf;
+        }
+    }
+
+}

Copied: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/gin/HupaGinjector.java (from r1516164, james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java)
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/gin/HupaGinjector.java?p2=james/hupa/trunk/client/src/main/java/org/apache/hupa/client/gin/HupaGinjector.java&p1=james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java&r1=1516164&r2=1516205&rev=1516205&view=diff
==============================================================================
--- james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/exception/InvalidSessionException.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/gin/HupaGinjector.java Wed Aug 21 16:35:16 2013
@@ -1,29 +1,37 @@
-/****************************************************************
- * 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.shared.exception;
-
-public class InvalidSessionException extends HupaException{
-
-	private static final long serialVersionUID = 995112620968798947L;
-
-	public InvalidSessionException(String message) {
-        super(message);
-    }
-}
+/****************************************************************
+ * 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.gin;
+
+import net.customware.gwt.dispatch.client.gin.StandardDispatchModule;
+import net.customware.gwt.presenter.client.EventBus;
+import net.customware.gwt.presenter.client.place.PlaceManager;
+
+import org.apache.hupa.client.mvp.AppPresenter;
+import org.apache.hupa.client.rf.HupaRequestFactory;
+
+import com.google.gwt.inject.client.GinModules;
+import com.google.gwt.inject.client.Ginjector;
+
+@GinModules({StandardDispatchModule.class,HupaClientModule.class})
+public interface HupaGinjector extends Ginjector {
+    AppPresenter getAppPresenter();
+    PlaceManager getPlaceManager();
+    EventBus getEventBus();
+    HupaRequestFactory getRequestFactory();
+}

Added: 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=1516205&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/AppPresenter.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/AppPresenter.java Wed Aug 21 16:35:16 2013
@@ -0,0 +1,246 @@
+/****************************************************************
+ * 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 net.customware.gwt.dispatch.client.DispatchAsync;
+import net.customware.gwt.presenter.client.EventBus;
+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.client.HupaConstants;
+import org.apache.hupa.shared.data.User;
+import org.apache.hupa.shared.events.FlashEvent;
+import org.apache.hupa.shared.events.FlashEventHandler;
+import org.apache.hupa.shared.events.LoginEvent;
+import org.apache.hupa.shared.events.LoginEventHandler;
+import org.apache.hupa.shared.events.LogoutEvent;
+import org.apache.hupa.shared.events.LogoutEventHandler;
+import org.apache.hupa.shared.events.ServerStatusEvent;
+import org.apache.hupa.shared.events.ServerStatusEventHandler;
+import org.apache.hupa.shared.events.SessionExpireEvent;
+import org.apache.hupa.shared.events.SessionExpireEventHandler;
+import org.apache.hupa.shared.events.ServerStatusEvent.ServerStatus;
+import org.apache.hupa.shared.rpc.CheckSession;
+import org.apache.hupa.shared.rpc.CheckSessionResult;
+import org.apache.hupa.shared.rpc.Idle;
+import org.apache.hupa.shared.rpc.IdleResult;
+import org.apache.hupa.shared.rpc.LogoutUser;
+import org.apache.hupa.shared.rpc.LogoutUserResult;
+
+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;
+import com.google.gwt.user.client.Timer;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.ui.HasText;
+import com.google.inject.Inject;
+
+/**
+ * Presenter which flips the in the LoginPresenter or the LoginPresenter depending on if the user is 
+ * logged in or not
+ *
+ */
+public class AppPresenter extends WidgetContainerPresenter<AppPresenter.Display>{
+
+    private static final int IDLE_INTERVAL = 150000;
+    HupaConstants constants;
+
+    public interface Display extends WidgetContainerDisplay {
+        public HasClickHandlers getLogoutClick();
+        public HasClickHandlers getContactsClick();
+        public HasClickHandlers getMainClick();
+        public void showTopNavigation(boolean show);
+        public void showContactsButton();
+        public void showMainButton();
+        public HasText getUserText();
+        public void setServerStatus(ServerStatus status);
+        public void showMessage(String message, int millisecs);
+    }
+
+    private Timer noopTimer = new IdleTimer();
+
+    private DispatchAsync dispatcher;
+    private User user;
+    private ServerStatus serverStatus = ServerStatus.Available;
+    private MainPresenter mainPresenter;
+    private LoginPresenter loginPresenter;
+    private ContactsPresenter contactsPresenter;
+    
+    @Inject
+    public AppPresenter(Display display, DispatchAsync dispatcher, final EventBus bus, HupaConstants constants, LoginPresenter loginPresenter, MainPresenter mainPresenter, ContactsPresenter contactsPresenter) {
+        super(display, bus, loginPresenter, mainPresenter, contactsPresenter);
+        this.mainPresenter = mainPresenter;
+        this.loginPresenter = loginPresenter;
+        this.contactsPresenter = contactsPresenter;
+        this.dispatcher = dispatcher;  
+        this.constants = constants;
+    }
+
+    private void showMain(User user) {
+        display.showTopNavigation(true);
+        display.showContactsButton();
+        mainPresenter.revealDisplay(user);
+    }
+    
+    private void showLogin(String username) {
+        display.showTopNavigation(false);
+        loginPresenter.revealDisplay();
+    }
+
+    private void showContacts() {
+        display.showTopNavigation(true);
+        display.showMainButton();
+        contactsPresenter.revealDisplay();
+    }
+
+    @Override
+    protected void onBind() {
+        super.onBind();
+        registerHandler(eventBus.addHandler(LoginEvent.TYPE, new LoginEventHandler() {
+
+            public void onLogin(LoginEvent event) {
+                user = event.getUser();
+                display.getUserText().setText(event.getUser().getName());
+                noopTimer.scheduleRepeating(IDLE_INTERVAL);
+                showMain(user);
+                display.showMessage(constants.welcome(), 3000);
+            }
+
+        }));
+        
+        registerHandler(eventBus.addHandler(LogoutEvent.TYPE, new LogoutEventHandler() {
+
+            public void onLogout(LogoutEvent event) {
+                User u = event.getUser();
+                String username = null;
+                if (u != null) {
+                    username = u.getName();
+                }
+                showLogin(username);
+                noopTimer.cancel();
+            }
+            
+        }));
+        registerHandler(display.getLogoutClick().addClickHandler(new ClickHandler() {
+
+            public void onClick(ClickEvent event) {
+                doLogout();
+            }
+            
+        }));
+        registerHandler(display.getContactsClick().addClickHandler(new ClickHandler() {
+            
+            public void onClick(ClickEvent event) {
+                showContacts();
+            }
+            
+        }));
+        registerHandler(display.getMainClick().addClickHandler(new ClickHandler() {
+            
+            public void onClick(ClickEvent event) {
+                showMain(user);
+            }
+            
+        }));
+        registerHandler(eventBus.addHandler(SessionExpireEvent.TYPE, new SessionExpireEventHandler() {
+
+            public void onSessionExpireEvent(SessionExpireEvent event) {
+                doLogout();
+            }
+            
+        }));
+        registerHandler(eventBus.addHandler(ServerStatusEvent.TYPE, new ServerStatusEventHandler() {
+            
+            public void onServerStatusChange(ServerStatusEvent event) {
+                if (event.getStatus() != serverStatus) {
+                    GWT.log("Server status has hanged from " + serverStatus + " to" + event.getStatus(), null);
+                    serverStatus = event.getStatus();
+                    display.setServerStatus(serverStatus);
+                }
+            }
+            
+        }));
+        registerHandler(eventBus.addHandler(FlashEvent.TYPE, new FlashEventHandler() {
+            
+            public void onFlash(FlashEvent event) {
+                display.showMessage(event.getMessage(), event.getMillisec());
+            }
+            
+        }));
+
+        checkSession();
+    }
+    
+
+    private void doLogout() {
+        if (user != null) {
+            dispatcher.execute(new LogoutUser(), new HupaCallback<LogoutUserResult>(dispatcher, eventBus) {
+                public void callback(LogoutUserResult result) {
+                    eventBus.fireEvent(new LogoutEvent(result.getUser()));
+                }
+            });
+        }
+    }
+
+    private void checkSession() {
+        dispatcher.execute(new CheckSession(), new AsyncCallback<CheckSessionResult>() {
+            public void onFailure(Throwable caught) {
+                serverStatus = ServerStatus.Unavailable;
+                display.setServerStatus(serverStatus);
+                showLogin(null);
+            }
+            public void onSuccess(CheckSessionResult result) {
+                serverStatus = ServerStatus.Available;
+                display.setServerStatus(serverStatus);
+                if (result.isValid()) {
+                    eventBus.fireEvent(new LoginEvent(result.getUser()));
+                } else {
+                    showLogin(null);
+                }
+            }
+        });
+    }
+    
+    private class IdleTimer extends Timer {
+        boolean running = false;
+        public void run() {
+            if (!running) {
+                running = true;
+                dispatcher.execute(new Idle(), new HupaCallback<IdleResult>(dispatcher, eventBus) {
+                    public void callback(IdleResult result) {
+                        running = false;
+                        // check if the server is not supporting the Idle command.
+                        // if so cancel this Timer
+                        if (result.isSupported() == false) {
+                            IdleTimer.this.cancel();
+                        }
+                        // Noop
+                        // TODO: put code here to read new events from server (new messages ...)
+                    }
+                });
+            }
+        }
+    }
+
+    
+}

Added: 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=1516205&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/AppView.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/AppView.java Wed Aug 21 16:35:16 2013
@@ -0,0 +1,256 @@
+/****************************************************************
+ * 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.client.HupaCSS;
+import org.apache.hupa.client.HupaConstants;
+import org.apache.hupa.shared.events.ServerStatusEvent.ServerStatus;
+import org.apache.hupa.widgets.ui.RndPanel;
+
+import com.google.gwt.event.dom.client.HasClickHandlers;
+import com.google.gwt.user.client.Timer;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.FlowPanel;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.HasText;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Hyperlink;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.SimplePanel;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.inject.Inject;
+
+/**
+ * AppView is the main WidgetContainer which show the LoginView or the MainView depending on if 
+ * the user is logged in or not
+ *
+ */
+public class AppView extends Composite implements AppPresenter.Display {
+    
+    private FlowPanel appContainer = new FlowPanel();
+    
+    private HTML logoContainer = new HTML(" "); 
+
+    private RndPanel topWrapper = new RndPanel();
+    private SimplePanel topContainer = new SimplePanel();
+    private HorizontalPanel buttonContainer = new HorizontalPanel();
+    private HorizontalPanel infoContainer = new HorizontalPanel();
+    
+    private RndPanel centralContainer = new RndPanel();
+
+    private HorizontalPanel loginInfoPanel = new HorizontalPanel();
+    private Label loginLabel = new Label();
+    private Label loginUserLabel = new Label();
+    private Hyperlink mainButton = new Hyperlink();
+    private Hyperlink contactsButton = new Hyperlink();
+    private Hyperlink logoutButton = new Hyperlink();
+    private Label appnameLabel = new Label();
+    
+    private RndPanel flashContainer = new RndPanel();
+    private Label flashLabel = new Label();
+    private Label extraLabel = new Label();
+    
+    private FlowPanel bottomContainer = new FlowPanel();
+    private HTML footLabel = new HTML();
+    
+    @Inject
+    public AppView(HupaConstants constants) {
+
+        // add class names
+        appContainer.addStyleName(HupaCSS.C_app_container);
+        logoContainer.addStyleName(HupaCSS.C_logo_container);
+        topContainer.addStyleName(HupaCSS.C_top_container);
+        centralContainer.addStyleName(HupaCSS.C_main_container);
+        bottomContainer.addStyleName(HupaCSS.C_bottom_container);
+        
+        topWrapper.addStyleName(HupaCSS.C_top_container + "-wrap");
+        buttonContainer.addStyleName(HupaCSS.C_button_container);
+        infoContainer.addStyleName(HupaCSS.C_info_container);
+        loginInfoPanel.addStyleName(HupaCSS.C_login_info_container);
+        loginLabel.addStyleName(HupaCSS.C_login_info_label);
+        loginUserLabel.addStyleName(HupaCSS.C_login_info_user);
+        logoutButton.addStyleName(HupaCSS.C_menu_button);
+        contactsButton.addStyleName(HupaCSS.C_menu_button);
+        mainButton.addStyleName(HupaCSS.C_menu_button);
+        appnameLabel.addStyleName(HupaCSS.C_header);
+        flashContainer.addStyleName(HupaCSS.C_flash);
+        
+        // internationalize elements
+        logoutButton.setText(constants.logoutButton());
+        loginLabel.setText(constants.loginAs() + ": ");
+        appnameLabel.setText(constants.productName());
+        contactsButton.setText(constants.contactsTab());
+        mainButton.setText(constants.mailTab());
+        footLabel.setHTML(constants.footer());
+        
+        // Layout containers and panels
+        buttonContainer.add(loginInfoPanel);
+        loginInfoPanel.add(loginLabel);
+        loginInfoPanel.add(loginUserLabel);
+        buttonContainer.add(contactsButton);
+        buttonContainer.add(mainButton);
+        buttonContainer.add(logoutButton);
+        buttonContainer.setCellWidth(loginInfoPanel, "100%");
+        
+        infoContainer.add(appnameLabel);
+        infoContainer.add(extraLabel);
+        
+        topWrapper.add(buttonContainer);
+        topWrapper.add(infoContainer);
+        topWrapper.add(flashContainer);
+        topContainer.add(topWrapper);
+        
+        flashContainer.add(flashLabel);
+        
+        bottomContainer.add(footLabel);
+        
+        appContainer.add(logoContainer);
+        appContainer.add(topContainer);
+        appContainer.add(centralContainer);
+        appContainer.add(bottomContainer);
+        initWidget(appContainer);
+        
+        showTopNavigation(false);
+    }
+
+
+    /*
+     * (non-Javadoc)
+     * @see net.customware.gwt.presenter.client.widget.WidgetDisplay#asWidget()
+     */
+    public Widget asWidget() {
+        return this;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.hupa.client.mvp.AppPresenter.Display#getLogoutClick()
+     */
+    public HasClickHandlers getLogoutClick() {
+        return logoutButton;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.apache.hupa.client.mvp.AppPresenter.Display#showTopNavigation(boolean
+     * )
+     */
+    public void showTopNavigation(boolean show) {
+        buttonContainer.setVisible(show);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.hupa.client.mvp.AppPresenter.Display#getUserText()
+     */
+    public HasText getUserText() {
+        return loginUserLabel;
+    }
+
+
+    /*
+     * (non-Javadoc)
+     * @see net.customware.gwt.presenter.client.widget.WidgetContainerDisplay#addWidget(com.google.gwt.user.client.ui.Widget)
+     */
+    public void addWidget(Widget widget) {
+        widget.addStyleName(HupaCSS.C_main_container);
+        centralContainer.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) {
+        centralContainer.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) {
+        centralContainer.setWidget(widget);
+    }
+
+
+    public HasClickHandlers getContactsClick() {
+        return contactsButton;
+    }
+
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.hupa.client.mvp.AppPresenter.Display#setServerStatus(org.apache.hupa.shared.events.ServerStatusEvent.ServerStatus)
+     */
+    public void setServerStatus(ServerStatus status) {
+        if (status == ServerStatus.Available) 
+            showMessage("Server available.", 2000);
+        else 
+            showMessage("Server unavailable", 0);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.hupa.client.mvp.AppPresenter.Display#showMessage(java.lang.String, int)
+     */
+    public void showMessage(String message, int millisecs) {
+        flashLabel.setText(message);
+        flashContainer.setVisible(true);
+        if (millisecs > 0)
+            hideMessage.schedule(millisecs);
+    }
+    
+    private final Timer hideMessage = new Timer() {
+        public void run() {
+            flashContainer.setVisible(false);
+            flashLabel.setText("");
+        }
+    };
+
+    /* (non-Javadoc)
+     * @see org.apache.hupa.client.mvp.AppPresenter.Display#showContactsButton()
+     */
+    public void showContactsButton() {
+        mainButton.setVisible(false);
+        contactsButton.setVisible(true);
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.hupa.client.mvp.AppPresenter.Display#showMainButton()
+     */
+    public void showMainButton() {
+        mainButton.setVisible(true);
+        contactsButton.setVisible(false);
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.hupa.client.mvp.AppPresenter.Display#getMainClick()
+     */
+    public HasClickHandlers getMainClick() {
+        return mainButton;
+    }
+
+}

Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/ContactsPresenter.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/ContactsPresenter.java?rev=1516205&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/ContactsPresenter.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/ContactsPresenter.java Wed Aug 21 16:35:16 2013
@@ -0,0 +1,93 @@
+/****************************************************************
+ * 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.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 org.apache.hupa.client.HupaCallback;
+import org.apache.hupa.shared.events.ContactsUpdatedEvent;
+import org.apache.hupa.shared.events.ContactsUpdatedEventHandler;
+import org.apache.hupa.shared.events.MessagesReceivedEvent;
+import org.apache.hupa.shared.events.MessagesReceivedEventHandler;
+import org.apache.hupa.shared.events.SentMessageEvent;
+import org.apache.hupa.shared.events.SentMessageEventHandler;
+import org.apache.hupa.shared.rpc.Contacts;
+import org.apache.hupa.shared.rpc.ContactsResult;
+import org.apache.hupa.shared.rpc.ContactsResult.Contact;
+
+public class ContactsPresenter extends WidgetPresenter<ContactsPresenter.Display>{
+
+    public interface Display extends NameAwareWidgetDisplay, WidgetDisplay {
+        public void setContacts(Contact[] contacts);
+        public Contact[] getContacts();
+    }
+
+    DispatchAsync dispatcher;
+    protected Contact[] contacts;
+    protected EventBus eventBus;
+    
+    @Inject
+    public ContactsPresenter(Display display, EventBus eventBus, DispatchAsync dispatcher) {
+        super(display, eventBus);
+        this.dispatcher = dispatcher;
+        this.eventBus = eventBus;
+    }
+    
+    @Override
+    protected void onBind() {
+        registerHandler(eventBus.addHandler(ContactsUpdatedEvent.TYPE, new ContactsUpdatedEventHandler() {
+            public void onContactsUpdated(ContactsUpdatedEvent event) {
+                contacts = event.getContacts();
+                display.setContacts(contacts);
+            }
+        }));
+        registerHandler(eventBus.addHandler(MessagesReceivedEvent.TYPE, new MessagesReceivedEventHandler() {
+            public void onMessagesReceived(MessagesReceivedEvent event) {
+                updateContactsFromServer();
+            }
+        }));
+        registerHandler(eventBus.addHandler(SentMessageEvent.TYPE, new SentMessageEventHandler() {
+            public void onSentMessageEvent(SentMessageEvent ev) {
+                updateContactsFromServer();
+            }
+        }));
+    }
+
+    @Override
+    protected void onRevealDisplay() {
+    }
+
+    @Override
+    protected void onUnbind() {
+    }
+
+    protected void updateContactsFromServer() {
+        dispatcher.execute(new Contacts(),  new HupaCallback<ContactsResult>(dispatcher, eventBus) {
+            public void callback(ContactsResult result) {
+                eventBus.fireEvent(new ContactsUpdatedEvent(result.getContacts()));
+            }
+        }); 
+    }
+    
+}

Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/ContactsView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/ContactsView.java?rev=1516205&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/ContactsView.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/ContactsView.java Wed Aug 21 16:35:16 2013
@@ -0,0 +1,89 @@
+/****************************************************************
+ * 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.gwt.gen2.table.override.client.FlexTable;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.inject.Inject;
+
+import org.apache.hupa.client.HupaCSS;
+import org.apache.hupa.client.HupaConstants;
+import org.apache.hupa.shared.rpc.ContactsResult.Contact;
+
+import java.util.ArrayList;
+
+public class ContactsView extends Composite implements ContactsPresenter.Display{
+
+    private VerticalPanel panel = new VerticalPanel();
+    FlexTable ctable = new FlexTable();
+    
+    private HupaConstants constants;
+    
+    @Inject
+    public ContactsView(HupaConstants constants) {
+        this.constants = constants;
+        panel.addStyleName(HupaCSS.C_contacts_container);
+        panel.add(new HTML("<h1>Contacts view: comming soon<h1>"));
+        panel.add(ctable);
+        initWidget(panel);
+    }
+    
+    /*
+     * (non-Javadoc)
+     * @see org.apache.hupa.client.mvp.NameAwareWidgetDisplay#getName()
+     */
+    public String getName() {
+        return constants.contactsTab();
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see net.customware.gwt.presenter.client.widget.WidgetDisplay#asWidget()
+     */
+    public Widget asWidget() {
+        return this;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.hupa.client.mvp.ContactsPresenter.Display#setContacts(org.apache.hupa.shared.rpc.ContactsResult.Contact[])
+     */
+    public void setContacts(Contact[] contacts) {
+        ctable.clearAll();
+        for(int i=0; i<contacts.length; i++) {
+            ctable.setText(i, 0, contacts[i].realname);
+            ctable.setText(i, 1, contacts[i].mail);
+        }
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.hupa.client.mvp.ContactsPresenter.Display#getContacts()
+     */
+    public Contact[] getContacts() {
+        ArrayList<Contact> contacts = new ArrayList<Contact>();
+        for (int i=0; i < ctable.getRowCount(); i++) {
+            contacts.add(new Contact(ctable.getText(i, 0), ctable.getText(i, 1)));
+        }
+        return contacts.toArray(new Contact[contacts.size()]);
+    }
+
+}



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