mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-27 14:27:15 +00:00
Races lists - Adjusted columns and added fields for wind fixes, video
and audio to races list DTO
This commit is contained in:
1 parent
746683f097
commit
59f6da4ebd
2 files changed
+35
-16
No files matched your search
+14
-14
@@ -351,29 +351,29 @@ public class RaceListColumnFactory {
|
||||
};
|
||||
}
|
||||
|
||||
public static <T extends RaceListRaceDTO> SortableRaceListColumn<T, Long> getWindFixesCountColumn() {
|
||||
public static <T extends RaceListRaceDTO> SortableRaceListColumn<T, Number> getWindFixesCountColumn() {
|
||||
return new DataCountColumn<T>(DataCountColumn.ICON_WIND) {
|
||||
@Override
|
||||
public Long getValue(T object) {
|
||||
return null; // TODO
|
||||
public Number getValue(T object) {
|
||||
return object.getWindFixesCount();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static <T extends RaceListRaceDTO> SortableRaceListColumn<T, Long> getVideoCountColumn() {
|
||||
public static <T extends RaceListRaceDTO> SortableRaceListColumn<T, Number> getVideoCountColumn() {
|
||||
return new DataCountColumn<T>(DataCountColumn.ICON_VIDEO) {
|
||||
@Override
|
||||
public Long getValue(T object) {
|
||||
return null; // TODO
|
||||
public Number getValue(T object) {
|
||||
return object.getVideoCount();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static <T extends RaceListRaceDTO> SortableRaceListColumn<T, Long> getAudioCountColumn() {
|
||||
public static <T extends RaceListRaceDTO> SortableRaceListColumn<T, Number> getAudioCountColumn() {
|
||||
return new DataCountColumn<T>(DataCountColumn.ICON_AUDIO) {
|
||||
@Override
|
||||
public Long getValue(T object) {
|
||||
return null; // TODO
|
||||
public Number getValue(T object) {
|
||||
return object.getAudioCount();
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -508,17 +508,17 @@ public class RaceListColumnFactory {
|
||||
};
|
||||
}
|
||||
|
||||
private static abstract class DataCountColumn<T extends RaceListRaceDTO> extends SortableRaceListColumn<T, Long> {
|
||||
private static abstract class DataCountColumn<T extends RaceListRaceDTO> extends SortableRaceListColumn<T, Number> {
|
||||
private static final SafeUri ICON_WIND = UriUtils.fromTrustedString("images/home/icon-wind.png");
|
||||
private static final SafeUri ICON_VIDEO = UriUtils.fromTrustedString("images/home/icon-video.png");
|
||||
private static final SafeUri ICON_AUDIO = UriUtils.fromTrustedString("images/home/icon-audio.png");
|
||||
|
||||
private DataCountColumn(final SafeUri imageUri) {
|
||||
super(new SafeHtmlHeader(TEMPLATE.imageHeader(CSS.raceslist_head_itemflag(), imageUri)), new AbstractCell<Long>() {
|
||||
super(new SafeHtmlHeader(TEMPLATE.imageHeader(CSS.raceslist_head_itemflag(), imageUri)), new AbstractCell<Number>() {
|
||||
@Override
|
||||
public void render(Context context, Long value, SafeHtmlBuilder sb) {
|
||||
if (value != null && value > 0) {
|
||||
sb.append(value);
|
||||
public void render(Context context, Number value, SafeHtmlBuilder sb) {
|
||||
if (value != null && value.longValue() > 0) {
|
||||
sb.append(value.longValue());
|
||||
} else {
|
||||
sb.appendHtmlConstant("—");
|
||||
}
|
||||
|
||||
+21
-2
@@ -8,7 +8,9 @@ public class RaceListRaceDTO extends RaceMetadataDTO {
|
||||
|
||||
private Duration duration;
|
||||
private CompetitorDTO winner;
|
||||
// TODO: fields for wind(!?), video and audio counters
|
||||
private int windFixesCount;
|
||||
private int videoCount;
|
||||
private int audioCount;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private RaceListRaceDTO() {
|
||||
@@ -30,5 +32,22 @@ public class RaceListRaceDTO extends RaceMetadataDTO {
|
||||
public void setWinner(CompetitorDTO winner) {
|
||||
this.winner = winner;
|
||||
}
|
||||
|
||||
public int getWindFixesCount() {
|
||||
return windFixesCount;
|
||||
}
|
||||
public void setWindFixesCount(int windFixesCount) {
|
||||
this.windFixesCount = windFixesCount;
|
||||
}
|
||||
public int getVideoCount() {
|
||||
return videoCount;
|
||||
}
|
||||
public void setVideoCount(int videoCount) {
|
||||
this.videoCount = videoCount;
|
||||
}
|
||||
public int getAudioCount() {
|
||||
return audioCount;
|
||||
}
|
||||
public void setAudioCount(int audioCount) {
|
||||
this.audioCount = audioCount;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user