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 ma...@apache.org on 2014/03/02 13:12:27 UTC
svn commit: r1573291 [1/8] - in /james/hupa/trunk: ./ client/
client/src/main/java/org/apache/hupa/
client/src/main/java/org/apache/hupa/client/
client/src/main/java/org/apache/hupa/client/activity/
client/src/main/java/org/apache/hupa/client/ioc/ clie...
Author: manolo
Date: Sun Mar 2 12:12:22 2014
New Revision: 1573291
URL: http://svn.apache.org/r1573291
Log:
Complete refactor of HUPA so as many pieces can be reusable.
Adding the ability to support multiple imap/smtp servers, and autodiscovering of server configuration.
Adding client side caching infra based on localStorage.
Improved performance, and removed repeated calls.
Fixing a lot of issues which makes Hupa almost ready for production environments.
Now client is a separated module which produce a reusable jar artifact.
etc, etc.
Added:
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/AddressListActivity.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ioc/AppInjector.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mapper/AddressListActivityMapper.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/storage/
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/storage/AppCacheHTML5.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/storage/HupaStorage.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/AddressListView.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/AddressListView.ui.xml
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/HupaPlugins.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SettingLabelPanel.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SettingLabelPanel.ui.xml
james/hupa/trunk/client/src/main/java/org/apache/hupa/public/
james/hupa/trunk/client/src/main/java/org/apache/hupa/public/Hupa-sd.html
james/hupa/trunk/client/src/main/java/org/apache/hupa/public/Hupa.css
james/hupa/trunk/client/src/main/java/org/apache/hupa/public/Hupa.html
james/hupa/trunk/client/src/main/java/org/apache/hupa/public/favicon.ico (with props)
james/hupa/trunk/client/src/main/java/org/apache/hupa/public/images/
james/hupa/trunk/client/src/main/java/org/apache/hupa/public/images/ajax-loader.gif (with props)
james/hupa/trunk/client/src/main/java/org/apache/hupa/public/images/buttons.png (with props)
james/hupa/trunk/client/src/main/java/org/apache/hupa/public/images/circles.png (with props)
james/hupa/trunk/client/src/main/java/org/apache/hupa/public/images/hborder.png (with props)
james/hupa/trunk/client/src/main/java/org/apache/hupa/public/images/hupa-logo-32.jpg (with props)
james/hupa/trunk/client/src/main/java/org/apache/hupa/public/images/hupa-logo-48.jpg (with props)
james/hupa/trunk/client/src/main/java/org/apache/hupa/public/images/hupa-logo-49-transparent.png (with props)
james/hupa/trunk/client/src/main/java/org/apache/hupa/public/images/hupa-logo-64-transparent.png (with props)
james/hupa/trunk/client/src/main/java/org/apache/hupa/public/images/hupa-logo-64.jpg (with props)
james/hupa/trunk/client/src/main/java/org/apache/hupa/public/images/hupa-logo-original-transparent.png (with props)
james/hupa/trunk/client/src/main/java/org/apache/hupa/public/images/hupa-logo-original.jpg (with props)
james/hupa/trunk/client/src/main/java/org/apache/hupa/public/images/hupa-spinning.gif (with props)
james/hupa/trunk/client/src/main/java/org/apache/hupa/public/images/linen.jpg (with props)
james/hupa/trunk/client/src/main/java/org/apache/hupa/public/images/linen_login.jpg (with props)
james/hupa/trunk/client/src/main/java/org/apache/hupa/public/images/listicons.png (with props)
james/hupa/trunk/client/src/main/java/org/apache/hupa/public/images/login_shadow.png (with props)
james/hupa/trunk/client/src/main/java/org/apache/hupa/public/images/splitter.png (with props)
james/hupa/trunk/client/src/main/java/org/apache/hupa/public/images/vborder.png (with props)
james/hupa/trunk/client/src/main/java/org/apache/hupa/public/styles.css
james/hupa/trunk/client/src/test/java/org/apache/hupa/client/HupaClientTestBase.java
james/hupa/trunk/client/src/test/java/org/apache/hupa/client/ioc/
james/hupa/trunk/client/src/test/java/org/apache/hupa/client/ioc/GinClientTestModule.java
james/hupa/trunk/client/src/test/java/org/apache/hupa/client/storage/
james/hupa/trunk/client/src/test/java/org/apache/hupa/client/storage/HupaStorageTest.java
james/hupa/trunk/hupa/
james/hupa/trunk/hupa/src/
james/hupa/trunk/hupa/src/main/
james/hupa/trunk/hupa/src/main/java/
james/hupa/trunk/hupa/src/main/java/com/
james/hupa/trunk/hupa/src/main/java/com/google/
james/hupa/trunk/hupa/src/main/java/com/google/web/
james/hupa/trunk/hupa/src/main/java/com/google/web/bindery/
james/hupa/trunk/hupa/src/main/java/com/google/web/bindery/requestfactory/
james/hupa/trunk/hupa/src/main/java/com/google/web/bindery/requestfactory/server/
james/hupa/trunk/hupa/src/main/java/com/google/web/bindery/requestfactory/server/ResolverServiceLayer.java
james/hupa/trunk/hupa/src/main/java/org/
james/hupa/trunk/hupa/src/main/java/org/apache/
james/hupa/trunk/hupa/src/main/java/org/apache/hupa/
james/hupa/trunk/hupa/src/main/java/org/apache/hupa/HupaDev.gwt.xml
james/hupa/trunk/hupa/src/main/java/org/apache/hupa/HupaProd.gwt.xml
james/hupa/trunk/hupa/src/main/java/org/apache/hupa/client/
james/hupa/trunk/hupa/src/main/java/org/apache/hupa/client/Hupa.java
james/hupa/trunk/hupa/src/main/resources/
james/hupa/trunk/hupa/src/main/resources/log4j.properties
james/hupa/trunk/hupa/src/main/webapp/
james/hupa/trunk/hupa/src/main/webapp/WEB-INF/
james/hupa/trunk/hupa/src/main/webapp/WEB-INF/conf/
james/hupa/trunk/hupa/src/main/webapp/WEB-INF/conf/config.properties
james/hupa/trunk/hupa/src/main/webapp/WEB-INF/web.xml
james/hupa/trunk/hupa/src/main/webapp/index.html
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/utils/SettingsDiscoverer.java
james/hupa/trunk/server/src/test/java/org/apache/hupa/server/guice/GuiceJunitRunner.java
james/hupa/trunk/server/src/test/java/org/apache/hupa/server/service/SendMessageServiceTest.java
james/hupa/trunk/server/src/test/resources/
james/hupa/trunk/server/src/test/resources/testimage.jpg (with props)
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/algorithms/
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/algorithms/B64.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/algorithms/Md5.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/algorithms/RC4.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/data/HasFullName.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/data/HasId.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/AddressClickEvent.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/AddressClickEventHandler.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/AttachClickEvent.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/AttachClickEventHandler.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/MessageListRangeChangedEvent.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/MessageListRangeChangedEventHandler.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/MessageViewEvent.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/MessageViewEventHandler.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/RefreshFoldersEvent.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/RefreshFoldersEventHandler.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/SendClickEvent.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/SendClickEventHandler.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/ShowRawEvent.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/ShowRawEventHandler.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/storage/
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/storage/AppCache.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/storage/AppCacheMemory.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/storage/AppSerializer.java
james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/dialog/
james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/dialog/Dialog.java
Removed:
james/hupa/trunk/client/src/main/java/org/apache/hupa/HupaProd.gwt.xml
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ioc/AppGinjector.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/rf/IdleRequest.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/res/CssFolderListView.css~HEAD
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/res/CssLoginView.css
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/res/CssMessagesCellTable.css~HEAD
james/hupa/trunk/client/src/main/webapp/Hupa.css
james/hupa/trunk/client/src/main/webapp/Hupa.html
james/hupa/trunk/client/src/main/webapp/WEB-INF/web.xml
james/hupa/trunk/client/src/main/webapp/favicon.ico
james/hupa/trunk/client/src/main/webapp/images/ajax-loader.gif
james/hupa/trunk/client/src/main/webapp/images/buttons.png
james/hupa/trunk/client/src/main/webapp/images/hupa-logo-32.jpg
james/hupa/trunk/client/src/main/webapp/images/hupa-logo-48.jpg
james/hupa/trunk/client/src/main/webapp/images/hupa-logo-49-transparent.png
james/hupa/trunk/client/src/main/webapp/images/hupa-logo-64-transparent.png
james/hupa/trunk/client/src/main/webapp/images/hupa-logo-64.jpg
james/hupa/trunk/client/src/main/webapp/images/hupa-logo-original-transparent.png
james/hupa/trunk/client/src/main/webapp/images/hupa-logo-original.jpg
james/hupa/trunk/client/src/main/webapp/images/hupa-spinning.gif
james/hupa/trunk/client/src/main/webapp/images/linen.jpg
james/hupa/trunk/client/src/main/webapp/images/linen_login.jpg
james/hupa/trunk/client/src/main/webapp/images/listicons.png
james/hupa/trunk/client/src/main/webapp/images/login_shadow.png
james/hupa/trunk/client/src/main/webapp/images/splitter.png
james/hupa/trunk/client/src/main/webapp/reset.css
james/hupa/trunk/client/src/main/webapp/styles.css
james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/mock/MockSMTPTransport.java
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/DispatchServletModule.java
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/providers/JavaMailSessionProvider.java
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/IdleService.java
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/IdleServiceImpl.java
james/hupa/trunk/server/src/main/webapp/WEB-INF/conf/config.properties
james/hupa/trunk/server/src/test/java/org/apache/hupa/server/service/IdleServiceTest.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/data/IdleActionImpl.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/data/IdleResultImpl.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/data/MessageAttachmentImpl.java~HEAD
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/data/MessageImpl.java~HEAD
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/data/SettingsImpl.java~HEAD
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/domain/IdleAction.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/domain/IdleResult.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/domain/ImapFolder.java~HEAD
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/RefreshUnreadEvent.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/RefreshUnreadEventHandler.java
Modified:
james/hupa/trunk/client/pom.xml
james/hupa/trunk/client/src/main/java/org/apache/hupa/Hupa.gwt.xml
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/Hupa.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaController.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/ComposeActivity.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/ComposeToolBarActivity.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/FolderListActivity.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/LoginActivity.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/MessageContentActivity.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/MessageListActivity.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/NavigationActivity.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/SettingNavActivity.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/ToolBarActivity.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/TopBarActivity.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ioc/AppGinModule.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mapper/ActivityAsyncProxy.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mapper/ActivityManagerInitializer.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mapper/ComposeToolBarActivityMapper.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mapper/ContactsListActivityMapper.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mapper/FolderListActivityMapper.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mapper/LabelListActivityMapper.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mapper/SettingNavActivityMapper.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mapper/ToolBarActivityMapper.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mapper/TopBarActivityMapper.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mapper/_HupaActivityMapper.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mapper/_MessageActivityMapper.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/place/ComposePlace.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/place/MessagePlace.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/rf/HupaRequestFactory.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/rf/LoginUserRequest.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ComposeToolBarView.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ComposeToolBarView.ui.xml
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ComposeView.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ComposeView.ui.xml
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/FolderListView.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/HupaLayout.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/HupaLayout.ui.xml
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/HupaLayoutable.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelListView.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelPropertiesView.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelPropertiesView.ui.xml
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LoginView.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LoginView.ui.xml
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageContentView.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageContentView.ui.xml
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageListFooterView.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageListView.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessagesCellTable.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/NavigationView.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/NavigationView.ui.xml
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SettingNavView.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/SettingNavView.ui.xml
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ToolBarView.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ToolBarView.ui.xml
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/_CenterComposePanel.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/_CenterSettingPanel.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/_CenterSettingPanel.ui.xml
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/_ToolPanel.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/_ToolPanel.ui.xml
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/__ComposePanel.ui.xml
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/__ContentPanel.ui.xml
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/__OutlineComposePanel.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/__OutlineComposePanel.ui.xml
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/__OutlinePanel.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/res/CssLabelListView.css
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/res/buttons.png
james/hupa/trunk/client/src/test/java/org/apache/hupa/client/mock/MockMessageSendDisplay.java
james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/guice/AbstractGuiceTestModule.java
james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/mock/MockConstants.java
james/hupa/trunk/mock/src/main/java/org/apache/hupa/server/mock/MockIMAPStore.java
james/hupa/trunk/mock/src/main/resources/mime/11.msg
james/hupa/trunk/mock/src/main/resources/mime/12.msg
james/hupa/trunk/mock/src/main/resources/mime/13.msg
james/hupa/trunk/pom.xml
james/hupa/trunk/server/pom.xml
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/CachedIMAPStore.java
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/IMAPStoreCache.java
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/InMemoryIMAPStoreCache.java
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/providers/DefaultUserSettingsProvider.java
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/ioc/GuiceListener.java
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/ioc/GuiceServerModule.java
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/ioc/GuiceWebModule.java
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/ioc/IocRfServiceDecorator.java
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/ioc/demo/DemoGuiceServerModule.java
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/preferences/InImapUserPreferencesStorage.java
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/AbstractService.java
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/FetchFoldersServiceImpl.java
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/FetchMessagesServiceImpl.java
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/GetMessageDetailsServiceImpl.java
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/LoginUserService.java
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/LoginUserServiceImpl.java
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/SendForwardMessageServiceImpl.java
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/SendMessageBaseServiceImpl.java
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/SendReplyMessageServiceImpl.java
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/servlet/DownloadAttachmentServlet.java
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/utils/ConfigurationProperties.java
james/hupa/trunk/server/src/test/java/org/apache/hupa/server/HupaGuiceTestCase.java
james/hupa/trunk/server/src/test/java/org/apache/hupa/server/guice/GuiceServerTestModule.java
james/hupa/trunk/server/src/test/java/org/apache/hupa/server/integration/StoreBugTest.java
james/hupa/trunk/server/src/test/java/org/apache/hupa/server/service/GetMessageDetailServiceTest.java
james/hupa/trunk/server/src/test/java/org/apache/hupa/server/service/LoginUserServiceTest.java
james/hupa/trunk/server/src/test/java/org/apache/hupa/server/utils/TestUtils.java
james/hupa/trunk/shared/pom.xml
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/data/FetchMessagesActionImpl.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/data/ImapFolderImpl.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/data/MailHeaderImpl.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/data/MessageDetailsImpl.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/data/MessageImpl.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/data/SettingsImpl.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/data/SmtpMessageImpl.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/data/UserImpl.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/domain/ImapFolder.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/domain/MailHeader.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/domain/Message.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/domain/MessageDetails.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/domain/Settings.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/domain/SmtpMessage.java
james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/domain/User.java
james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/WidgetsCSS.java
Modified: james/hupa/trunk/client/pom.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/pom.xml?rev=1573291&r1=1573290&r2=1573291&view=diff
==============================================================================
--- james/hupa/trunk/client/pom.xml (original)
+++ james/hupa/trunk/client/pom.xml Sun Mar 2 12:12:22 2014
@@ -25,10 +25,10 @@
<version>0.0.5-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
- <artifactId>hupa</artifactId>
- <packaging>war</packaging>
- <name>Apache James Hupa</name>
- <description>A GWT based IMAP webmail</description>
+ <artifactId>hupa-client</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache James Hupa Client</name>
+ <description>Client code of a GWT based IMAP webmail</description>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
@@ -54,6 +54,13 @@
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
+ <artifactId>hupa-server</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
<artifactId>hupa-shared</artifactId>
</dependency>
<dependency>
@@ -81,6 +88,10 @@
<artifactId>gin</artifactId>
</dependency>
<dependency>
+ <groupId>com.googlecode.gwtquery</groupId>
+ <artifactId>gwtquery</artifactId>
+ </dependency>
+ <dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
@@ -120,76 +131,29 @@
</dependency>
</dependencies>
<build>
- <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*.java</include>
+ <include>**/*.xml</include>
+ <include>**/*.html</include>
+ <include>**/*.css</include>
+ <include>**/*.png</include>
+ <include>**/*.gif</include>
+ <include>**/*.jpg</include>
+ <include>**/*.properties</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>**/*.*</include>
+ </includes>
+ </resource>
+ </resources>
<plugins>
<plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>gwt-maven-plugin</artifactId>
- <configuration>
- <runTarget>Hupa.html</runTarget>
- <localWorkers>1</localWorkers>
- <compileReport>${gwt.compileReport}</compileReport>
- <disableClassMetadata>${gwt.disableClassMetadata}</disableClassMetadata>
- <disableCastChecking>${gwt.disableCastChecking}</disableCastChecking>
- <logLevel>${gwt.logLevel}</logLevel>
- <style>${gwt.style}</style>
- <fragmentCount>10</fragmentCount>
- <enableClosureCompiler>${gwt.enableClosureCompiler}</enableClosureCompiler>
- <disableRunAsync>${gwt.disableRunAsync}</disableRunAsync>
- <modules>
- <module>org.apache.hupa.Hupa${gwt.moduleSuffix}</module>
- </modules>
- <extraJvmArgs>-XX:MaxPermSize=512M -Xmx1024M</extraJvmArgs>
- </configuration>
- <executions>
- <execution>
- <phase>prepare-package</phase>
- <goals>
- <goal>compile</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-<!-- maven-sure-fire-plugin configurations commented - Why was this needed ? -->
-<!-- - response by manolo: -->
-<!-- This is needed when running gwt tests, the gwt compiler needs to access to -->
-<!-- java source files so as it can parse them an compile into javascript -->
-<!-- Because we like fast tests, so far, all our tests are run in jvm instead of -->
-<!-- in browser emulator, we can do that because we use MVP pattern in hupa -->
-<!-- Maybe we needed this in a future when testing our widgets or stuff which only -->
-<!-- run in browser. -->
-<!-- <plugin> -->
-<!-- <groupId>org.apache.maven.plugins</groupId> -->
-<!-- <artifactId>maven-surefire-plugin</artifactId> -->
-<!-- <configuration> -->
-<!-- <useSystemClassLoader>false</useSystemClassLoader> -->
-<!-- <additionalClasspathElements> -->
-<!-- <additionalClasspathElement>${basedir}/src/test/java</additionalClasspathElement> -->
-<!-- <additionalClasspathElement>${basedir}/src/main/java</additionalClasspathElement> -->
-<!-- </additionalClasspathElements> -->
-<!-- </configuration> -->
-<!-- </plugin> -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-war-plugin</artifactId>
- <configuration>
- <webXml>src/main/webapp/WEB-INF/web.xml</webXml>
- <webResources>
- <!-- this is a ugly hack but I'm not sure howto solve it -->
- <!-- This take care of including the config file within the war -->
- <resource>
- <directory>../server/src/main/webapp/</directory>
- </resource>
- </webResources>
- <warName>${project.artifactId}-${project.version}</warName>
- <archive>
- <manifest>
- <mainClass>org.apache.hupa.Launcher</mainClass>
- </manifest>
- </archive>
- </configuration>
- </plugin>
- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
@@ -240,63 +204,6 @@
</execution>
</executions>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
- <executions>
- <execution>
- <id>copy-resources</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>copy-resources</goal>
- </goals>
- <configuration>
- <outputDirectory>${project.build.directory}/${project.build.finalName}</outputDirectory>
- <resources>
- <resource>
- <directory>src/main/webapp</directory>
- </resource>
- </resources>
- </configuration>
- </execution>
- <execution>
- <id>copy-launcher</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>copy-resources</goal>
- </goals>
- <configuration>
- <outputDirectory>${project.build.directory}/${project.build.finalName}</outputDirectory>
- <resources>
- <resource>
- <directory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</directory>
- <include>org/apache/hupa/Launcher.class</include>
- </resource>
- </resources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>jetty-classpath</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>unpack-dependencies</goal>
- </goals>
- <configuration>
- <includeGroupIds>org.eclipse.jetty,javax.servlet</includeGroupIds>
- <excludeArtifactIds>jsp-api,jstl</excludeArtifactIds>
- <outputDirectory>
- ${project.build.directory}/${project.artifactId}-${project.version}
- </outputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
</plugins>
</build>
</project>
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=1573291&r1=1573290&r2=1573291&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 Sun Mar 2 12:12:22 2014
@@ -14,11 +14,11 @@
the specific language governing permissions and limitations under the
License.
-->
-<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.6.4//EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.6.4/distro-source/core/src/gwt-module.dtd">
<module rename-to='hupa'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>
- <inherits name="com.google.gwt.i18n.I18N"/>
+ <inherits name="com.google.gwt.i18n.I18N"/>
+ <inherits name='com.google.gwt.query.QueryMin'/>
<!-- inherits Logging module -->
<inherits name="com.google.gwt.logging.Logging"/>
<set-property name="gwt.logging.enabled" value="TRUE"/>
@@ -58,10 +58,8 @@
<!-- <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'/> -->
-
-
- <!-- CSS loaded asynchronously -->
- <stylesheet src="../styles.css"/>
+
+ <set-configuration-property name="CssResource.style" value="pretty"/>
<!-- xsiframe would be the default in gwt soon -->
<add-linker name="xsiframe"/>
@@ -73,7 +71,5 @@
<!-- In dev mode compile just for FF and webkit -->
<set-property name="user.agent" value="gecko1_8,safari"/>
-
- <!-- Specify the app entry point class. -->
- <entry-point class='org.apache.hupa.client.Hupa'/>
+
</module>
Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/Hupa.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/Hupa.java?rev=1573291&r1=1573290&r2=1573291&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/Hupa.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/Hupa.java Sun Mar 2 12:12:22 2014
@@ -19,39 +19,55 @@
package org.apache.hupa.client;
-import org.apache.hupa.client.ioc.AppGinjector;
+import org.apache.hupa.client.ioc.AppGinModule.AppGinjector;
+import org.apache.hupa.client.ioc.AppInjector;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.GWT.UncaughtExceptionHandler;
+import com.google.gwt.query.client.GQuery;
import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.ui.RootPanel;
public class Hupa implements EntryPoint {
+
@Override
public void onModuleLoad() {
handleExceptionsAsync();
initApp();
}
-
- private void initApp() {
- replaceLoading();
- injector.getHupaController().start();
+
+ protected void initApp() {
+ DOM.getElementById("loading").removeFromParent();
+ createInjector().getHupaController();
+ bindEvents();
}
+
+ protected void bindEvents() {
+ }
+
+ protected AppInjector createInjector() {
+ return GWT.create(AppGinjector.class);
+ }
- private void handleExceptionsAsync() {
+ protected void handleExceptionsAsync() {
GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
public void onUncaughtException(Throwable e) {
e.printStackTrace();
+ GQuery.console.log(stackTraceToString(e));
}
});
}
-
- private void replaceLoading() {
- DOM.removeChild(RootPanel.getBodyElement(),
- DOM.getElementById("loading"));
- }
-
- private final AppGinjector injector = GWT.create(AppGinjector.class);
-
+
+ private String stackTraceToString(Throwable throwable) {
+ String ret = "";
+ while (throwable != null) {
+ if (ret != "")
+ ret += "\nCaused by: ";
+ ret += throwable.toString();
+ for (StackTraceElement sTE : throwable.getStackTrace())
+ ret += "\n at " + sTE;
+ throwable = throwable.getCause();
+ }
+ return ret;
+ }
}
Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaController.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaController.java?rev=1573291&r1=1573290&r2=1573291&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaController.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaController.java Sun Mar 2 12:12:22 2014
@@ -20,36 +20,34 @@
package org.apache.hupa.client;
import org.apache.hupa.client.activity.NotificationActivity;
-import org.apache.hupa.client.activity.ToolBarActivity;
import org.apache.hupa.client.activity.TopBarActivity;
import org.apache.hupa.client.mapper.ActivityManagerInitializer;
import org.apache.hupa.client.place.ComposePlace;
import org.apache.hupa.client.place.ContactPlace;
+import org.apache.hupa.client.place.DefaultPlace;
import org.apache.hupa.client.place.FolderPlace;
import org.apache.hupa.client.place.HupaPlace;
import org.apache.hupa.client.place.SettingPlace;
-import org.apache.hupa.client.rf.CheckSessionRequest;
import org.apache.hupa.client.rf.HupaRequestFactory;
-import org.apache.hupa.client.rf.IdleRequest;
+import org.apache.hupa.client.storage.HupaStorage;
import org.apache.hupa.client.ui.HupaLayout;
import org.apache.hupa.client.ui.HupaLayoutable;
import org.apache.hupa.client.ui.LoginLayoutable;
-import org.apache.hupa.client.ui.LoginView;
-import org.apache.hupa.shared.domain.IdleAction;
-import org.apache.hupa.shared.domain.IdleResult;
import org.apache.hupa.shared.domain.User;
import org.apache.hupa.shared.events.LoginEvent;
+import org.apache.hupa.shared.events.LogoutEvent;
+import org.apache.hupa.shared.events.LogoutEventHandler;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
-import com.google.gwt.dom.client.StyleInjector;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.place.shared.Place;
import com.google.gwt.place.shared.PlaceChangeEvent;
import com.google.gwt.place.shared.PlaceController;
import com.google.gwt.place.shared.PlaceHistoryHandler;
import com.google.gwt.user.client.Timer;
+import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.RootLayoutPanel;
import com.google.inject.Inject;
import com.google.web.bindery.requestfactory.shared.Receiver;
@@ -57,45 +55,65 @@ import com.google.web.bindery.requestfac
public class HupaController {
- private static final int IDLE_INTERVAL = 15000;
- private PlaceController placeController;
- private PlaceHistoryHandler placeHistoryHandler;
- @Inject private HupaLayoutable hupaLayout;
- @Inject private HupaRequestFactory requestFactory;
- @Inject private LoginLayoutable loginLayout;
+ private final PlaceController placeController;
+ private final HupaLayoutable hupaLayout;
+ private final LoginLayoutable loginLayout;
+
@Inject private NotificationActivity.Displayable noticeRegion;
@Inject private TopBarActivity.Displayable topBar;
- @Inject private ToolBarActivity.Displayable toolBar;
- private EventBus eventBus;
-
- private Timer noopTimer = new IdleTimer();
+
+ public static User user = null;
@Inject
- public HupaController(PlaceController placeController, PlaceHistoryHandler placeHistoryHandler, EventBus eventBus,
- ActivityManagerInitializer initializeActivityManagerByGin) {
+ public HupaController(final PlaceController placeController, final PlaceHistoryHandler placeHistoryHandler,
+ final EventBus eventBus, ActivityManagerInitializer initializeActivityManagerByGin, HupaRequestFactory requestFactory,
+ HupaStorage storage, final HupaLayoutable hupaLayout, final LoginLayoutable loginLayout) {
+
this.placeController = placeController;
- this.placeHistoryHandler = placeHistoryHandler;
- this.eventBus = eventBus;
- eventBus.addHandler(PlaceChangeEvent.TYPE, new PlaceChangHandler());
- }
-
- public void start() {
- bindCss();
- placeHistoryHandler.handleCurrentHistory();
- }
-
- private void bindCss() {
- // TODO:replace with a more gentle approach
- StyleInjector.inject(LoginView.Resources.INSTANCE.stylesheet().getText());
- }
-
- private final class PlaceChangHandler implements PlaceChangeEvent.Handler {
- @Override
- public void onPlaceChange(PlaceChangeEvent event) {
- checkSession();
- adjustLayout(event);
- }
- }
+ this.hupaLayout = hupaLayout;
+ this.loginLayout = loginLayout;
+
+ eventBus.addHandler(PlaceChangeEvent.TYPE, new PlaceChangeEvent.Handler() {
+ @Override
+ public void onPlaceChange(PlaceChangeEvent event) {
+ adjustLayout(event);
+ }
+ });
+
+ requestFactory.sessionRequest().getUser().fire(new Receiver<User>() {
+ @Override
+ public void onSuccess(User u) {
+ if (u == null) {
+ placeController.goTo(new DefaultPlace(""));
+ onFailure(null);
+ } else {
+ user = u;
+ eventBus.fireEvent(new LoginEvent(user));
+ showScreen(false);
+ eventBus.fireEvent(new LoginEvent(user));
+ placeHistoryHandler.handleCurrentHistory();
+ }
+ }
+ @Override
+ public void onFailure(ServerFailure error) {
+ showScreen(true);
+ }
+ });
+
+ eventBus.addHandler(LogoutEvent.TYPE, new LogoutEventHandler() {
+ public void onLogout(LogoutEvent logoutEvent) {
+ RootLayoutPanel.get().clear();
+// RootLayoutPanel.get().add(loginLayout.get());
+// pc.goTo(new DefaultPlace(""));
+ Window.Location.reload();
+ }
+ });
+ }
+
+ private void showScreen(boolean login) {
+ RootLayoutPanel.get().clear();
+ RootLayoutPanel.get().add(login ? loginLayout.get() : hupaLayout.get());
+ }
private void adjustLayout(PlaceChangeEvent event) {
Place place = event.getNewPlace();
@@ -115,37 +133,15 @@ public class HupaController {
hupaLayout.switchTo(HupaLayout.LAYOUT_CONTACT);
} else if (place instanceof SettingPlace) {
hupaLayout.switchTo(HupaLayout.LAYOUT_SETTING);
+ SettingPlace sp = (SettingPlace)place;
+ hupaLayout.arrangeSettingLayout(sp);
} else if(place instanceof HupaPlace){
hupaLayout.switchTo(HupaLayout.LAYOUT_MESSAGE);
+ } else {
+ return;
}
}
- private void checkSession() {
- CheckSessionRequest checkSession = requestFactory.sessionRequest();
- checkSession.getUser().fire(new Receiver<User>() {
- @Override
- public void onSuccess(User user) {
- if (user == null) {
- RootLayoutPanel.get().clear();
- RootLayoutPanel.get().add(loginLayout.get());
- noopTimer.cancel();
- } else {
- RootLayoutPanel.get().clear();
- RootLayoutPanel.get().add(hupaLayout.get());
- eventBus.fireEvent(new LoginEvent(user));
- noopTimer.scheduleRepeating(IDLE_INTERVAL);
- }
- }
-
- @Override
- public void onFailure(ServerFailure error) {
- RootLayoutPanel.get().clear();
- RootLayoutPanel.get().add(loginLayout.get());
- noopTimer.cancel();
- }
- });
- }
-
public void showNotice(String html, int millis) {
noticeRegion.notice(html);
if (millis > 0)
@@ -170,30 +166,4 @@ public class HupaController {
noticeRegion.hideNotification();
}
};
-
- private class IdleTimer extends Timer {
- boolean running = false;
-
- public void run() {
- if (!running) {
- running = true;
- IdleRequest idle = requestFactory.idleRequest();
- IdleAction action = idle.create(IdleAction.class);
- idle.idle(action).fire(new Receiver<IdleResult>() {
- @Override
- public void onSuccess(IdleResult response) {
- running = false;
- // check if the server is not supporting the Idle
- // command. if so cancel this Timer
- if (response.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/activity/AddressListActivity.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/AddressListActivity.java?rev=1573291&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/AddressListActivity.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/AddressListActivity.java Sun Mar 2 12:12:22 2014
@@ -0,0 +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.client.activity;
+
+import com.google.gwt.event.shared.EventBus;
+import com.google.gwt.user.client.ui.AcceptsOneWidget;
+import com.google.gwt.user.client.ui.IsWidget;
+import com.google.inject.Inject;
+
+public class AddressListActivity extends AppBaseActivity {
+
+ @Override
+ public void start(AcceptsOneWidget container, EventBus eventBus) {
+ container.setWidget(display.asWidget());
+ }
+
+ @Inject private Displayable display;
+
+ public interface Displayable extends IsWidget {}
+}
Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/ComposeActivity.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/ComposeActivity.java?rev=1573291&r1=1573290&r2=1573291&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/ComposeActivity.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/ComposeActivity.java Sun Mar 2 12:12:22 2014
@@ -34,7 +34,6 @@ import org.apache.hupa.client.place.Comp
import org.apache.hupa.client.rf.SendForwardMessageRequest;
import org.apache.hupa.client.rf.SendMessageRequest;
import org.apache.hupa.client.rf.SendReplyMessageRequest;
-import org.apache.hupa.client.ui.MessagesCellTable;
import org.apache.hupa.client.validation.EmailListValidator;
import org.apache.hupa.shared.Util;
import org.apache.hupa.shared.data.MessageAttachmentImpl;
@@ -48,19 +47,27 @@ import org.apache.hupa.shared.domain.Sen
import org.apache.hupa.shared.domain.SendReplyMessageAction;
import org.apache.hupa.shared.domain.SmtpMessage;
import org.apache.hupa.shared.domain.User;
+import org.apache.hupa.shared.events.AddressClickEvent;
+import org.apache.hupa.shared.events.AddressClickEventHandler;
+import org.apache.hupa.shared.events.AttachClickEvent;
+import org.apache.hupa.shared.events.AttachClickEventHandler;
import org.apache.hupa.shared.events.LoginEvent;
import org.apache.hupa.shared.events.LoginEventHandler;
import org.apache.hupa.shared.events.MailToEvent;
import org.apache.hupa.shared.events.MailToEventHandler;
+import org.apache.hupa.shared.events.SendClickEvent;
+import org.apache.hupa.shared.events.SendClickEventHandler;
import com.google.gwt.activity.shared.Activity;
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.event.dom.client.HasFocusHandlers;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.storage.client.Storage;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
+import com.google.gwt.user.client.ui.HasEnabled;
import com.google.gwt.user.client.ui.HasHTML;
import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.IsWidget;
@@ -72,9 +79,8 @@ import com.google.web.bindery.requestfac
public class ComposeActivity extends AppBaseActivity {
@Inject private Displayable display;
@Inject private HupaController hupaController;
- @Inject private TopBarActivity topBar;
private List<MessageAttachment> attachments = new ArrayList<MessageAttachment>();
- private ComposePlace place;
+ protected ComposePlace place;
private User user;
public Activity with(ComposePlace place) {
@@ -96,7 +102,7 @@ public class ComposeActivity extends App
return null;
}
return null;
-// return "Do you want to leave this page?"; TODO
+ // return "Do you want to leave this page?"; TODO
}
@Override
@@ -113,17 +119,24 @@ public class ComposeActivity extends App
}
- private void fillHeader() {
+ protected void fillHeader() {
if (place == null || place.getParameters() == null)
return;
- if (user == null){
+ if (user == null) {
user = place.getParameters().getUser();
}
- if(user == null){
- user = topBar.getUser();
+ if (user == null) {
+ user = HupaController.user;
}
display.getFromList().addItem(user.getName());
- if("new".equals(place.getToken())){
+ display.getUploader().reset();
+ if ("new".equals(place.getToken())) {
+ display.getTo().setText("");
+ display.getCc().setText("");
+ display.getBcc().setText("");
+ display.getSubject().setText(place.getSubject() == null ? "" : place.getSubject());
+ display.getMessageHTML().setHTML(place.getBody() == null ? "" : place.getBody());
+ attachments.clear();
return;
}
Message oldMessage = place.getParameters().getOldmessage();
@@ -208,12 +221,34 @@ public class ComposeActivity extends App
}
return ret;
}
- private void bindTo(EventBus eventBus) {
+ protected void bindTo(EventBus eventBus) {
+ eventBus.addHandler(AddressClickEvent.TYPE, new AddressClickEventHandler() {
+ @Override
+ public void onClick(AddressClickEvent event) {
+ String to = display.getTo().getText();
+ if(to != null && to.trim().length() > 0){
+ display.getTo().setText(to + ";" + event.getEmail());
+ }else {
+ display.getTo().setText(event.getEmail());
+ }
+ }
+ });
+ eventBus.addHandler(SendClickEvent.TYPE, new SendClickEventHandler() {
+ public void onSendClick(SendClickEvent event) {
+ send();
+ }
+ });
eventBus.addHandler(LoginEvent.TYPE, new LoginEventHandler() {
public void onLogin(LoginEvent event) {
user = event.getUser();
}
});
+ eventBus.addHandler(AttachClickEvent.TYPE, new AttachClickEventHandler() {
+ public void onAttachClick(AttachClickEvent event) {
+ display.getAttachButton().fireEvent(new ClickEvent() {
+ });
+ }
+ });
registerHandler(display.getSendClick().addClickHandler(sendClickHandler));
registerHandler(display.getCancelClick().addClickHandler(cancelClickHandler));
@@ -269,33 +304,38 @@ public class ComposeActivity extends App
registerHandler(display.getUploader().addOnFinishUploadHandler(onFinishUploadHandler));
registerHandler(display.getUploader().addOnCancelUploadHandler(onCancelUploadHandler));
- eventBus.addHandler(MailToEvent.TYPE, new MailToEventHandler(){
-
+ eventBus.addHandler(MailToEvent.TYPE, new MailToEventHandler() {
@Override
public void onMailTo(MailToEvent event) {
display.getTo().setText(event.getMailto());
- }});
-
+ }
+ });
+
fillSuggestList();
-
+
}
private void fillSuggestList() {
+ // TODO move this to hupaStorage
Storage contactStore = Storage.getLocalStorageIfSupported();
- if(contactStore != null){
- String contactsString = contactStore.getItem(MessagesCellTable.CONTACTS_STORE);
- if(contactsString != null){
- display.fillContactList(contactsString.replace("[", "").replace("]", "").trim().split(","));
- }
+ if (contactStore != null) {
+ String contactsString = contactStore.getItem(MessageListActivity.CONTACTS_STORE);
+ if (contactsString != null) {
+ display.fillContactList(contactsString.replace("[", "").replace("]", "").trim().split(","));
+ }
}
}
private OnFinishUploaderHandler onFinishUploadHandler = new OnFinishUploaderHandler() {
public void onFinish(IUploader uploader) {
if (uploader.getStatus() == Status.SUCCESS) {
- String name = uploader.getInputName();
MessageAttachment attachment = new MessageAttachmentImpl();
- attachment.setName(name);
+ // We use the fileInputName (unique) instead of the fileName so
+ // as we
+ // can find the item in the registry.
+ attachment.setName(uploader.getInputName());
+ attachment.setContentType(uploader.getServerInfo().ctype);
+ attachment.setSize(uploader.getServerInfo().size);
attachments.add(attachment);
}
}
@@ -303,13 +343,8 @@ public class ComposeActivity extends App
private OnStatusChangedHandler onStatusChangedHandler = new OnStatusChangedHandler() {
public void onStatusChanged(IUploader uploader) {
- // TODO buttons disabled
- // Status stat = display.getUploader().getStatus();
-
- // if (stat == Status.INPROGRESS)
- // display.getSendEnable().setEnabled(false);
- // else
- // display.getSendEnable().setEnabled(true);
+ Status stat = display.getUploader().getStatus();
+ ((HasEnabled) display.getSendClick()).setEnabled(stat != Status.INPROGRESS);
}
};
@@ -333,54 +368,62 @@ public class ComposeActivity extends App
protected ClickHandler sendClickHandler = new ClickHandler() {
public void onClick(ClickEvent event) {
- if (!validate())
- return;
- hupaController.showTopLoading("Sending...");
-
- if ("new".equals(place.getToken())) {
- SendMessageRequest sendReq = rf.sendMessageRequest();
- SendMessageAction sendAction = sendReq.create(SendMessageAction.class);
- sendAction.setMessage(parseMessage(sendReq));
- sendReq.send(sendAction).fire(new Receiver<GenericResult>() {
- @Override
- public void onSuccess(GenericResult response) {
- afterSend(response);
- }
- });
- } else if ("forward".equals(place.getToken())) {
- // FIXME will get a NullPointerException given accessing
- // directly from some URL like #/compose:forward
- SendForwardMessageRequest req = rf.sendForwardMessageRequest();
- SendForwardMessageAction action = req.create(SendForwardMessageAction.class);
- action.setMessage(parseMessage(req));
- ImapFolder f = req.create(ImapFolder.class);
- f.setFullName(place.getParameters().getFolderName());
- action.setFolder(f);
- action.setUid(place.getParameters().getOldmessage().getUid());
- req.send(action).fire(new Receiver<GenericResult>() {
- @Override
- public void onSuccess(GenericResult response) {
- afterSend(response);
- }
- });
- } else {
- SendReplyMessageRequest replyReq = rf.sendReplyMessageRequest();
- SendReplyMessageAction action = replyReq.create(SendReplyMessageAction.class);
- action.setMessage(parseMessage(replyReq));
- ImapFolder folder = replyReq.create(ImapFolder.class);
- folder.setFullName(place.getParameters().getFolderName());
- action.setFolder(folder);
- action.setUid(place.getParameters().getOldmessage().getUid());
- replyReq.send(action).fire(new Receiver<GenericResult>() {
- @Override
- public void onSuccess(GenericResult response) {
- afterSend(response);
- }
- });
- }
+ send();
}
};
+ protected void send() {
+ if (!validate())
+ return;
+ hupaController.showTopLoading("Sending...");
+
+ MessageDetails oldDetails = place.getParameters().getOldDetails();
+
+ if ("new".equals(place.getToken())) {
+ SendMessageRequest sendReq = rf.sendMessageRequest();
+ SendMessageAction sendAction = sendReq.create(SendMessageAction.class);
+ sendAction.setMessage(parseMessage(sendReq));
+ sendReq.send(sendAction).fire(new Receiver<GenericResult>() {
+ @Override
+ public void onSuccess(GenericResult response) {
+ afterSend(response);
+ }
+ });
+ } else if ("forward".equals(place.getToken())) {
+ // FIXME will get a NullPointerException given accessing
+ // directly from some URL like #/compose:forward
+ SendForwardMessageRequest req = rf.sendForwardMessageRequest();
+ SendForwardMessageAction action = req.create(SendForwardMessageAction.class);
+ action.setReferences(oldDetails.getReferences());
+
+ action.setMessage(parseMessage(req));
+ ImapFolder f = req.create(ImapFolder.class);
+ f.setFullName(place.getParameters().getFolderName());
+ action.setFolder(f);
+ action.setUid(place.getParameters().getOldmessage().getUid());
+ req.send(action).fire(new Receiver<GenericResult>() {
+ @Override
+ public void onSuccess(GenericResult response) {
+ afterSend(response);
+ }
+ });
+ } else {
+ SendReplyMessageRequest replyReq = rf.sendReplyMessageRequest();
+ SendReplyMessageAction action = replyReq.create(SendReplyMessageAction.class);
+ action.setReferences(oldDetails.getReferences());
+ action.setMessage(parseMessage(replyReq));
+ ImapFolder folder = replyReq.create(ImapFolder.class);
+ folder.setFullName(place.getParameters().getFolderName());
+ action.setFolder(folder);
+ action.setUid(place.getParameters().getOldmessage().getUid());
+ replyReq.send(action).fire(new Receiver<GenericResult>() {
+ @Override
+ public void onSuccess(GenericResult response) {
+ afterSend(response);
+ }
+ });
+ }
+ }
private boolean validate() {
// Don't trust only in view validation
return display.validate() && display.getTo().getText().trim().length() > 0
@@ -389,7 +432,7 @@ public class ComposeActivity extends App
&& EmailListValidator.isValidAddressList(display.getBcc().getText());
}
- private SmtpMessage parseMessage(RequestContext rc) {
+ protected SmtpMessage parseMessage(RequestContext rc) {
SmtpMessage message = rc.create(SmtpMessage.class);
List<MessageAttachment> attaches = new ArrayList<MessageAttachment>();
for (MessageAttachment attach : attachments) {
@@ -456,5 +499,6 @@ public class ComposeActivity extends App
ListBox getFromList();
IUploader getUploader();
void fillContactList(String[] contacts);
+ HasFocusHandlers getAttachButton();
}
}
Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/ComposeToolBarActivity.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/ComposeToolBarActivity.java?rev=1573291&r1=1573290&r2=1573291&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/ComposeToolBarActivity.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/ComposeToolBarActivity.java Sun Mar 2 12:12:22 2014
@@ -19,6 +19,10 @@
package org.apache.hupa.client.activity;
+import org.apache.hupa.client.place.ComposePlace;
+
+import com.google.gwt.activity.shared.Activity;
+import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.gwt.user.client.ui.IsWidget;
@@ -26,12 +30,18 @@ import com.google.inject.Inject;
public class ComposeToolBarActivity extends AppBaseActivity {
+ public Activity with(ComposePlace place) {
+ return this;
+ }
+
+ @Inject private Displayable display;
+
@Override
public void start(AcceptsOneWidget container, EventBus eventBus) {
container.setWidget(display.asWidget());
}
- @Inject private Displayable display;
-
- public interface Displayable extends IsWidget {}
+ public interface Displayable extends IsWidget {
+ HasClickHandlers getSendClick();
+ }
}
Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/FolderListActivity.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/FolderListActivity.java?rev=1573291&r1=1573290&r2=1573291&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/FolderListActivity.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/FolderListActivity.java Sun Mar 2 12:12:22 2014
@@ -19,10 +19,11 @@
package org.apache.hupa.client.activity;
-import org.apache.hupa.shared.events.RefreshUnreadEvent;
-import org.apache.hupa.shared.events.RefreshUnreadEventHandler;
+import org.apache.hupa.shared.events.RefreshFoldersEvent;
+import org.apache.hupa.shared.events.RefreshFoldersEventHandler;
import com.google.gwt.event.shared.EventBus;
+import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.inject.Inject;
@@ -36,15 +37,27 @@ public class FolderListActivity extends
container.setWidget(display.asWidget());
bindTo(eventBus);
}
+
+ private Timer refreshFoldersTimer = new Timer() {
+ public void run() {
+ eventBus.fireEvent(new RefreshFoldersEvent());
+ }
+ };
private void bindTo(EventBus eventBus) {
-
- eventBus.addHandler(RefreshUnreadEvent.TYPE, new RefreshUnreadEventHandler() {
+ eventBus.addHandler(RefreshFoldersEvent.TYPE, new RefreshFoldersEventHandler() {
@Override
- public void onRefreshEvent(RefreshUnreadEvent event) {
+ public void onRefreshEvent(RefreshFoldersEvent event) {
display.refresh();
}
});
+ refreshFoldersTimer.scheduleRepeating(3*60*1000);
+ }
+
+ @Override
+ public void onStop() {
+ super.onStop();
+ refreshFoldersTimer.cancel();
}
public interface Displayable extends IsWidget {
Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/LoginActivity.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/LoginActivity.java?rev=1573291&r1=1573290&r2=1573291&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/LoginActivity.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/LoginActivity.java Sun Mar 2 12:12:22 2014
@@ -20,22 +20,21 @@
package org.apache.hupa.client.activity;
import org.apache.hupa.client.HupaConstants;
+import org.apache.hupa.client.HupaController;
import org.apache.hupa.client.place.FolderPlace;
import org.apache.hupa.client.rf.LoginUserRequest;
+import org.apache.hupa.client.storage.HupaStorage;
import org.apache.hupa.client.ui.HupaLayoutable;
+import org.apache.hupa.shared.domain.Settings;
import org.apache.hupa.shared.domain.User;
import org.apache.hupa.shared.events.FlashEvent;
import org.apache.hupa.shared.events.LoginEvent;
import org.apache.hupa.shared.events.SessionExpireEvent;
import org.apache.hupa.shared.events.SessionExpireEventHandler;
+import org.apache.hupa.widgets.dialog.Dialog;
-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.event.shared.EventBus;
-import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
-import com.google.gwt.user.client.ui.Focusable;
import com.google.gwt.user.client.ui.HasValue;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.RootLayoutPanel;
@@ -45,74 +44,87 @@ import com.google.web.bindery.requestfac
import com.google.web.bindery.requestfactory.shared.ServerFailure;
public class LoginActivity extends AppBaseActivity {
-
+
- @Inject private HupaLayoutable hupaLayout;
-
- @Override
- public void start(AcceptsOneWidget container, EventBus eventBus) {
- bind();
- container.setWidget(display.asWidget());
- display.setLoading(false);
- }
-
- public void bind() {
- registerHandler(display.getLoginClick().addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent event) {
- doLogin();// FIXME double run if press "ENTER" key in the login
- // page
- }
- }));
- eventBus.addHandler(SessionExpireEvent.TYPE, new SessionExpireEventHandler() {
- public void onSessionExpireEvent(SessionExpireEvent event) {
- eventBus.fireEvent(new FlashEvent(constants.sessionTimedOut(), 4000));
- }
- });
- }
-
- private void doLogin() {
- String user = display.getUserNameValue().getValue().trim();
- String pass = display.getPasswordValue().getValue().trim();
- if (user.isEmpty() || pass.isEmpty())
- return;
- display.setLoading(true);
- LoginUserRequest loginRequest = rf.loginRequest();
- loginRequest.login(user, pass).fire(new Receiver<User>() {
- @Override
- public void onSuccess(User response) {
- RootLayoutPanel.get().clear();
- RootLayoutPanel.get().add(hupaLayout.get());
- pc.goTo(new FolderPlace(response.getSettings().getInboxFolderName()));
- eventBus.fireEvent(new LoginEvent(response));
- display.setLoading(false);
- }
- @Override
- public void onFailure(ServerFailure error) {
- Window.alert(error.getMessage());// TODO a more gentle way
- display.setLoading(false);
- doReset();
- }
- });
- }
-
- /**
- * Reset display
- */
- private void doReset() {
- display.getUserNameValue().setValue("");
- display.getPasswordValue().setValue("");
- display.getUserNameFocus().setFocus(true);
- }
-
- @Inject private Displayable display;
- @Inject private HupaConstants constants;
-
- public interface Displayable extends IsWidget {
- public HasClickHandlers getLoginClick();
- public HasValue<String> getUserNameValue();
- public HasValue<String> getPasswordValue();
- public Focusable getUserNameFocus();
- public void setLoading(boolean loading);
- public Widget asWidget();
- }
+ @Inject private HupaLayoutable hupaLayout;
+ @Inject private Displayable display;
+ @Inject private HupaConstants constants;
+ @Inject private HupaStorage storage;
+
+ private Settings settings;
+
+ @Override
+ public void start(AcceptsOneWidget container, final EventBus eventBus) {
+ container.setWidget(display.asWidget());
+ display.setActivity(this);
+ display.setLoading(false);
+
+ registerHandler(eventBus.addHandler(SessionExpireEvent.TYPE, new SessionExpireEventHandler() {
+ public void onSessionExpireEvent(SessionExpireEvent event) {
+ eventBus.fireEvent(new FlashEvent(constants.sessionTimedOut(), 4000));
+ }
+ }));
+ }
+
+ public void doLogin() {
+ final String user = display.getUserNameValue().getValue().trim();
+ final String pass = display.getPasswordValue().getValue().trim();
+ if (user.isEmpty() || pass.isEmpty())
+ return;
+ display.setLoading(true);
+
+ LoginUserRequest loginRequest = rf.loginRequest();
+ if (settings != null) {
+ settings = display.getSettings(loginRequest.edit(settings));
+ }
+
+ loginRequest.login(user, pass, settings).fire(new Receiver<User>() {
+ @Override
+ public void onSuccess(User response) {
+ HupaController.user = response;
+
+ RootLayoutPanel.get().clear();
+ RootLayoutPanel.get().add(hupaLayout.get());
+ pc.goTo(new FolderPlace(response.getSettings().getInboxFolderName()));
+
+ eventBus.fireEvent(new LoginEvent(response));
+ display.setLoading(false);
+
+ storage.saveSettings(user, settings);
+ }
+ @Override
+ public void onFailure(ServerFailure error) {
+ Dialog.alert("Unable to login, verify that your user, password and settings are correct.");
+ display.setLoading(false);
+ }
+ });
+ }
+
+ public interface Displayable extends IsWidget {
+ public HasValue<String> getUserNameValue();
+ public Settings getSettings(Settings edit);
+ public void setActivity(LoginActivity loginActivity);
+ public HasValue<String> getPasswordValue();
+ public void setLoading(boolean loading);
+ public Widget asWidget();
+ void setSettings(Settings s);
+ }
+
+ public void loadSettings() {
+ System.out.println("Load settings");
+ String email = display.getUserNameValue().getValue();
+ if (!email.isEmpty()) {
+ settings = storage.getSettingsByEmail(email);
+ if (settings == null) {
+ rf.loginRequest().getSettings(email).fire(new Receiver<Settings>() {
+ public void onSuccess(Settings response) {
+ settings = response;
+ display.setSettings(settings);
+ }
+ });
+ } else {
+ display.setSettings(settings);
+ }
+ }
+ }
}
Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/MessageContentActivity.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/MessageContentActivity.java?rev=1573291&r1=1573290&r2=1573291&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/MessageContentActivity.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/MessageContentActivity.java Sun Mar 2 12:12:22 2014
@@ -20,9 +20,9 @@
package org.apache.hupa.client.activity;
import java.util.List;
-import java.util.logging.Level;
import java.util.logging.Logger;
+import org.apache.hupa.client.HupaController;
import org.apache.hupa.client.place.ComposePlace;
import org.apache.hupa.client.place.MessagePlace.TokenWrapper;
import org.apache.hupa.client.rf.GetMessageDetailsRequest;
@@ -31,20 +31,22 @@ import org.apache.hupa.shared.SConsts;
import org.apache.hupa.shared.domain.GetMessageDetailsAction;
import org.apache.hupa.shared.domain.GetMessageDetailsResult;
import org.apache.hupa.shared.domain.ImapFolder;
+import org.apache.hupa.shared.domain.MailHeader;
import org.apache.hupa.shared.domain.MessageAttachment;
-import org.apache.hupa.shared.events.DeleteClickEvent;
-import org.apache.hupa.shared.events.DeleteClickEventHandler;
+import org.apache.hupa.shared.domain.MessageDetails;
import org.apache.hupa.shared.events.MailToEvent;
+import org.apache.hupa.shared.events.MessageViewEvent;
+import org.apache.hupa.shared.events.RefreshFoldersEvent;
+import org.apache.hupa.shared.events.RefreshFoldersEventHandler;
+import org.apache.hupa.shared.events.ShowRawEvent;
+import org.apache.hupa.shared.events.ShowRawEventHandler;
import com.google.gwt.activity.shared.Activity;
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.event.shared.EventBus;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
-import com.google.gwt.user.client.ui.HasVisibility;
+import com.google.gwt.user.client.ui.HasHTML;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.inject.Inject;
import com.google.web.bindery.requestfactory.shared.Receiver;
@@ -55,82 +57,90 @@ public class MessageContentActivity exte
private static final Logger log = Logger.getLogger(MessageContentActivity.class.getName());
@Inject private Displayable display;
- private String fullName;
+ @Inject private ToolBarActivity.Displayable toolBar;
+
+ private String folder;
private String uid;
-
+ private MessageDetails details;
+
+ public MessageContentActivity() {
+ exportJSMethods(this);
+ }
+
@Override
- public void start(AcceptsOneWidget container, EventBus eventBus) {
+ public void start(AcceptsOneWidget container, final EventBus eventBus) {
bindTo(eventBus);
- display.getRawPanel().setVisible(false);
if (isUidSet()) {
- display.getRawPanel().setVisible(true);
+ hc.showTopLoading("Loading... ");
+ display.clearContent();
GetMessageDetailsRequest req = rf.messageDetailsRequest();
GetMessageDetailsAction action = req.create(GetMessageDetailsAction.class);
final ImapFolder f = req.create(ImapFolder.class);
- f.setFullName(fullName);
+ f.setFullName(folder);
action.setFolder(f);
action.setUid(Long.parseLong(uid));
+
+ final String id = uid;
req.get(action).fire(new Receiver<GetMessageDetailsResult>() {
@Override
public void onSuccess(GetMessageDetailsResult response) {
- display.fillMessageContent(response.getMessageDetails().getText());
- List<MessageAttachment> attaches = response.getMessageDetails().getMessageAttachments();
- if (attaches == null || attaches.isEmpty()) {
- display.showAttachmentPanel(false);
- } else {
- display.showAttachmentPanel(true);
- display.setAttachments(response.getMessageDetails().getMessageAttachments(), fullName,
- Long.parseLong(uid));
+ if (!id.equals(uid)) {
+ return;
+ }
+ hc.hideTopLoading();
+ eventBus.fireEvent(new MessageViewEvent(response.getMessageDetails()));
+
+ details = response.getMessageDetails();
+ display.fillMessageContent(details.getText(), false);
+
+ List<MessageAttachment> attaches = details.getMessageAttachments();
+ if (attaches != null && !attaches.isEmpty()) {
+ display.setAttachments(attaches, folder, Long.parseLong(uid));
}
}
@Override
public void onFailure(ServerFailure error) {
+ hc.hideTopLoading();
+ toolBar.enableAllTools(false);
if (error.isFatal()) {
- log.log(Level.SEVERE, error.getMessage());
- // TODO write the error message to status bar.
- throw new RuntimeException(error.getMessage());
+ hc.showNotice(error.getMessage(), 10000);
}
}
});
}
container.setWidget(display.asWidget());
- exportJSMethods(this);
}
private void bindTo(EventBus eventBus) {
- eventBus.addHandler(DeleteClickEvent.TYPE, new DeleteClickEventHandler() {
- @Override
- public void onDeleteClickEvent(DeleteClickEvent event) {
- display.clearContent();
- }
- });
- this.registerHandler(display.getRaw().addClickHandler(new ClickHandler() {
+ eventBus.addHandler(ShowRawEvent.TYPE, new ShowRawEventHandler() {
@Override
- public void onClick(ClickEvent event) {
+ public void onShowRaw(ShowRawEvent event) {
String message_url = GWT.getModuleBaseURL() + SConsts.SERVLET_SOURCE + "?" + SConsts.PARAM_UID + "="
- + uid + "&" + SConsts.PARAM_FOLDER + "=" + fullName;
+ + uid + "&" + SConsts.PARAM_FOLDER + "=" + folder;
Window.open(message_url, "_blank", "");
}
-
- }));
+ });
+ eventBus.addHandler(RefreshFoldersEvent.TYPE, new RefreshFoldersEventHandler() {
+ public void onRefreshEvent(RefreshFoldersEvent event) {
+ display.clearContent();
+ }
+ });
}
-
+
private boolean isUidSet() {
return uid != null && uid.matches("\\d+");
}
public interface Displayable extends IsWidget {
- void fillMessageContent(String messageContent);
void clearContent();
- void setAttachments(List<MessageAttachment> attachements, String folder, long uid);
- void showAttachmentPanel(boolean is);
- HasClickHandlers getRaw();
- HasVisibility getRawPanel();
+ void setAttachments(List<MessageAttachment> attachements, String folder, long uid);
+ HasHTML getMessageHTML();
+ void fillMessageContent(String messageDetail, boolean isEditable);
}
public Activity with(TokenWrapper tokenWrapper) {
- fullName = tokenWrapper.getFolder();
+ folder = tokenWrapper.getFolder();
uid = tokenWrapper.getUid();
return this;
}
@@ -143,20 +153,35 @@ public class MessageContentActivity exte
pc.goTo(new ComposePlace("new").with(new Parameters(null, null, null, null)));
eventBus.fireEvent(new MailToEvent(mailto));
}
+
+ private String getHeader(String key) {
+ for (MailHeader h : details.getMailHeaders()) {
+ if (h.getName().equals(key)) {
+ return h.getValue();
+ }
+ }
+ return null;
+ }
+
+ private boolean isSenderMessage() {
+ String from = getHeader("From");
+ return from != null && from.contains(HupaController.user.getName())
+ || folder.equals(HupaController.user.getSettings().getSentFolderName());
+ }
- private native void exportJSMethods(MessageContentActivity activity)
+ protected native void exportJSMethods(MessageContentActivity activity)
/*-{
- $wnd.openLink = function(url) {
- try {
- activity.@org.apache.hupa.client.activity.MessageContentActivity::openLink(Ljava/lang/String;) (url);
- } catch(e) {}
- return false;
- };
- $wnd.mailTo = function(mail) {
- try {
- activity.@org.apache.hupa.client.activity.MessageContentActivity::mailTo(Ljava/lang/String;) (mail);
- } catch(e) {}
- return false;
- };
- }-*/;
+ $wnd.openLink = function(url) {
+ try {
+ activity.@org.apache.hupa.client.activity.MessageContentActivity::openLink(Ljava/lang/String;) (url);
+ } catch(e) {}
+ return false;
+ };
+ $wnd.mailTo = function(mail) {
+ try {
+ activity.@org.apache.hupa.client.activity.MessageContentActivity::mailTo(Ljava/lang/String;) (mail);
+ } catch(e) {}
+ return false;
+ };
+ }-*/;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org