mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-28 14:57:12 +00:00
pass through the decision whether charts would be shown, based on client height
This commit is contained in:
1 parent
c15e62e494
commit
30f1fa3e86
7 files changed
+37
-22
No files matched your search
+3
-3
@@ -170,10 +170,10 @@ public class AutoPlayController implements RaceTimesInfoProviderListener {
|
||||
RaceSelectionModel raceSelectionModel = new RaceSelectionModel();
|
||||
List<RegattaAndRaceIdentifier> singletonList = Collections.singletonList(raceToShow);
|
||||
raceSelectionModel.setSelection(singletonList);
|
||||
|
||||
RaceBoardPanel raceBoardPanel = new RaceBoardPanel(sailingService, mediaService, userService, asyncActionsExecutor,
|
||||
competitorsAndTheirBoats, raceboardTimer, raceSelectionModel, leaderboardName, null, /* event */null, raceboardViewConfig,
|
||||
errorReporter, StringMessages.INSTANCE, userAgent, raceTimesInfoProvider, /* showMapControls */false);
|
||||
competitorsAndTheirBoats, raceboardTimer, raceSelectionModel, leaderboardName, null, /* event */ null, raceboardViewConfig,
|
||||
errorReporter, StringMessages.INSTANCE, userAgent, raceTimesInfoProvider, /* showMapControls */ false,
|
||||
/* isScreenLargeEnoughToOfferChartSupport */ true);
|
||||
return raceBoardPanel;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -30,8 +30,8 @@ public class RaceTimePanel extends TimePanel<RaceTimePanelSettings> implements R
|
||||
private boolean redrawAllMarkersPendingForMinMaxBeingInitialized;
|
||||
|
||||
public RaceTimePanel(Timer timer, TimeRangeWithZoomProvider timeRangeProvider, StringMessages stringMessages,
|
||||
RaceTimesInfoProvider raceTimesInfoProvider, boolean canReplayWhileLiveIsPossible) {
|
||||
super(timer, timeRangeProvider, stringMessages, canReplayWhileLiveIsPossible);
|
||||
RaceTimesInfoProvider raceTimesInfoProvider, boolean canReplayWhileLiveIsPossible, boolean isScreenLargeEnoughToOfferChartSupport) {
|
||||
super(timer, timeRangeProvider, stringMessages, canReplayWhileLiveIsPossible, isScreenLargeEnoughToOfferChartSupport);
|
||||
this.raceTimesInfoProvider = raceTimesInfoProvider;
|
||||
selectedRace = null;
|
||||
autoAdjustPlayMode = true;
|
||||
|
||||
+7
-3
@@ -89,7 +89,13 @@ public class TimePanel<T extends TimePanelSettings> extends SimplePanel implemen
|
||||
private static ClientResources resources = GWT.create(ClientResources.class);
|
||||
protected static TimePanelCss timePanelCss = TimePanelCssResources.INSTANCE.css();
|
||||
|
||||
public TimePanel(Timer timer, TimeRangeWithZoomProvider timeRangeProvider, StringMessages stringMessages, boolean canReplayWhileLiveIsPossible) {
|
||||
/**
|
||||
* @param isScreenLargeEnoughToOfferChartSupport
|
||||
* if <code>true</code>, the right padding will be set such that the time panel lines up with charts such
|
||||
* as the competitor chart or the wind chart shown above it
|
||||
*/
|
||||
public TimePanel(Timer timer, TimeRangeWithZoomProvider timeRangeProvider, StringMessages stringMessages,
|
||||
boolean canReplayWhileLiveIsPossible, boolean isScreenLargeEnoughToOfferChartSupport) {
|
||||
this.timer = timer;
|
||||
this.timeRangeProvider = timeRangeProvider;
|
||||
this.stringMessages = stringMessages;
|
||||
@@ -105,8 +111,6 @@ public class TimePanel<T extends TimePanelSettings> extends SimplePanel implemen
|
||||
timePanelSliderFlowWrapper = new FlowPanel();
|
||||
timePanelSlider.setStyleName("timePanelSlider");
|
||||
timePanelSlider.getElement().getStyle().setPaddingLeft(66, Unit.PX);
|
||||
// TODO pass this in as a parameter; bug 3345
|
||||
boolean isScreenLargeEnoughToOfferChartSupport = true;
|
||||
if (isScreenLargeEnoughToOfferChartSupport) {
|
||||
timePanelSlider.getElement().getStyle().setPaddingRight(66, Unit.PX);
|
||||
}
|
||||
|
||||
+2
-1
@@ -151,7 +151,8 @@ public class EmbeddedMapAndWindChartEntryPoint extends AbstractSailingEntryPoint
|
||||
// Use a TimePanel to manage wind chart zoom, although the TimePanel itself is not being displayed;
|
||||
// let the time panel always return to "live" mode.
|
||||
final TimePanel<TimePanelSettings> timePanel = new TimePanel<TimePanelSettings>(
|
||||
timer, timeRangeWithZoomProvider, getStringMessages(), /* canReplayWhileLive */ false) {
|
||||
timer, timeRangeWithZoomProvider, getStringMessages(), /* canReplayWhileLive */ false,
|
||||
/* isScreenLargeEnoughToOfferChartSupport set to true iff wind chart will be displayed */ showWindChart) {
|
||||
protected boolean isLiveModeToBeMadePossible() {
|
||||
return true;
|
||||
}
|
||||
|
||||
+6
-3
@@ -6,6 +6,7 @@ import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Document;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
@@ -97,7 +98,7 @@ public class RaceBoardEntryPoint extends AbstractSailingEntryPoint {
|
||||
sailingService.getRaceboardData(regattaName, raceName, leaderboardName, leaderboardGroupName, eventId, new AsyncCallback<RaceboardDataDTO>() {
|
||||
@Override
|
||||
public void onSuccess(RaceboardDataDTO result) {
|
||||
checkUrlParameters(result, canReplayWhileLiveIsPossible, showMapControls);
|
||||
checkUrlParameters(result, canReplayWhileLiveIsPossible, showMapControls, Document.get().getClientHeight() >= 768);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -116,7 +117,8 @@ public class RaceBoardEntryPoint extends AbstractSailingEntryPoint {
|
||||
vp.add(new Label(message));
|
||||
}
|
||||
|
||||
private void checkUrlParameters(RaceboardDataDTO raceboardData, boolean canReplayWhileLiveIsPossible, boolean showMapControls) {
|
||||
private void checkUrlParameters(RaceboardDataDTO raceboardData, boolean canReplayWhileLiveIsPossible, boolean showMapControls,
|
||||
boolean isScreenLargeEnoughToOfferChartSupport) {
|
||||
if (!raceboardData.isValidLeaderboard()) {
|
||||
createErrorPage(getStringMessages().noSuchLeaderboard());
|
||||
return;
|
||||
@@ -148,7 +150,8 @@ public class RaceBoardEntryPoint extends AbstractSailingEntryPoint {
|
||||
RaceTimesInfoProvider raceTimesInfoProvider = new RaceTimesInfoProvider(sailingService, asyncActionsExecutor, this, singletonList, 5000l /* requestInterval*/);
|
||||
RaceBoardPanel raceBoardPanel = new RaceBoardPanel(sailingService, mediaService, getUserService(), asyncActionsExecutor,
|
||||
raceboardData.getCompetitorAndTheirBoats(), timer, raceSelectionModel, leaderboardName, leaderboardGroupName, eventId,
|
||||
raceboardViewConfig, RaceBoardEntryPoint.this, getStringMessages(), userAgent, raceTimesInfoProvider, showMapControls);
|
||||
raceboardViewConfig, RaceBoardEntryPoint.this, getStringMessages(), userAgent, raceTimesInfoProvider, showMapControls,
|
||||
isScreenLargeEnoughToOfferChartSupport);
|
||||
|
||||
createRaceBoardInOneScreenMode(raceBoardPanel, raceboardViewConfig);
|
||||
}
|
||||
|
||||
+16
-9
@@ -123,13 +123,17 @@ public class RaceBoardPanel extends SimplePanel implements RaceSelectionChangeLi
|
||||
* @param eventId
|
||||
* an optional event that can be used for "back"-navigation in case the race board shows a race in the
|
||||
* context of an event; may be <code>null</code>.
|
||||
* @param isScreenLargeEnoughToOfferChartSupport
|
||||
* if the screen is large enough to display charts such as the competitor chart or the wind chart, a
|
||||
* padding is provided for the RaceTimePanel that aligns its right border with that of the charts, and
|
||||
* the charts are created.
|
||||
*/
|
||||
public RaceBoardPanel(SailingServiceAsync sailingService, MediaServiceAsync mediaService,
|
||||
UserService userService, AsyncActionsExecutor asyncActionsExecutor, Map<CompetitorDTO, BoatDTO> competitorsAndTheirBoats,
|
||||
Timer timer, RaceSelectionProvider theRaceSelectionProvider, String leaderboardName,
|
||||
String leaderboardGroupName, UUID eventId, RaceBoardViewConfiguration raceboardViewConfiguration,
|
||||
ErrorReporter errorReporter, final StringMessages stringMessages,
|
||||
UserAgentDetails userAgent, RaceTimesInfoProvider raceTimesInfoProvider, boolean showMapControls) {
|
||||
UserAgentDetails userAgent, RaceTimesInfoProvider raceTimesInfoProvider, boolean showMapControls, boolean isScreenLargeEnoughToOfferChartSupport) {
|
||||
this.sailingService = sailingService;
|
||||
this.mediaService = mediaService;
|
||||
this.stringMessages = stringMessages;
|
||||
@@ -176,7 +180,7 @@ public class RaceBoardPanel extends SimplePanel implements RaceSelectionChangeLi
|
||||
leaderboardPanel.setTitle(stringMessages.leaderboard());
|
||||
leaderboardPanel.getElement().getStyle().setMarginLeft(6, Unit.PX);
|
||||
leaderboardPanel.getElement().getStyle().setMarginTop(10, Unit.PX);
|
||||
createOneScreenView(leaderboardName, leaderboardGroupName, eventId, mainPanel, showMapControls, raceMap, userService); // initializes the raceMap field
|
||||
createOneScreenView(leaderboardName, leaderboardGroupName, eventId, mainPanel, showMapControls, isScreenLargeEnoughToOfferChartSupport, raceMap, userService); // initializes the raceMap field
|
||||
leaderboardPanel.addLeaderboardUpdateListener(this);
|
||||
// in case the URL configuration contains the name of a competitors filter set we try to activate it
|
||||
// FIXME the competitorsFilterSets has now moved to CompetitorSearchTextBox (which should probably be renamed); pass on the parameters to the LeaderboardPanel and see what it does with it
|
||||
@@ -190,7 +194,7 @@ public class RaceBoardPanel extends SimplePanel implements RaceSelectionChangeLi
|
||||
}
|
||||
}
|
||||
timePanel = new RaceTimePanel(timer, timeRangeWithZoomModel, stringMessages, raceTimesInfoProvider,
|
||||
raceboardViewConfiguration.isCanReplayDuringLiveRaces());
|
||||
raceboardViewConfiguration.isCanReplayDuringLiveRaces(), isScreenLargeEnoughToOfferChartSupport);
|
||||
timeRangeWithZoomModel.addTimeZoomChangeListener(timePanel);
|
||||
raceTimesInfoProvider.addRaceTimesInfoProviderListener(timePanel);
|
||||
raceSelectionProvider.addRaceSelectionChangeListener(timePanel);
|
||||
@@ -198,17 +202,20 @@ public class RaceBoardPanel extends SimplePanel implements RaceSelectionChangeLi
|
||||
}
|
||||
|
||||
/**
|
||||
* @param event an optional event; may be <code>null</code> or else can be used to show some context information in
|
||||
* the {@link GlobalNavigationPanel}.
|
||||
* @param event
|
||||
* an optional event; may be <code>null</code> or else can be used to show some context information in
|
||||
* the {@link GlobalNavigationPanel}.
|
||||
* @param isScreenLargeEnoughToOfferChartSupport
|
||||
* if the screen is large enough to display charts such as the competitor chart or the wind chart, a
|
||||
* padding is provided for the RaceTimePanel that aligns its right border with that of the charts, and
|
||||
* the charts are created.
|
||||
*/
|
||||
private void createOneScreenView(String leaderboardName, String leaderboardGroupName, UUID event, FlowPanel mainPanel,
|
||||
boolean showMapControls, RaceMap raceMap, UserService userService) {
|
||||
boolean showMapControls, boolean isScreenLargeEnoughToOfferChartSupport, RaceMap raceMap, UserService userService) {
|
||||
// create the default leaderboard and select the right race
|
||||
raceTimesInfoProvider.addRaceTimesInfoProviderListener(raceMap);
|
||||
raceMap.onRaceSelectionChange(Collections.singletonList(selectedRaceIdentifier));
|
||||
List<Component<?>> components = new ArrayList<Component<?>>();
|
||||
// TODO pass this in as a parameter; bug 3345
|
||||
boolean isScreenLargeEnoughToOfferChartSupport = true;
|
||||
if (isScreenLargeEnoughToOfferChartSupport) {
|
||||
competitorChart = new MultiCompetitorRaceChart(sailingService, asyncActionsExecutor, competitorSelectionProvider, raceSelectionProvider,
|
||||
timer, timeRangeWithZoomModel, stringMessages, errorReporter, true, true, leaderboardGroupName, leaderboardName);
|
||||
@@ -238,7 +245,7 @@ public class RaceBoardPanel extends SimplePanel implements RaceSelectionChangeLi
|
||||
mainPanel.add(componentViewer.getViewerWidget());
|
||||
}
|
||||
boolean showLeaderboard = getConfiguration().isShowLeaderboard();
|
||||
if (Document.get().getClientWidth() <= 1024) {
|
||||
if (Document.get().getClientWidth() < 1024) {
|
||||
showLeaderboard = false;
|
||||
}
|
||||
setLeaderboardVisible(showLeaderboard);
|
||||
|
||||
+1
-1
@@ -309,7 +309,7 @@ public class SimulatorMainPanel extends SimplePanel {
|
||||
timer.setTime(windParams.getStartTime().getTime());
|
||||
int secondsTimeStep = (int) windParams.getTimeStep().asSeconds();
|
||||
timer.setPlaySpeedFactor(secondsTimeStep);
|
||||
timePanel = new TimePanel<TimePanelSettings>(timer, timeRangeProvider, stringMessages, false);
|
||||
timePanel = new TimePanel<TimePanelSettings>(timer, timeRangeProvider, stringMessages, false, isScreenLargeEnoughToOfferChartSupport);
|
||||
|
||||
busyIndicator = new SimpleBusyIndicator(false, 0.8f);
|
||||
|
||||
|
||||
Reference in new issue
Block a user