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 04:46:29 UTC

svn commit: r1522139 - in /james/hupa/trunk/client/src/main/java/org/apache/hupa: ./ client/ client/activity/ client/gin/ client/mvp/ client/place/ client/ui/

Author: dongxu
Date: Thu Sep 12 02:46:28 2013
New Revision: 1522139

URL: http://svn.apache.org/r1522139
Log:
change the LOGIN progress using native MVP instead of gwt-presenter

Added:
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaEvoCallback.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/gin/HupaEvoClientModule.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/gin/HupaEvoGinjector.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/gin/InjectablePlaceController.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/ActivityPlace.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/AppActivityMapper.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/AppPlaceFactory.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/AppPlaceHistoryMapper.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/place/LoginPlace.java
Modified:
    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/activity/LoginActivity.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/LoginView.java
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LoginView.java

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=1522139&r1=1522138&r2=1522139&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 Thu Sep 12 02:46:28 2013
@@ -41,10 +41,14 @@
   <inherits name='com.google.gwt.widgetideas.WidgetIdeas'/>
   <inherits name='com.google.gwt.gen2.commonwidget.CommonWidget' />
   <inherits name='com.google.gwt.gen2.table.override.Override'/>
-  <inherits name='com.google.gwt.gen2.table.ScrollTable'/>
+  <inherits name='com.google.gwt.gen2.table.ScrollTable'/><!--
   <inherits name='net.customware.gwt.dispatch.Dispatch' />
+<<<<<<< HEAD
   <inherits name='net.customware.gwt.presenter.Presenter' />
 <<<<<<< HEAD
+=======
+  <inherits name='net.customware.gwt.presenter.Presenter' />  -->
+>>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
   <inherits name="com.google.gwt.activity.Activity"/>
   <inherits name="com.google.gwt.place.Place"/>
   <inherits name="com.google.gwt.inject.Inject"/>

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=1522139&r1=1522138&r2=1522139&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 Thu Sep 12 02:46:28 2013
@@ -23,6 +23,7 @@ package org.apache.hupa.client;
 <<<<<<< HEAD
 <<<<<<< HEAD
 <<<<<<< HEAD
+<<<<<<< HEAD
 import org.apache.hupa.client.ioc.AppGinjector;
 
 import com.google.gwt.core.client.EntryPoint;
@@ -69,20 +70,31 @@ import org.apache.hupa.client.mvp.AppPre
 <<<<<<< HEAD
 <<<<<<< HEAD
 =======
+=======
+>>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
 import org.apache.hupa.client.gin.HupaEvoGinjector;
 import org.apache.hupa.client.mvp.AppPlaceFactory;
 import org.apache.hupa.client.mvp.AppPlaceHistoryMapper;
 import org.apache.hupa.client.place.LoginPlace;
+<<<<<<< HEAD
 >>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
 =======
 >>>>>>> Change to new mvp framework - first step
 =======
 >>>>>>> first commit
+=======
+>>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
 
+import com.google.gwt.activity.shared.ActivityManager;
+import com.google.gwt.activity.shared.ActivityMapper;
 import com.google.gwt.core.client.EntryPoint;
 import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.shared.EventBus;
+import com.google.gwt.place.shared.PlaceController;
+import com.google.gwt.place.shared.PlaceHistoryHandler;
 import com.google.gwt.user.client.DOM;
 import com.google.gwt.user.client.ui.RootPanel;
+import com.google.gwt.user.client.ui.SimplePanel;
 
 <<<<<<< HEAD
 public class Hupa implements EntryPoint {
@@ -124,21 +136,45 @@ public class Hupa implements EntryPoint 
 >>>>>>> Change to new mvp framework - first step
 =======
 public class Hupa implements EntryPoint{
-    private final HupaGinjector injector = GWT.create(HupaGinjector.class);
+//    private final HupaGinjector injector = GWT.create(HupaGinjector.class);
+
+	private SimplePanel appWidget = new SimplePanel();
+  private final HupaEvoGinjector injector = GWT.create(HupaEvoGinjector.class);
     
     public void onModuleLoad() {
         // remove the loading message from the browser
         com.google.gwt.user.client.Element loading = DOM.getElementById("loading");
 
         DOM.removeChild(RootPanel.getBodyElement(), loading);
+//
+//        AppPresenter aPres = injector.getAppPresenter();
+//        aPres.bind();
+//       
+//        RootPanel.get().add(aPres.getDisplay().asWidget());
+//
+//        PlaceManager placeManager = injector.getPlaceManager();
+//        placeManager.fireCurrentPlace();
+
+		EventBus eventBus = injector.getEventBus();
+		PlaceController placeController = injector.getPlaceController();
+
+
+		ActivityMapper activityMapper = injector.getActivityMapper();
+		ActivityManager activityManager = new ActivityManager(activityMapper, eventBus);
+		activityManager.setDisplay(appWidget);
 
-        AppPresenter aPres = injector.getAppPresenter();
-        aPres.bind();
-       
-        RootPanel.get().add(aPres.getDisplay().asWidget());
-
-        PlaceManager placeManager = injector.getPlaceManager();
-        placeManager.fireCurrentPlace();
+		AppPlaceFactory factory = injector.getAppPlaceFactory();
+		LoginPlace defaultPlace = factory.getLoginPlace();
+		
+		AppPlaceHistoryMapper historyMapper = GWT.create(AppPlaceHistoryMapper.class);
+		historyMapper.setFactory(factory);
+		
+		PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper);
+		historyHandler.register(placeController, eventBus, defaultPlace);
+		
+		RootPanel.get().add(appWidget);
+		
+		historyHandler.handleCurrentHistory();
     }
 >>>>>>> first commit
 

Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaEvoCallback.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaEvoCallback.java?rev=1522139&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaEvoCallback.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaEvoCallback.java Thu Sep 12 02:46:28 2013
@@ -0,0 +1,102 @@
+package org.apache.hupa.client;
+
+import net.customware.gwt.dispatch.client.DispatchAsync;
+
+import org.apache.hupa.client.activity.LoginActivity.Display;
+import org.apache.hupa.shared.events.LogoutEvent;
+import org.apache.hupa.shared.events.ServerStatusEvent;
+import org.apache.hupa.shared.events.ServerStatusEvent.ServerStatus;
+import org.apache.hupa.shared.exception.InvalidSessionException;
+import org.apache.hupa.shared.rpc.CheckSession;
+import org.apache.hupa.shared.rpc.CheckSessionResult;
+
+import com.google.gwt.event.shared.EventBus;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.inject.Inject;
+
+public abstract class HupaEvoCallback<T> implements AsyncCallback<T> {
+    
+    private DispatchAsync dispatcher = null;
+    private EventBus eventBus = null;
+    private ServerStatusEvent available = new ServerStatusEvent(ServerStatus.Available); 
+    private ServerStatusEvent unavailable = new ServerStatusEvent(ServerStatus.Unavailable); 
+
+    @SuppressWarnings("unused")
+    private Display display = null;
+
+    @Inject
+    public HupaEvoCallback(DispatchAsync dispatcher, EventBus bus, Display display) {
+        this(dispatcher, bus);
+        this.display = display;
+        
+        //this.display.startProcessing();
+    }
+    
+    @Inject
+    public HupaEvoCallback(DispatchAsync dispatcher, EventBus bus) {
+        this.dispatcher = dispatcher;
+        this.eventBus = bus;
+    }
+
+    /**
+     * If you override this method, remember to call super.onFailure() 
+     */
+    public void onFailure(final Throwable originalCaught) {
+        // Server's response is invalid due to:
+        // server unaccessible, session error or server exception
+        dispatcher.execute(new CheckSession(), new AsyncCallback<CheckSessionResult>() {
+            public void onFailure(Throwable caught) {
+                if (caught instanceof InvalidSessionException) {
+                    eventBus.fireEvent(new LogoutEvent(null));
+                } else {
+                    // The server is unaccessible
+                    eventBus.fireEvent(unavailable);
+                }
+                finish();
+            }
+            public void onSuccess(CheckSessionResult result) {
+                if (!result.isValid()) {
+                    // Server's connection is fine, but the user has not a valid session
+                    eventBus.fireEvent(new LogoutEvent(null));
+                } else {
+                    // Server's connection is fine, and the user has a valid session
+                    // So the original action failed because a server's exception 
+                    eventBus.fireEvent(available);
+                }
+                finish();
+            }
+
+            private void finish() {
+                callbackError(originalCaught);
+                //if (display != null)
+                    //display.stopProcessing();
+            }
+        });
+    }
+    
+    /**
+     * If you override this method, remember to call super.onSuccess() 
+     */
+    public void onSuccess(T result) {
+        // Server's response is valid,
+        eventBus.fireEvent(available);
+        // Execute the original method
+        callback(result);
+        // If display is being used, stop it
+        //if (display != null)
+            //display.stopProcessing();
+    }
+    
+    /**
+     * The callback code which the user has to implement
+     */
+    public abstract void callback(T result); 
+
+    /**
+     * The callback code in the case of error
+     * Override this method, if you need this feature.
+     */
+    public void callbackError(Throwable caught) {
+        System.out.println("HupaCallBack Error: " + caught);
+    }
+}

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=1522139&r1=1522138&r2=1522139&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 Thu Sep 12 02:46:28 2013
@@ -1,4 +1,5 @@
 <<<<<<< HEAD
+<<<<<<< HEAD
 /****************************************************************
  * Licensed to the Apache Software Foundation (ASF) under one   *
  * or more contributor license agreements.  See the NOTICE file *
@@ -31,23 +32,31 @@ import org.apache.hupa.shared.events.Ses
 import org.apache.hupa.shared.events.SessionExpireEventHandler;
 
 =======
+=======
+>>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
 package org.apache.hupa.client.activity;
 
 import net.customware.gwt.dispatch.client.DispatchAsync;
 
 import org.apache.hupa.client.HupaConstants;
+<<<<<<< HEAD
 import org.apache.hupa.client.evo.HupaEvoCallback;
 import org.apache.hupa.client.place.MailFolderPlace;
 import org.apache.hupa.client.ui.WidgetDisplayable;
 import org.apache.hupa.shared.events.FlashEvent;
 import org.apache.hupa.shared.events.SessionExpireEvent;
 import org.apache.hupa.shared.events.SessionExpireEventHandler;
+=======
+import org.apache.hupa.client.HupaEvoCallback;
+import org.apache.hupa.client.place.LoginPlace;
+>>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
 import org.apache.hupa.shared.rpc.LoginUser;
 import org.apache.hupa.shared.rpc.LoginUserResult;
 
 import com.google.gwt.activity.shared.AbstractActivity;
 <<<<<<< HEAD
 <<<<<<< HEAD
+<<<<<<< HEAD
 import com.google.gwt.core.client.GWT;
 >>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
 =======
@@ -55,11 +64,15 @@ import com.google.gwt.core.client.GWT;
 =======
 import com.google.gwt.core.client.GWT;
 >>>>>>> decorate the theme
+=======
+import com.google.gwt.core.client.GWT;
+>>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
 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;
 <<<<<<< HEAD
+<<<<<<< HEAD
 =======
 import com.google.gwt.place.shared.PlaceController;
 <<<<<<< HEAD
@@ -97,10 +110,48 @@ public class LoginActivity extends Abstr
 	@Inject
 	public LoginActivity(Displayable display, EventBus eventBus, PlaceController placeController,
 			DispatchAsync dispatcher) {
+=======
+import com.google.gwt.place.shared.PlaceController;
+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.Widget;
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+public class LoginActivity extends AbstractActivity {
+
+	private HupaConstants constants = GWT.create(HupaConstants.class);
+
+	private LoginPlace place;
+	private final Display display;
+	private final EventBus eventBus;
+	// private final HupaEvoCallback loginRpcService;
+	private PlaceController placeController;
+
+	private DispatchAsync dispatcher;
+	private Provider<LoginPlace> oldGoToPlaceProvider;
+	private Provider<LoginPlace> newGoToPlaceProvider;
+
+	@Inject
+	public LoginActivity(Display display, EventBus eventBus, PlaceController placeController, DispatchAsync dispatcher,
+			Provider<LoginPlace> newGoToPlaceProvider) {
+>>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
 		this.display = display;
 		this.eventBus = eventBus;
 		this.placeController = placeController;
 		this.dispatcher = dispatcher;
+<<<<<<< HEAD
+	}
+>>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
+=======
+		this.newGoToPlaceProvider = newGoToPlaceProvider;
+		// this.loginRpcService = loginRpcService;
+	}
+
+	public void init(LoginPlace place) {
+		this.place = place;
 	}
 >>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
 
@@ -109,6 +160,7 @@ public class LoginActivity extends Abstr
 		bind();
 		container.setWidget(display.asWidget());
 <<<<<<< HEAD
+<<<<<<< HEAD
 		display.setLoading(false);
 	}
 
@@ -125,6 +177,8 @@ public class LoginActivity extends Abstr
 			}
 		});
 =======
+=======
+>>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
 
 	}
 
@@ -134,6 +188,7 @@ public class LoginActivity extends Abstr
 				doLogin();
 			}
 		});
+<<<<<<< HEAD
 		display.getResetClick().addClickHandler(new ClickHandler() {
 
 			public void onClick(ClickEvent event) {
@@ -150,12 +205,16 @@ public class LoginActivity extends Abstr
 		});
 
 >>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
+=======
+
+>>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
 	}
 
 	private void doLogin() {
 		String user = display.getUserNameValue().getValue().trim();
 		String pass = display.getPasswordValue().getValue().trim();
 <<<<<<< HEAD
+<<<<<<< HEAD
 		if (user.isEmpty() || pass.isEmpty())
 			return;
 		display.setLoading(true);
@@ -174,11 +233,14 @@ public class LoginActivity extends Abstr
 				Window.alert(error.getMessage());// TODO a more gentle way
 				display.setLoading(false);
 =======
+=======
+>>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
 
 		if (user.isEmpty() || pass.isEmpty())
 			return;
 
 		display.setLoading(true);
+<<<<<<< HEAD
 //		HupaRequestFactory rf = GWT.create(HupaRequestFactory.class);
 //		rf.initialize(eventBus);
 //		UserRequest userRequest = rf.userRequest();
@@ -198,19 +260,28 @@ public class LoginActivity extends Abstr
 		
 		
 		
+=======
+>>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
 		dispatcher.execute(new LoginUser(user, pass), new HupaEvoCallback<LoginUserResult>(dispatcher, eventBus,
 				display) {
 			public void callback(LoginUserResult result) {
 				display.setLoading(false);
+<<<<<<< HEAD
 				// eventBus.fireEvent(new LoginEvent(result.getUser()));
 //				LoginActivity.this.placeController.goTo(mailInboxPlaceProvider.get().with(result.getUser()));
 				LoginActivity.this.placeController.goTo(new MailFolderPlace().with(result.getUser()));
+=======
+				Window.alert("success");
+				// eventBus.fireEvent(new LoginEvent(result.getUser()));
+//				LoginActivity.this.placeController.goTo(newGoToPlaceProvider.get());
+>>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
 				doReset();
 			}
 
 			public void callbackError(Throwable caught) {
 				display.setLoading(false);
 <<<<<<< HEAD
+<<<<<<< HEAD
 				Window.alert("error");
 <<<<<<< HEAD
 				LoginActivity.this.placeController.goTo(mailInboxPlaceProvider.get());
@@ -227,6 +298,15 @@ public class LoginActivity extends Abstr
 			}
 		});
 		
+=======
+				Window.alert("failure");
+//				LoginActivity.this.placeController.goTo(newGoToPlaceProvider.get());
+				// eventBus.fireEvent(new FlashEvent(constants.loginInvalid(),
+				// 4000));
+				doReset();
+			}
+		});
+>>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
 	}
 
 	/**
@@ -240,6 +320,7 @@ public class LoginActivity extends Abstr
 
 <<<<<<< HEAD
 <<<<<<< HEAD
+<<<<<<< HEAD
 	@Inject private Displayable display;
 	@Inject private HupaConstants constants;
 
@@ -254,6 +335,9 @@ public class LoginActivity extends Abstr
 =======
 	public interface Displayable extends WidgetDisplayable {
 >>>>>>> Change to new mvp framework - first step
+=======
+	public interface Display {
+>>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
 		public HasClickHandlers getLoginClick();
 
 		public HasClickHandlers getResetClick();
@@ -266,6 +350,9 @@ public class LoginActivity extends Abstr
 
 		public void setLoading(boolean loading);
 
+<<<<<<< HEAD
+>>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
+=======
 >>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
 		public Widget asWidget();
 	}

Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/gin/HupaEvoClientModule.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/gin/HupaEvoClientModule.java?rev=1522139&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/gin/HupaEvoClientModule.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/gin/HupaEvoClientModule.java Thu Sep 12 02:46:28 2013
@@ -0,0 +1,46 @@
+package org.apache.hupa.client.gin;
+
+import net.customware.gwt.dispatch.client.DefaultExceptionHandler;
+import net.customware.gwt.dispatch.client.DispatchAsync;
+import net.customware.gwt.dispatch.client.ExceptionHandler;
+
+import org.apache.hupa.client.CachingDispatchAsync;
+import org.apache.hupa.client.activity.LoginActivity;
+import org.apache.hupa.client.mvp.AppActivityMapper;
+import org.apache.hupa.client.mvp.AppPlaceFactory;
+import org.apache.hupa.client.ui.LoginView;
+
+import com.google.gwt.activity.shared.ActivityMapper;
+import com.google.gwt.event.shared.EventBus;
+import com.google.gwt.event.shared.SimpleEventBus;
+import com.google.gwt.inject.client.AbstractGinModule;
+import com.google.gwt.place.shared.PlaceController;
+import com.google.inject.Provides;
+import com.google.inject.Singleton;
+
+public class HupaEvoClientModule extends AbstractGinModule {
+
+	@Override
+	protected void configure() {
+		// bind the EventBus
+		bind(EventBus.class).to(SimpleEventBus.class).in(Singleton.class);
+		bind(PlaceController.class).to(InjectablePlaceController.class).in(Singleton.class);
+
+		bind(AppPlaceFactory.class).in(Singleton.class);
+
+		// bind the mapper
+		bind(ActivityMapper.class).to(AppActivityMapper.class).in(Singleton.class);
+
+		// bind the views
+		bind(LoginActivity.Display.class).to(LoginView.class);
+        // Used by dispatch. Note that GWT 2.4 has its own ExceptionHandler etc in other namespace
+        bind(ExceptionHandler.class).to(DefaultExceptionHandler.class);
+
+	}
+    @Provides
+    @Singleton
+    protected DispatchAsync provideDispatchAsync(ExceptionHandler exceptionHandler) {
+        return new CachingDispatchAsync( exceptionHandler );
+    }
+
+}

Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/gin/HupaEvoGinjector.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/gin/HupaEvoGinjector.java?rev=1522139&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/gin/HupaEvoGinjector.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/gin/HupaEvoGinjector.java Thu Sep 12 02:46:28 2013
@@ -0,0 +1,21 @@
+package org.apache.hupa.client.gin;
+
+import org.apache.hupa.client.mvp.AppPlaceFactory;
+
+import com.google.gwt.activity.shared.ActivityMapper;
+import com.google.gwt.event.shared.EventBus;
+import com.google.gwt.inject.client.GinModules;
+import com.google.gwt.inject.client.Ginjector;
+import com.google.gwt.place.shared.PlaceController;
+
+@GinModules({HupaEvoClientModule.class})
+public interface HupaEvoGinjector  extends Ginjector {
+
+	ActivityMapper getActivityMapper();
+	
+	PlaceController getPlaceController();
+	
+	EventBus getEventBus();
+	
+	AppPlaceFactory getAppPlaceFactory();
+}

Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/gin/InjectablePlaceController.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/gin/InjectablePlaceController.java?rev=1522139&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/gin/InjectablePlaceController.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/gin/InjectablePlaceController.java Thu Sep 12 02:46:28 2013
@@ -0,0 +1,20 @@
+package org.apache.hupa.client.gin;
+
+import javax.inject.Inject;
+
+import com.google.gwt.event.shared.EventBus;
+import com.google.gwt.place.shared.PlaceController;
+
+
+/**
+ * The injectable PlaceController to be able to inject the eventbus into
+ *
+ */
+public class InjectablePlaceController extends PlaceController {
+
+	@Inject
+	public InjectablePlaceController(EventBus eventBus) {
+		super(eventBus);
+	}
+
+}

Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/ActivityPlace.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/ActivityPlace.java?rev=1522139&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/ActivityPlace.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/ActivityPlace.java Thu Sep 12 02:46:28 2013
@@ -0,0 +1,35 @@
+package org.apache.hupa.client.mvp;
+
+import com.google.gwt.activity.shared.Activity;
+import com.google.gwt.place.shared.Place;
+
+/**
+ * Mapping an Activity to a Place
+ * 
+ * @author Mahamad El Tanahy
+ * 
+ */
+public abstract class ActivityPlace<T extends Activity> extends Place {
+
+	protected T activity;
+
+	public ActivityPlace(T activity) {
+		this.activity = activity;
+		setPlaceName("");
+	}
+
+	public T getActivity() {
+		return activity;
+	}
+
+	private String placeName;
+
+	public void setPlaceName(String token) {
+		this.placeName = token;
+	}
+
+	public String getPlaceName() {
+		return placeName;
+	}
+
+}

Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/AppActivityMapper.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/AppActivityMapper.java?rev=1522139&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/AppActivityMapper.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/AppActivityMapper.java Thu Sep 12 02:46:28 2013
@@ -0,0 +1,35 @@
+package org.apache.hupa.client.mvp;
+
+import javax.inject.Inject;
+
+import com.google.gwt.activity.shared.Activity;
+import com.google.gwt.activity.shared.ActivityMapper;
+import com.google.gwt.event.shared.EventBus;
+import com.google.gwt.place.shared.Place;
+import com.google.gwt.place.shared.PlaceController;
+
+
+public class AppActivityMapper implements ActivityMapper {
+
+	private EventBus eventBus;
+	private PlaceController placeController;
+	
+	@Inject
+	public AppActivityMapper(EventBus eventBus, PlaceController placeController) {
+		super();
+		this.eventBus = eventBus;
+		this.placeController = placeController;
+	}
+	
+	@Override
+	public Activity getActivity(Place place) {
+		if (place instanceof ActivityPlace) {
+			Activity activity = ((ActivityPlace) place).getActivity();
+            return activity;
+        }
+
+        return null;
+		
+	}
+
+}

Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/AppPlaceFactory.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/AppPlaceFactory.java?rev=1522139&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/AppPlaceFactory.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/AppPlaceFactory.java Thu Sep 12 02:46:28 2013
@@ -0,0 +1,30 @@
+package org.apache.hupa.client.mvp;
+
+import org.apache.hupa.client.place.LoginPlace;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+/**
+ * 
+ * A place factory which knows about all the tokenizers in the app
+ * 
+ */
+public class AppPlaceFactory {
+
+	@Inject
+	LoginPlace.Tokenizer loginPlaceTokenizer;
+
+	@Inject
+	Provider<LoginPlace> loginProvider;
+
+	// contact place
+	public LoginPlace.Tokenizer getLoginPlaceTokenizer() {
+		return loginPlaceTokenizer;
+	}
+
+	public LoginPlace getLoginPlace() {
+		return loginProvider.get();
+	}
+
+}

Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/AppPlaceHistoryMapper.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/AppPlaceHistoryMapper.java?rev=1522139&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/AppPlaceHistoryMapper.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/AppPlaceHistoryMapper.java Thu Sep 12 02:46:28 2013
@@ -0,0 +1,13 @@
+package org.apache.hupa.client.mvp;
+
+import org.apache.hupa.client.place.LoginPlace;
+
+import com.google.gwt.place.shared.PlaceHistoryMapperWithFactory;
+import com.google.gwt.place.shared.WithTokenizers;
+
+//@WithTokenizers({ LoginPlace.Tokenizer.class })
+public interface AppPlaceHistoryMapper extends PlaceHistoryMapperWithFactory<AppPlaceFactory> {
+
+	// empty
+
+}

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/LoginView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/LoginView.java?rev=1522139&r1=1522138&r2=1522139&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/LoginView.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/LoginView.java Thu Sep 12 02:46:28 2013
@@ -257,10 +257,14 @@ public class LoginView extends Composite
      */
     public HasClickHandlers getLoginClick() {
 <<<<<<< HEAD
+<<<<<<< HEAD
         return submitButton;
 =======
         return loginButton;
 >>>>>>> first commit
+=======
+        return submitButton;
+>>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
     }
 
     /*

Added: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/place/LoginPlace.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/place/LoginPlace.java?rev=1522139&view=auto
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/place/LoginPlace.java (added)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/place/LoginPlace.java Thu Sep 12 02:46:28 2013
@@ -0,0 +1,42 @@
+package org.apache.hupa.client.place;
+
+import org.apache.hupa.client.activity.LoginActivity;
+import org.apache.hupa.client.mvp.ActivityPlace;
+
+import com.google.gwt.place.shared.PlaceTokenizer;
+import com.google.gwt.place.shared.Prefix;
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+public class LoginPlace extends ActivityPlace<LoginActivity> {
+
+	@Inject
+	public LoginPlace(LoginActivity activity) {
+		super(activity);
+	}
+
+	@Prefix("Login")
+	public static class Tokenizer implements PlaceTokenizer<LoginPlace> {
+
+		private final Provider<LoginPlace> placeProvider;
+
+		@Inject
+		public Tokenizer(Provider<LoginPlace> placeProvider) {
+			this.placeProvider = placeProvider;
+		}
+
+		@Override
+		public LoginPlace getPlace(String token) {
+			LoginPlace place = placeProvider.get();
+			place.setPlaceName(token);
+			return place;
+		}
+
+		@Override
+		public String getToken(LoginPlace place) {
+			return place.getPlaceName();
+		}
+
+	}
+
+}

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LoginView.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LoginView.java?rev=1522139&r1=1522138&r2=1522139&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LoginView.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/ui/LoginView.java Thu Sep 12 02:46:28 2013
@@ -1,4 +1,5 @@
 <<<<<<< HEAD
+<<<<<<< HEAD
 /****************************************************************
  * Licensed to the Apache Software Foundation (ASF) under one   *
  * or more contributor license agreements.  See the NOTICE file *
@@ -37,11 +38,16 @@ import org.apache.hupa.widgets.ui.Loadin
 import org.apache.hupa.widgets.ui.RndPanel;
 
 >>>>>>> Change to new mvp framework - first step
+=======
+package org.apache.hupa.client.ui;
+
+>>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
 import com.google.gwt.event.dom.client.HasClickHandlers;
 import com.google.gwt.event.dom.client.KeyCodes;
 import com.google.gwt.event.dom.client.KeyUpEvent;
 import com.google.gwt.event.dom.client.KeyUpHandler;
 <<<<<<< HEAD
+<<<<<<< HEAD
 import com.google.gwt.resources.client.ClientBundle;
 import com.google.gwt.resources.client.CssResource;
 import com.google.gwt.resources.client.CssResource.NotStrict;
@@ -49,6 +55,8 @@ import com.google.gwt.uibinder.client.Ui
 import com.google.gwt.uibinder.client.UiField;
 =======
 >>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
+=======
+>>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
 import com.google.gwt.user.client.DOM;
 import com.google.gwt.user.client.ui.Button;
 import com.google.gwt.user.client.ui.Composite;
@@ -58,6 +66,7 @@ import com.google.gwt.user.client.ui.Foc
 import com.google.gwt.user.client.ui.FormPanel;
 <<<<<<< HEAD
 <<<<<<< HEAD
+<<<<<<< HEAD
 import com.google.gwt.user.client.ui.FormPanel.SubmitEvent;
 import com.google.gwt.user.client.ui.HTMLPanel;
 import com.google.gwt.user.client.ui.HasValue;
@@ -157,6 +166,8 @@ public class LoginView extends Composite
 =======
 import com.google.gwt.user.client.ui.FormPanel.SubmitEvent;
 >>>>>>> Change to new mvp framework - first step
+=======
+>>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
 import com.google.gwt.user.client.ui.HasValue;
 import com.google.gwt.user.client.ui.Panel;
 import com.google.gwt.user.client.ui.PasswordTextBox;
@@ -164,9 +175,22 @@ import com.google.gwt.user.client.ui.Sub
 import com.google.gwt.user.client.ui.TextBox;
 import com.google.gwt.user.client.ui.VerticalPanel;
 import com.google.gwt.user.client.ui.Widget;
+<<<<<<< HEAD
 import com.google.inject.Inject;
 
 public class LoginView extends Composite implements KeyUpHandler, LoginActivity.Displayable {
+=======
+import com.google.gwt.user.client.ui.FormPanel.SubmitEvent;
+import com.google.inject.Inject;
+
+import org.apache.hupa.client.HupaCSS;
+import org.apache.hupa.client.HupaConstants;
+import org.apache.hupa.client.activity.LoginActivity;
+import org.apache.hupa.widgets.ui.Loading;
+import org.apache.hupa.widgets.ui.RndPanel;
+
+public class LoginView extends Composite implements KeyUpHandler, LoginActivity.Display {
+>>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
 	private Button loginButton = new Button();
 	private SubmitButton submitButton;
 	private Button resetButton;
@@ -214,6 +238,9 @@ public class LoginView extends Composite
 		mainContainer.add(rPanel);
 		mainContainer.add(loading);
 		initWidget(mainContainer);
+<<<<<<< HEAD
+>>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
+=======
 >>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
 
 		usernameTextBox.addKeyUpHandler(this);
@@ -221,6 +248,7 @@ public class LoginView extends Composite
 		passwordTextBox.addKeyUpHandler(this);
 
 <<<<<<< HEAD
+<<<<<<< HEAD
 		/*
 		 * The user submits the form so as the browser detect it and displays
 		 * the save password dialog. Then we click on the hidden loginButton
@@ -231,6 +259,8 @@ public class LoginView extends Composite
 				if (!usernameTextBox.getValue().trim().isEmpty()
 						&& !passwordTextBox.getValue().trim().isEmpty()) {
 =======
+=======
+>>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
 		loading.hide();
 
 		// The user submits the form so as the browser detect it and displays
@@ -240,6 +270,9 @@ public class LoginView extends Composite
 		formPanel.addSubmitHandler(new FormPanel.SubmitHandler() {
 			public void onSubmit(SubmitEvent event) {
 				if (!usernameTextBox.getValue().trim().isEmpty() && !passwordTextBox.getValue().trim().isEmpty()) {
+<<<<<<< HEAD
+>>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
+=======
 >>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
 					loginButton.click();
 				}
@@ -247,6 +280,7 @@ public class LoginView extends Composite
 			}
 		});
 <<<<<<< HEAD
+<<<<<<< HEAD
 		innerBox.add(loginButton);
 		loginButton.setVisible(false);
 		setLoading(false);
@@ -276,6 +310,11 @@ public class LoginView extends Composite
 		mainContainer.add(loginButton);
 		loginButton.setVisible(false);
 >>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
+=======
+		// loginButton must be in the document to handle the click() method
+		mainContainer.add(loginButton);
+		loginButton.setVisible(false);
+>>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
 	}
 
 	@Override
@@ -298,12 +337,18 @@ public class LoginView extends Composite
 
 	@Override
 <<<<<<< HEAD
+<<<<<<< HEAD
+=======
 =======
+>>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
 	public HasClickHandlers getResetClick() {
 		return resetButton;
 	}
 
 	@Override
+<<<<<<< HEAD
+>>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
+=======
 >>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
 	public HasValue<String> getUserNameValue() {
 		return usernameTextBox;
@@ -320,6 +365,7 @@ public class LoginView extends Composite
 	}
 
 <<<<<<< HEAD
+<<<<<<< HEAD
 	// FIXME the ajax loader will not hidden after normal logout
 	@Override
 	public void setLoading(boolean load) {
@@ -332,6 +378,8 @@ public class LoginView extends Composite
 			message.addStyleName(style.hidden());
 		}
 =======
+=======
+>>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
 	@Override
 	public void setLoading(boolean load) {
 		if (load) {
@@ -340,6 +388,9 @@ public class LoginView extends Composite
 			loading.hide();
 		}
 
+<<<<<<< HEAD
+>>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
+=======
 >>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
 	}
 
@@ -349,6 +400,7 @@ public class LoginView extends Composite
 	}
 
 <<<<<<< HEAD
+<<<<<<< HEAD
 	interface LoginViewUiBinder extends UiBinder<FlowPanel, LoginView> {
 	}
 
@@ -357,4 +409,6 @@ public class LoginView extends Composite
 
 =======
 >>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
+=======
+>>>>>>> change the LOGIN progress using native MVP instead of gwt-presenter
 }



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