diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/autoplay/client/app/AutoplayPerspectiveOwnSettings.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/autoplay/client/app/AutoplayPerspectiveOwnSettings.java index caf5a6aadbf..cb3d06d240e 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/autoplay/client/app/AutoplayPerspectiveOwnSettings.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/autoplay/client/app/AutoplayPerspectiveOwnSettings.java @@ -7,25 +7,29 @@ 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; + private BooleanSetting fullscreen; + private BooleanSetting switchToLive; + private IntegerSetting timeToSwitchBeforeRaceStartInSeconds; + private IntegerSetting waitTimeAfterRaceEndInSeconds; public AutoplayPerspectiveOwnSettings() { } - public AutoplayPerspectiveOwnSettings(boolean fullscreen, boolean switchToLive, int timeToSwitchBeforeRaceStart) { + public AutoplayPerspectiveOwnSettings(boolean fullscreen, boolean switchToLive, + int timeToSwitchBeforeRaceStartInSeconds, int waitTimeAfterRaceEndInSeconds) { super(); this.fullscreen.setValue(fullscreen); this.switchToLive.setValue(switchToLive); - this.timeToSwitchBeforeRaceStart.setValue(timeToSwitchBeforeRaceStart); + this.timeToSwitchBeforeRaceStartInSeconds.setValue(timeToSwitchBeforeRaceStartInSeconds); + this.waitTimeAfterRaceEndInSeconds.setValue(waitTimeAfterRaceEndInSeconds); } @Override protected void addChildSettings() { fullscreen = new BooleanSetting("fullscreen", this, true); switchToLive = new BooleanSetting("switchToLive", this, true); - timeToSwitchBeforeRaceStart = new IntegerSetting("timeToSwitchBeforeRaceStart", this, 180); + timeToSwitchBeforeRaceStartInSeconds = new IntegerSetting("timeToSwitchBeforeRaceStart", this, 180); + waitTimeAfterRaceEndInSeconds = new IntegerSetting("waitTimeAfterRaceEnd", this, 60); } @@ -37,7 +41,11 @@ public class AutoplayPerspectiveOwnSettings extends AbstractGenericSerializableS return switchToLive.getValue(); } - public int getTimeToSwitchBeforeRaceStart() { - return timeToSwitchBeforeRaceStart.getValue(); + public int getTimeToSwitchBeforeRaceStartInSeconds() { + return timeToSwitchBeforeRaceStartInSeconds.getValue(); + } + + public int getWaitTimeAfterRaceEndInSeconds() { + return waitTimeAfterRaceEndInSeconds.getValue(); } } diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/autoplay/client/app/AutoplaySettingsDialogComponent.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/autoplay/client/app/AutoplaySettingsDialogComponent.java index c30ce86d11d..48f165da67d 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/autoplay/client/app/AutoplaySettingsDialogComponent.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/autoplay/client/app/AutoplaySettingsDialogComponent.java @@ -12,21 +12,24 @@ import com.sap.sse.gwt.client.dialog.DataEntryDialog.Validator; import com.sap.sse.gwt.client.shared.components.SettingsDialogComponent; public class AutoplaySettingsDialogComponent implements SettingsDialogComponent { - private AutoplayPerspectiveOwnSettings initialSettings; + private final AutoplayPerspectiveOwnSettings initialSettings; + private final StringMessages stringMessages; + private CheckBox fullScreen; private CheckBox switchToLiveRaceAutomatically; private IntegerBox timeBeforeRaceStartInput; + private IntegerBox waitTimeAfterRaceEndInput; AutoplaySettingsDialogComponent(AutoplayPerspectiveOwnSettings settings) { this.initialSettings = settings; + + stringMessages = StringMessages.INSTANCE; } @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); @@ -38,8 +41,14 @@ public class AutoplaySettingsDialogComponent implements SettingsDialogComponent< Label timeBeforeRaceStartDescription = new Label(stringMessages.timeBeforeRaceStart()); vp.add(timeBeforeRaceStartDescription); - timeBeforeRaceStartInput = dialog.createIntegerBox(initialSettings.getTimeToSwitchBeforeRaceStart(), 5); + timeBeforeRaceStartInput = dialog.createIntegerBox(initialSettings.getTimeToSwitchBeforeRaceStartInSeconds(), 5); vp.add(timeBeforeRaceStartInput); + + Label timeAfterRaceEndDescription = new Label(stringMessages.timeAfterRaceEnd()); + vp.add(timeAfterRaceEndDescription); + + waitTimeAfterRaceEndInput = dialog.createIntegerBox(initialSettings.getWaitTimeAfterRaceEndInSeconds(), 5); + vp.add(waitTimeAfterRaceEndInput); return vp; } @@ -47,7 +56,7 @@ public class AutoplaySettingsDialogComponent implements SettingsDialogComponent< @Override public AutoplayPerspectiveOwnSettings getResult() { return new AutoplayPerspectiveOwnSettings(fullScreen.getValue(), switchToLiveRaceAutomatically.getValue(), - timeBeforeRaceStartInput.getValue()); + timeBeforeRaceStartInput.getValue(), waitTimeAfterRaceEndInput.getValue()); } @Override @@ -55,9 +64,9 @@ public class AutoplaySettingsDialogComponent implements SettingsDialogComponent< return new Validator() { @Override public String getErrorMessage(AutoplayPerspectiveOwnSettings valueToValidate) { - if (valueToValidate.timeToSwitchBeforeRaceStart.getValue() < 0) { - // TODO i18n - return "negative delay"; + if (valueToValidate.getTimeToSwitchBeforeRaceStartInSeconds() < 0 + || valueToValidate.getWaitTimeAfterRaceEndInSeconds() < 0) { + return stringMessages.delaysMustNotBeNegative(); } else { return null; } diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/autoplay/client/nodes/RootNodeClassic.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/autoplay/client/nodes/RootNodeClassic.java index 59c0f948f8f..e5b0aaadd21 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/autoplay/client/nodes/RootNodeClassic.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/autoplay/client/nodes/RootNodeClassic.java @@ -2,6 +2,7 @@ package com.sap.sailing.gwt.autoplay.client.nodes; import com.sap.sailing.domain.common.RegattaAndRaceIdentifier; import com.sap.sailing.gwt.autoplay.client.app.AutoPlayClientFactory; +import com.sap.sailing.gwt.autoplay.client.app.AutoplayPerspectiveOwnSettings; import com.sap.sailing.gwt.autoplay.client.events.FailureEvent; import com.sap.sailing.gwt.autoplay.client.nodes.base.AutoPlayNode; import com.sap.sailing.gwt.autoplay.client.nodes.base.RootNodeBase; @@ -53,4 +54,16 @@ public class RootNodeClassic extends RootNodeBase { transitionTo(idle); } + @Override + protected long getSwitchBeforeRaceStartInMillis() { + AutoplayPerspectiveOwnSettings ownSettings = getClientFactory().getAutoPlayCtx().getAutoplaySettings().getPerspectiveOwnSettings(); + return ownSettings.getTimeToSwitchBeforeRaceStartInSeconds() * 1000; + } + + @Override + protected long getWaitTimeAfterRaceEndInMillis() { + AutoplayPerspectiveOwnSettings ownSettings = getClientFactory().getAutoPlayCtx().getAutoplaySettings().getPerspectiveOwnSettings(); + return ownSettings.getWaitTimeAfterRaceEndInSeconds() * 1000; + } + } diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/autoplay/client/nodes/RootNodeSixtyInch.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/autoplay/client/nodes/RootNodeSixtyInch.java index 22601b434d3..5871c93c0de 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/autoplay/client/nodes/RootNodeSixtyInch.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/autoplay/client/nodes/RootNodeSixtyInch.java @@ -82,4 +82,14 @@ public class RootNodeSixtyInch extends RootNodeBase { } transitionTo(idleLoop); } + + @Override + protected long getSwitchBeforeRaceStartInMillis() { + return 3*60*1000; + } + + @Override + protected long getWaitTimeAfterRaceEndInMillis() { + return 60*1000; + } } diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/autoplay/client/nodes/base/RootNodeBase.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/autoplay/client/nodes/base/RootNodeBase.java index 4d957d8de41..1c653e80f99 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/autoplay/client/nodes/base/RootNodeBase.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/autoplay/client/nodes/base/RootNodeBase.java @@ -95,7 +95,8 @@ public abstract class RootNodeBase extends BaseCompositeNode { this.leaderBoardName = cf.getAutoPlayCtx().getContextDefinition().getLeaderboardName(); AutoplayHelper.getLiveRace(cf.getSailingService(), cf.getErrorReporter(), cf.getAutoPlayCtx().getEvent(), - leaderBoardName, cf.getDispatch(), new AsyncCallback>() { + leaderBoardName, cf.getDispatch(), getWaitTimeAfterRaceEndInMillis(), + getSwitchBeforeRaceStartInMillis(), new AsyncCallback>() { @Override public void onSuccess(Pair result) { errorCount = 0; @@ -142,6 +143,10 @@ public abstract class RootNodeBase extends BaseCompositeNode { }); } + protected abstract long getSwitchBeforeRaceStartInMillis(); + + protected abstract long getWaitTimeAfterRaceEndInMillis(); + private final void setCurrentState(boolean isPreLiveRace, RegattaAndRaceIdentifier liveRace, RootNodeState goingTo, RootNodeState comingFrom) { if (goingTo != comingFrom) { diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/autoplay/client/utils/AutoplayHelper.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/autoplay/client/utils/AutoplayHelper.java index 6bede23a7b0..ae233f7f703 100755 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/autoplay/client/utils/AutoplayHelper.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/autoplay/client/utils/AutoplayHelper.java @@ -44,9 +44,6 @@ import com.sap.sse.gwt.client.player.Timer; import com.sap.sse.gwt.client.player.Timer.PlayModes; public class AutoplayHelper { - private static final long PRE_RACE_DELAY = 180000; - private static final long WAIT_TIME_AFTER_END_OF_RACE_MIILIS = 60 * 1000; // 1 min - private static final RaceMapResources raceMapResources = GWT.create(RaceMapResources.class); private static Timer fastCurrentTimeProvider = new Timer(PlayModes.Live, /* delayBetweenAutoAdvancesInMilliseconds */1000l); @@ -66,8 +63,8 @@ public class AutoplayHelper { } public static void getLiveRace(SailingServiceAsync sailingService, ErrorReporter errorReporter, EventDTO event, - String leaderBoardName, SailingDispatchSystem dispatch, - AsyncCallback> callback) { + String leaderBoardName, SailingDispatchSystem dispatch, long waitTimeAfterRaceEndInMillis, + long switchBeforeRaceStartInMillis, AsyncCallback> callback) { if (fastCurrentTimeProvider.getRefreshInterval() != 1000) { fastCurrentTimeProvider.setRefreshInterval(1000); } @@ -98,7 +95,8 @@ public class AutoplayHelper { fastCurrentTimeProvider.adjustClientServerOffset(clientTimeWhenRequestWasSent, serverTimeDuringRequest, clientTimeWhenResponseWasReceived); Pair timeToStartAndRaceIdentifier = checkForLiveRace( - selectedLeaderboard, serverTimeDuringRequest, raceTimesInfoProvider); + selectedLeaderboard, serverTimeDuringRequest, raceTimesInfoProvider, + waitTimeAfterRaceEndInMillis, switchBeforeRaceStartInMillis); callback.onSuccess(timeToStartAndRaceIdentifier); // kill old provider! raceTimesInfoProvider.terminate(); @@ -125,7 +123,8 @@ public class AutoplayHelper { * Side effect free method to get a LifeRace from a timesProvider and a leaderboard */ public static Pair checkForLiveRace(AbstractLeaderboardDTO currentLeaderboard, - Date serverTimeDuringRequest, RaceTimesInfoProvider raceTimesInfoProvider) { + Date serverTimeDuringRequest, RaceTimesInfoProvider raceTimesInfoProvider, + long waitTimeAfterRaceEndInMillis, long switchBeforeRaceStartInMillis) { Map raceTimesInfos = raceTimesInfoProvider.getRaceTimesInfos(); for (RaceColumnDTO race : currentLeaderboard.getRaceList()) { for (FleetDTO fleet : race.getFleets()) { @@ -134,15 +133,16 @@ public class AutoplayHelper { RaceTimesInfoDTO raceTimes = raceTimesInfos.get(raceIdentifier); boolean notNullInRequiredValues = raceTimes != null && raceTimes.startOfTracking != null && raceTimes.getStartOfRace() != null; + boolean raceHasNotEndedOrOnlyRecentlyEnded = raceTimes.endOfRace == null || serverTimeDuringRequest.getTime() - raceTimes.delayToLiveInMs < raceTimes.endOfRace.getTime() - + WAIT_TIME_AFTER_END_OF_RACE_MIILIS; + + waitTimeAfterRaceEndInMillis; if (notNullInRequiredValues && raceHasNotEndedOrOnlyRecentlyEnded) { long startTimeInMs = raceTimes.getStartOfRace().getTime(); long startIn = startTimeInMs - serverTimeDuringRequest.getTime() - raceTimes.delayToLiveInMs; - if (startIn <= PRE_RACE_DELAY && startIn > NEGATIVE_SANITY_CHECK) { + if (startIn <= switchBeforeRaceStartInMillis && startIn > NEGATIVE_SANITY_CHECK) { startOfLifeRace = raceTimes.getStartOfRace(); return new Pair(startIn, raceIdentifier); } diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages.java index 2051d20fc36..e796df1b81c 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages.java @@ -1299,6 +1299,7 @@ public interface StringMessages extends com.sap.sse.gwt.client.StringMessages, String startBrowserFullscreen(); String switchToLiveRaceAutomatically(); String timeBeforeRaceStart(); + String timeAfterRaceEnd(); String showXYDiagram(); String xyDiagram(); String boatSpeed(); @@ -2152,11 +2153,12 @@ public interface StringMessages extends com.sap.sse.gwt.client.StringMessages, String newExpeditionRace(); String newExpeditionCompetitor(); String selectOneCompetitorToMapTheImportedData(); - String startTypingForSuggestions(); + String startTypingForSuggestions(); String maneuverTable(); String speedIn(); String speedOut(); String selectAtLeastOneCompetitorManeuver(); String noDataManeuverTable(); String errorTryingToDetermineBoatLinkedToCompetitor(String raceColumnName, String leaderboardName, String message); + String delaysMustNotBeNegative(); } diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages.properties b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages.properties index e6b7fe8616f..5a25cd7b058 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages.properties +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages.properties @@ -1267,7 +1267,8 @@ startAutoplay=Start autoplay autoplaySettings=Autoplay settings startBrowserFullscreen=Start browser in fullscreen mode switchToLiveRaceAutomatically=Switch to live race automatically -timeBeforeRaceStart=time before race start (in s) +timeBeforeRaceStart=Time to switch to race before race start (in s) +timeAfterRaceEnd=Time to show race after race end (in s) errorTryingToGetEvents=Error trying to get events: {0} showXYDiagram=Show x-y-diagram xyDiagram=x-y-Diagram @@ -2147,4 +2148,5 @@ speedIn=Speed in speedOut=Speed out selectAtLeastOneCompetitorManeuver=To show the maneuver table, select at least one competitor noDataManeuverTable=There are no maneuvers detected yet -errorTryingToDetermineBoatLinkedToCompetitor=Error trying to determine boat linked to competitor {0} in leaderboard {1}: {2} \ No newline at end of file +errorTryingToDetermineBoatLinkedToCompetitor=Error trying to determine boat linked to competitor {0} in leaderboard {1}: {2} +delaysMustNotBeNegative=Delays must not be negative \ No newline at end of file diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages_de.properties b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages_de.properties index 1fc0314adee..adb83ae9ca5 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages_de.properties +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages_de.properties @@ -1256,7 +1256,8 @@ startAutoplay=Automatisches Abspielen starten autoplaySettings=Einstellungen für automatisches Abspielen startBrowserFullscreen=Browser im Vollbildmodus starten switchToLiveRaceAutomatically=Automatisches Umschalten zum Live-Rennen -timeBeforeRaceStart=Zeit vor dem Rennstart (in s) +timeBeforeRaceStart=Zeitraum vor dem Rennstart, in welchem bereits das Rennen angezeigt wird (in s) +timeAfterRaceEnd=Zeit nach dem Rennende, in welchem noch das Rennen angezeigt wird (in s) errorTryingToGetEvents=Fehler beim Laden von Veranstaltungen: {0} createDefaultSettingsForAllRegattas=Standardeinstellungen für alle Regatten anlegen... noOverallEventSelected=Keine übergeordnete Veranstaltung ausgewählt... @@ -2143,4 +2144,5 @@ speedIn=Anfangsgeschwindigkeit speedOut=Endgeschwindigkeit selectAtLeastOneCompetitorManeuver=Um die Manövertabelle anzuzeigen, muss mindestens ein Teilnehmer ausgewählt werden noDataManeuverTable=Es wurde noch keine Manöver erkannt -errorTryingToDetermineBoatLinkedToCompetitor=Fehler bei der Ermittlung des Bootes für Teilnehmer {0} in Ergebnisliste {1}: {2} \ No newline at end of file +errorTryingToDetermineBoatLinkedToCompetitor=Fehler bei der Ermittlung des Bootes für Teilnehmer {0} in Ergebnisliste {1}: {2} +delaysMustNotBeNegative=Abhängige Zeiten dürfen nicht negativ sein \ No newline at end of file diff --git a/java/com.sap.sailing.selenium.test/META-INF/MANIFEST.MF b/java/com.sap.sailing.selenium.test/META-INF/MANIFEST.MF index 696c4cd1db1..ede5abfad5a 100644 --- a/java/com.sap.sailing.selenium.test/META-INF/MANIFEST.MF +++ b/java/com.sap.sailing.selenium.test/META-INF/MANIFEST.MF @@ -11,7 +11,9 @@ Require-Bundle: org.hamcrest;bundle-version="1.1.0", com.sap.sse.mongodb;bundle-version="1.0.0", org.mongodb.mongo-java-driver;bundle-version="2.13.0", com.sap.sailing.domain.common, - com.sap.sse.common + com.sap.sse.common, + jcl.over.slf4j;bundle-version="1.6.4";resolution:=optional, + slf4j.api;bundle-version="1.6.4";resolution:=optional Bundle-ClassPath: lib/cglib-nodep-2.2.3.jar, . Automatic-Module-Name: com.sap.sailing.selenium.test diff --git a/java/com.sap.sailing.selenium.test/com.sap.sailing.selenium.test (No Proxy).launch b/java/com.sap.sailing.selenium.test/com.sap.sailing.selenium.test (No Proxy).launch index 66a15e1ff1d..c0933ab0952 100644 --- a/java/com.sap.sailing.selenium.test/com.sap.sailing.selenium.test (No Proxy).launch +++ b/java/com.sap.sailing.selenium.test/com.sap.sailing.selenium.test (No Proxy).launch @@ -1,27 +1,20 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + +