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:27:16 UTC

svn commit: r1522349 - in /james/hupa/trunk/client/src/main/java/org/apache/hupa/client: HupaController.java activity/ComposeActivity.java activity/ToolBarActivity.java mapper/ComposeActivityMapper.java mapper/ToolBarActivityMapper.java

Author: dongxu
Date: Thu Sep 12 04:27:16 2013
New Revision: 1522349

URL: http://svn.apache.org/r1522349
Log:
fixed issue#18

Modified:
    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/ToolBarActivity.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mapper/ComposeActivityMapper.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mapper/ToolBarActivityMapper.java

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=1522349&r1=1522348&r2=1522349&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 Thu Sep 12 04:27:16 2013
@@ -27,6 +27,9 @@ package org.apache.hupa.client;
 <<<<<<< HEAD
 import org.apache.hupa.client.activity.NotificationActivity;
 <<<<<<< HEAD
+<<<<<<< HEAD
+=======
+>>>>>>> fixed issue#18
 import org.apache.hupa.client.activity.ToolBarActivity;
 import org.apache.hupa.client.activity.TopBarActivity;
 =======
@@ -153,6 +156,7 @@ public class HupaController {
 	@Inject private 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();
@@ -337,9 +341,9 @@ public class HupaController {
 
 	private void adjustLayout(PlaceChangeEvent event) {
 		Place place = event.getNewPlace();
-
 		if (place instanceof ComposePlace) {
-			if (((ComposePlace) place).getParameters() != null) {
+			ComposePlace here = (ComposePlace) place;
+			if (here.getParameters() != null) {
 				hupaLayout.switchToCompose();
 			} else {
 				this.placeController.goTo(new MailFolderPlace("Mock-Inbox"));
@@ -386,25 +390,25 @@ public class HupaController {
 		});
 	}
 
-    public void showNotice(String html, int millis){
-    	noticeRegion.notice(html);
-        if (millis > 0)
-        	hideNotice.schedule(millis);
-    }
-    
-    public void showTopLoading(String message){
-    	topBar.showLoading(message);
-    }
-    
-    public void hideTopLoading(){
-    	topBar.hideLoading();
-    }
-    
-    private final Timer hideNotice = new Timer() {
-        public void run() {
-        	noticeRegion.hideNotification();
-        }
-    };
+	public void showNotice(String html, int millis) {
+		noticeRegion.notice(html);
+		if (millis > 0)
+			hideNotice.schedule(millis);
+	}
+
+	public void showTopLoading(String message) {
+		topBar.showLoading(message);
+	}
+
+	public void hideTopLoading() {
+		topBar.hideLoading();
+	}
+
+	private final Timer hideNotice = new Timer() {
+		public void run() {
+			noticeRegion.hideNotification();
+		}
+	};
 
 	private class IdleTimer extends Timer {
 		boolean running = false;

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=1522349&r1=1522348&r2=1522349&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:27:16 2013
@@ -458,11 +458,16 @@ public class ComposeActivity extends App
 	}
 
 	private void fillHeader() {
-		if (place == null)
+		if (place == null || place.getParameters() == null)
 			return;
+		if (user == null){
+			user = place.getParameters().getUser();
+		}
+		display.getFromList().addItem(user.getName());
+		if("new".equals(place.getToken())){
+			return;
+		}
 		Message oldMessage = place.getParameters().getOldmessage();
-		if (user != null)
-			display.getFromList().addItem(user.getName());
 		display.getMessageHTML().setHTML(
 				wrapMessage(oldMessage, place.getParameters().getOldDetails(), place.getToken()));
 		if ("forward".equals(place.getToken())) {

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/ToolBarActivity.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/ToolBarActivity.java?rev=1522349&r1=1522348&r2=1522349&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/ToolBarActivity.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/activity/ToolBarActivity.java Thu Sep 12 04:27:16 2013
@@ -208,6 +208,10 @@ public class ToolBarActivity extends App
 		this.folderName = folder;
 		return this;
 	}
+	
+	public Displayable getDisplay(){
+		return display;
+	}
 
 <<<<<<< HEAD
 	@Inject private Displayable display;
@@ -291,6 +295,7 @@ public class ToolBarActivity extends App
 		HasClickHandlers getForward();
 
 		void setParameters(Parameters parameters);
+		Parameters getParameters();
 
 		HasClickHandlers getMarkUnread();
 

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mapper/ComposeActivityMapper.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mapper/ComposeActivityMapper.java?rev=1522349&r1=1522348&r2=1522349&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mapper/ComposeActivityMapper.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mapper/ComposeActivityMapper.java Thu Sep 12 04:27:16 2013
@@ -21,6 +21,8 @@ package org.apache.hupa.client.mapper;
 
 import org.apache.hupa.client.activity.ComposeActivity;
 import org.apache.hupa.client.place.ComposePlace;
+import org.apache.hupa.client.place.MailFolderPlace;
+import org.apache.hupa.client.ui.ToolBarView.Parameters;
 
 import com.google.gwt.activity.shared.Activity;
 import com.google.gwt.activity.shared.ActivityMapper;
@@ -44,11 +46,9 @@ public class ComposeActivityMapper imple
 	public Activity getActivity(final Place place) {
 		if (!(place instanceof ComposePlace))
 			return null;
-		final ComposePlace composePlace = (ComposePlace)place;
-		if(composePlace.getParameters() == null) return null;
-//		if(composePlace.getParameters() == null){
-//			placeController.goTo(new MailFolderPlace("Mock-Inbox"));
-//		}
+		final ComposePlace here = (ComposePlace) place;
+		if (!"new".equals(here.getToken()) && here.getParameters() == null)
+			return null;
 		return new ActivityAsyncProxy() {
 			@Override
 			protected void doAsync(RunAsyncCallback callback) {
@@ -57,7 +57,7 @@ public class ComposeActivityMapper imple
 
 			@Override
 			protected Activity createInstance() {
-				return composeActivityProvider.get().with(composePlace);
+				return composeActivityProvider.get().with(here);
 			}
 		};
 	}

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mapper/ToolBarActivityMapper.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mapper/ToolBarActivityMapper.java?rev=1522349&r1=1522348&r2=1522349&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mapper/ToolBarActivityMapper.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mapper/ToolBarActivityMapper.java Thu Sep 12 04:27:16 2013
@@ -43,6 +43,7 @@ import com.google.gwt.activity.shared.Ac
 =======
 =======
 import org.apache.hupa.client.place.MailFolderPlace;
+import org.apache.hupa.client.ui.ToolBarView.Parameters;
 
 import com.google.gwt.activity.shared.Activity;
 >>>>>>> fixed issue#11, write a subclass of SplitLayoutPanel to override its onResize but failed, use the native one, and then refactor some names
@@ -104,6 +105,7 @@ public class ToolBarActivityMapper exten
 		this.toolBarActivityProvider = toolActivityProvider;
 	}
 <<<<<<< HEAD
+<<<<<<< HEAD
 
 	public Activity getActivity(Place place) {
 <<<<<<< HEAD
@@ -116,6 +118,9 @@ public class ToolBarActivityMapper exten
 >>>>>>> try to fix some issues by reorganize the activity mapper and place controller
 =======
 	
+=======
+
+>>>>>>> fixed issue#18
 	@Override
 <<<<<<< HEAD
 	Activity asyncLoadActivity(Place place) {
@@ -123,8 +128,17 @@ public class ToolBarActivityMapper exten
 >>>>>>> fixed issue#11, write a subclass of SplitLayoutPanel to override its onResize but failed, use the native one, and then refactor some names
 =======
 	Activity asyncLoadActivity(final Place place) {
+<<<<<<< HEAD
 		
 >>>>>>> fix the bugs resulted from the no unit tests
+=======
+		final ToolBarActivity tba = toolBarActivityProvider.get();
+		if (place instanceof MailFolderPlace) { // might be from login page
+			MailFolderPlace here = (MailFolderPlace) place;
+			tba.getDisplay().setParameters(new Parameters(here.getUser(), here.getFullName(), null, null));
+		}
+
+>>>>>>> fixed issue#18
 		return new ActivityAsyncProxy() {
 			@Override
 			protected void doAsync(RunAsyncCallback callback) {
@@ -134,10 +148,10 @@ public class ToolBarActivityMapper exten
 			@Override
 			protected Activity createInstance() {
 				String token = null;
-				if(place instanceof MailFolderPlace){
-					token = ((MailFolderPlace)place).getFullName();
+				if (place instanceof MailFolderPlace) {
+					token = ((MailFolderPlace) place).getFullName();
 				}
-				return toolBarActivityProvider.get().with(token);
+				return tba.with(token);
 			}
 		};
 >>>>>>> support code split



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