mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-11 06:40:53 +00:00
first steps for filtering (selected course areas and regattas)
This commit is contained in:
1 parent
2f5af22dd3
commit
9e87684c0a
5 files changed
+48
-3
No files matched your search
+35
-1
@@ -112,12 +112,30 @@ public class RegattaRaceStatesComponent extends SimplePanel implements Component
|
||||
|
||||
private void updateTable(List<RegattaOverviewEntryDTO> newEntries) {
|
||||
allEntries = newEntries;
|
||||
List<RegattaOverviewEntryDTO> filteredEntries = getFilteredEntries(allEntries);
|
||||
regattaOverviewDataProvider.getList().clear();
|
||||
regattaOverviewDataProvider.getList().addAll(allEntries);
|
||||
// now sort again according to selected criterion
|
||||
ColumnSortEvent.fire(regattaOverviewTable, regattaOverviewTable.getColumnSortList());
|
||||
}
|
||||
|
||||
private List<RegattaOverviewEntryDTO> getFilteredEntries(List<RegattaOverviewEntryDTO> raceList) {
|
||||
List<RegattaOverviewEntryDTO> filteredEntries = new ArrayList<RegattaOverviewEntryDTO>(raceList);
|
||||
|
||||
for (RegattaOverviewEntryDTO entry : raceList) {
|
||||
if (!settings.getVisibleCourseAreas().contains(entry.courseAreaIdAsString)) {
|
||||
filteredEntries.remove(entry);
|
||||
continue;
|
||||
}
|
||||
if (!settings.getVisibleRegattas().contains(entry.regattaName)) {
|
||||
filteredEntries.remove(entry);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return filteredEntries;
|
||||
}
|
||||
|
||||
//TODO: Change all of this using a filter model
|
||||
private Collection<? extends RegattaOverviewEntryDTO> filterAndSort(List<RegattaOverviewEntryDTO> raceList) {
|
||||
List<RegattaOverviewEntryDTO> reversedUnfilterted = new ArrayList<RegattaOverviewEntryDTO>(raceList);
|
||||
@@ -453,7 +471,23 @@ public class RegattaRaceStatesComponent extends SimplePanel implements Component
|
||||
|
||||
@Override
|
||||
public void updateSettings(RegattaRaceStatesSettings newSettings) {
|
||||
// TODO: update the settings here
|
||||
if (!settings.getVisibleCourseAreas().containsAll(newSettings.getVisibleCourseAreas())) {
|
||||
settings.getVisibleCourseAreas().clear();
|
||||
settings.getVisibleCourseAreas().addAll(newSettings.getVisibleCourseAreas());
|
||||
}
|
||||
|
||||
if (!settings.getVisibleRegattas().containsAll(newSettings.getVisibleRegattas())) {
|
||||
settings.getVisibleRegattas().clear();
|
||||
settings.getVisibleRegattas().addAll(newSettings.getVisibleRegattas());
|
||||
}
|
||||
|
||||
if (settings.isShowOnlyRacesOfSameDay() == newSettings.isShowOnlyRacesOfSameDay()) {
|
||||
settings.setShowOnlyRaceOfSameDay(newSettings.isShowOnlyRacesOfSameDay());
|
||||
}
|
||||
|
||||
if (settings.isShowOnlyCurrentlyRunningRaces() == newSettings.isShowOnlyCurrentlyRunningRaces()) {
|
||||
settings.setShowOnlyCurrentlyRunningRaces(newSettings.isShowOnlyCurrentlyRunningRaces());
|
||||
}
|
||||
updateTable(allEntries);
|
||||
}
|
||||
|
||||
|
||||
+9
-1
@@ -28,7 +28,7 @@ public class RegattaRaceStatesSettings {
|
||||
public List<String> getVisibleCourseAreas() {
|
||||
return visibleCourseAreas;
|
||||
}
|
||||
|
||||
|
||||
public List<String> getVisibleRegattas() {
|
||||
return visibleRegattas;
|
||||
}
|
||||
@@ -37,7 +37,15 @@ public class RegattaRaceStatesSettings {
|
||||
return showOnlyRacesOfSameDay;
|
||||
}
|
||||
|
||||
public void setShowOnlyRaceOfSameDay(boolean newValue) {
|
||||
showOnlyRacesOfSameDay = newValue;
|
||||
}
|
||||
|
||||
public boolean isShowOnlyCurrentlyRunningRaces() {
|
||||
return showOnlyCurrentlyRunningRaces;
|
||||
}
|
||||
|
||||
public void setShowOnlyCurrentlyRunningRaces(boolean newValue) {
|
||||
showOnlyCurrentlyRunningRaces = newValue;
|
||||
}
|
||||
}
|
||||
+2
@@ -2398,6 +2398,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
public List<RegattaOverviewEntryDTO> getRegattaOverviewEntriesForEvent(String eventIdAsString) {
|
||||
List<RegattaOverviewEntryDTO> result = new ArrayList<RegattaOverviewEntryDTO>();
|
||||
Event event = getService().getEvent(convertIdentifierStringToUuid(eventIdAsString));
|
||||
|
||||
if (event != null) {
|
||||
for (CourseArea courseArea : event.getVenue().getCourseAreas()) {
|
||||
for (Leaderboard leaderboard : getService().getLeaderboards().values()) {
|
||||
@@ -2407,6 +2408,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
for (Fleet fleet : raceColumn.getFleets()) {
|
||||
RegattaOverviewEntryDTO entry = new RegattaOverviewEntryDTO();
|
||||
entry.courseAreaName = courseArea.getName();
|
||||
entry.courseAreaIdAsString = courseArea.getId().toString();
|
||||
entry.regattaName = regattaName;
|
||||
entry.raceInfo = createRaceInfoDTO(raceColumn, fleet);
|
||||
result.add(entry);
|
||||
|
||||
+1
@@ -6,6 +6,7 @@ import com.sap.sailing.domain.common.dto.NamedDTO;
|
||||
public class CourseAreaDTO extends NamedDTO implements IsSerializable {
|
||||
private static final long serialVersionUID = -5279690838452265454L;
|
||||
public String id;
|
||||
|
||||
public CourseAreaDTO() {
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -3,10 +3,10 @@ package com.sap.sailing.gwt.ui.shared;
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class RegattaOverviewEntryDTO implements IsSerializable {
|
||||
public String courseAreaIdAsString;
|
||||
public String courseAreaName;
|
||||
public String regattaName;
|
||||
public RaceInfoDTO raceInfo;
|
||||
|
||||
|
||||
// for GWT serialization
|
||||
public RegattaOverviewEntryDTO() { }
|
||||
|
||||
Reference in new issue
Block a user