james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From don...@apache.org
Subject svn commit: r1522415 - in /james/hupa/trunk/client/src/main: java/org/apache/hupa/client/activity/ComposeActivity.java java/org/apache/hupa/client/ui/ComposeView.java java/org/apache/hupa/client/ui/MessagesCellTable.java webapp/styles.css
Date Thu, 12 Sep 2013 04:55:20 GMT
Author: dongxu
Date: Thu Sep 12 04:55:20 2013
New Revision: 1522415

URL: http://svn.apache.org/r1522415
Log:
fixed issue#73, using LinkedHashSet in memory to store the contacts list like 'Echo Wang <echowdx@gmail.com>'

Modified:
    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/ui/ComposeView.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/MessagesCellTable.java
    james/hupa/trunk/client/src/main/webapp/styles.css

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=1522415&r1=1522414&r2=1522415&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
Thu Sep 12 04:55:20 2013
@@ -53,6 +53,8 @@ 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.ContactsUpdatedEvent;
+import org.apache.hupa.shared.events.ContactsUpdatedEventHandler;
 import org.apache.hupa.shared.events.LoginEvent;
 import org.apache.hupa.shared.events.LoginEventHandler;
 import org.apache.hupa.shared.events.MailToEvent;
@@ -98,6 +100,9 @@ import com.google.gwt.event.dom.client.H
 import com.google.gwt.event.shared.EventBus;
 <<<<<<< HEAD
 <<<<<<< HEAD
+<<<<<<< HEAD
+=======
+>>>>>>> fixed issue#73, using LinkedHashSet in memory to store the contacts
list like 'Echo Wang <echowdx@gmail.com>'
 import com.google.gwt.storage.client.Storage;
 import com.google.gwt.user.client.History;
 <<<<<<< HEAD
@@ -620,6 +625,18 @@ public class ComposeActivity extends App
 				display.getTo().setText(event.getMailto());
 			}});
 		
+		fillSuggestList();
+		
+	}
+
+	private void fillSuggestList() {
+		Storage contactStore = Storage.getLocalStorageIfSupported();
+		if(contactStore != null){
+			String contactsString = contactStore.getItem(MessagesCellTable.CONTACTS_STORE);
+			if(contactsString != null){
+				display.fillContactList(contactsString.replace("[", "").replace("]", "").trim().split(","));

+			}	
+		}
 	}
 
 <<<<<<< HEAD
@@ -995,6 +1012,7 @@ public class ComposeActivity extends App
 		ListBox getFromList();
 		IUploader getUploader();
 		void fillContactList(String[] contacts);
+<<<<<<< HEAD
 =======
 		Window.alert("//TODO send result is: " + response.isSuccess());
 =======
@@ -1046,5 +1064,7 @@ public class ComposeActivity extends App
 >>>>>>> make add operation buttons work according to the click events
 		IUploader getUploader();
 >>>>>>> make attachments sending work as expected
+=======
+>>>>>>> fixed issue#73, using LinkedHashSet in memory to store the contacts
list like 'Echo Wang <echowdx@gmail.com>'
 	}
 }

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ComposeView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ComposeView.java?rev=1522415&r1=1522414&r2=1522415&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ComposeView.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/ComposeView.java Thu Sep
12 04:55:20 2013
@@ -466,6 +466,12 @@ public class ComposeView extends Composi
 		hideRow(ROW_FOLLOWUP);
 		// show(addFollowupButton);
 	}
+	
+
+	@Override
+    public void fillContactList(String[] contacts){
+        toSuggest.fillOracle(contacts);
+    }
 
 	private void showRow(int row) {
 		if (isShowing(row)) {

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=1522415&r1=1522414&r2=1522415&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 04:55:20 2013
@@ -500,7 +500,9 @@ public class MessagesCellTable extends D
 package org.apache.hupa.client.ui;
 
 import java.util.Date;
+import java.util.LinkedHashSet;
 import java.util.List;
+import java.util.Set;
 
 import org.apache.hupa.client.HupaConstants;
 import org.apache.hupa.client.HupaController;
@@ -524,6 +526,8 @@ import com.google.gwt.cell.client.ImageR
 import com.google.gwt.cell.client.TextCell;
 import com.google.gwt.cell.client.ValueUpdater;
 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.Element;
 import com.google.gwt.dom.client.InputElement;
 import com.google.gwt.dom.client.NativeEvent;
@@ -533,6 +537,7 @@ import com.google.gwt.i18n.client.DateTi
 import com.google.gwt.place.shared.Place;
 import com.google.gwt.place.shared.PlaceController;
 import com.google.gwt.resources.client.ImageResource;
+import com.google.gwt.storage.client.Storage;
 import com.google.gwt.user.cellview.client.Column;
 import com.google.gwt.user.cellview.client.DataGrid;
 import com.google.gwt.user.cellview.client.Header;
@@ -592,6 +597,7 @@ public class MessagesCellTable extends D
 	HupaRequestFactory rf;
 
 	private MessageListDataProvider dataProvider;
+	public static final String CONTACTS_STORE = "hupa-contacts";
 
 	public class MessageListDataProvider extends AsyncDataProvider<Message> implements
HasRefresh {
 
@@ -608,12 +614,48 @@ public class MessagesCellTable extends D
 			this.onRangeChanged(display);
 		}
 
+		Set<String> contacts = new LinkedHashSet<String>();
+		private Storage contactsStore = null;
+
+		private void cacheContacts(List<Message> messages) {
+			for (Message message : messages) {
+				message.getFrom();
+				message.getTo();
+				message.getCc();
+				message.getReplyto();
+
+				contacts.add(message.getFrom());
+				contacts.add(message.getReplyto());
+
+				for (String to : message.getTo()) {
+					contacts.add(to);
+				}
+				for (String cc : message.getCc()) {
+					contacts.add(cc);
+				}
+			}
+			saveToLocalStorage(contacts);
+		}
+		private void saveToLocalStorage(Set<String> contacts) {
+			contactsStore = Storage.getLocalStorageIfSupported();
+			if (contactsStore != null) {
+				String contactsString = contactsStore.getItem(CONTACTS_STORE);
+				if (null != contactsString) {
+					for (String contact : contactsString.split(",")) {
+						contacts.add(contact.replace("[", "").replace("]", "").trim());
+
+					}
+				}
+				contactsStore.setItem(CONTACTS_STORE, contacts.toString());
+			}
+		}
+
 		@Override
 		protected void onRangeChanged(HasData<Message> display) {
 			FetchMessagesRequest req = rf.messagesRequest();
 			FetchMessagesAction action = req.create(FetchMessagesAction.class);
 			final ImapFolder f = req.create(ImapFolder.class);
-            final int start = display.getVisibleRange().getStart();
+			final int start = display.getVisibleRange().getStart();
 			f.setFullName(parseFolderName(pc));
 			action.setFolder(f);
 			action.setOffset(display.getVisibleRange().getLength());
@@ -629,6 +671,11 @@ public class MessagesCellTable extends D
 						updateRowData(start, response.getMessages());
 					}
 					hc.hideTopLoading();
+					Scheduler.get().scheduleDeferred(new ScheduledCommand() {
+						public void execute() {
+							cacheContacts(response.getMessages());
+						}
+					});
 				}
 
 				@Override
@@ -643,14 +690,13 @@ public class MessagesCellTable extends D
 		}
 
 	}
-	
+
 	public final class CheckboxHeader extends Header<Boolean> {
 
 		private final MultiSelectionModel<? super Message> selectionModel;
 		private final AsyncDataProvider<Message> provider;
 
-		public CheckboxHeader(MultiSelectionModel<? super Message> selectionModel,
-				AsyncDataProvider<Message> provider) {
+		public CheckboxHeader(MultiSelectionModel<? super Message> selectionModel, AsyncDataProvider<Message>
provider) {
 			super(new CheckboxCell());
 			this.selectionModel = selectionModel;
 			this.provider = provider;
@@ -658,10 +704,10 @@ public class MessagesCellTable extends D
 
 		@Override
 		public Boolean getValue() {
-			if(selectionModel == null || provider==null){
+			if (selectionModel == null || provider == null) {
 				return false;
 			}
-			if(selectionModel.getSelectedSet().size() == 0 || provider.getDataDisplays().size() ==
0){
+			if (selectionModel.getSelectedSet().size() == 0 || provider.getDataDisplays().size() ==
0) {
 				return false;
 			}
 			boolean allItemsSelected = selectionModel.getSelectedSet().size() == provider.getDataDisplays().size();

Modified: james/hupa/trunk/client/src/main/webapp/styles.css
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/webapp/styles.css?rev=1522415&r1=1522414&r2=1522415&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/webapp/styles.css (original)
+++ james/hupa/trunk/client/src/main/webapp/styles.css Thu Sep 12 04:55:20 2013
@@ -2162,11 +2162,14 @@ fieldset.tab {
     color: #0d0eb0;
     text-decoration: underline;
     cursor: pointer;
+<<<<<<< HEAD
 }.hupa-attachment .hupa-hyperlink {
     padding-left: 5px;
     color: #0d0eb0;
     text-decoration: underline;
     cursor: pointer;
+=======
+>>>>>>> fixed issue#73, using LinkedHashSet in memory to store the contacts
list like 'Echo Wang <echowdx@gmail.com>'
 }
 
 
@@ -2270,6 +2273,7 @@ fieldset.tab {
   width: 0px;
   height: 0px;
   overflow: hidden;
+<<<<<<< HEAD
 }
 
 
@@ -4663,3 +4667,6 @@ fieldset.tab {
 	filter: alpha(opacity =     30);
 }
 >>>>>>> make delete label in label setting work(backend now)
+=======
+}
+>>>>>>> fixed issue#73, using LinkedHashSet in memory to store the contacts
list like 'Echo Wang <echowdx@gmail.com>'



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