mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-08 21:30:57 +00:00
Merge branch 'racecommittee_regattaoverview' into racecommittee_app
This commit is contained in:
commit
8e427c378e
5 files changed
+93
-6
No files matched your search
+26
@@ -0,0 +1,26 @@
|
||||
package com.sap.sailing.gwt.ui.client;
|
||||
|
||||
import com.google.gwt.cell.client.AbstractCell;
|
||||
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||
import com.google.gwt.safehtml.shared.SafeHtmlUtils;
|
||||
import com.google.gwt.user.client.ui.Anchor;
|
||||
|
||||
/**
|
||||
* A GWT cell rendering a simple anchor.
|
||||
* @author C5163874
|
||||
*
|
||||
*/
|
||||
public class AnchorCell extends AbstractCell<Anchor> {
|
||||
@Override
|
||||
public void render(com.google.gwt.cell.client.Cell.Context context, Anchor a, SafeHtmlBuilder sb) {
|
||||
if (a.getHref() != null && a.getHref().trim().length() > 0 && a.isEnabled()) {
|
||||
sb.append(SafeHtmlUtils.fromTrustedString("<a target=\"_blank\" href=\""));
|
||||
sb.append(SafeHtmlUtils.fromTrustedString(a.getHref()));
|
||||
sb.append(SafeHtmlUtils.fromTrustedString("\">"));
|
||||
sb.append(SafeHtmlUtils.fromTrustedString(a.getText()));
|
||||
sb.append(SafeHtmlUtils.fromTrustedString("</a>"));
|
||||
} else {
|
||||
sb.append(SafeHtmlUtils.fromTrustedString(a.getText()));
|
||||
}
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package com.sap.sailing.gwt.ui.client;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.google.gwt.user.client.Window;
|
||||
|
||||
public class EntryPointLinkFactory {
|
||||
public static String createRaceBoardLink(Map<String, String> parameters) {
|
||||
return createEntryPointLink("/gwt/RaceBoard.html", parameters);
|
||||
}
|
||||
|
||||
public static String createLeaderboardLink(Map<String, String> parameters) {
|
||||
return createEntryPointLink("/gwt/Leaderboard.html", parameters);
|
||||
}
|
||||
|
||||
private static String createEntryPointLink(String baseLink, Map<String, String> parameters) {
|
||||
String debugParam = Window.Location.getParameter("gwt.codesvr");
|
||||
String link = baseLink;
|
||||
int i = 1;
|
||||
for(Entry<String, String> entry: parameters.entrySet()) {
|
||||
link += i == 1 ? "?" : "&";
|
||||
link += entry.getKey() + "=" + entry.getValue();
|
||||
i++;
|
||||
}
|
||||
if (debugParam != null && !debugParam.isEmpty()) {
|
||||
link += i == 1 ? "?" : "&";
|
||||
link += "gwt.codesvr=" + debugParam;
|
||||
}
|
||||
return URLEncoder.encode(link);
|
||||
}
|
||||
}
|
||||
+32
-6
@@ -4,7 +4,9 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.gwt.cell.client.ClickableTextCell;
|
||||
import com.google.gwt.cell.client.FieldUpdater;
|
||||
@@ -23,6 +25,7 @@ import com.google.gwt.user.cellview.client.Column;
|
||||
import com.google.gwt.user.cellview.client.ColumnSortEvent;
|
||||
import com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler;
|
||||
import com.google.gwt.user.cellview.client.TextColumn;
|
||||
import com.google.gwt.user.client.ui.Anchor;
|
||||
import com.google.gwt.user.client.ui.Button;
|
||||
import com.google.gwt.user.client.ui.DialogBox;
|
||||
import com.google.gwt.user.client.ui.Grid;
|
||||
@@ -35,6 +38,8 @@ import com.google.gwt.view.client.ListDataProvider;
|
||||
import com.sap.sailing.domain.common.LeaderboardNameConstants;
|
||||
import com.sap.sailing.domain.common.NauticalSide;
|
||||
import com.sap.sailing.domain.common.dto.FleetDTO;
|
||||
import com.sap.sailing.gwt.ui.client.AnchorCell;
|
||||
import com.sap.sailing.gwt.ui.client.EntryPointLinkFactory;
|
||||
import com.sap.sailing.gwt.ui.client.ErrorReporter;
|
||||
import com.sap.sailing.gwt.ui.client.GwtJsonDeSerializer;
|
||||
import com.sap.sailing.gwt.ui.client.MarkedAsyncCallback;
|
||||
@@ -175,10 +180,17 @@ public class RegattaRaceStatesComponent extends SimplePanel implements Component
|
||||
|
||||
});
|
||||
|
||||
TextColumn<RegattaOverviewEntryDTO> regattaNameColumn = new TextColumn<RegattaOverviewEntryDTO>() {
|
||||
AnchorCell leaderboardAnchorCell = new AnchorCell();
|
||||
Column<RegattaOverviewEntryDTO, Anchor> regattaNameColumn = new Column<RegattaOverviewEntryDTO, Anchor>(leaderboardAnchorCell) {
|
||||
@Override
|
||||
public String getValue(RegattaOverviewEntryDTO entryDTO) {
|
||||
return entryDTO.regattaDisplayName;
|
||||
public Anchor getValue(RegattaOverviewEntryDTO entryDTO) {
|
||||
Map<String, String> leaderboardLinkParameters = new HashMap<String, String>();
|
||||
leaderboardLinkParameters.put("name", entryDTO.regattaName);
|
||||
leaderboardLinkParameters.put("showRaceDetails", String.valueOf(true));
|
||||
leaderboardLinkParameters.put("displayName", entryDTO.regattaDisplayName);
|
||||
String leaderboardLink = EntryPointLinkFactory.createLeaderboardLink(leaderboardLinkParameters);
|
||||
Anchor result = new Anchor(entryDTO.regattaDisplayName, leaderboardLink);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
regattaNameColumn.setSortable(true);
|
||||
@@ -216,10 +228,24 @@ public class RegattaRaceStatesComponent extends SimplePanel implements Component
|
||||
|
||||
});
|
||||
|
||||
TextColumn<RegattaOverviewEntryDTO> raceNameColumn = new TextColumn<RegattaOverviewEntryDTO>() {
|
||||
AnchorCell raceCell = new AnchorCell();
|
||||
Column<RegattaOverviewEntryDTO, Anchor> raceNameColumn = new Column<RegattaOverviewEntryDTO, Anchor>(raceCell) {
|
||||
@Override
|
||||
public String getValue(RegattaOverviewEntryDTO entryDTO) {
|
||||
return entryDTO.raceInfo.raceName;
|
||||
public Anchor getValue(RegattaOverviewEntryDTO entryDTO) {
|
||||
Anchor result = null;
|
||||
if (entryDTO.raceInfo.raceIdentifier != null && entryDTO.raceInfo.isTracked) {
|
||||
Map<String, String> raceLinkParameters = new HashMap<String, String>();
|
||||
raceLinkParameters.put("leaderboardName", entryDTO.regattaName);
|
||||
raceLinkParameters.put("raceName", entryDTO.raceInfo.raceIdentifier.getRaceName());
|
||||
raceLinkParameters.put("canReplayDuringLiveRaces", "true");
|
||||
raceLinkParameters.put("regattaName", entryDTO.regattaName);
|
||||
String raceBoardLink = EntryPointLinkFactory.createRaceBoardLink(raceLinkParameters);
|
||||
result = new Anchor(entryDTO.raceInfo.raceName, raceBoardLink);
|
||||
} else {
|
||||
result = new Anchor(entryDTO.raceInfo.raceName);
|
||||
result.setEnabled(false);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
raceNameColumn.setSortable(true);
|
||||
|
||||
+2
@@ -672,6 +672,8 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
raceInfoDTO.fleetName = fleet.getName();
|
||||
raceInfoDTO.fleetOrdering = fleet.getOrdering();
|
||||
raceInfoDTO.raceIdentifier = raceColumn.getRaceIdentifier(fleet);
|
||||
raceInfoDTO.isTracked = raceColumn.getTrackedRace(fleet) != null ? true : false;
|
||||
|
||||
return raceInfoDTO;
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -18,6 +18,7 @@ public class RaceInfoDTO implements IsSerializable {
|
||||
public Flags lastUpperFlag;
|
||||
public Flags lastLowerFlag;
|
||||
public boolean isLastFlagDisplayed;
|
||||
public boolean isTracked;
|
||||
public RaceCourseDTO lastCourseDesign;
|
||||
public String lastCourseName;
|
||||
public RaceIdentifier raceIdentifier;
|
||||
|
||||
Reference in new issue
Block a user