mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-25 05:23:51 +00:00
unified autoplay settings to properly use the settings system
This commit is contained in:
1 parent
c15bbc0fef
commit
37c2058932
13 files changed
+233
-152
No files matched your search
+1
-11
@@ -1,19 +1,9 @@
|
||||
package com.sap.sailing.gwt.autoplay.client.app;
|
||||
|
||||
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.LeaderboardWithHeaderPerspectiveSettings;
|
||||
import com.sap.sailing.gwt.ui.raceboard.RaceBoardPerspectiveLifecycle;
|
||||
import com.sap.sailing.gwt.ui.raceboard.RaceBoardPerspectiveSettings;
|
||||
import com.sap.sse.gwt.client.shared.perspective.PerspectiveCompositeSettings;
|
||||
|
||||
public interface PlaceNavigator {
|
||||
void goToStart();
|
||||
|
||||
void goToPlayer(AutoPlayerConfiguration playerConfig,
|
||||
|
||||
LeaderboardWithHeaderPerspectiveLifecycle leaderboardLifecycle,
|
||||
PerspectiveCompositeSettings<LeaderboardWithHeaderPerspectiveSettings> leaderboardSettings,
|
||||
RaceBoardPerspectiveLifecycle raceboardLifecycle,
|
||||
PerspectiveCompositeSettings<RaceBoardPerspectiveSettings> raceboardSettings);
|
||||
void goToPlayer(AutoPlayerConfiguration playerConfig);
|
||||
}
|
||||
+2
-12
@@ -4,11 +4,6 @@ import com.google.gwt.place.shared.PlaceController;
|
||||
import com.sap.sailing.gwt.autoplay.client.place.player.AutoPlayerConfiguration;
|
||||
import com.sap.sailing.gwt.autoplay.client.place.player.PlayerPlace;
|
||||
import com.sap.sailing.gwt.autoplay.client.place.start.StartPlace;
|
||||
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.ui.raceboard.RaceBoardPerspectiveLifecycle;
|
||||
import com.sap.sailing.gwt.ui.raceboard.RaceBoardPerspectiveSettings;
|
||||
import com.sap.sse.gwt.client.shared.perspective.PerspectiveCompositeSettings;
|
||||
|
||||
public class PlaceNavigatorImpl implements PlaceNavigator {
|
||||
private final PlaceController placeController;
|
||||
@@ -24,13 +19,8 @@ public class PlaceNavigatorImpl implements PlaceNavigator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void goToPlayer(AutoPlayerConfiguration playerConfig,
|
||||
LeaderboardWithHeaderPerspectiveLifecycle leaderboardLifecycle,
|
||||
PerspectiveCompositeSettings<LeaderboardWithHeaderPerspectiveSettings> leaderboardSettings,
|
||||
RaceBoardPerspectiveLifecycle raceboardLifecycle,
|
||||
PerspectiveCompositeSettings<RaceBoardPerspectiveSettings> raceboardSettings) {
|
||||
PlayerPlace playerPlace = new PlayerPlace(playerConfig, leaderboardLifecycle, leaderboardSettings,
|
||||
raceboardLifecycle, raceboardSettings);
|
||||
public void goToPlayer(AutoPlayerConfiguration playerConfig) {
|
||||
PlayerPlace playerPlace = new PlayerPlace(playerConfig);
|
||||
placeController.goTo(playerPlace);
|
||||
}
|
||||
|
||||
|
||||
+1
-10
@@ -1,12 +1,7 @@
|
||||
package com.sap.sailing.gwt.autoplay.client.place.player;
|
||||
|
||||
import com.google.gwt.place.shared.PlaceTokenizer;
|
||||
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.common.client.AbstractBasePlace;
|
||||
import com.sap.sailing.gwt.ui.raceboard.RaceBoardPerspectiveLifecycle;
|
||||
import com.sap.sailing.gwt.ui.raceboard.RaceBoardPerspectiveSettings;
|
||||
import com.sap.sse.gwt.client.shared.perspective.PerspectiveCompositeSettings;
|
||||
|
||||
public class PlayerPlace extends AbstractBasePlace {
|
||||
private final AutoPlayerConfiguration playerConfiguration;
|
||||
@@ -24,11 +19,7 @@ public class PlayerPlace extends AbstractBasePlace {
|
||||
//these are currently regenerated in the PlayerActivity, based on the historydata. Once the settings are properly stored, this should be replaced.
|
||||
}
|
||||
|
||||
public PlayerPlace(AutoPlayerConfiguration playerConfiguration,
|
||||
LeaderboardWithHeaderPerspectiveLifecycle leaderboardLifecycle,
|
||||
PerspectiveCompositeSettings<LeaderboardWithHeaderPerspectiveSettings> leaderboardSettings,
|
||||
RaceBoardPerspectiveLifecycle raceboardLifecycle,
|
||||
PerspectiveCompositeSettings<RaceBoardPerspectiveSettings> raceboardSettings) {
|
||||
public PlayerPlace(AutoPlayerConfiguration playerConfiguration) {
|
||||
super(AutoPlayerConfiguration.PARAM_EVENTID, playerConfiguration.getEventUidAsString(),
|
||||
AutoPlayerConfiguration.PARAM_FULLSCREEN, String.valueOf(playerConfiguration.isFullscreenMode()),
|
||||
AutoPlayerConfiguration.PARAM_LEADEROARD_NAME, playerConfiguration.getLeaderboardName(),
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.sap.sailing.gwt.autoplay.client.place.start;
|
||||
|
||||
import com.sap.sse.common.settings.generic.AbstractGenericSerializableSettings;
|
||||
|
||||
public class AutoplayContextSettings extends AbstractGenericSerializableSettings {
|
||||
private static final long serialVersionUID = 6699950643747065960L;
|
||||
|
||||
@Override
|
||||
protected void addChildSettings() {
|
||||
}
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
package com.sap.sailing.gwt.autoplay.client.place.start;
|
||||
|
||||
import com.sap.sailing.domain.common.dto.AbstractLeaderboardDTO;
|
||||
import com.sap.sailing.gwt.autoplay.client.shared.leaderboard.LeaderboardWithHeaderPerspectiveLifecycle;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.raceboard.RaceBoardPerspectiveLifecycle;
|
||||
import com.sap.sse.gwt.client.shared.components.SettingsDialogComponent;
|
||||
import com.sap.sse.gwt.client.shared.perspective.AbstractPerspectiveLifecycle;
|
||||
|
||||
public class AutoplayPerspectiveLifecycle extends AbstractPerspectiveLifecycle<AutoplayPerspectiveOwnSettings> {
|
||||
public static final String ID = "appl";
|
||||
private LeaderboardWithHeaderPerspectiveLifecycle leaderboardLifecycle;
|
||||
private RaceBoardPerspectiveLifecycle raceboardLifecycle;
|
||||
|
||||
public AutoplayPerspectiveLifecycle(AbstractLeaderboardDTO leaderboard) {
|
||||
leaderboardLifecycle = new LeaderboardWithHeaderPerspectiveLifecycle(leaderboard, StringMessages.INSTANCE);
|
||||
raceboardLifecycle = new RaceBoardPerspectiveLifecycle(leaderboard, StringMessages.INSTANCE);
|
||||
addLifeCycle(leaderboardLifecycle);
|
||||
addLifeCycle(raceboardLifecycle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AutoplayPerspectiveOwnSettings createPerspectiveOwnDefaultSettings() {
|
||||
return new AutoplayPerspectiveOwnSettings();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SettingsDialogComponent<AutoplayPerspectiveOwnSettings> getPerspectiveOwnSettingsDialogComponent(
|
||||
AutoplayPerspectiveOwnSettings settings) {
|
||||
return new AutoplaySettingsDialogComponent(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalizedShortName() {
|
||||
return StringMessages.INSTANCE.autoplayConfiguration();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComponentId() {
|
||||
return ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSettings() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AutoplayPerspectiveOwnSettings extractOwnGlobalSettings(AutoplayPerspectiveOwnSettings settings) {
|
||||
return settings;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AutoplayPerspectiveOwnSettings extractOwnContextSettings(AutoplayPerspectiveOwnSettings settings) {
|
||||
return createPerspectiveOwnDefaultSettings();
|
||||
}
|
||||
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package com.sap.sailing.gwt.autoplay.client.place.start;
|
||||
|
||||
import com.sap.sse.common.settings.generic.AbstractGenericSerializableSettings;
|
||||
import com.sap.sse.common.settings.generic.BooleanSetting;
|
||||
import com.sap.sse.common.settings.generic.IntegerSetting;
|
||||
|
||||
public class AutoplayPerspectiveOwnSettings extends AbstractGenericSerializableSettings {
|
||||
private static final long serialVersionUID = -9013901094746556797L;
|
||||
|
||||
BooleanSetting fullscreen;
|
||||
BooleanSetting switchToLive;
|
||||
IntegerSetting timeToSwitchBeforeRaceStart;
|
||||
|
||||
public AutoplayPerspectiveOwnSettings() {
|
||||
}
|
||||
|
||||
public AutoplayPerspectiveOwnSettings(boolean fullscreen, boolean switchToLive, int timeToSwitchBeforeRaceStart) {
|
||||
super();
|
||||
this.fullscreen.setValue(fullscreen);
|
||||
this.switchToLive.setValue(switchToLive);
|
||||
this.timeToSwitchBeforeRaceStart.setValue(timeToSwitchBeforeRaceStart);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addChildSettings() {
|
||||
fullscreen = new BooleanSetting("fullscreen", this, true);
|
||||
switchToLive = new BooleanSetting("switchToLive", this, true);
|
||||
timeToSwitchBeforeRaceStart = new IntegerSetting("timeToSwitchBeforeRaceStart", this, 180);
|
||||
|
||||
}
|
||||
|
||||
public boolean isFullscreen() {
|
||||
return fullscreen.getValue();
|
||||
}
|
||||
|
||||
public boolean isSwitchToLive() {
|
||||
return switchToLive.getValue();
|
||||
}
|
||||
|
||||
public int getTimeToSwitchBeforeRaceStart() {
|
||||
return timeToSwitchBeforeRaceStart.getValue();
|
||||
}
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
package com.sap.sailing.gwt.autoplay.client.place.start;
|
||||
|
||||
import com.google.gwt.user.client.ui.CheckBox;
|
||||
import com.google.gwt.user.client.ui.FocusWidget;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sse.gwt.client.controls.IntegerBox;
|
||||
import com.sap.sse.gwt.client.dialog.DataEntryDialog;
|
||||
import com.sap.sse.gwt.client.dialog.DataEntryDialog.Validator;
|
||||
import com.sap.sse.gwt.client.shared.components.SettingsDialogComponent;
|
||||
|
||||
public class AutoplaySettingsDialogComponent implements SettingsDialogComponent<AutoplayPerspectiveOwnSettings> {
|
||||
private AutoplayPerspectiveOwnSettings initialSettings;
|
||||
private CheckBox fullScreen;
|
||||
private CheckBox switchToLiveRaceAutomatically;
|
||||
private IntegerBox timeBeforeRaceStartInput;
|
||||
|
||||
AutoplaySettingsDialogComponent(AutoplayPerspectiveOwnSettings settings) {
|
||||
this.initialSettings = settings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget getAdditionalWidget(DataEntryDialog<?> dialog) {
|
||||
VerticalPanel vp = new VerticalPanel();
|
||||
|
||||
StringMessages stringMessages = StringMessages.INSTANCE;
|
||||
|
||||
fullScreen = dialog.createCheckbox(stringMessages.startBrowserFullscreen());
|
||||
fullScreen.setValue(initialSettings.isFullscreen());
|
||||
vp.add(fullScreen);
|
||||
|
||||
switchToLiveRaceAutomatically = dialog.createCheckbox(stringMessages.switchToLiveRaceAutomatically());
|
||||
switchToLiveRaceAutomatically.setValue(initialSettings.isSwitchToLive());
|
||||
vp.add(switchToLiveRaceAutomatically);
|
||||
|
||||
Label timeBeforeRaceStartDescription = new Label(stringMessages.timeBeforeRaceStart());
|
||||
vp.add(timeBeforeRaceStartDescription);
|
||||
|
||||
timeBeforeRaceStartInput = dialog.createIntegerBox(initialSettings.getTimeToSwitchBeforeRaceStart(), 5);
|
||||
vp.add(timeBeforeRaceStartInput);
|
||||
|
||||
return vp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AutoplayPerspectiveOwnSettings getResult() {
|
||||
return new AutoplayPerspectiveOwnSettings(fullScreen.getValue(), switchToLiveRaceAutomatically.getValue(),
|
||||
timeBeforeRaceStartInput.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Validator<AutoplayPerspectiveOwnSettings> getValidator() {
|
||||
return new Validator<AutoplayPerspectiveOwnSettings>() {
|
||||
@Override
|
||||
public String getErrorMessage(AutoplayPerspectiveOwnSettings valueToValidate) {
|
||||
if (valueToValidate.timeToSwitchBeforeRaceStart.getValue() < 0) {
|
||||
// TODO i18n
|
||||
return "negative delay";
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FocusWidget getFocusWidget() {
|
||||
return fullScreen;
|
||||
}
|
||||
|
||||
}
|
||||
+40
-79
@@ -15,24 +15,19 @@ import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.uibinder.client.UiHandler;
|
||||
import com.google.gwt.user.client.ui.Button;
|
||||
import com.google.gwt.user.client.ui.CheckBox;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.IntegerBox;
|
||||
import com.google.gwt.user.client.ui.ListBox;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.sap.sailing.domain.common.dto.AbstractLeaderboardDTO;
|
||||
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.shared.leaderboard.LeaderboardWithHeaderPerspectiveLifecycle;
|
||||
import com.sap.sailing.gwt.autoplay.client.shared.leaderboard.LeaderboardWithHeaderPerspectiveSettings;
|
||||
import com.sap.sailing.gwt.common.authentication.FixedSailingAuthentication;
|
||||
import com.sap.sailing.gwt.common.authentication.SAPSailingHeaderWithAuthentication;
|
||||
import com.sap.sailing.gwt.common.client.SharedResources;
|
||||
import com.sap.sailing.gwt.ui.client.EntryPointLinkFactory;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.raceboard.RaceBoardPerspectiveLifecycle;
|
||||
import com.sap.sailing.gwt.ui.raceboard.RaceBoardPerspectiveSettings;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardGroupDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.StrippedLeaderboardDTO;
|
||||
@@ -41,9 +36,9 @@ import com.sap.sse.common.settings.Settings;
|
||||
import com.sap.sse.gwt.client.GWTLocaleUtil;
|
||||
import com.sap.sse.gwt.client.dialog.DataEntryDialog.DialogCallback;
|
||||
import com.sap.sse.gwt.client.event.LocaleChangeEvent;
|
||||
import com.sap.sse.gwt.client.shared.perspective.PerspectiveCompositeLifecycleTabbedSettingsDialog;
|
||||
import com.sap.sse.gwt.client.shared.components.LinkWithSettingsGenerator;
|
||||
import com.sap.sse.gwt.client.shared.components.SettingsDialogForLinkSharing;
|
||||
import com.sap.sse.gwt.client.shared.perspective.PerspectiveCompositeSettings;
|
||||
import com.sap.sse.gwt.client.shared.perspective.PerspectiveLifecycle;
|
||||
import com.sap.sse.security.ui.client.UserService;
|
||||
|
||||
public class DesktopStartView extends Composite implements StartView {
|
||||
@@ -61,8 +56,6 @@ public class DesktopStartView extends Composite implements StartView {
|
||||
@UiField(provided = true)
|
||||
ListBox leaderboardSelectionBox;
|
||||
@UiField
|
||||
CheckBox startInFullscreenModeBox;
|
||||
@UiField
|
||||
Button startAutoPlayButton;
|
||||
@UiField
|
||||
DivElement leaderboardSelectionUi;
|
||||
@@ -70,24 +63,13 @@ public class DesktopStartView extends Composite implements StartView {
|
||||
DivElement screenConfigurationUi;
|
||||
@UiField
|
||||
FlowPanel leaderboardPerspectiveSettingsPanel;
|
||||
@UiField
|
||||
FlowPanel raceboardPerspectiveSettingsPanel;
|
||||
|
||||
@UiField
|
||||
CheckBox autoSwitchToRaceboard;
|
||||
@UiField
|
||||
IntegerBox timeToRaceStartInSeconds;
|
||||
|
||||
private final PlaceNavigator navigator;
|
||||
private final EventBus eventBus;
|
||||
private final List<EventDTO> events;
|
||||
|
||||
private LeaderboardWithHeaderPerspectiveLifecycle leaderboardLifecycle;
|
||||
private PerspectiveCompositeSettings<LeaderboardWithHeaderPerspectiveSettings> leaderboardSettings;
|
||||
private RaceBoardPerspectiveLifecycle raceboardLifecycle;
|
||||
private PerspectiveCompositeSettings<RaceBoardPerspectiveSettings> raceboardSettings;
|
||||
|
||||
private final int defaultTimeToRaceStartTimeInSeconds = 180;
|
||||
private AutoplayPerspectiveLifecycle autoplayLifecycle;
|
||||
protected PerspectiveCompositeSettings<AutoplayPerspectiveOwnSettings> autoplayPerspectiveSettings;
|
||||
|
||||
public DesktopStartView(PlaceNavigator navigator, EventBus eventBus, UserService userService) {
|
||||
super();
|
||||
@@ -119,10 +101,6 @@ public class DesktopStartView extends Composite implements StartView {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
this.ensureDebugId("AutoPlayStartView");
|
||||
|
||||
startInFullscreenModeBox.setValue(true);
|
||||
autoSwitchToRaceboard.setValue(true);
|
||||
timeToRaceStartInSeconds.setValue(defaultTimeToRaceStartTimeInSeconds);
|
||||
|
||||
leaderboardSelectionUi.getStyle().setVisibility(Visibility.HIDDEN);
|
||||
screenConfigurationUi.getStyle().setVisibility(Visibility.HIDDEN);
|
||||
|
||||
@@ -131,27 +109,8 @@ public class DesktopStartView extends Composite implements StartView {
|
||||
}
|
||||
|
||||
private void updatePerspectives(AbstractLeaderboardDTO leaderboard) {
|
||||
leaderboardLifecycle = new LeaderboardWithHeaderPerspectiveLifecycle(leaderboard, StringMessages.INSTANCE);
|
||||
leaderboardSettings = leaderboardLifecycle.createDefaultSettings();
|
||||
raceboardLifecycle = new RaceBoardPerspectiveLifecycle(leaderboard, StringMessages.INSTANCE);
|
||||
raceboardSettings = raceboardLifecycle.createDefaultSettings();
|
||||
}
|
||||
|
||||
private <PL extends PerspectiveLifecycle<PS>, PS extends Settings> void openPerspectiveSettingsDialog(
|
||||
final PL lifecycle, PerspectiveCompositeSettings<PS> settings, OnSettingsCallback<PS> callback) {
|
||||
PerspectiveCompositeLifecycleTabbedSettingsDialog<PL, PS> dialog = new PerspectiveCompositeLifecycleTabbedSettingsDialog<>(
|
||||
null, null, StringMessages.INSTANCE, lifecycle, settings, lifecycle.getLocalizedShortName(),
|
||||
new DialogCallback<PerspectiveCompositeSettings<PS>>() {
|
||||
@Override
|
||||
public void ok(PerspectiveCompositeSettings<PS> newSettings) {
|
||||
callback.newSettings(newSettings);
|
||||
};
|
||||
|
||||
@Override
|
||||
public void cancel() {
|
||||
}
|
||||
});
|
||||
dialog.show();
|
||||
autoplayLifecycle = new AutoplayPerspectiveLifecycle(leaderboard);
|
||||
autoplayPerspectiveSettings = autoplayLifecycle.createDefaultSettings();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -189,23 +148,17 @@ public class DesktopStartView extends Composite implements StartView {
|
||||
StrippedLeaderboardDTO selectedLeaderboard = getSelectedLeaderboard();
|
||||
this.updatePerspectives(selectedLeaderboard);
|
||||
|
||||
createPerspectiveSettingsUI(leaderboardLifecycle, leaderboardSettings, leaderboardPerspectiveSettingsPanel,
|
||||
true, new OnSettingsCallback<LeaderboardWithHeaderPerspectiveSettings>() {
|
||||
|
||||
@Override
|
||||
public void newSettings(PerspectiveCompositeSettings<LeaderboardWithHeaderPerspectiveSettings> newSettings) {
|
||||
leaderboardSettings = newSettings;
|
||||
}
|
||||
});
|
||||
|
||||
createPerspectiveSettingsUI(raceboardLifecycle, raceboardSettings, raceboardPerspectiveSettingsPanel,
|
||||
false, new OnSettingsCallback<RaceBoardPerspectiveSettings>() {
|
||||
|
||||
@Override
|
||||
public void newSettings(PerspectiveCompositeSettings<RaceBoardPerspectiveSettings> newSettings) {
|
||||
raceboardSettings = newSettings;
|
||||
}
|
||||
});
|
||||
leaderboardPerspectiveSettingsPanel.clear();
|
||||
Button perspectiveSettingsButton = new Button(StringMessages.INSTANCE.settings());
|
||||
perspectiveSettingsButton.getElement().getStyle().setMarginRight(10, Unit.PX);
|
||||
leaderboardPerspectiveSettingsPanel.add(perspectiveSettingsButton);
|
||||
perspectiveSettingsButton.setEnabled(true);
|
||||
perspectiveSettingsButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
openSettingsDialog();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
startAutoPlayButton.setEnabled(false);
|
||||
startAutoPlayButton.addStyleName(SharedResources.INSTANCE.mainCss().buttoninactive());
|
||||
@@ -214,21 +167,28 @@ public class DesktopStartView extends Composite implements StartView {
|
||||
.setVisibility(selectedLeaderboardName != null ? Visibility.VISIBLE : Visibility.HIDDEN);
|
||||
}
|
||||
|
||||
private <PL extends PerspectiveLifecycle<PS>, PS extends Settings> void createPerspectiveSettingsUI(
|
||||
final PL lifecycle, PerspectiveCompositeSettings<PS> settings, FlowPanel perspectiveSettingsPanel,
|
||||
boolean leaderBoardTrueRaceBoardFalse, OnSettingsCallback<PS> onSettingsCallback) {
|
||||
perspectiveSettingsPanel.clear();
|
||||
protected void openSettingsDialog() {
|
||||
final AutoplayContextSettings autoplayContextSettings = new AutoplayContextSettings();
|
||||
final LinkWithSettingsGenerator<PerspectiveCompositeSettings<AutoplayPerspectiveOwnSettings>> linkWithSettingsGenerator = new LinkWithSettingsGenerator<>(
|
||||
EntryPointLinkFactory.AUTOPLAY_PATH, autoplayContextSettings);
|
||||
|
||||
DialogCallback<PerspectiveCompositeSettings<AutoplayPerspectiveOwnSettings>> callback = new DialogCallback<PerspectiveCompositeSettings<AutoplayPerspectiveOwnSettings>>() {
|
||||
|
||||
Button perspectiveSettingsButton = new Button(StringMessages.INSTANCE.settings());
|
||||
perspectiveSettingsButton.getElement().getStyle().setMarginRight(10, Unit.PX);
|
||||
perspectiveSettingsPanel.add(perspectiveSettingsButton);
|
||||
perspectiveSettingsButton.setEnabled(settings.hasSettings());
|
||||
perspectiveSettingsButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
openPerspectiveSettingsDialog(lifecycle, settings, onSettingsCallback);
|
||||
public void ok(PerspectiveCompositeSettings<AutoplayPerspectiveOwnSettings> editedObject) {
|
||||
autoplayPerspectiveSettings = editedObject;
|
||||
}
|
||||
});
|
||||
|
||||
@Override
|
||||
public void cancel() {
|
||||
}
|
||||
};
|
||||
|
||||
SettingsDialogForLinkSharing<PerspectiveCompositeSettings<AutoplayPerspectiveOwnSettings>> dialog = new SettingsDialogForLinkSharing<PerspectiveCompositeSettings<AutoplayPerspectiveOwnSettings>>(
|
||||
linkWithSettingsGenerator, autoplayLifecycle, autoplayLifecycle.createDefaultSettings(),
|
||||
StringMessages.INSTANCE, true, callback);
|
||||
dialog.show();
|
||||
|
||||
}
|
||||
|
||||
@UiHandler("localeSelectionBox")
|
||||
@@ -244,9 +204,10 @@ public class DesktopStartView extends Composite implements StartView {
|
||||
String selectedLeaderboardName = getSelectedLeaderboardName();
|
||||
|
||||
if (selectedEvent != null && selectedLeaderboardName != null) {
|
||||
// TODO generate place settings url, and directly start other place
|
||||
navigator.goToPlayer(new AutoPlayerConfiguration(selectedEvent.id.toString(), selectedLeaderboardName,
|
||||
startInFullscreenModeBox.getValue(), timeToRaceStartInSeconds.getValue()),
|
||||
leaderboardLifecycle, leaderboardSettings, raceboardLifecycle, raceboardSettings);
|
||||
autoplayPerspectiveSettings.getPerspectiveOwnSettings().isFullscreen(),
|
||||
autoplayPerspectiveSettings.getPerspectiveOwnSettings().getTimeToSwitchBeforeRaceStart()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-35
@@ -46,33 +46,6 @@
|
||||
</div>
|
||||
|
||||
<div ui:field="screenConfigurationUi">
|
||||
<div class="{res.mediaCss.grid} {style.row} {style.headline}">
|
||||
<div class="{res.mediaCss.columns}"><ui:text from='{i18n.autoplaySettings}' /></div>
|
||||
</div>
|
||||
<div class="{res.mediaCss.grid} {style.row}">
|
||||
<div class="{res.mediaCss.small12} {res.mediaCss.medium6} {res.mediaCss.large3} {res.mediaCss.columns}">
|
||||
<span><ui:text from='{i18n.startBrowserFullscreen}' />:</span>
|
||||
</div>
|
||||
<div class="{res.mediaCss.small12} {res.mediaCss.medium6} {res.mediaCss.large9} {res.mediaCss.columns}">
|
||||
<g:CheckBox ui:field="startInFullscreenModeBox" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="{res.mediaCss.grid} {style.row}">
|
||||
<div class="{res.mediaCss.small12} {res.mediaCss.medium6} {res.mediaCss.large3} {res.mediaCss.columns}">
|
||||
<span><ui:text from='{i18n.switchToLiveRaceAutomatically}' />:</span>
|
||||
</div>
|
||||
<div class="{res.mediaCss.small12} {res.mediaCss.medium6} {res.mediaCss.large9} {res.mediaCss.columns}">
|
||||
<g:CheckBox ui:field="autoSwitchToRaceboard" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="{res.mediaCss.grid} {style.row}">
|
||||
<div class="{res.mediaCss.small12} {res.mediaCss.medium6} {res.mediaCss.large3} {res.mediaCss.columns}">
|
||||
<span><ui:text from='{i18n.timeBeforeRaceStart}' />:</span>
|
||||
</div>
|
||||
<div class="{res.mediaCss.small12} {res.mediaCss.medium6} {res.mediaCss.large9} {res.mediaCss.columns}">
|
||||
<g:IntegerBox ui:field="timeToRaceStartInSeconds" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="{res.mediaCss.grid} {style.row} {style.headline}">
|
||||
<div class="{res.mediaCss.columns}"><ui:text from='{i18n.page}' /> <ui:text from='{i18n.settings}' /></div>
|
||||
</div>
|
||||
@@ -84,14 +57,6 @@
|
||||
<g:FlowPanel ui:field="leaderboardPerspectiveSettingsPanel" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="{res.mediaCss.grid} {style.row}">
|
||||
<div class="{res.mediaCss.small12} {res.mediaCss.medium6} {res.mediaCss.large3} {res.mediaCss.columns}">
|
||||
<span><ui:text from='{i18n.raceViewer}' /> <ui:text from='{i18n.page}' />:</span>
|
||||
</div>
|
||||
<div class="{res.mediaCss.small12} {res.mediaCss.medium6} {res.mediaCss.large9} {res.mediaCss.columns}">
|
||||
<g:FlowPanel ui:field="raceboardPerspectiveSettingsPanel" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="{res.mediaCss.grid} {style.row}">
|
||||
<div class="{res.mediaCss.columns}"><hr/></div>
|
||||
</div>
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ public class StartActivity extends AbstractActivity {
|
||||
|
||||
public static final String LOAD_EVENTS_DATA_CATEGORY = "loadEventsData";
|
||||
|
||||
public StartActivity(StartPlace place, StartClientFactory clientFactory) {
|
||||
public StartActivity(StartClientFactory clientFactory) {
|
||||
this.clientFactory = clientFactory;
|
||||
}
|
||||
|
||||
|
||||
+1
-3
@@ -6,10 +6,8 @@ import com.sap.sse.gwt.client.mvp.AbstractActivityProxy;
|
||||
public class StartActivityProxy extends AbstractActivityProxy {
|
||||
|
||||
private final StartClientFactory clientFactory;
|
||||
private final StartPlace place;
|
||||
|
||||
public StartActivityProxy(StartPlace place, StartClientFactory clientFactory) {
|
||||
this.place = place;
|
||||
this.clientFactory = clientFactory;
|
||||
}
|
||||
|
||||
@@ -18,7 +16,7 @@ public class StartActivityProxy extends AbstractActivityProxy {
|
||||
GWT.runAsync(new AbstractRunAsyncCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
super.onSuccess(new StartActivity(place, clientFactory));
|
||||
super.onSuccess(new StartActivity(clientFactory));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+1
@@ -7,6 +7,7 @@ import com.sap.sse.gwt.client.AbstractEntryPointLinkFactory;
|
||||
|
||||
public class EntryPointLinkFactory extends AbstractEntryPointLinkFactory {
|
||||
public static final String LEADERBOARD_PATH = "/gwt/Leaderboard.html";
|
||||
public static final String AUTOPLAY_PATH = "/gwt/AutoPlay.html";
|
||||
|
||||
public static String createRaceBoardLink(Map<String, String> parameters) {
|
||||
return createEntryPointLink("/gwt/RaceBoard.html", parameters);
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ public class SettingsDialogForLinkSharing<SettingsType extends Settings> extends
|
||||
true, null);
|
||||
}
|
||||
|
||||
private SettingsDialogForLinkSharing(LinkWithSettingsGenerator<SettingsType> linkWithSettingsGenerator,
|
||||
public SettingsDialogForLinkSharing(LinkWithSettingsGenerator<SettingsType> linkWithSettingsGenerator,
|
||||
ComponentLifecycle<SettingsType, ?> componentLifecycle, SettingsType settings,
|
||||
StringMessages stringMessages, boolean animationEnabled, DialogCallback<SettingsType> callback) {
|
||||
super(componentLifecycle.getLocalizedShortName(), componentLifecycle.getSettingsDialogComponent(settings),
|
||||
|
||||
Reference in new issue
Block a user