mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-09 13:50:57 +00:00
Handling more URL parameters by using GenericSerializableSettings
This commit is contained in:
1 parent
f98b9c70e5
commit
47be750377
2 files changed
+61
-16
No files matched your search
+8
-16
@@ -11,13 +11,11 @@ import com.google.gwt.user.client.ui.RootPanel;
|
||||
import com.google.gwt.user.client.ui.SimplePanel;
|
||||
import com.sap.sailing.gwt.common.authentication.FixedSailingAuthentication;
|
||||
import com.sap.sailing.gwt.common.authentication.SAPSailingHeaderWithAuthentication;
|
||||
import com.sap.sailing.gwt.settings.client.raceboard.RaceBoardPerspectiveOwnSettings;
|
||||
import com.sap.sailing.gwt.ui.client.AbstractSailingEntryPoint;
|
||||
import com.sap.sailing.gwt.ui.client.RegattaRefresher;
|
||||
import com.sap.sailing.gwt.ui.client.shared.panels.SimpleWelcomeWidget;
|
||||
import com.sap.sailing.gwt.ui.client.shared.racemap.RaceMapSettings;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardGroupDTO;
|
||||
import com.sap.sse.gwt.shared.GwtHttpRequestUtils;
|
||||
import com.sap.sse.gwt.settings.SettingsToUrlSerializer;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -29,15 +27,10 @@ public class SpectatorEntryPoint extends AbstractSailingEntryPoint implements Re
|
||||
@Override
|
||||
protected void doOnModuleLoad() {
|
||||
super.doOnModuleLoad();
|
||||
|
||||
final SpectatorSettings settings = new SettingsToUrlSerializer().deserializeFromCurrentLocation(new SpectatorSettings());
|
||||
|
||||
String groupParamValue = Window.Location.getParameter("leaderboardGroupName");
|
||||
String viewModeParamValue = Window.Location.getParameter("viewMode");
|
||||
final boolean canReplayDuringLiveRaces = GwtHttpRequestUtils.getBooleanParameter(
|
||||
RaceBoardPerspectiveOwnSettings.PARAM_CAN_REPLAY_DURING_LIVE_RACES, /* defaultValue */ false);
|
||||
final boolean showMapControls = GwtHttpRequestUtils.getBooleanParameter(
|
||||
RaceMapSettings.PARAM_SHOW_MAPCONTROLS, /* defaultValue */ true);
|
||||
boolean showRaceDetails = Window.Location.getParameter("showRaceDetails") != null
|
||||
&& Window.Location.getParameter("showRaceDetails").equalsIgnoreCase("true");
|
||||
final String groupParamValue = settings.getLeaderboardGroupName();
|
||||
final String groupName;
|
||||
if (groupParamValue == null || groupParamValue.isEmpty()) {
|
||||
groupName = null;
|
||||
@@ -56,21 +49,20 @@ public class SpectatorEntryPoint extends AbstractSailingEntryPoint implements Re
|
||||
|
||||
RootPanel rootPanel = RootPanel.get();
|
||||
FlowPanel groupAndFeedbackPanel = new FlowPanel();
|
||||
boolean embedded = Window.Location.getParameter("embedded") != null
|
||||
&& Window.Location.getParameter("embedded").equalsIgnoreCase("true");
|
||||
boolean embedded = settings.isEmbedded();
|
||||
if (groupName == null) {
|
||||
FlowPanel groupOverviewPanel = new FlowPanel();
|
||||
groupOverviewPanel.addStyleName("contentOuterPanel");
|
||||
// DON'T DELETE -> the EventOverviewPanel will replace the LeaderboardGroupOverviewPanel later on
|
||||
// EventOverviewPanel eventOverviewPanel = new EventOverviewPanel(sailingService, this, stringMessages, showRaceDetails);
|
||||
// groupOverviewPanel.add( eventOverviewPanel);
|
||||
LeaderboardGroupOverviewPanel leaderboardGroupOverviewPanel = new LeaderboardGroupOverviewPanel(sailingService, this, getStringMessages(), showRaceDetails);
|
||||
LeaderboardGroupOverviewPanel leaderboardGroupOverviewPanel = new LeaderboardGroupOverviewPanel(sailingService, this, getStringMessages(), settings.isShowRaceDetails());
|
||||
groupOverviewPanel.add(leaderboardGroupOverviewPanel);
|
||||
rootPanel.add(groupOverviewPanel);
|
||||
} else {
|
||||
LeaderboardGroupPanel groupPanel = new LeaderboardGroupPanel(sailingService, getStringMessages(), this,
|
||||
groupName, viewModeParamValue, embedded, showRaceDetails, canReplayDuringLiveRaces,
|
||||
showMapControls);
|
||||
groupName, settings.getViewMode(), embedded, settings.isShowRaceDetails(), settings.isCanReplayDuringLiveRaces(),
|
||||
settings.isShowMapControls());
|
||||
groupAndFeedbackPanel.add(groupPanel);
|
||||
if (!embedded) {
|
||||
groupPanel.setWelcomeWidget(new SimpleWelcomeWidget(getStringMessages().welcomeToSailingAnalytics(),
|
||||
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
package com.sap.sailing.gwt.ui.spectator;
|
||||
|
||||
import com.sap.sailing.gwt.settings.client.raceboard.RaceBoardPerspectiveOwnSettings;
|
||||
import com.sap.sailing.gwt.ui.client.shared.racemap.RaceMapSettings;
|
||||
import com.sap.sse.common.settings.generic.AbstractGenericSerializableSettings;
|
||||
import com.sap.sse.common.settings.generic.BooleanSetting;
|
||||
import com.sap.sse.common.settings.generic.StringSetting;
|
||||
|
||||
public class SpectatorSettings extends AbstractGenericSerializableSettings {
|
||||
|
||||
private static final long serialVersionUID = 3490708255272671012L;
|
||||
|
||||
private transient StringSetting leaderboardGroupName;
|
||||
private transient StringSetting viewMode;
|
||||
private transient BooleanSetting canReplayDuringLiveRaces;
|
||||
private transient BooleanSetting showMapControls;
|
||||
private transient BooleanSetting showRaceDetails;
|
||||
private transient BooleanSetting embedded;
|
||||
|
||||
@Override
|
||||
protected void addChildSettings() {
|
||||
leaderboardGroupName = new StringSetting("leaderboardGroupName", this);
|
||||
viewMode = new StringSetting("viewMode", this);
|
||||
canReplayDuringLiveRaces = new BooleanSetting(RaceBoardPerspectiveOwnSettings.PARAM_CAN_REPLAY_DURING_LIVE_RACES, this, false);
|
||||
showMapControls = new BooleanSetting(RaceMapSettings.PARAM_SHOW_MAPCONTROLS, this, true);
|
||||
showRaceDetails = new BooleanSetting("showRaceDetails", this, false);
|
||||
embedded = new BooleanSetting("embedded", this, false);
|
||||
}
|
||||
|
||||
public String getLeaderboardGroupName() {
|
||||
return leaderboardGroupName.getValue();
|
||||
}
|
||||
|
||||
public String getViewMode() {
|
||||
return viewMode.getValue();
|
||||
}
|
||||
|
||||
public boolean isCanReplayDuringLiveRaces() {
|
||||
return Boolean.TRUE.equals(canReplayDuringLiveRaces.getValue());
|
||||
}
|
||||
|
||||
public boolean isShowMapControls() {
|
||||
return Boolean.TRUE.equals(showMapControls.getValue());
|
||||
}
|
||||
|
||||
public boolean isShowRaceDetails() {
|
||||
return Boolean.TRUE.equals(showRaceDetails.getValue());
|
||||
}
|
||||
|
||||
public boolean isEmbedded() {
|
||||
return Boolean.TRUE.equals(embedded.getValue());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user