initial implementation supporting desktop and mobile

This commit is contained in:
Kai Boernert committed 2017-10-17 19:04:02 +02:00
1 parent 8a6e83e071
commit 89c95fce20
15 files changed
+55 -20

No files matched your search

@@ -0,0 +1,3 @@
eclipse.preferences.version=1
googleCloudSqlEnabled=false
localDevMySqlEnabled=true
@@ -88,7 +88,7 @@ public class DesktopActivityMapper implements ActivityMapper {
} else if (place instanceof ImprintPlace) {
return new ImprintActivityProxy((ImprintPlace) place);
} else if (place instanceof MoreLoginInformationPlace) {
return new MoreLoginInformationActivity(place);
return new MoreLoginInformationActivity(place, clientFactory);
} else {
return null;
}
@@ -29,7 +29,6 @@ public class MoreLoginInformation extends Composite {
Event.setEventListener(register, new EventListener() {
@Override
public void onBrowserEvent(Event event) {
GWT.debugger();
onRegisterClick.run();
}
});
@@ -1,14 +1,17 @@
package com.sap.sailing.gwt.home.desktop.places.morelogininformation;
import com.google.gwt.activity.shared.Activity;
import com.google.gwt.core.shared.GWT;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.place.shared.Place;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.sap.sailing.gwt.home.desktop.app.DesktopClientFactory;
import com.sap.sse.security.ui.authentication.AuthenticationRequestEvent;
public class MoreLoginInformationActivity implements Activity {
private DesktopClientFactory clientFactory;
public MoreLoginInformationActivity(Place place) {
public MoreLoginInformationActivity(Place place, DesktopClientFactory clientFactory) {
this.clientFactory = clientFactory;
}
@Override
@@ -31,8 +34,7 @@ public class MoreLoginInformationActivity implements Activity {
panel.setWidget(new MoreLoginInformation(new Runnable() {
@Override
public void run() {
GWT.debugger();
// eventBus.fireEvent(new RegistrationRequestEvent());
clientFactory.getEventBus().fireEvent(new AuthenticationRequestEvent(true));
}
}));
}
@@ -91,7 +91,7 @@ public class UserProfileActivity extends AbstractActivity implements UserProfile
@Override
public void doTriggerLoginForm() {
clientFactory.getEventBus().fireEvent(new AuthenticationRequestEvent());
clientFactory.getEventBus().fireEvent(new AuthenticationRequestEvent(false));
}
@Override
@@ -78,8 +78,6 @@ public class MobileActivityMapper implements ActivityMapper {
return new PasswordResetActivityProxy((PasswordResetPlace) place, clientFactory);
} else if (place instanceof AbstractUserProfilePlace) {
return new UserProfileActivityProxy((AbstractUserProfilePlace) place, clientFactory);
} else if (place instanceof AuthenticationPlace) {
return new AuthenticationActivityProxy((AuthenticationPlace) place, clientFactory);
} else if (place instanceof ConfirmationPlace) {
return new ConfirmationActivityProxy((ConfirmationPlace) place, clientFactory);
} else if (place instanceof PasswordResetPlace) {
@@ -22,8 +22,8 @@ public class MobilePlacesNavigator extends HomePlacesNavigator {
return createPlaceNavigation(baseUrl, isOnRemoteServer, place);
}
public PlaceNavigation<AuthenticationPlace> getSignInNavigation(boolean registration) {
return createLocalPlaceNavigation(new AuthenticationPlace(registration));
public PlaceNavigation<AuthenticationPlace> getSignInNavigation(boolean registerView) {
return createLocalPlaceNavigation(new AuthenticationPlace(registerView));
}
}
@@ -68,7 +68,7 @@ public class Header extends Composite {
signInNavigationItem = addNavigation(com.sap.sse.security.ui.client.i18n.StringMessages.INSTANCE.signIn(), new Runnable() {
@Override
public void run() {
placeNavigator.getSignInNavigation().goToPlace();
placeNavigator.getSignInNavigation(false).goToPlace();
}
});
userDetailsNavigationItem = addNavigation(placeNavigator.getUserProfileNavigation(), com.sap.sse.security.ui.client.i18n.StringMessages.INSTANCE.userDetails());
@@ -11,13 +11,16 @@ import com.sap.sailing.gwt.home.shared.usermanagement.view.AuthenticationViewMob
import com.sap.sse.security.ui.authentication.AuthenticationClientFactoryImpl;
import com.sap.sse.security.ui.authentication.AuthenticationPlaceManagementController;
import com.sap.sse.security.ui.authentication.WrappedPlaceManagementController;
import com.sap.sse.security.ui.authentication.create.CreateAccountPlace;
import com.sap.sse.security.ui.authentication.view.AuthenticationView;
public class AuthenticationActivity extends AbstractActivity {
private final MobileApplicationClientFactory clientFactory;
private final AuthenticationView userManagementView = new AuthenticationViewMobile();
private boolean register;
public AuthenticationActivity(AuthenticationPlace place, MobileApplicationClientFactory clientFactory) {
register = place.isRegisterView();
this.clientFactory = clientFactory;
}
@@ -30,6 +33,9 @@ public class AuthenticationActivity extends AbstractActivity {
new SignInSuccessfulNavigationMobile()),
userManagementView, eventBus);
userManagementController.start();
if(register){
userManagementController.goTo(new CreateAccountPlace());
}
}
private class SignInSuccessfulNavigationMobile implements Runnable {
@@ -9,16 +9,21 @@ import com.sap.sailing.gwt.home.shared.places.PlaceTokenPrefixes;
import com.sap.sse.security.ui.client.i18n.StringMessages;
public class AuthenticationPlace extends Place implements HasMobileVersion, HasLocationTitle {
private boolean register;
public AuthenticationPlace(boolean register) {
this.register = register;
private boolean registerView;
public AuthenticationPlace(boolean registerView) {
this.registerView = registerView;
}
@Override
public String getLocationTitle() {
return StringMessages.INSTANCE.user();
}
public boolean isRegisterView() {
return registerView;
}
@Prefix(PlaceTokenPrefixes.UserAuthentication)
public static class Tokenizer implements PlaceTokenizer<AuthenticationPlace> {
@@ -157,7 +157,7 @@ public class AuthenticationManagerImpl implements AuthenticationManager {
@Override
public void logout() {
userService.logout();
eventBus.fireEvent(new AuthenticationRequestEvent());
eventBus.fireEvent(new AuthenticationRequestEvent(false));
}
@Override
@@ -9,10 +9,19 @@ import com.google.gwt.event.shared.GwtEvent;
public class AuthenticationRequestEvent extends GwtEvent<AuthenticationRequestEvent.Handler> {
public static final Type<Handler> TYPE = new Type<AuthenticationRequestEvent.Handler>();
private final boolean register;
public AuthenticationRequestEvent(boolean register) {
this.register = register;
}
public interface Handler extends EventHandler {
void onUserManagementRequestEvent(AuthenticationRequestEvent event);
}
public boolean isRegister() {
return register;
}
@Override
public Type<Handler> getAssociatedType() {
@@ -19,6 +19,6 @@ public class FlyoutNotLoggedInPresenter implements NotLoggedInPresenter {
@Override
public void doTriggerLoginForm() {
eventBus.fireEvent(new AuthenticationRequestEvent());
eventBus.fireEvent(new AuthenticationRequestEvent(false));
}
}
@@ -45,7 +45,7 @@ public class LoggedInUserInfoActivity extends AbstractActivity implements Logged
@Override
public void gotoProfileUi() {
eventBus.fireEvent(new AuthenticationRequestEvent());
eventBus.fireEvent(new AuthenticationRequestEvent(false));
callback.handleUserProfileNavigation();
}
@@ -5,6 +5,7 @@ import com.sap.sse.security.ui.authentication.AuthenticationContextEvent;
import com.sap.sse.security.ui.authentication.AuthenticationRequestEvent;
import com.sap.sse.security.ui.authentication.WrappedPlaceManagementController;
import com.sap.sse.security.ui.authentication.app.AuthenticationContext;
import com.sap.sse.security.ui.authentication.create.CreateAccountPlace;
/**
* Default implementation of {@link AuthenticationMenuView.Presenter} and {@link FlyoutAuthenticationView.Presenter} to
@@ -47,7 +48,11 @@ public class FlyoutAuthenticationPresenter implements AuthenticationMenuView.Pre
eventBus.addHandler(AuthenticationRequestEvent.TYPE, new AuthenticationRequestEvent.Handler() {
@Override
public void onUserManagementRequestEvent(AuthenticationRequestEvent event) {
toggleFlyout();
if(event.isRegister()){
showRegister();
}else{
toggleFlyout();
}
}
});
@@ -60,6 +65,14 @@ public class FlyoutAuthenticationPresenter implements AuthenticationMenuView.Pre
authenticationMenuView.setAuthenticated(initialAuthentication.isLoggedIn());
}
public void showRegister() {
if (!flyoutAuthenticationView.isShowing()) {
flyoutAuthenticationView.show();
authenticationPlaceManagementController.start();
authenticationPlaceManagementController.goTo(new CreateAccountPlace());
}
}
@Override
public void toggleFlyout() {
if (flyoutAuthenticationView.isShowing()) {