unsubscribe from competitors-for-race updates in those PlayerModes that don't need it

Change-Id: Ib0eabc33e29e0dbecfa4b86b2991d86aa8dc6a21
This commit is contained in:
Axel Uhl committed 2016-07-16 15:33:26 +02:00
1 parent dae3acd2e9
commit 0a666baf6e
3 files changed
+14

No files matched your search

@@ -30,6 +30,8 @@ import com.sap.sse.gwt.client.player.Timer;
* {@link #trigger} method each time (abstract in this class). Subclasses can and should do the following:
*
* <ul>
* <li>Redefine {@link #applyTo(RaceBoardPanel)} and call the {@code stopReceiving...} methods for those types of
* events they don't need</li>
* <li>Redefine specific callback methods in case more processing is required or canceling the listener is desired only
* when certain preconditions are met</li>
* <li>Implement the {@link #trigger} method to check if all information required has been received by now and then use
@@ -19,6 +19,12 @@ public class FullAnalysisMode extends AbstractRaceBoardMode {
private boolean leaderboardSettingsAdjusted;
private boolean timerAdjusted;
@Override
public void applyTo(RaceBoardPanel raceBoardPanel) {
super.applyTo(raceBoardPanel);
stopReceivingCompetitorsInRace();
}
/**
* Listening for race times info continues until information about the end of the race has been received. The leaderboard
* settings are adjusted as soon as a valid leaderboard has been received.
@@ -24,6 +24,12 @@ public class PlayerMode extends AbstractRaceBoardMode {
private boolean timerAdjusted;
@Override
public void applyTo(RaceBoardPanel raceBoardPanel) {
super.applyTo(raceBoardPanel);
stopReceivingCompetitorsInRace();
}
private void adjustLeaderboardSettings() {
final LeaderboardSettings existingSettings = getLeaderboardPanel().getSettings();
final List<DetailType> raceDetailsToShow = new ArrayList<>(existingSettings.getRaceDetailsToShow());