mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-22 12:03:58 +00:00
Merge branch 'master' into bug4346
Conflicts: java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/partials/media/SailingFullscreenViewer.java
This commit is contained in:
commit
cc9c9cbbfd
29 files changed
+262
-121
No files matched your search
+1
-1
@@ -159,7 +159,7 @@ public class AuthenticationManagerImpl implements AuthenticationManager {
|
||||
@Override
|
||||
public void logout() {
|
||||
userService.logout();
|
||||
eventBus.fireEvent(new AuthenticationRequestEvent());
|
||||
eventBus.fireEvent(new AuthenticationRequestEvent(AuthenticationPlaces.SIGN_IN));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+20
-7
@@ -24,6 +24,8 @@ import com.sap.sse.security.ui.authentication.view.AuthenticationView;
|
||||
*/
|
||||
public class AuthenticationPlaceManagementController extends WrappedPlaceManagementController {
|
||||
|
||||
private final AuthenticationClientFactory clientFactory;
|
||||
|
||||
/**
|
||||
* Creates a new {@link AuthenticationPlaceManagementController} instance with the given parameters.
|
||||
*
|
||||
@@ -35,14 +37,25 @@ public class AuthenticationPlaceManagementController extends WrappedPlaceManagem
|
||||
public AuthenticationPlaceManagementController(AuthenticationClientFactory clientFactory,
|
||||
AuthenticationCallback callback, AuthenticationView authenticationView, EventBus globalEventBus) {
|
||||
super(new Configuration(clientFactory, callback, authenticationView));
|
||||
globalEventBus.addHandler(AuthenticationContextEvent.TYPE, new AuthenticationContextEvent.Handler() {
|
||||
@Override
|
||||
public void onUserChangeEvent(AuthenticationContextEvent event) {
|
||||
AuthenticationPlaceManagementController.this.fireEvent(event);
|
||||
}
|
||||
});
|
||||
this.clientFactory = clientFactory;
|
||||
globalEventBus.addHandler(AuthenticationContextEvent.TYPE, this::fireEvent);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tells the wrapped framework to go to the {@link Place} represented by the given {@link AuthenticationPlaces}
|
||||
* instance is no user is logged in. Otherwise the wrapped framework will go to the {@link LoggedInUserInfoPlace
|
||||
* user info} page.
|
||||
*
|
||||
* @param authPlace
|
||||
* {@link AuthenticationPlaces} instance representing a {@link Place} instance to go to
|
||||
*
|
||||
* @see #goTo(Place)
|
||||
*/
|
||||
public void goTo(AuthenticationPlaces authPlace) {
|
||||
final boolean isLoggedIn = clientFactory.getAuthenticationManager().getAuthenticationContext().isLoggedIn();
|
||||
super.goTo(isLoggedIn ? new LoggedInUserInfoPlace() : authPlace.getPlace());
|
||||
}
|
||||
|
||||
private static class Configuration implements PlaceManagementConfiguration {
|
||||
private final AuthenticationClientFactory clientFactory;
|
||||
private final AuthenticationCallback callback;
|
||||
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package com.sap.sse.security.ui.authentication;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import com.sap.sse.security.ui.authentication.create.CreateAccountPlace;
|
||||
import com.sap.sse.security.ui.authentication.signin.SignInPlace;
|
||||
|
||||
/**
|
||||
* Enumeration to specify a requested {@link AbstractAuthenticationPlace authentication places}.
|
||||
*/
|
||||
public enum AuthenticationPlaces {
|
||||
|
||||
/** {@link AuthenticationPlaces} representation for {@link SignInPlace} */
|
||||
SIGN_IN(SignInPlace::new),
|
||||
/** {@link AuthenticationPlaces} representation for {@link CreateAccountPlace} */
|
||||
CREATE_ACCOUNT(CreateAccountPlace::new);
|
||||
|
||||
private final Supplier<? extends AbstractAuthenticationPlace> placeSupplier;
|
||||
|
||||
private AuthenticationPlaces(Supplier<? extends AbstractAuthenticationPlace> placeSupplier) {
|
||||
this.placeSupplier = placeSupplier;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return new instance of the {@link AbstractAuthenticationPlace} represented by this {@link AuthenticationPlaces}
|
||||
*/
|
||||
public AbstractAuthenticationPlace getPlace() {
|
||||
return this.placeSupplier.get();
|
||||
}
|
||||
|
||||
}
|
||||
+10
-1
@@ -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 AuthenticationPlaces requestedPlace;
|
||||
|
||||
public AuthenticationRequestEvent(AuthenticationPlaces requestedPlace) {
|
||||
this.requestedPlace = requestedPlace;
|
||||
}
|
||||
|
||||
public interface Handler extends EventHandler {
|
||||
void onUserManagementRequestEvent(AuthenticationRequestEvent event);
|
||||
}
|
||||
|
||||
|
||||
public AuthenticationPlaces getRequestedPlace() {
|
||||
return requestedPlace;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type<Handler> getAssociatedType() {
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
package com.sap.sse.security.ui.authentication.decorator;
|
||||
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.sap.sse.security.ui.authentication.AuthenticationPlaces;
|
||||
import com.sap.sse.security.ui.authentication.AuthenticationRequestEvent;
|
||||
|
||||
/**
|
||||
@@ -19,6 +20,6 @@ public class FlyoutNotLoggedInPresenter implements NotLoggedInPresenter {
|
||||
|
||||
@Override
|
||||
public void doTriggerLoginForm() {
|
||||
eventBus.fireEvent(new AuthenticationRequestEvent());
|
||||
eventBus.fireEvent(new AuthenticationRequestEvent(AuthenticationPlaces.SIGN_IN));
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -7,6 +7,7 @@ import com.google.gwt.user.client.ui.AcceptsOneWidget;
|
||||
import com.sap.sse.security.ui.authentication.AuthenticationCallback;
|
||||
import com.sap.sse.security.ui.authentication.AuthenticationClientFactory;
|
||||
import com.sap.sse.security.ui.authentication.AuthenticationContextEvent;
|
||||
import com.sap.sse.security.ui.authentication.AuthenticationPlaces;
|
||||
import com.sap.sse.security.ui.authentication.AuthenticationRequestEvent;
|
||||
import com.sap.sse.security.ui.authentication.signin.SignInPlace;
|
||||
|
||||
@@ -45,7 +46,7 @@ public class LoggedInUserInfoActivity extends AbstractActivity implements Logged
|
||||
|
||||
@Override
|
||||
public void gotoProfileUi() {
|
||||
eventBus.fireEvent(new AuthenticationRequestEvent());
|
||||
eventBus.fireEvent(new AuthenticationRequestEvent(AuthenticationPlaces.SIGN_IN));
|
||||
callback.handleUserProfileNavigation();
|
||||
}
|
||||
|
||||
|
||||
+14
-6
@@ -2,9 +2,11 @@ package com.sap.sse.security.ui.authentication.view;
|
||||
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.sap.sse.security.ui.authentication.AuthenticationContextEvent;
|
||||
import com.sap.sse.security.ui.authentication.AuthenticationPlaceManagementController;
|
||||
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
|
||||
@@ -33,7 +35,7 @@ public class FlyoutAuthenticationPresenter implements AuthenticationMenuView.Pre
|
||||
*/
|
||||
public FlyoutAuthenticationPresenter(final FlyoutAuthenticationView flyoutAuthenticationView,
|
||||
final AuthenticationMenuView authenticationMenuView,
|
||||
WrappedPlaceManagementController authenticationPlaceManagementController,
|
||||
AuthenticationPlaceManagementController authenticationPlaceManagementController,
|
||||
EventBus eventBus, AuthenticationContext initialAuthentication) {
|
||||
this.flyoutAuthenticationView = flyoutAuthenticationView;
|
||||
this.authenticationMenuView = authenticationMenuView;
|
||||
@@ -44,11 +46,9 @@ public class FlyoutAuthenticationPresenter implements AuthenticationMenuView.Pre
|
||||
authenticationMenuView.setPresenter(this);
|
||||
flyoutAuthenticationView.setAutoHidePartner(authenticationMenuView);
|
||||
|
||||
eventBus.addHandler(AuthenticationRequestEvent.TYPE, new AuthenticationRequestEvent.Handler() {
|
||||
@Override
|
||||
public void onUserManagementRequestEvent(AuthenticationRequestEvent event) {
|
||||
toggleFlyout();
|
||||
}
|
||||
eventBus.addHandler(AuthenticationRequestEvent.TYPE, event -> {
|
||||
flyoutAuthenticationView.show();
|
||||
authenticationPlaceManagementController.goTo(event.getRequestedPlace());
|
||||
});
|
||||
|
||||
eventBus.addHandler(AuthenticationContextEvent.TYPE, new AuthenticationContextEvent.Handler() {
|
||||
@@ -60,6 +60,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()) {
|
||||
|
||||
Reference in new issue
Block a user