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/09/12 06:32:58 UTC
svn commit: r1522360 - in /james/hupa/trunk:
client/src/main/java/org/apache/hupa/client/ioc/
client/src/main/java/org/apache/hupa/client/rf/
client/src/main/java/org/apache/hupa/client/ui/
server/src/main/java/org/apache/hupa/server/service/ server/sr...
Author: dongxu
Date: Thu Sep 12 04:32:57 2013
New Revision: 1522360
URL: http://svn.apache.org/r1522360
Log:
pull all folders for label settings
Modified:
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/rf/FetchFoldersRequest.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/FoldersTreeViewModel.java
james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelListView.java
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/FetchFoldersService.java
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/FetchFoldersServiceImpl.java
james/hupa/trunk/server/src/test/java/org/apache/hupa/server/service/FetchFolderServiceTest.java
Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ioc/AppGinModule.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ioc/AppGinModule.java?rev=1522360&r1=1522359&r2=1522360&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ioc/AppGinModule.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ioc/AppGinModule.java Thu Sep 12 04:32:57 2013
@@ -353,6 +353,7 @@ public class AppGinModule extends Abstra
bind(ComposeToolBarActivity.Displayable.class).to(ComposeToolBarView.class);
<<<<<<< HEAD
<<<<<<< HEAD
+<<<<<<< HEAD
bind(ComposeActivity.Displayable.class).to(ComposeView.class);
bind(SearchBoxActivity.Displayable.class).to(SearchBoxView.class);
@@ -369,6 +370,9 @@ public class AppGinModule extends Abstra
=======
// bind(ComposeActivity.Displayable.class).to(ComposeView.class).in(Singleton.class);
>>>>>>> fixed issue#62
+=======
+ bind(ComposeActivity.Displayable.class).to(ComposeView.class);
+>>>>>>> pull all folders for label settings
bind(LabelListActivity.Displayable.class).to(LabelListView.class).in(Singleton.class);
>>>>>>> make label settings prototype
Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/rf/FetchFoldersRequest.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/rf/FetchFoldersRequest.java?rev=1522360&r1=1522359&r2=1522360&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/rf/FetchFoldersRequest.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/rf/FetchFoldersRequest.java Thu Sep 12 04:32:57 2013
@@ -32,8 +32,12 @@ import com.google.web.bindery.requestfac
@Service(value = FetchFoldersService.class, locator = IocRfServiceLocator.class)
public interface FetchFoldersRequest extends RequestContext {
<<<<<<< HEAD
+<<<<<<< HEAD
Request<List<ImapFolder>> fetch(ImapFolder imapFolder, Boolean recursive);
=======
Request<List<ImapFolder>> fetch(ImapFolder imapFolder);
>>>>>>> Fix issue #15.
+=======
+ Request<List<ImapFolder>> fetch(ImapFolder imapFolder, Boolean recursive);
+>>>>>>> pull all folders for label settings
}
Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/FoldersTreeViewModel.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/FoldersTreeViewModel.java?rev=1522360&r1=1522359&r2=1522360&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/FoldersTreeViewModel.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/FoldersTreeViewModel.java Thu Sep 12 04:32:57 2013
@@ -97,7 +97,7 @@ public class FoldersTreeViewModel implem
*/
@Override
public <T> NodeInfo<?> getNodeInfo(T value) {
- return new DefaultNodeInfo<ImapFolder>(new ImapFolderListDataProvider((ImapFolder) value), new FolderCell(
+ return new DefaultNodeInfo<ImapFolder>(new ImapFolderListDataProvider(rf, (ImapFolder) value), new FolderCell(
ClickEvent.getType().getName()), selectionModel, null);
}
@@ -158,11 +158,13 @@ public class FoldersTreeViewModel implem
}
}
- class ImapFolderListDataProvider extends AsyncDataProvider<ImapFolder> {
+ public class ImapFolderListDataProvider extends AsyncDataProvider<ImapFolder> {
+ private HupaRequestFactory rf;
private ImapFolder folder;
- public ImapFolderListDataProvider(ImapFolder folder) {
+ public ImapFolderListDataProvider(HupaRequestFactory rf, ImapFolder folder) {
+ this.rf = rf;
this.folder = folder;
}
@@ -173,7 +175,7 @@ public class FoldersTreeViewModel implem
@Override
protected void onRangeChanged(HasData<ImapFolder> display) {
- rf.fetchFoldersRequest().fetch(folder).fire(new Receiver<List<ImapFolder>>() {
+ rf.fetchFoldersRequest().fetch(folder, Boolean.FALSE).fire(new Receiver<List<ImapFolder>>() {
@Override
public void onSuccess(List<ImapFolder> response) {
if (response == null || response.size() == 0) {
Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelListView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelListView.java?rev=1522360&r1=1522359&r2=1522360&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelListView.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LabelListView.java Thu Sep 12 04:32:57 2013
@@ -20,6 +20,7 @@
package org.apache.hupa.client.ui;
<<<<<<< HEAD
+<<<<<<< HEAD
import java.util.ArrayList;
import java.util.List;
@@ -181,52 +182,90 @@ public class LabelListView extends Compo
interface LabelListUiBinder extends UiBinder<DockLayoutPanel, LabelListView> {
=======
import java.util.Arrays;
+=======
+import java.util.ArrayList;
+>>>>>>> pull all folders for label settings
import java.util.List;
import org.apache.hupa.client.activity.LabelListActivity;
+import org.apache.hupa.client.rf.HupaRequestFactory;
+import org.apache.hupa.shared.domain.ImapFolder;
import com.google.gwt.cell.client.TextCell;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.cellview.client.CellList;
-import com.google.gwt.user.cellview.client.HasKeyboardSelectionPolicy.KeyboardSelectionPolicy;
import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.SimplePanel;
-import com.google.gwt.view.client.SelectionChangeEvent;
-import com.google.gwt.view.client.SingleSelectionModel;
+import com.google.gwt.view.client.AsyncDataProvider;
+import com.google.gwt.view.client.HasData;
+import com.google.inject.Inject;
+import com.google.web.bindery.requestfactory.shared.Receiver;
+import com.google.web.bindery.requestfactory.shared.ServerFailure;
public class LabelListView extends Composite implements LabelListActivity.Displayable {
@UiField SimplePanel thisView;
- public LabelListView() {
+ @Inject
+ public LabelListView(HupaRequestFactory rf) {
initWidget(binder.createAndBindUi(this));
- thisView.setWidget(createTabList());
+ ImapLabelListDataProvider data = new ImapLabelListDataProvider(rf);
+ CellList<String> cellList = new CellList<String>(new TextCell());
+ data.addDataDisplay(cellList);
+ thisView.setWidget(cellList);
}
- private static final List<String> TABS = Arrays.asList("Mock-Inbox", "Mock-Junk", "Mock-Draft", "Mock-Delete");
+ public class ImapLabelListDataProvider extends AsyncDataProvider<String> {
- private CellList<String> createTabList() {
- TextCell textCell = new TextCell();
- CellList<String> cellList = new CellList<String>(textCell);
- cellList.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
- final SingleSelectionModel<String> selectionModel = new SingleSelectionModel<String>();
- cellList.setSelectionModel(selectionModel);
- selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
- public void onSelectionChange(SelectionChangeEvent event) {
- String selected = selectionModel.getSelectedObject();
- if (selected != null) {
- // Window.alert("You selected: " + selected);
+ private HupaRequestFactory rf;
+
+ public ImapLabelListDataProvider(HupaRequestFactory rf) {
+ this.rf = rf;
+ }
+
+ @Override
+ public void addDataDisplay(HasData<String> display) {
+ super.addDataDisplay(display);
+ }
+
+ @Override
+ protected void onRangeChanged(HasData<String> display) {
+ rf.fetchFoldersRequest().fetch(null, Boolean.TRUE).fire(new Receiver<List<ImapFolder>>() {
+ @Override
+ public void onSuccess(List<ImapFolder> response) {
+ if (response == null || response.size() == 0) {
+ updateRowCount(-1, true);
+ } else {
+ List<String> fn = new ArrayList<String>();
+ for (ImapFolder a : response) {
+ fillCellList(fn, a);
+ }
+ updateRowData(0, fn);
+ }
}
- }
- });
- cellList.setRowCount(TABS.size(), true);
- // Push the data into the widget.
- cellList.setRowData(0, TABS);
- return cellList;
+ private void fillCellList(List<String> fn, ImapFolder a) {
+ fn.add(a.getFullName());
+ if(a.getHasChildren()){
+ for(ImapFolder subFolder : a.getChildren()){
+ fillCellList(fn, subFolder);
+ }
+ }
+ }
+
+ @Override
+ public void onFailure(ServerFailure error) {
+ if (error.isFatal()) {
+ throw new RuntimeException(error.getMessage());
+ }
+ }
+
+ });
+
+ }
+
}
interface LabelListUiBinder extends UiBinder<SimplePanel, LabelListView> {
Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/FetchFoldersService.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/FetchFoldersService.java?rev=1522360&r1=1522359&r2=1522360&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/FetchFoldersService.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/FetchFoldersService.java Thu Sep 12 04:32:57 2013
@@ -39,6 +39,10 @@ public interface FetchFoldersService {
import org.apache.hupa.shared.exception.HupaException;
public interface FetchFoldersService {
+<<<<<<< HEAD
List<ImapFolder> fetch(ImapFolder folder) throws MessagingException, HupaException;
>>>>>>> re-add server unit tests
+=======
+ List<ImapFolder> fetch(ImapFolder folder, Boolean recursive) throws MessagingException, HupaException;
+>>>>>>> pull all folders for label settings
}
Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/FetchFoldersServiceImpl.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/FetchFoldersServiceImpl.java?rev=1522360&r1=1522359&r2=1522360&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/FetchFoldersServiceImpl.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/service/FetchFoldersServiceImpl.java Thu Sep 12 04:32:57 2013
@@ -29,6 +29,9 @@ import org.apache.hupa.shared.data.ImapF
import org.apache.hupa.shared.domain.ImapFolder;
<<<<<<< HEAD
<<<<<<< HEAD
+<<<<<<< HEAD
+=======
+>>>>>>> pull all folders for label settings
import org.apache.hupa.shared.domain.User;
import org.apache.hupa.shared.exception.HupaException;
=======
@@ -44,16 +47,22 @@ public class FetchFoldersServiceImpl ext
@Override
<<<<<<< HEAD
<<<<<<< HEAD
+<<<<<<< HEAD
+=======
+>>>>>>> pull all folders for label settings
public List<ImapFolder> fetch(ImapFolder imapFolder, Boolean recursive) throws MessagingException, HupaException {
if(recursive){
return this.pullAll();
}
+<<<<<<< HEAD
=======
public List<ImapFolder> fetch(ImapFolder imapFolder) throws MessagingException {
>>>>>>> Fix issue #15.
=======
public List<ImapFolder> fetch(ImapFolder imapFolder) throws MessagingException, HupaException{
>>>>>>> re-add server unit tests
+=======
+>>>>>>> pull all folders for label settings
try {
Folder folder = null;
IMAPStore store = cache.get(getUser());
@@ -74,6 +83,9 @@ public class FetchFoldersServiceImpl ext
}
}
<<<<<<< HEAD
+<<<<<<< HEAD
+=======
+>>>>>>> pull all folders for label settings
public List<ImapFolder> pullAll() throws MessagingException, HupaException {
User user = getUser();
@@ -147,13 +159,17 @@ public class FetchFoldersServiceImpl ext
return iFolder;
}
+<<<<<<< HEAD
=======
>>>>>>> Fix issue #15.
+=======
+>>>>>>> pull all folders for label settings
/**
* Create a new IMAPFolder from the given Folder
*
<<<<<<< HEAD
+<<<<<<< HEAD
* @param folder
* Current folder
* @return imapFolder Created IMAPFolder
@@ -166,10 +182,16 @@ public class FetchFoldersServiceImpl ext
private ImapFolder createImapFolder(Folder folder) throws HupaException {
=======
* @param folder Current folder
+=======
+ * @param folder
+ * Current folder
+>>>>>>> pull all folders for label settings
* @return imapFolder Created IMAPFolder
- * @throws HupaException
- * @throws Exception If an error occurs
- * @throws MessagingException If an error occurs
+ * @throws HupaException
+ * @throws Exception
+ * If an error occurs
+ * @throws MessagingException
+ * If an error occurs
*/
<<<<<<< HEAD
private ImapFolder createImapFolder(Folder folder) {
@@ -199,10 +221,14 @@ public class FetchFoldersServiceImpl ext
iFolder.setSubscribed(folder.isSubscribed());
iFolder.setUnseenMessageCount(folder.getUnreadMessageCount());
<<<<<<< HEAD
+<<<<<<< HEAD
if (folder.list().length != 0) {
=======
if(folder.list().length != 0){
>>>>>>> Fix issue #15.
+=======
+ if (folder.list().length != 0) {
+>>>>>>> pull all folders for label settings
iFolder.setHasChildren(true);
}
} catch (MessagingException e) {
Modified: james/hupa/trunk/server/src/test/java/org/apache/hupa/server/service/FetchFolderServiceTest.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/test/java/org/apache/hupa/server/service/FetchFolderServiceTest.java?rev=1522360&r1=1522359&r2=1522360&view=diff
==============================================================================
--- james/hupa/trunk/server/src/test/java/org/apache/hupa/server/service/FetchFolderServiceTest.java (original)
+++ james/hupa/trunk/server/src/test/java/org/apache/hupa/server/service/FetchFolderServiceTest.java Thu Sep 12 04:32:57 2013
@@ -41,10 +41,14 @@ public class FetchFolderServiceTest exte
httpSession.removeAttribute(SConsts.USER_SESS_ATTR);
try {
<<<<<<< HEAD
+<<<<<<< HEAD
fetchFoldersService.fetch(new ImapFolderImpl(), false);
=======
fetchFoldersService.fetch(new ImapFolderImpl());
>>>>>>> re-add server unit tests
+=======
+ fetchFoldersService.fetch(new ImapFolderImpl(), false);
+>>>>>>> pull all folders for label settings
fail("Invalid session");
} catch (InvalidSessionException e) {
} catch (Exception e) {
@@ -57,10 +61,14 @@ public class FetchFolderServiceTest exte
httpSession.setAttribute(SConsts.USER_SESS_ATTR, testUser);
try {
<<<<<<< HEAD
+<<<<<<< HEAD
List<ImapFolder> folders = fetchFoldersService.fetch(null, false);
=======
List<ImapFolder> folders = fetchFoldersService.fetch(null);
>>>>>>> re-add server unit tests
+=======
+ List<ImapFolder> folders = fetchFoldersService.fetch(null, false);
+>>>>>>> pull all folders for label settings
assertTrue(folders.isEmpty());
} catch (Exception e) {
e.printStackTrace();
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org