mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-08 13:20:57 +00:00
Merge branch 'master' into bug3700
This commit is contained in:
commit
b5f4cc3128
12 files changed
+107
-32
No files matched your search
+1
-1
@@ -31,7 +31,7 @@ public class LeaderboardDTO extends AbstractLeaderboardDTO implements Serializab
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* The competitor list, ordered ascending by total rank
|
||||
* The competitor list, ordered ascending by total rank, suppressed competitors removed
|
||||
*/
|
||||
public List<CompetitorDTO> competitors;
|
||||
|
||||
|
||||
+6
@@ -610,11 +610,17 @@ public abstract class AbstractSimpleLeaderboardImpl implements Leaderboard, Race
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* suppressed competitors are removed from the result
|
||||
*/
|
||||
@Override
|
||||
public List<Competitor> getCompetitorsFromBestToWorst(TimePoint timePoint) {
|
||||
return getCompetitorsFromBestToWorst(getRaceColumns(), timePoint);
|
||||
}
|
||||
|
||||
/**
|
||||
* suppressed competitors are removed from the result
|
||||
*/
|
||||
private List<Competitor> getCompetitorsFromBestToWorst(Iterable<RaceColumn> raceColumnsToConsider, TimePoint timePoint) {
|
||||
List<Competitor> result = new ArrayList<Competitor>();
|
||||
for (Competitor competitor : getCompetitors()) {
|
||||
|
||||
+1
-1
@@ -427,7 +427,7 @@ public class EventListComposite extends Composite implements EventsRefresher, Le
|
||||
return e1.venue.getCourseAreas().toString().compareTo(e2.venue.getCourseAreas().toString());
|
||||
}
|
||||
});
|
||||
result.setComparator(courseAreasColumn, new Comparator<EventDTO>() {
|
||||
result.setComparator(leaderboardGroupsColumn, new Comparator<EventDTO>() {
|
||||
@Override
|
||||
public int compare(EventDTO e1, EventDTO e2) {
|
||||
return e1.getLeaderboardGroups().toString().compareTo(e2.getLeaderboardGroups().toString());
|
||||
|
||||
+2
-2
@@ -206,8 +206,8 @@ public class RegattaListComposite extends Composite implements RegattasDisplayer
|
||||
return regatta.rankingMetricType != null ? RankingMetricTypeFormatter.format(regatta.rankingMetricType, stringMessages) : "";
|
||||
}
|
||||
};
|
||||
regattaBoatClassColumn.setSortable(true);
|
||||
columnSortHandler.setComparator(regattaBoatClassColumn, new Comparator<RegattaDTO>() {
|
||||
rankingMetricColumn.setSortable(true);
|
||||
columnSortHandler.setComparator(rankingMetricColumn, new Comparator<RegattaDTO>() {
|
||||
@Override
|
||||
public int compare(RegattaDTO r1, RegattaDTO r2) {
|
||||
return new NaturalComparator(false).compare(r1.rankingMetricType.name(), r2.rankingMetricType.name());
|
||||
|
||||
+5
-6
@@ -123,8 +123,10 @@ public class RaceCompetitorSet extends RaceCompetitorIdsAsStringWithMD5Hash {
|
||||
|
||||
/**
|
||||
* Tries to locate the competitors described by the IDs in {@link #idsAsStringOfCompetitorsParticipatingInRace} in
|
||||
* <code>competitors</code> and returns them in a set. If not all competitors can be found, <code>null</code> is
|
||||
* returned instead.
|
||||
* <code>competitors</code> and returns them in a set. The subset of competitors found this way is returned.
|
||||
* Note that due to the possibility of suppressing competitors it is possible that competitors are listed
|
||||
* as entries in the race but cannot be resolved in the leaderboard's competitors which does not contain
|
||||
* those being suppressed.
|
||||
*/
|
||||
private Set<CompetitorDTO> computeCompetitorsFromIDs(Iterable<CompetitorDTO> competitors) {
|
||||
Set<CompetitorDTO> result;
|
||||
@@ -138,10 +140,7 @@ public class RaceCompetitorSet extends RaceCompetitorIdsAsStringWithMD5Hash {
|
||||
result = new HashSet<>();
|
||||
for (String id : getIdsOfCompetitorsParticipatingInRaceAsStrings()) {
|
||||
CompetitorDTO c = competitorsByIdAsString.get(id);
|
||||
if (c == null) {
|
||||
result = null;
|
||||
break;
|
||||
} else {
|
||||
if (c != null) {
|
||||
result.add(c);
|
||||
}
|
||||
}
|
||||
|
||||
+7
-12
@@ -8,17 +8,12 @@ import java.util.Set;
|
||||
import com.google.gwt.view.client.MultiSelectionModel;
|
||||
import com.google.gwt.view.client.ProvidesKey;
|
||||
import com.google.gwt.view.client.SelectionChangeEvent;
|
||||
import com.google.gwt.view.client.SelectionModel.AbstractSelectionModel;
|
||||
import com.google.gwt.view.client.SetSelectionModel;
|
||||
|
||||
/**
|
||||
* A multi selection model, that allows to block the selection change notifications.<br>
|
||||
* This is a copy of {@link MultiSelectionModel}, because the implementation of <code>MultiSelectionModel</code>
|
||||
* wasn't open enough.
|
||||
* A multi selection model, that allows to block the selection change notifications.
|
||||
* @author Lennart Hensler (D054527)
|
||||
*/
|
||||
public class ControllableMultiSelectionModel<T> extends AbstractSelectionModel<T>
|
||||
implements SetSelectionModel<T> {
|
||||
public class ControllableMultiSelectionModel<T> extends MultiSelectionModel<T> {
|
||||
|
||||
// Ensure one value per key
|
||||
private final Map<Object, T> selectedSet;
|
||||
@@ -80,13 +75,13 @@ public class ControllableMultiSelectionModel<T> extends AbstractSelectionModel<T
|
||||
*/
|
||||
@Override
|
||||
public Set<T> getSelectedSet() {
|
||||
resolveChanges();
|
||||
determineChanges();
|
||||
return new HashSet<T>(selectedSet.values());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelected(T item) {
|
||||
resolveChanges();
|
||||
determineChanges();
|
||||
return selectedSet.containsKey(getKey(item));
|
||||
}
|
||||
|
||||
@@ -101,7 +96,7 @@ public class ControllableMultiSelectionModel<T> extends AbstractSelectionModel<T
|
||||
if (!blockNotifications) {
|
||||
super.scheduleSelectionChangeEvent();
|
||||
} else {
|
||||
resolveChanges();
|
||||
determineChanges();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,10 +105,10 @@ public class ControllableMultiSelectionModel<T> extends AbstractSelectionModel<T
|
||||
if (isEventScheduled()) {
|
||||
setEventCancelled(true);
|
||||
}
|
||||
resolveChanges();
|
||||
determineChanges();
|
||||
}
|
||||
|
||||
private void resolveChanges() {
|
||||
private void determineChanges() {
|
||||
if (selectionChanges.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
.cellTableCell {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.cellTableFirstColumn {
|
||||
width: 1px;
|
||||
padding: 2px 0 2px 3px;
|
||||
}
|
||||
|
||||
.cellTableHoveredRow {
|
||||
cursor: default;
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package com.sap.sailing.gwt.ui.datamining.selection.filter;
|
||||
|
||||
import com.google.gwt.user.cellview.client.CellTable;
|
||||
|
||||
public interface FilterTableResources extends CellTable.Resources {
|
||||
|
||||
@Source({ CellTable.Style.DEFAULT_CSS, "FilterTable.css" })
|
||||
FilterTableStyle cellTableStyle();
|
||||
|
||||
interface FilterTableStyle extends CellTable.Style {
|
||||
}
|
||||
}
|
||||
+54
-9
@@ -6,11 +6,19 @@ import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.gwt.cell.client.CheckboxCell;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.BrowserEvents;
|
||||
import com.google.gwt.dom.client.NativeEvent;
|
||||
import com.google.gwt.user.cellview.client.CellTable;
|
||||
import com.google.gwt.user.cellview.client.Column;
|
||||
import com.google.gwt.user.cellview.client.TextColumn;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.google.gwt.view.client.CellPreviewEvent;
|
||||
import com.google.gwt.view.client.DefaultSelectionEventManager;
|
||||
import com.google.gwt.view.client.DefaultSelectionEventManager.SelectAction;
|
||||
import com.google.gwt.view.client.ListDataProvider;
|
||||
import com.google.gwt.view.client.ProvidesKey;
|
||||
import com.google.gwt.view.client.SelectionChangeEvent;
|
||||
@@ -36,7 +44,8 @@ public class FilterableSelectionTable<ContentType extends Serializable> {
|
||||
|
||||
allData = new ArrayList<ContentType>();
|
||||
|
||||
table = new BaseCelltable<>(Integer.MAX_VALUE);
|
||||
FilterTableResources tableRes = GWT.create(FilterTableResources.class);
|
||||
table = new BaseCelltable<>(Integer.MAX_VALUE, tableRes);
|
||||
table.setWidth("100%");
|
||||
table.setAutoHeaderRefreshDisabled(true);
|
||||
table.setAutoFooterRefreshDisabled(true);
|
||||
@@ -48,16 +57,15 @@ public class FilterableSelectionTable<ContentType extends Serializable> {
|
||||
}
|
||||
};
|
||||
contentColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
|
||||
table.addColumn(contentColumn);
|
||||
|
||||
selectionModel = new ControllableMultiSelectionModel<ContentType>();
|
||||
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
|
||||
|
||||
selectionModel = new ControllableMultiSelectionModel<>();
|
||||
final Column<ContentType, Boolean> checkColumn = new Column<ContentType, Boolean>(
|
||||
new CheckboxCell(true, false)) {
|
||||
@Override
|
||||
public void onSelectionChange(SelectionChangeEvent event) {
|
||||
notifyListeners();
|
||||
public Boolean getValue(ContentType object) {
|
||||
return selectionModel.isSelected(object);
|
||||
}
|
||||
});
|
||||
table.setSelectionModel(selectionModel);
|
||||
};
|
||||
|
||||
dataProvider = new ListDataProvider<ContentType>(new ProvidesKey<ContentType>() {
|
||||
@Override
|
||||
@@ -67,6 +75,43 @@ public class FilterableSelectionTable<ContentType extends Serializable> {
|
||||
});
|
||||
dataProvider.addDataDisplay(table);
|
||||
|
||||
table.addColumn(checkColumn);
|
||||
table.addColumn(contentColumn);
|
||||
|
||||
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
|
||||
@Override
|
||||
public void onSelectionChange(SelectionChangeEvent event) {
|
||||
notifyListeners();
|
||||
}
|
||||
});
|
||||
table.setSelectionModel(selectionModel, DefaultSelectionEventManager.<ContentType> createCustomManager(
|
||||
new DefaultSelectionEventManager.CheckboxEventTranslator<ContentType>() {
|
||||
@Override
|
||||
public boolean clearCurrentSelection(CellPreviewEvent<ContentType> event) {
|
||||
return !isCheckboxColumn(event.getColumn());
|
||||
}
|
||||
|
||||
@Override
|
||||
public SelectAction translateSelectionEvent(CellPreviewEvent<ContentType> event) {
|
||||
NativeEvent nativeEvent = event.getNativeEvent();
|
||||
if (BrowserEvents.CLICK.equals(nativeEvent.getType())) {
|
||||
if (nativeEvent.getCtrlKey()) {
|
||||
ContentType value = event.getValue();
|
||||
selectionModel.setSelected(value, !selectionModel.isSelected(value));
|
||||
return SelectAction.IGNORE;
|
||||
}
|
||||
if (!selectionModel.getSelectedSet().isEmpty() && !isCheckboxColumn(event.getColumn())) {
|
||||
return SelectAction.DEFAULT;
|
||||
}
|
||||
}
|
||||
return SelectAction.TOGGLE;
|
||||
}
|
||||
|
||||
private boolean isCheckboxColumn(int columnIndex) {
|
||||
return columnIndex == table.getColumnIndex(checkColumn);
|
||||
}
|
||||
}));
|
||||
|
||||
filterPanel = new AbstractFilterablePanel<ContentType>(allData, table, dataProvider) {
|
||||
@Override
|
||||
public Iterable<String> getSearchableStrings(ContentType content) {
|
||||
|
||||
+1
-1
@@ -131,8 +131,8 @@ public class WinningLanesMode extends RaceBoardModeWithPerRaceCompetitors {
|
||||
if (!adjustedCompetitorSelection && getLeaderboardForSpecificTimePoint() != null && getCompetitorsInRace() != null) {
|
||||
stopReceivingCompetitorsInRace();
|
||||
adjustedCompetitorSelection = true;
|
||||
updateCompetitorSelection();
|
||||
}
|
||||
updateCompetitorSelection();
|
||||
}
|
||||
|
||||
}
|
||||
+5
@@ -15,5 +15,10 @@ public class RaceMapDataDTO implements IsSerializable {
|
||||
public LinkedHashMap<CompetitorDTO, QuickRankDTO> quickRanks;
|
||||
public LinkedHashMap<CompetitorDTO, Integer> competitorsInOrderOfWindwardDistanceTraveledWithOneBasedLegNumber;
|
||||
public long simulationResultVersion;
|
||||
|
||||
/**
|
||||
* The competitor IDs in their {@link Object#toString()} representation, for all competitors in the race, including those
|
||||
* that may be suppressed in a leaderboard.
|
||||
*/
|
||||
public HashSet<String> raceCompetitorIdsAsStrings;
|
||||
}
|
||||
+1
@@ -77,6 +77,7 @@ public class SensorDataImportServlet extends AbstractFileUploadServlet {
|
||||
}
|
||||
}
|
||||
if (importerToUse == null) {
|
||||
in.close();
|
||||
throw new RuntimeException("Sensor importer not found");
|
||||
}
|
||||
in.mark(READ_BUFFER_SIZE);
|
||||
|
||||
Reference in new issue
Block a user