Merge remote-tracking branch 'server/master'

This commit is contained in:
Axel Uhl committed 2012-03-09 16:41:10 +01:00
commit ffc8e185b9
3 files changed
+47 -23

No files matched your search

@@ -41,6 +41,7 @@ import com.google.gwt.maps.client.overlay.Polyline;
import com.google.gwt.maps.client.overlay.PolylineOptions; import com.google.gwt.maps.client.overlay.PolylineOptions;
import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RequiresResize;
import com.google.gwt.user.client.ui.SimplePanel; import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget; import com.google.gwt.user.client.ui.Widget;
@@ -74,7 +75,7 @@ import com.sap.sailing.gwt.ui.shared.components.Component;
import com.sap.sailing.gwt.ui.shared.components.SettingsDialogComponent; import com.sap.sailing.gwt.ui.shared.components.SettingsDialogComponent;
public class RaceMap extends SimplePanel implements TimeListener, CompetitorSelectionChangeListener, RaceSelectionChangeListener, public class RaceMap extends SimplePanel implements TimeListener, CompetitorSelectionChangeListener, RaceSelectionChangeListener,
Component<RaceMapSettings>, RequiresDataInitialization { Component<RaceMapSettings>, RequiresDataInitialization, RequiresResize {
protected MapWidget map; protected MapWidget map;
private final SailingServiceAsync sailingService; private final SailingServiceAsync sailingService;
@@ -925,6 +926,9 @@ public class RaceMap extends SimplePanel implements TimeListener, CompetitorSele
} }
} }
/**
* @return The last shown GPS fix for the given competitor
*/
protected GPSFixDTO getBoatFix(CompetitorDTO competitorDTO) { protected GPSFixDTO getBoatFix(CompetitorDTO competitorDTO) {
return fixes.get(competitorDTO).get(lastShownFix.get(competitorDTO)); return fixes.get(competitorDTO).get(lastShownFix.get(competitorDTO));
} }
@@ -1138,21 +1142,23 @@ public class RaceMap extends SimplePanel implements TimeListener, CompetitorSele
competitors = isZoomOnlyToSelectedCompetitors() ? selectedCompetitors : forMap.getCompetitorsToShow(); competitors = isZoomOnlyToSelectedCompetitors() ? selectedCompetitors : forMap.getCompetitorsToShow();
} }
for (CompetitorDTO competitor : competitors) { for (CompetitorDTO competitor : competitors) {
List<GPSFixDTO> competitorFixes = forMap.fixes.get(competitor); try {
Integer lastShownFixForCompetitor = forMap.lastShownFix.get(competitor); GPSFixDTO competitorFix = forMap.getBoatFix(competitor);
GPSFixDTO competitorFix = competitorFixes != null && lastShownFixForCompetitor != null ? competitorFixes.get(lastShownFixForCompetitor) : null; PositionDTO competitorPosition = competitorFix != null ? competitorFix.position : null;
PositionDTO competitorPosition = competitorFix != null ? competitorFix.position : null; LatLng competitorLatLng = competitorPosition != null ? LatLng.newInstance(competitorPosition.latDeg,
LatLng competitorLatLng = competitorPosition != null ? LatLng.newInstance(competitorPosition.latDeg, competitorPosition.lngDeg) : null;
competitorPosition.lngDeg) : null; LatLngBounds bounds = competitorLatLng != null ? LatLngBounds.newInstance(competitorLatLng,
LatLngBounds bounds = competitorLatLng != null ? LatLngBounds.newInstance(competitorLatLng, competitorLatLng) : null;
competitorLatLng) : null; if (bounds != null) {
if (bounds != null) { if (newBounds == null) {
if (newBounds == null) { newBounds = bounds;
newBounds = bounds; } else {
} else { newBounds.extend(bounds.getNorthEast());
newBounds.extend(bounds.getNorthEast()); newBounds.extend(bounds.getSouthWest());
newBounds.extend(bounds.getSouthWest()); }
} }
} catch (IndexOutOfBoundsException e) {
//Catch this in case the competitor has no GPS fixes at the current time (e.g. in race 'Finale 2' of STG)
} }
} }
return newBounds; return newBounds;
@@ -1214,4 +1220,10 @@ public class RaceMap extends SimplePanel implements TimeListener, CompetitorSele
public boolean isDataInitialized() { public boolean isDataInitialized() {
return dataInitialized; return dataInitialized;
} }
@Override
public void onResize() {
map.checkResize();
zoomMapToNewBounds(getSettings().getZoomSettings().getNewBounds(RaceMap.this));
}
} }
@@ -55,17 +55,19 @@ public class LeaderboardGroupPanel extends FormPanel implements HasWelcomeWidget
private ErrorReporter errorReporter; private ErrorReporter errorReporter;
private LeaderboardGroupDTO group; private LeaderboardGroupDTO group;
private String root; private String root;
private String viewMode;
private FlowPanel mainPanel; private FlowPanel mainPanel;
private Widget welcomeWidget = null; private Widget welcomeWidget = null;
public LeaderboardGroupPanel(SailingServiceAsync sailingService, StringMessages stringConstants, public LeaderboardGroupPanel(SailingServiceAsync sailingService, StringMessages stringConstants,
ErrorReporter errorReporter, final String groupName, String root) { ErrorReporter errorReporter, final String groupName, String root, String viewMode) {
super(); super();
this.sailingService = sailingService; this.sailingService = sailingService;
this.stringConstants = stringConstants; this.stringConstants = stringConstants;
this.errorReporter = errorReporter; this.errorReporter = errorReporter;
this.root = root; this.root = root;
this.viewMode = viewMode;
if (this.root == null || this.root.length() == 0) { if (this.root == null || this.root.length() == 0) {
this.root = "leaderboardGroupPanel"; this.root = "leaderboardGroupPanel";
} }
@@ -187,15 +189,21 @@ public class LeaderboardGroupPanel extends FormPanel implements HasWelcomeWidget
String displayName = race.getRaceColumnName(); String displayName = race.getRaceColumnName();
if (race.getRaceColumnName().equals(stringConstants.overview())) { if (race.getRaceColumnName().equals(stringConstants.overview())) {
String link = URLFactory.INSTANCE.encode("/gwt/Leaderboard.html?name=" + leaderboard.name String link = URLFactory.INSTANCE.encode("/gwt/Leaderboard.html?name=" + leaderboard.name
+ "&leaderboardGroupName=" + group.name + "&root=" + root + "&leaderboardGroupName=" + group.name + "&root=" + root);
+ (debugParam != null && !debugParam.isEmpty() ? "&gwt.codesvr=" + debugParam : "")); if(debugParam != null && !debugParam.isEmpty())
link += "&gwt.codesvr=" + debugParam;
if(viewMode != null && !viewMode.isEmpty())
link += "&viewMode=" + viewMode;
b.append(ANCHORTEMPLATE.anchor(link, displayName, STYLE_NAME_PREFIX + "ActiveLeaderboard")); b.append(ANCHORTEMPLATE.anchor(link, displayName, STYLE_NAME_PREFIX + "ActiveLeaderboard"));
} else { } else {
if (race.getRaceIdentifier() != null) { if (race.getRaceIdentifier() != null) {
EventNameAndRaceName raceId = (EventNameAndRaceName) race.getRaceIdentifier(); EventNameAndRaceName raceId = (EventNameAndRaceName) race.getRaceIdentifier();
String link = URLFactory.INSTANCE.encode("/gwt/RaceBoard.html?leaderboardName=" + leaderboard.name + "&raceName=" + raceId.getRaceName() String link = URLFactory.INSTANCE.encode("/gwt/RaceBoard.html?leaderboardName=" + leaderboard.name + "&raceName=" + raceId.getRaceName()
+ "&eventName=" + raceId.getEventName() + "&leaderboardGroupName=" + group.name + "&root=" + root + "&eventName=" + raceId.getEventName() + "&leaderboardGroupName=" + group.name + "&root=" + root);
+ (debugParam != null && !debugParam.isEmpty() ? "&gwt.codesvr=" + debugParam : "")); if(debugParam != null && !debugParam.isEmpty())
link += "&gwt.codesvr=" + debugParam;
if(viewMode != null && !viewMode.isEmpty())
link += "&viewMode=" + viewMode;
b.append(ANCHORTEMPLATE.anchor(link, displayName, STYLE_NAME_PREFIX + "ActiveRace")); b.append(ANCHORTEMPLATE.anchor(link, displayName, STYLE_NAME_PREFIX + "ActiveRace"));
} else { } else {
b.append(TEXTTEMPLATE.textWithClass(race.getRaceColumnName(), STYLE_NAME_PREFIX + "InactiveRace")); b.append(TEXTTEMPLATE.textWithClass(race.getRaceColumnName(), STYLE_NAME_PREFIX + "InactiveRace"));
@@ -213,8 +221,11 @@ public class LeaderboardGroupPanel extends FormPanel implements HasWelcomeWidget
EventNameAndRaceName raceId = (EventNameAndRaceName) race.getRaceIdentifier(); EventNameAndRaceName raceId = (EventNameAndRaceName) race.getRaceIdentifier();
String link = URLFactory.INSTANCE.encode("/gwt/RaceBoard.html?leaderboardName=" + leaderboard.name String link = URLFactory.INSTANCE.encode("/gwt/RaceBoard.html?leaderboardName=" + leaderboard.name
+ "&raceName=" + raceId.getRaceName() + "&root=" + root + raceId.getRaceName() + "&eventName=" + "&raceName=" + raceId.getRaceName() + "&root=" + root + raceId.getRaceName() + "&eventName="
+ raceId.getEventName() + "&leaderboardGroupName=" + group.name + raceId.getEventName() + "&leaderboardGroupName=" + group.name);
+ (debugParam != null && !debugParam.isEmpty() ? "&gwt.codesvr=" + debugParam : "")); if(debugParam != null && !debugParam.isEmpty())
link += "&gwt.codesvr=" + debugParam;
if(viewMode != null && !viewMode.isEmpty())
link += "&viewMode=" + viewMode;
b.append(ANCHORTEMPLATE.anchor(link, race.getRaceColumnName(), STYLE_NAME_PREFIX + "ActiveRace")); b.append(ANCHORTEMPLATE.anchor(link, race.getRaceColumnName(), STYLE_NAME_PREFIX + "ActiveRace"));
} else { } else {
if (!first) { if (!first) {
@@ -21,6 +21,7 @@ public class SpectatorEntryPoint extends AbstractEntryPoint implements EventRefr
public void onModuleLoad() { public void onModuleLoad() {
super.onModuleLoad(); super.onModuleLoad();
String groupParamValue = Window.Location.getParameter("leaderboardGroupName"); String groupParamValue = Window.Location.getParameter("leaderboardGroupName");
String viewModeParamValue = Window.Location.getParameter("viewMode");
final String groupName; final String groupName;
if (groupParamValue == null || groupParamValue.isEmpty()) { if (groupParamValue == null || groupParamValue.isEmpty()) {
groupName = null; groupName = null;
@@ -52,7 +53,7 @@ public class SpectatorEntryPoint extends AbstractEntryPoint implements EventRefr
// panelToDisplay = new LeaderboardGroupOverviewPanel(sailingService, this, stringMessages); // panelToDisplay = new LeaderboardGroupOverviewPanel(sailingService, this, stringMessages);
Window.alert("No leaderboard group name was given."); Window.alert("No leaderboard group name was given.");
} else { } else {
panelToDisplay = new LeaderboardGroupPanel(sailingService, stringMessages, this, groupName, root); panelToDisplay = new LeaderboardGroupPanel(sailingService, stringMessages, this, groupName, root, viewModeParamValue);
LeaderboardGroupPanel groupPanel = (LeaderboardGroupPanel) panelToDisplay; LeaderboardGroupPanel groupPanel = (LeaderboardGroupPanel) panelToDisplay;
groupPanel.setWelcomeWidget(new SimpleWelcomeWidget( stringMessages.welcomeToSailingAnalytics(), groupPanel.setWelcomeWidget(new SimpleWelcomeWidget( stringMessages.welcomeToSailingAnalytics(),
"Understanding what happens out on the race course isn't always easy. To help solve this challenge and" + "Understanding what happens out on the race course isn't always easy. To help solve this challenge and" +