mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-06 19:12:23 +00:00
fixed URL parameter handling for competitor columns
This commit is contained in:
1 parent
8041fd0058
commit
6ff52fbfa6
4 files changed
+37
-16
No files matched your search
+2
@@ -7,6 +7,7 @@ import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.google.gwt.core.shared.GWT;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
@@ -48,6 +49,7 @@ public class LeaderboardEntryPoint extends AbstractSailingEntryPoint {
|
||||
|
||||
@Override
|
||||
protected void doOnModuleLoad() {
|
||||
GWT.debugger();
|
||||
super.doOnModuleLoad();
|
||||
final boolean showRaceDetails = GwtHttpRequestUtils.getBooleanParameter(LeaderboardUrlSettings.PARAM_SHOW_RACE_DETAILS, false /* default*/);
|
||||
final boolean embedded = GwtHttpRequestUtils.getBooleanParameter(LeaderboardUrlSettings.PARAM_EMBEDDED, false /* default*/);
|
||||
|
||||
+11
-10
@@ -2065,7 +2065,7 @@ public class LeaderboardPanel extends SimplePanel implements TimeListener, PlayS
|
||||
* adds the <code>column</code> to the right end of the {@link #getLeaderboardTable() leaderboard table} and sets
|
||||
* the column style according to the {@link LeaderboardSortableColumnWithMinMax#getColumnStyle() column's style definition}.
|
||||
*/
|
||||
protected void addColumn(LeaderboardSortableColumnWithMinMax<LeaderboardRowDTO, ?> column) {
|
||||
protected void addColumn(AbstractSortableColumnWithMinMax<LeaderboardRowDTO, ?> column) {
|
||||
leaderboardTable.addColumn(column, column.getHeader(), column.getComparator(), column
|
||||
.getPreferredSortingOrder().isAscending());
|
||||
String columnStyle = column.getColumnStyle();
|
||||
@@ -2810,20 +2810,20 @@ public class LeaderboardPanel extends SimplePanel implements TimeListener, PlayS
|
||||
* @return the 0-based index for the next column
|
||||
*/
|
||||
private int ensureSailIDAndCompetitorColumn(int columnIndexWhereToInsertTheNextColumn) {
|
||||
SailIDColumn<LeaderboardRowDTO> sailIdColumn = new SailIDColumn<LeaderboardRowDTO>(new CompetitorFetcher<LeaderboardRowDTO>() {
|
||||
@Override
|
||||
public CompetitorDTO getCompetitor(LeaderboardRowDTO t) {
|
||||
return t.competitor;
|
||||
}
|
||||
});
|
||||
if (isShowCompetitorSailId()) {
|
||||
if (getLeaderboardTable().getColumnCount() <= columnIndexWhereToInsertTheNextColumn
|
||||
|| !(getLeaderboardTable().getColumn(columnIndexWhereToInsertTheNextColumn) instanceof SailIDColumn<?>)) {
|
||||
insertColumn(columnIndexWhereToInsertTheNextColumn, sailIdColumn);
|
||||
insertColumn(columnIndexWhereToInsertTheNextColumn, new SailIDColumn<LeaderboardRowDTO>(new CompetitorFetcher<LeaderboardRowDTO>() {
|
||||
@Override
|
||||
public CompetitorDTO getCompetitor(LeaderboardRowDTO t) {
|
||||
return t.competitor;
|
||||
}
|
||||
}));
|
||||
}
|
||||
columnIndexWhereToInsertTheNextColumn++;
|
||||
} else {
|
||||
if (getLeaderboardTable().getColumn(columnIndexWhereToInsertTheNextColumn) instanceof SailIDColumn<?>) {
|
||||
if (getLeaderboardTable().getColumnCount() > columnIndexWhereToInsertTheNextColumn
|
||||
&& getLeaderboardTable().getColumn(columnIndexWhereToInsertTheNextColumn) instanceof SailIDColumn<?>) {
|
||||
removeColumn(columnIndexWhereToInsertTheNextColumn);
|
||||
}
|
||||
}
|
||||
@@ -2834,7 +2834,8 @@ public class LeaderboardPanel extends SimplePanel implements TimeListener, PlayS
|
||||
}
|
||||
columnIndexWhereToInsertTheNextColumn++;
|
||||
} else {
|
||||
if (getLeaderboardTable().getColumn(columnIndexWhereToInsertTheNextColumn) instanceof CompetitorColumn) {
|
||||
if (getLeaderboardTable().getColumnCount() > columnIndexWhereToInsertTheNextColumn
|
||||
&& getLeaderboardTable().getColumn(columnIndexWhereToInsertTheNextColumn) instanceof CompetitorColumn) {
|
||||
removeColumn(columnIndexWhereToInsertTheNextColumn);
|
||||
}
|
||||
}
|
||||
|
||||
+8
@@ -4,6 +4,14 @@ import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.common.DetailType;
|
||||
|
||||
/**
|
||||
* Settings for the {@link LeaderboardPanel} component. If you change here, please also visit
|
||||
* {@link LeaderboardSettingsDialogComponent} to make the setting editable, and edit {@link LeaderboardUrlSettings}
|
||||
* for URL generation and parsing.
|
||||
*
|
||||
* @author Axel Uhl (d043530)
|
||||
*
|
||||
*/
|
||||
public class LeaderboardSettings {
|
||||
public static final String PARAM_LEADERBOARD_GROUP_NAME = "leaderboardGroupName";
|
||||
public static final String PARAM_EMBEDDED = "embedded";
|
||||
|
||||
+16
-6
@@ -151,11 +151,21 @@ public class LeaderboardUrlSettings {
|
||||
maneuverDetails.append('=');
|
||||
maneuverDetails.append(maneuverDetail.name());
|
||||
}
|
||||
StringBuilder showAddedScores = new StringBuilder();
|
||||
showAddedScores.append('&');
|
||||
showAddedScores.append(LeaderboardUrlSettings.PARAM_SHOW_ADDED_SCORES);
|
||||
showAddedScores.append('=');
|
||||
showAddedScores.append(settings.getLeaderboardSettings().isShowAddedScores());
|
||||
StringBuilder additionalOverallParams = new StringBuilder();
|
||||
additionalOverallParams.append('&');
|
||||
additionalOverallParams.append(LeaderboardUrlSettings.PARAM_SHOW_ADDED_SCORES);
|
||||
additionalOverallParams.append('=');
|
||||
additionalOverallParams.append(settings.getLeaderboardSettings().isShowAddedScores());
|
||||
if (!settings.getLeaderboardSettings().isShowCompetitorSailIdColumn() || !settings.getLeaderboardSettings().isShowCompetitorFullNameColumn()) {
|
||||
additionalOverallParams.append('&');
|
||||
additionalOverallParams.append(LeaderboardUrlSettings.PARAM_SHOW_COMPETITOR_NAME_COLUMNS);
|
||||
additionalOverallParams.append('=');
|
||||
if (settings.getLeaderboardSettings().isShowCompetitorSailIdColumn()) {
|
||||
additionalOverallParams.append(LeaderboardUrlSettings.COMPETITOR_NAME_COLUMN_SAIL_ID);
|
||||
} else if (settings.getLeaderboardSettings().isShowCompetitorFullNameColumn()) {
|
||||
additionalOverallParams.append(LeaderboardUrlSettings.COMPETITOR_NAME_COLUMN_FULL_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
String debugParam = Window.Location.getParameter("gwt.codesvr");
|
||||
String link = URLEncoder.encode("/gwt/Leaderboard.html?name=" + leaderboardName
|
||||
@@ -177,7 +187,7 @@ public class LeaderboardUrlSettings {
|
||||
+ (settings.isAutoExpandLastRaceColumn() ? "&"+LeaderboardUrlSettings.PARAM_AUTO_EXPAND_LAST_RACE_COLUMN+"=true" : "")
|
||||
+ (settings.getLeaderboardSettings().getNumberOfLastRacesToShow() == null ? "" :
|
||||
"&"+LeaderboardUrlSettings.PARAM_NAME_LAST_N+"="+settings.getLeaderboardSettings().getNumberOfLastRacesToShow())
|
||||
+ showAddedScores.toString()
|
||||
+ additionalOverallParams.toString()
|
||||
+ (debugParam != null && !debugParam.isEmpty() ? "&gwt.codesvr=" + debugParam : ""));
|
||||
return link;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user