User management was added for the different content views

This commit is contained in:
Stsiapan_Tsybulski committed 2016-08-29 12:44:08 +03:00
1 parent df5393c8f4
commit f4480e13d5
6 files changed
+24 -38

No files matched your search

@@ -2,17 +2,12 @@ package com.sap.sailing.gwt.autoplay.client;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Style.Position;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.ui.RootPanel;
import com.sap.sailing.gwt.autoplay.client.app.AutoPlayAppActivityMapper; import com.sap.sailing.gwt.autoplay.client.app.AutoPlayAppActivityMapper;
import com.sap.sailing.gwt.autoplay.client.app.AutoPlayAppClientFactory; import com.sap.sailing.gwt.autoplay.client.app.AutoPlayAppClientFactory;
import com.sap.sailing.gwt.autoplay.client.app.AutoPlayAppHistoryMapper; import com.sap.sailing.gwt.autoplay.client.app.AutoPlayAppHistoryMapper;
import com.sap.sailing.gwt.common.authentication.FixedSailingAuthentication;
import com.sap.sailing.gwt.common.client.SharedResources; import com.sap.sailing.gwt.common.client.SharedResources;
import com.sap.sailing.gwt.ui.client.StringMessages; import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sse.gwt.client.mvp.AbstractMvpEntryPoint; import com.sap.sse.gwt.client.mvp.AbstractMvpEntryPoint;
import com.sap.sse.security.ui.authentication.generic.sapheader.SAPHeaderWithAuthentication;
public class AutoPlayEntryPoint extends AbstractMvpEntryPoint<StringMessages, AutoPlayAppClientFactory> { public class AutoPlayEntryPoint extends AbstractMvpEntryPoint<StringMessages, AutoPlayAppClientFactory> {
@Override @Override
@@ -22,11 +17,6 @@ public class AutoPlayEntryPoint extends AbstractMvpEntryPoint<StringMessages, Au
AutoPlayAppHistoryMapper applicationHistoryMapper = GWT.create(AutoPlayAppHistoryMapper.class); AutoPlayAppHistoryMapper applicationHistoryMapper = GWT.create(AutoPlayAppHistoryMapper.class);
initMvp(clientFactory, applicationHistoryMapper, new AutoPlayAppActivityMapper(clientFactory)); initMvp(clientFactory, applicationHistoryMapper, new AutoPlayAppActivityMapper(clientFactory));
SAPHeaderWithAuthentication header = initHeader();
new FixedSailingAuthentication(clientFactory.getUserService(), header.getAuthenticationMenuView());
RootPanel.get().add(header);
SharedResources.INSTANCE.mediaCss().ensureInjected(); SharedResources.INSTANCE.mediaCss().ensureInjected();
SharedResources.INSTANCE.mainCss().ensureInjected(); SharedResources.INSTANCE.mainCss().ensureInjected();
Document.get().getBody().addClassName(SharedResources.INSTANCE.mainCss().desktop()); Document.get().getBody().addClassName(SharedResources.INSTANCE.mainCss().desktop());
@@ -36,13 +26,4 @@ public class AutoPlayEntryPoint extends AbstractMvpEntryPoint<StringMessages, Au
protected StringMessages createStringMessages() { protected StringMessages createStringMessages() {
return GWT.create(StringMessages.class); return GWT.create(StringMessages.class);
} }
private SAPHeaderWithAuthentication initHeader() {
SAPHeaderWithAuthentication header = new SAPHeaderWithAuthentication(getStringMessages().sapSailingAnalytics(),
getStringMessages().autoplayConfiguration());
header.getElement().getStyle().setPosition(Position.FIXED);
header.getElement().getStyle().setTop(0, Unit.PX);
header.getElement().getStyle().setWidth(100, Unit.PCT);
return header;
}
} }
@@ -29,7 +29,7 @@ public class DesktopApplicationClientFactory extends AbstractApplicationClientFa
@Override @Override
public StartView createStartView() { public StartView createStartView() {
return new DesktopStartView(getPlaceNavigator(), getEventBus()); return new DesktopStartView(getPlaceNavigator(), getEventBus(), getUserService());
} }
@Override @Override
@@ -100,7 +100,7 @@ public class AutoPlayController implements RaceTimesInfoProviderListener, Leader
playerView.clearContent(); playerView.clearContent();
boolean withFullscreenButton = autoPlayerConfiguration.isFullscreenMode() && isInitialScreen; boolean withFullscreenButton = autoPlayerConfiguration.isFullscreenMode() && isInitialScreen;
LeaderboardWithHeaderPerspective leaderboardPerspective = new LeaderboardWithHeaderPerspective(leaderboardPerspectiveLifecycleWithAllSettings, LeaderboardWithHeaderPerspective leaderboardPerspective = new LeaderboardWithHeaderPerspective(leaderboardPerspectiveLifecycleWithAllSettings,
sailingService, asyncActionsExecutor, sailingService, userService, asyncActionsExecutor,
new CompetitorSelectionModel(/* hasMultiSelection */ true), leaderboardTimer, new CompetitorSelectionModel(/* hasMultiSelection */ true), leaderboardTimer,
autoPlayerConfiguration.getLeaderboardName(), errorReporter, StringMessages.INSTANCE, autoPlayerConfiguration.getLeaderboardName(), errorReporter, StringMessages.INSTANCE,
userAgent, withFullscreenButton); userAgent, withFullscreenButton);
@@ -27,6 +27,7 @@ import com.sap.sailing.gwt.autoplay.client.app.PlaceNavigator;
import com.sap.sailing.gwt.autoplay.client.place.player.AutoPlayerConfiguration; import com.sap.sailing.gwt.autoplay.client.place.player.AutoPlayerConfiguration;
import com.sap.sailing.gwt.autoplay.client.shared.leaderboard.LeaderboardWithHeaderPerspectiveLifecycle; import com.sap.sailing.gwt.autoplay.client.shared.leaderboard.LeaderboardWithHeaderPerspectiveLifecycle;
import com.sap.sailing.gwt.autoplay.client.shared.leaderboard.LeaderboardWithHeaderPerspectiveSettings; import com.sap.sailing.gwt.autoplay.client.shared.leaderboard.LeaderboardWithHeaderPerspectiveSettings;
import com.sap.sailing.gwt.common.authentication.FixedSailingAuthentication;
import com.sap.sailing.gwt.common.client.SharedResources; import com.sap.sailing.gwt.common.client.SharedResources;
import com.sap.sailing.gwt.ui.client.StringMessages; import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.raceboard.RaceBoardPerspectiveLifecycle; import com.sap.sailing.gwt.ui.raceboard.RaceBoardPerspectiveLifecycle;
@@ -38,11 +39,12 @@ import com.sap.sse.common.settings.Settings;
import com.sap.sse.gwt.client.GWTLocaleUtil; import com.sap.sse.gwt.client.GWTLocaleUtil;
import com.sap.sse.gwt.client.dialog.DataEntryDialog.DialogCallback; import com.sap.sse.gwt.client.dialog.DataEntryDialog.DialogCallback;
import com.sap.sse.gwt.client.event.LocaleChangeEvent; import com.sap.sse.gwt.client.event.LocaleChangeEvent;
import com.sap.sse.gwt.client.sapheader.SAPHeader;
import com.sap.sse.gwt.client.shared.perspective.PerspectiveCompositeLifecycleTabbedSettingsDialog; import com.sap.sse.gwt.client.shared.perspective.PerspectiveCompositeLifecycleTabbedSettingsDialog;
import com.sap.sse.gwt.client.shared.perspective.PerspectiveCompositeSettings; import com.sap.sse.gwt.client.shared.perspective.PerspectiveCompositeSettings;
import com.sap.sse.gwt.client.shared.perspective.PerspectiveLifecycle; import com.sap.sse.gwt.client.shared.perspective.PerspectiveLifecycle;
import com.sap.sse.gwt.client.shared.perspective.PerspectiveLifecycleWithAllSettings; import com.sap.sse.gwt.client.shared.perspective.PerspectiveLifecycleWithAllSettings;
import com.sap.sse.security.ui.authentication.generic.sapheader.SAPHeaderWithAuthentication;
import com.sap.sse.security.ui.client.UserService;
public class DesktopStartView extends Composite implements StartView { public class DesktopStartView extends Composite implements StartView {
private static StartPageViewUiBinder uiBinder = GWT.create(StartPageViewUiBinder.class); private static StartPageViewUiBinder uiBinder = GWT.create(StartPageViewUiBinder.class);
@@ -50,7 +52,7 @@ public class DesktopStartView extends Composite implements StartView {
interface StartPageViewUiBinder extends UiBinder<Widget, DesktopStartView> { interface StartPageViewUiBinder extends UiBinder<Widget, DesktopStartView> {
} }
@UiField(provided=true) SAPHeader sapHeader; @UiField(provided=true) SAPHeaderWithAuthentication sapHeader;
@UiField(provided=true) ListBox localeSelectionBox; @UiField(provided=true) ListBox localeSelectionBox;
@UiField(provided=true) ListBox eventSelectionBox; @UiField(provided=true) ListBox eventSelectionBox;
@UiField(provided=true) ListBox leaderboardSelectionBox; @UiField(provided=true) ListBox leaderboardSelectionBox;
@@ -73,15 +75,16 @@ public class DesktopStartView extends Composite implements StartView {
private final int defaultTimeToRaceStartTimeInSeconds = 180; private final int defaultTimeToRaceStartTimeInSeconds = 180;
public DesktopStartView(PlaceNavigator navigator, EventBus eventBus) { public DesktopStartView(PlaceNavigator navigator, EventBus eventBus, UserService userService) {
super(); super();
this.navigator = navigator; this.navigator = navigator;
this.eventBus = eventBus; this.eventBus = eventBus;
this.events = new ArrayList<EventDTO>(); this.events = new ArrayList<EventDTO>();
sapHeader = new SAPHeaderWithAuthentication(StringMessages.INSTANCE.sapSailingAnalytics(),
StringMessages.INSTANCE.autoplayConfiguration());
new FixedSailingAuthentication(userService, sapHeader.getAuthenticationMenuView());
// sapHeader = new SAPHeaderWithAuthentication(StringMessages.INSTANCE.sapSailingAnalytics(), StringMessages.INSTANCE.autoplayConfiguration());
sapHeader = new SAPHeader(StringMessages.INSTANCE.sapSailingAnalytics());
sapHeader.setHeaderTitle(StringMessages.INSTANCE.autoplayConfiguration());
eventSelectionBox = new ListBox(); eventSelectionBox = new ListBox();
eventSelectionBox.setMultipleSelect(false); eventSelectionBox.setMultipleSelect(false);
leaderboardSelectionBox = new ListBox(); leaderboardSelectionBox = new ListBox();
@@ -3,24 +3,26 @@ package com.sap.sailing.gwt.autoplay.client.shared.header;
import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.RepeatingCommand; import com.google.gwt.core.client.Scheduler.RepeatingCommand;
import com.google.gwt.user.client.ui.Widget; import com.google.gwt.user.client.ui.Widget;
import com.sap.sailing.gwt.common.authentication.FixedSailingAuthentication;
import com.sap.sailing.gwt.common.client.FullscreenUtil; import com.sap.sailing.gwt.common.client.FullscreenUtil;
import com.sap.sailing.gwt.ui.client.StringMessages; import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sse.gwt.client.sapheader.SAPHeader;
import com.sap.sse.gwt.client.shared.components.AbstractCompositeComponent; import com.sap.sse.gwt.client.shared.components.AbstractCompositeComponent;
import com.sap.sse.security.ui.authentication.generic.sapheader.SAPHeaderWithAuthentication;
import com.sap.sse.security.ui.client.UserService;
public class SAPHeaderComponent extends AbstractCompositeComponent<SAPHeaderComponentSettings> { public class SAPHeaderComponent extends AbstractCompositeComponent<SAPHeaderComponentSettings> {
private SAPHeaderComponentSettings settings; private SAPHeaderComponentSettings settings;
private final SAPHeaderComponentLifecycle componentLifecycle; private final SAPHeaderComponentLifecycle componentLifecycle;
private final SAPHeader sapHeader; private final SAPHeaderWithAuthentication sapHeader;
public SAPHeaderComponent(SAPHeaderComponentLifecycle componentLifecycle, SAPHeaderComponentSettings settings, public SAPHeaderComponent(SAPHeaderComponentLifecycle componentLifecycle, UserService userService, SAPHeaderComponentSettings settings,
StringMessages stringMessages, boolean startInAutoScreenMode) { StringMessages stringMessages, boolean startInAutoScreenMode) {
this.componentLifecycle = componentLifecycle; this.componentLifecycle = componentLifecycle;
this.settings = settings; this.settings = settings;
this.sapHeader = new SAPHeader(stringMessages.sapSailingAnalytics()); this.sapHeader = new SAPHeaderWithAuthentication(stringMessages.sapSailingAnalytics(), settings.getTitle());
new FixedSailingAuthentication(userService, sapHeader.getAuthenticationMenuView());
sapHeader.setHeaderTitle(settings.getTitle());
initWidget(sapHeader); initWidget(sapHeader);
if (startInAutoScreenMode) { if (startInAutoScreenMode) {
@@ -30,6 +30,7 @@ import com.sap.sse.gwt.client.shared.components.SettingsDialogComponent;
import com.sap.sse.gwt.client.shared.perspective.AbstractPerspectiveComposite; import com.sap.sse.gwt.client.shared.perspective.AbstractPerspectiveComposite;
import com.sap.sse.gwt.client.shared.perspective.PerspectiveLifecycleWithAllSettings; import com.sap.sse.gwt.client.shared.perspective.PerspectiveLifecycleWithAllSettings;
import com.sap.sse.gwt.client.useragent.UserAgentDetails; import com.sap.sse.gwt.client.useragent.UserAgentDetails;
import com.sap.sse.security.ui.client.UserService;
/** /**
* A perspective managing a header with a single leaderboard filling the rest of the screen. * A perspective managing a header with a single leaderboard filling the rest of the screen.
@@ -47,7 +48,7 @@ public class LeaderboardWithHeaderPerspective extends AbstractPerspectiveComposi
private final PerspectiveLifecycleWithAllSettings<LeaderboardWithHeaderPerspectiveLifecycle, LeaderboardWithHeaderPerspectiveSettings> componentLifecyclesAndSettings; private final PerspectiveLifecycleWithAllSettings<LeaderboardWithHeaderPerspectiveLifecycle, LeaderboardWithHeaderPerspectiveSettings> componentLifecyclesAndSettings;
public LeaderboardWithHeaderPerspective(PerspectiveLifecycleWithAllSettings<LeaderboardWithHeaderPerspectiveLifecycle, LeaderboardWithHeaderPerspectiveSettings> perspectiveLifecycleWithAllSettings, public LeaderboardWithHeaderPerspective(PerspectiveLifecycleWithAllSettings<LeaderboardWithHeaderPerspectiveLifecycle, LeaderboardWithHeaderPerspectiveSettings> perspectiveLifecycleWithAllSettings,
SailingServiceAsync sailingService, AsyncActionsExecutor asyncActionsExecutor, SailingServiceAsync sailingService, UserService userService, AsyncActionsExecutor asyncActionsExecutor,
CompetitorSelectionProvider competitorSelectionProvider, Timer timer, CompetitorSelectionProvider competitorSelectionProvider, Timer timer,
String leaderboardName, final ErrorReporter errorReporter, final StringMessages stringMessages, String leaderboardName, final ErrorReporter errorReporter, final StringMessages stringMessages,
UserAgentDetails userAgent, boolean startInFullScreenMode) { UserAgentDetails userAgent, boolean startInFullScreenMode) {
@@ -62,9 +63,8 @@ public class LeaderboardWithHeaderPerspective extends AbstractPerspectiveComposi
} }
} }
}); });
SAPHeaderComponentLifecycle sapHeaderLifecycle = getPerspectiveLifecycle().getSapHeaderLifecycle(); SAPHeaderComponentLifecycle sapHeaderLifecycle = getPerspectiveLifecycle().getSapHeaderLifecycle();
SAPHeaderComponent sapHeader = createSAPHeader(sapHeaderLifecycle, SAPHeaderComponent sapHeader = createSAPHeader(sapHeaderLifecycle, userService,
perspectiveLifecycleWithAllSettings.findComponentSettingsByLifecycle(sapHeaderLifecycle), perspectiveLifecycleWithAllSettings.findComponentSettingsByLifecycle(sapHeaderLifecycle),
stringMessages, startInFullScreenMode); stringMessages, startInFullScreenMode);
leaderboardPanel = createLeaderboardPanel(sailingService, asyncActionsExecutor, leaderboardPanel = createLeaderboardPanel(sailingService, asyncActionsExecutor,
@@ -183,9 +183,9 @@ public class LeaderboardWithHeaderPerspective extends AbstractPerspectiveComposi
leaderboardPanel.removeLeaderboardUpdateListener(listener); leaderboardPanel.removeLeaderboardUpdateListener(listener);
} }
private SAPHeaderComponent createSAPHeader(SAPHeaderComponentLifecycle componentLifecycle, SAPHeaderComponentSettings settings, private SAPHeaderComponent createSAPHeader(SAPHeaderComponentLifecycle componentLifecycle, UserService userService, SAPHeaderComponentSettings settings,
final StringMessages stringMessages, boolean withFullscreenButton) { final StringMessages stringMessages, boolean withFullscreenButton) {
return new SAPHeaderComponent(componentLifecycle, settings, stringMessages, withFullscreenButton); return new SAPHeaderComponent(componentLifecycle, userService, settings, stringMessages, withFullscreenButton);
} }
private LeaderboardPanel createLeaderboardPanel(SailingServiceAsync sailingService, AsyncActionsExecutor asyncActionsExecutor, private LeaderboardPanel createLeaderboardPanel(SailingServiceAsync sailingService, AsyncActionsExecutor asyncActionsExecutor,