mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-27 14:27:15 +00:00
Races lists - Added duration column
This commit is contained in:
1 parent
2a4d2e1956
commit
3d7b890acf
2 files changed
+35
-4
No files matched your search
+28
@@ -33,6 +33,7 @@ import com.sap.sailing.gwt.regattaoverview.client.FlagsMeaningExplanator;
|
||||
import com.sap.sailing.gwt.regattaoverview.client.SailingFlagsBuilder;
|
||||
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.common.client.DateAndTimeFormatterUtil;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.event.LiveRaceDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.event.RaceListRaceDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.event.SimpleCompetitorDTO;
|
||||
@@ -44,6 +45,7 @@ import com.sap.sailing.gwt.ui.shared.race.RaceMetadataDTO.RaceViewState;
|
||||
import com.sap.sailing.gwt.ui.shared.race.RaceProgressDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.race.SimpleWindDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.util.NullSafeComparableComparator;
|
||||
import com.sap.sse.common.Duration;
|
||||
import com.sap.sse.common.Util;
|
||||
import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
|
||||
@@ -207,6 +209,32 @@ public class RaceListColumnFactory {
|
||||
};
|
||||
}
|
||||
|
||||
public static <T extends RaceListRaceDTO> SortableRaceListColumn<T, String> getDurationColumn() {
|
||||
Cell<String> cell = new TextCell();
|
||||
InvertibleComparator<T> comparator = new InvertibleComparatorWrapper<T, Duration>(new NullSafeComparableComparator<Duration>(false)) {
|
||||
@Override
|
||||
protected Duration getComparisonValue(T object) {
|
||||
return object.getDuration();
|
||||
}
|
||||
};
|
||||
return new SortableRaceListColumn<T, String>(I18N.durationPlain(), cell, comparator) {
|
||||
@Override
|
||||
public String getHeaderStyle() {
|
||||
return getStyleNamesString(CSS.raceslist_head_item(), MEDIA_CSS.showonlarge());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnStyle() {
|
||||
return getStyleNamesString(CSS.race_item(), MEDIA_CSS.showonlarge());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue(T object) {
|
||||
return object.getDuration() != null ? DateAndTimeFormatterUtil.formatElapsedTime(object.getDuration().asMillis()) : null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static <T extends LiveRaceDTO> SortableRaceListColumn<T, FlagStateDTO> getFlagsColumn() {
|
||||
Cell<FlagStateDTO> cell = new AbstractCell<FlagStateDTO>() {
|
||||
@Override
|
||||
|
||||
+7
-4
@@ -25,6 +25,7 @@ import com.sap.sailing.gwt.home.client.place.event.partials.racelist.RaceListCon
|
||||
import com.sap.sailing.gwt.home.client.place.event.partials.racelist.SortableRaceListColumn;
|
||||
import com.sap.sailing.gwt.home.client.place.event.regatta.EventRegattaView.Presenter;
|
||||
import com.sap.sailing.gwt.home.client.place.event.regatta.RegattaTabView;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.ResultWithTTL;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.event.GetRaceListViewAction;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.event.RaceListRaceDTO;
|
||||
@@ -35,6 +36,8 @@ import com.sap.sailing.gwt.ui.shared.dispatch.event.RaceListViewDTO;
|
||||
*/
|
||||
public class RegattaRacesTabView extends Composite implements RegattaTabView<RegattaRacesPlace> {
|
||||
|
||||
private static final StringMessages I18N = StringMessages.INSTANCE;
|
||||
|
||||
private enum Navigation implements ListNavigationAction {
|
||||
SORT_LIST_FORMAT("Sortable list Format TODO", false),
|
||||
COMPETITION_FORMAT("Competition Format TODO", true);
|
||||
@@ -82,9 +85,7 @@ public class RegattaRacesTabView extends Composite implements RegattaTabView<Reg
|
||||
public void setPresenter(Presenter currentPresenter) {
|
||||
this.currentPresenter = currentPresenter;
|
||||
listFormatContainerUi.add(liveRacesList = new RacesListLive(currentPresenter, false));
|
||||
RaceListContainer<RaceListRaceDTO> container = new RaceListContainer<>("Finished Races TODO", finishedRacesList = new RaceListFinishedRaces(currentPresenter));
|
||||
container.setInfoText("Info text");
|
||||
listFormatContainerUi.add(container);
|
||||
listFormatContainerUi.add(new RaceListContainer<>(I18N.finishedRaces(), finishedRacesList = new RaceListFinishedRaces(currentPresenter)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -141,10 +142,11 @@ public class RegattaRacesTabView extends Composite implements RegattaTabView<Reg
|
||||
}
|
||||
|
||||
private class RaceListFinishedRaces extends AbstractRaceList<RaceListRaceDTO> {
|
||||
private final SortableRaceListColumn<RaceListRaceDTO, ?> winnerColumn = RaceListColumnFactory.getWinnerColumn();
|
||||
private final SortableRaceListColumn<RaceListRaceDTO, ?> durationColumn = RaceListColumnFactory.getDurationColumn();
|
||||
private final SortableRaceListColumn<RaceListRaceDTO, ?> windfixesCountColumn = RaceListColumnFactory.getWindFixesCountColumn();
|
||||
private final SortableRaceListColumn<RaceListRaceDTO, ?> videoCountColumn = RaceListColumnFactory.getVideoCountColumn();
|
||||
private final SortableRaceListColumn<RaceListRaceDTO, ?> audioCountColumn = RaceListColumnFactory.getAudioCountColumn();
|
||||
private final SortableRaceListColumn<RaceListRaceDTO, ?> winnerColumn = RaceListColumnFactory.getWinnerColumn();
|
||||
|
||||
public RaceListFinishedRaces(EventView.Presenter presenter) {
|
||||
super(presenter);
|
||||
@@ -166,6 +168,7 @@ public class RegattaRacesTabView extends Composite implements RegattaTabView<Reg
|
||||
add(raceNameColumn);
|
||||
add(fleetNameColumn);
|
||||
add(startTimeColumn);
|
||||
add(durationColumn);
|
||||
add(windSpeedColumn);
|
||||
add(windDirectionColumn);
|
||||
add(windfixesCountColumn);
|
||||
|
||||
Reference in new issue
Block a user