james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From don...@apache.org
Subject svn commit: r1522431 - in /james/hupa/trunk: client/src/main/java/org/apache/hupa/client/activity/ client/src/main/java/org/apache/hupa/client/ui/ shared/src/main/java/org/apache/hupa/shared/events/
Date Thu, 12 Sep 2013 05:01:26 GMT
Author: dongxu
Date: Thu Sep 12 05:01:25 2013
New Revision: 1522431

URL: http://svn.apache.org/r1522431
Log:
fixed issue#85, can move one message now in DEMO mode, while not test in Gmail mode

Modified:
    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/MessageListFooterActivity.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/MessageListFooterView.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageListFooterView.ui.xml
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessagesCellTable.java
    james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/MoveMessageEvent.java

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/MessageListActivity.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/MessageListActivity.java?rev=1522431&r1=1522430&r2=1522431&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/MessageListActivity.java
(original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/MessageListActivity.java
Thu Sep 12 05:01:25 2013
@@ -294,13 +294,17 @@ import org.apache.hupa.shared.data.ImapF
 >>>>>>> fixed issue#82, make display message first and then mark etc.
 import org.apache.hupa.shared.domain.DeleteMessageByUidAction;
 import org.apache.hupa.shared.domain.DeleteMessageResult;
+import org.apache.hupa.shared.domain.GenericResult;
 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.Message;
+import org.apache.hupa.shared.domain.MoveMessageAction;
 import org.apache.hupa.shared.domain.User;
 import org.apache.hupa.shared.events.DeleteClickEvent;
 import org.apache.hupa.shared.events.DeleteClickEventHandler;
+import org.apache.hupa.shared.events.MoveMessageEvent;
+import org.apache.hupa.shared.events.MoveMessageEventHandler;
 import org.apache.hupa.shared.events.RefreshMessagesEvent;
 import org.apache.hupa.shared.events.RefreshMessagesEventHandler;
 import org.apache.hupa.shared.events.RefreshUnreadEvent;
@@ -320,7 +324,7 @@ public class MessageListActivity extends
 	@Inject private ToolBarActivity.Displayable toolBar;
 	@Inject private TopBarActivity.Displayable topBar;
 	private String folderName;
-//	private String searchValue;
+	// private String searchValue;
 	private User user;
 
 	@Override
@@ -377,15 +381,15 @@ public class MessageListActivity extends
 		return "click".equals(event.getNativeEvent().getType()) && 0 != event.getColumn();
 	}
 
-	private void bindTo(EventBus eventBus) {
+	private void bindTo(final EventBus eventBus) {
 		eventBus.addHandler(DeleteClickEvent.TYPE, new DeleteClickEventHandler() {
 			@Override
 			public void onDeleteClickEvent(DeleteClickEvent event) {
 				deleteSelectedMessages();
 			}
 		});
-		
-		eventBus.addHandler(RefreshMessagesEvent.TYPE, new RefreshMessagesEventHandler(){
+
+		eventBus.addHandler(RefreshMessagesEvent.TYPE, new RefreshMessagesEventHandler() {
 			@Override
 			public void onRefresh(RefreshMessagesEvent event) {
 				display.setSearchValue(event.getSearchValue());
@@ -393,6 +397,56 @@ public class MessageListActivity extends
 			}
 		});
 
+		eventBus.addHandler(MoveMessageEvent.TYPE, new MoveMessageEventHandler() {
+
+			@Override
+			public void onMoveMessageHandler(final MoveMessageEvent event) {
+				hc.showTopLoading("Moving...");
+				MoveMessageRequest req = rf.moveMessageRequest();
+				ImapFolder f = req.create(ImapFolder.class);
+				ImapFolder newF = req.create(ImapFolder.class);
+
+				String fullName = null;
+				if (pc.getWhere() instanceof FolderPlace) {
+					fullName = ((FolderPlace) pc.getWhere()).getToken();
+				} else {
+					fullName = ((MessagePlace) pc.getWhere()).getTokenWrapper().getFolder();
+				}
+				f.setFullName(fullName);
+				newF.setFullName(event.getNewFolder().getFullName());
+				MoveMessageAction action = req.create(MoveMessageAction.class);
+
+				final List<Long> uids = display.getSelectedMessagesIds();
+				if(uids.isEmpty() || uids.size() > 1){//TODO can move more than one message once.
+					hc.hideTopLoading();
+					hc.showNotice("Please select one and only one message", 10000);
+					return;
+				}
+				action.setMessageUid(uids.get(0));
+				action.setNewFolder(newF);
+				action.setOldFolder(f);
+				req.move(action).fire(new Receiver<GenericResult>() {
+
+					@Override
+					public void onSuccess(GenericResult response) {
+						display.refresh();
+						eventBus.fireEvent(new RefreshUnreadEvent());
+						hc.hideTopLoading();
+						hc.showNotice("The conversation has been moved to \"" + event.getNewFolder() + "\"",
10000);
+					}
+
+					@Override
+					public void onFailure(ServerFailure error) {
+						super.onFailure(error);
+						hc.hideTopLoading();
+						hc.showNotice(error.getMessage(), 10000);
+					}
+
+				});
+			}
+
+		});
+
 	}
 
 	public MessageListActivity with(String folderName) {

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/MessageListFooterActivity.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/MessageListFooterActivity.java?rev=1522431&r1=1522430&r2=1522431&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/MessageListFooterActivity.java
(original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/MessageListFooterActivity.java
Thu Sep 12 05:01:25 2013
@@ -21,11 +21,15 @@ package org.apache.hupa.client.activity;
 
 <<<<<<< HEAD
 <<<<<<< HEAD
+<<<<<<< HEAD
+=======
+>>>>>>> fixed issue#85, can move one message now in DEMO mode, while
not test in Gmail mode
 import org.apache.hupa.shared.data.ImapFolderImpl;
 import org.apache.hupa.shared.events.MoveMessageEvent;
 
 import com.google.gwt.event.dom.client.ChangeEvent;
 import com.google.gwt.event.dom.client.ChangeHandler;
+<<<<<<< HEAD
 import com.google.gwt.event.shared.EventBus;
 import com.google.gwt.user.cellview.client.SimplePager;
 import com.google.gwt.user.client.ui.AcceptsOneWidget;
@@ -40,11 +44,18 @@ import com.google.gwt.user.cellview.clie
 import com.google.gwt.user.client.ui.AcceptsOneWidget;
 >>>>>>> integrate all of the views to their corresponding activities
and mappers
 =======
+=======
+>>>>>>> fixed issue#85, can move one message now in DEMO mode, while
not test in Gmail mode
 import com.google.gwt.event.shared.EventBus;
 import com.google.gwt.user.cellview.client.SimplePager;
 import com.google.gwt.user.client.ui.AcceptsOneWidget;
+import com.google.gwt.user.client.ui.HasVisibility;
 import com.google.gwt.user.client.ui.IsWidget;
+<<<<<<< HEAD
 >>>>>>> replace with IsWidget
+=======
+import com.google.gwt.user.client.ui.ListBox;
+>>>>>>> fixed issue#85, can move one message now in DEMO mode, while
not test in Gmail mode
 import com.google.inject.Inject;
 
 public class MessageListFooterActivity extends AppBaseActivity {
@@ -53,6 +64,9 @@ public class MessageListFooterActivity e
 	public void start(AcceptsOneWidget container, EventBus eventBus) {
 		container.setWidget(display.asWidget());
 <<<<<<< HEAD
+<<<<<<< HEAD
+=======
+>>>>>>> fixed issue#85, can move one message now in DEMO mode, while
not test in Gmail mode
 		bindTo(eventBus);
 	}
 
@@ -67,8 +81,11 @@ public class MessageListFooterActivity e
 				}
 			}
 		});
+<<<<<<< HEAD
 =======
 >>>>>>> integrate all of the views to their corresponding activities
and mappers
+=======
+>>>>>>> fixed issue#85, can move one message now in DEMO mode, while
not test in Gmail mode
 	}
 
 	@Inject private Displayable display;
@@ -90,6 +107,8 @@ public class MessageListFooterActivity e
 	public interface Displayable extends IsWidget {
 >>>>>>> replace with IsWidget
 		SimplePager getPager();
+		HasVisibility getLabelsPanel();
+		ListBox getLabels();
 	}
 >>>>>>> try to rearrange the places and history managment.
 }

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=1522431&r1=1522430&r2=1522431&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 05:01:25 2013
@@ -194,11 +194,9 @@ import org.apache.hupa.client.activity.L
 import org.apache.hupa.client.rf.HupaRequestFactory;
 import org.apache.hupa.shared.domain.ImapFolder;
 
-import com.google.gwt.cell.client.AbstractCell;
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.event.dom.client.ClickEvent;
 import com.google.gwt.event.dom.client.HasClickHandlers;
-import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
 import com.google.gwt.uibinder.client.UiBinder;
 import com.google.gwt.uibinder.client.UiField;
 import com.google.gwt.uibinder.client.UiHandler;
@@ -267,27 +265,6 @@ public class LabelListView extends Compo
 				}
 			});
 
-	static class LabelCell extends AbstractCell<LabelNode> {
-
-		public LabelCell() {
-		}
-
-		@Override
-		public void render(com.google.gwt.cell.client.Cell.Context context, LabelNode value, SafeHtmlBuilder
sb) {
-			if (value == null) {
-				return;
-			}
-
-			if (value.getFolder().getSubscribed()) {
-				sb.appendHtmlConstant(value.getNameForDisplay());
-			} else {
-				sb.appendHtmlConstant("<span style='color:gray;'>");
-				sb.appendHtmlConstant(value.getNameForDisplay());
-				sb.appendHtmlConstant("</span>");
-			}
-		}
-	}
-
 	public class ImapLabelListDataProvider extends AsyncDataProvider<LabelNode> implements
HasRefresh {
 
 		private HupaRequestFactory rf;

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageListFooterView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageListFooterView.java?rev=1522431&r1=1522430&r2=1522431&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageListFooterView.java
(original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageListFooterView.java
Thu Sep 12 05:01:25 2013
@@ -21,6 +21,9 @@ package org.apache.hupa.client.ui;
 
 <<<<<<< HEAD
 <<<<<<< HEAD
+<<<<<<< HEAD
+=======
+>>>>>>> fixed issue#85, can move one message now in DEMO mode, while
not test in Gmail mode
 import java.util.ArrayList;
 import java.util.List;
 
@@ -35,6 +38,7 @@ import com.google.gwt.user.cellview.clie
 import com.google.gwt.user.cellview.client.SimplePager.TextLocation;
 import com.google.gwt.user.client.ui.Composite;
 import com.google.gwt.user.client.ui.HasVisibility;
+<<<<<<< HEAD
 import com.google.gwt.user.client.ui.HorizontalPanel;
 import com.google.gwt.user.client.ui.ListBox;
 import com.google.gwt.user.client.ui.SimplePanel;
@@ -129,21 +133,88 @@ import com.google.gwt.uibinder.client.Ui
 import com.google.gwt.user.cellview.client.SimplePager;
 import com.google.gwt.user.cellview.client.SimplePager.TextLocation;
 import com.google.gwt.user.client.ui.Composite;
+=======
+>>>>>>> fixed issue#85, can move one message now in DEMO mode, while
not test in Gmail mode
 import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.ListBox;
+import com.google.gwt.user.client.ui.SimplePanel;
 import com.google.inject.Inject;
+import com.google.web.bindery.requestfactory.shared.Receiver;
+import com.google.web.bindery.requestfactory.shared.ServerFailure;
 
 public class MessageListFooterView extends Composite implements MessageListFooterActivity.Displayable
{
 
-	@UiField(provided = true)
-	SimplePager simplePager;
+	@UiField(provided = true) SimplePager simplePager;
+
+	@UiField ListBox labels;
+	@UiField SimplePanel labelsPanel;
+	private List<LabelNode> folderNodes = new ArrayList<LabelNode>();
+
+	private static final String ROOT_PATH = "imap_root";
 
 	@Inject
-	public MessageListFooterView(final MessagesCellTable table) {
+	public MessageListFooterView(final MessagesCellTable table, final HupaRequestFactory rf)
{
 		SimplePager.Resources pagerResources = GWT.create(SimplePager.Resources.class);
 		simplePager = new SimplePager(TextLocation.CENTER, pagerResources, false, 0, true);
 		simplePager.setDisplay(table);
-//		simplePager.setRangeLimited(false);
+		// simplePager.setRangeLimited(false);
 		initWidget(binder.createAndBindUi(this));
+
+		rf.fetchFoldersRequest().fetch(null, Boolean.TRUE).fire(new Receiver<List<ImapFolder>>()
{
+
+			private String INTENTS = "&nbsp;&nbsp;&nbsp;&nbsp;";
+
+			@Override
+			public void onSuccess(List<ImapFolder> response) {
+				folderNodes.clear();
+				if (response == null || response.size() == 0) {
+				} else {
+					for (ImapFolder folder : response) {
+						fillCellList(folderNodes, folder, LabelNode.ROOT, "");
+					}
+				}
+
+				makeParentList();
+			}
+
+			private void fillCellList(List<LabelNode> folderNodes, ImapFolder curFolder, LabelNode
parent,
+					String intents) {
+				LabelNode labelNode = new LabelNode();
+				labelNode.setFolder(curFolder);
+				labelNode.setName(curFolder.getName());
+				labelNode.setNameForDisplay(intents + curFolder.getName());
+				labelNode.setParent(parent);
+				labelNode.setPath(curFolder.getFullName());
+				folderNodes.add(labelNode);
+				if ("inbox".equalsIgnoreCase(curFolder.getName())) {
+					// if(selectionModel.getSelectedObject() == null){
+					// selectionModel.setSelected(labelNode, true);
+					// }
+				}
+				if (curFolder.getHasChildren()) {
+					for (ImapFolder subFolder : curFolder.getChildren()) {
+						fillCellList(folderNodes, subFolder, labelNode, intents + INTENTS);
+					}
+				}
+			}
+
+			@Override
+			public void onFailure(ServerFailure error) {
+				if (error.isFatal()) {
+					throw new RuntimeException(error.getMessage());
+				}
+			}
+
+		});
+	}
+
+	private void makeParentList() {
+		labels.clear();
+		labels.addItem("Move to...", ROOT_PATH);
+		for (LabelNode folderNode : this.folderNodes) {
+			labels.addItem(folderNode.getNameForDisplay().replace("&nbsp;&nbsp;", ". "), folderNode.getPath());
+		}
+
 	}
 
 <<<<<<< HEAD
@@ -175,6 +246,9 @@ public class MessageListFooterView exten
 	}
 
 <<<<<<< HEAD
+<<<<<<< HEAD
+=======
+>>>>>>> fixed issue#85, can move one message now in DEMO mode, while
not test in Gmail mode
 	@Override
 	public HasVisibility getLabelsPanel() {
 		return labelsPanel;
@@ -185,8 +259,11 @@ public class MessageListFooterView exten
 		return labels;
 	}
 
+<<<<<<< HEAD
 =======
 >>>>>>> make login page as one part of the overall layout & splite
layout to little one
 =======
 >>>>>>> try to rearrange the places and history managment.
+=======
+>>>>>>> fixed issue#85, can move one message now in DEMO mode, while
not test in Gmail mode
 }

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageListFooterView.ui.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageListFooterView.ui.xml?rev=1522431&r1=1522430&r2=1522431&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageListFooterView.ui.xml
(original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessageListFooterView.ui.xml
Thu Sep 12 05:01:25 2013
@@ -24,6 +24,7 @@
 		<c:SimplePager ui:field="simplePager" />
 		<g:SimplePanel ui:field="labelsPanel" addStyleNames="{style.moveMessage}">
 			<g:ListBox ui:field="labels"></g:ListBox>
+<<<<<<< HEAD
 		</g:SimplePanel>
 	</g:HorizontalPanel>
 =======
@@ -48,6 +49,8 @@
 =======
 		<g:SimplePanel addStyleNames="{style.moveMessage}">
 			<g:HTML>Hello</g:HTML>
+=======
+>>>>>>> fixed issue#85, can move one message now in DEMO mode, while
not test in Gmail mode
 		</g:SimplePanel>
 	</g:HorizontalPanel>
 >>>>>>> remove deprecated code

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessagesCellTable.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessagesCellTable.java?rev=1522431&r1=1522430&r2=1522431&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessagesCellTable.java
(original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessagesCellTable.java
Thu Sep 12 05:01:25 2013
@@ -838,7 +838,7 @@ public class MessagesCellTable extends D
         dataProvider.updateRowData(range.getStart(), sortedList);
 	}
 	
-	private String parseFolderName(final PlaceController pc) {
+	public String parseFolderName(final PlaceController pc) {
 		Place place = pc.getWhere();
 		if (place instanceof FolderPlace) {
 			folderName = ((FolderPlace) place).getToken();

Modified: james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/MoveMessageEvent.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/MoveMessageEvent.java?rev=1522431&r1=1522430&r2=1522431&view=diff
==============================================================================
--- james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/MoveMessageEvent.java
(original)
+++ james/hupa/trunk/shared/src/main/java/org/apache/hupa/shared/events/MoveMessageEvent.java
Thu Sep 12 05:01:25 2013
@@ -119,7 +119,11 @@ public class MoveMessageEvent extends Gw
         this.message = message;
     }
 
-    public User getUser() {
+    public MoveMessageEvent(ImapFolder newFolder) {
+    	this.newFolder = newFolder;
+	}
+
+	public User getUser() {
         return user;
     }
 



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


Mime
View raw message