mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-08 13:20:57 +00:00
implemented usage of boat class images to regatta list
This commit is contained in:
1 parent
7166194b85
commit
ed5e1cb144
12 files changed
+49
-19
No files matched your search
+4
-2
@@ -41,8 +41,10 @@ public abstract class AbstractLeaderboardDTO implements Serializable {
|
||||
|
||||
public Set<BoatClassDTO> getBoatClasses() {
|
||||
Set<BoatClassDTO> result = new HashSet<BoatClassDTO>();
|
||||
for (CompetitorDTO competitor : rows.keySet()) {
|
||||
result.add(competitor.getBoatClass());
|
||||
if(rows != null) {
|
||||
for (CompetitorDTO competitor : rows.keySet()) {
|
||||
result.add(competitor.getBoatClass());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
+11
@@ -5,15 +5,26 @@ import java.io.Serializable;
|
||||
public class BoatClassDTO extends NamedDTO implements Serializable {
|
||||
private static final long serialVersionUID = 1981789833769906676L;
|
||||
private double hullLengthInMeters;
|
||||
private String displayName;
|
||||
|
||||
BoatClassDTO() {}
|
||||
|
||||
public BoatClassDTO(String name, String displayName, double hullLengthInMeters) {
|
||||
super(name);
|
||||
this.hullLengthInMeters = hullLengthInMeters;
|
||||
}
|
||||
|
||||
public BoatClassDTO(String name, double hullLengthInMeters) {
|
||||
super(name);
|
||||
this.hullLengthInMeters = hullLengthInMeters;
|
||||
this.displayName = null;
|
||||
}
|
||||
|
||||
public double getHullLengthInMeters() {
|
||||
return hullLengthInMeters;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
}
|
||||
+4
-2
@@ -38,11 +38,13 @@ public interface BoatClass extends Named, IsManagedBySharedDomainFactory {
|
||||
* start with a non-upwind leg even though this method returns <code>true</code>.
|
||||
*/
|
||||
boolean typicallyStartsUpwind();
|
||||
|
||||
|
||||
String getDisplayName();
|
||||
|
||||
Distance getHullLength();
|
||||
|
||||
Distance getHullBeam();
|
||||
|
||||
|
||||
BoatHullType getHullType();
|
||||
|
||||
/**
|
||||
|
||||
+1
-5
@@ -48,9 +48,7 @@ public class BoatClassImpl extends NamedImpl implements BoatClass {
|
||||
|
||||
public BoatClassImpl(String name, boolean typicallyStartsUpwind) {
|
||||
this(name, typicallyStartsUpwind, /* displayName */ null,
|
||||
/* hull length */ name.toLowerCase().contains("extreme") && name.contains("40")
|
||||
? new MeterDistance(40*12*2.54/100)
|
||||
: new MeterDistance(5), /* hullBeam */ null, /* hullType */ null);
|
||||
/* hull length */ new MeterDistance(5), /* hullBeam */ null, /* hullType */ null);
|
||||
}
|
||||
|
||||
public BoatClassImpl(String name, BoatClassMasterdata masterData) {
|
||||
@@ -58,8 +56,6 @@ public class BoatClassImpl extends NamedImpl implements BoatClass {
|
||||
masterData.getHullBeam(), masterData.getHullType());
|
||||
}
|
||||
|
||||
// return new BoatClassImpl(boatClassName, typicallyStartsUpwind, displayName, hullLengthInMeter, hullBeamInMeter, hullType);
|
||||
|
||||
public BoatClassImpl(String name, boolean typicallyStartsUpwind, String displayName,
|
||||
Distance hullLength, Distance hullBeam, BoatHullType hullType) {
|
||||
super(name);
|
||||
|
||||
+1
-1
@@ -219,7 +219,7 @@ public class TransientCompetitorStoreImpl implements CompetitorStore, Serializab
|
||||
: countryCode.getTwoLetterISOCode(), countryCode == null ? ""
|
||||
: countryCode.getThreeLetterIOCCode(), countryCode == null ? "" : countryCode.getName(), c
|
||||
.getBoat().getSailID(), c.getId().toString(), new BoatClassDTO(c.getBoat().getBoatClass()
|
||||
.getName(), c.getBoat().getBoatClass().getHullLength().getMeters()));
|
||||
.getName(), c.getBoat().getBoatClass().getDisplayName(), c.getBoat().getBoatClass().getHullLength().getMeters()));
|
||||
weakCompetitorDTOCache.put(c, competitorDTO);
|
||||
}
|
||||
}
|
||||
|
||||
+3
@@ -7,6 +7,9 @@ import com.google.gwt.resources.client.ImageResource;
|
||||
public interface BoatClassImageResources extends ClientBundle {
|
||||
public static final BoatClassImageResources INSTANCE = GWT.create(BoatClassImageResources.class);
|
||||
|
||||
@Source("com/sap/sailing/gwt/ui/client/images/boatclass/GENERIC_BOATCLASS.png")
|
||||
ImageResource genericBoatClass();
|
||||
|
||||
@Source("com/sap/sailing/gwt/ui/client/images/boatclass/12MR.png")
|
||||
ImageResource _12mRIcon();
|
||||
|
||||
|
||||
+14
-5
@@ -15,7 +15,10 @@ import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.Event;
|
||||
import com.google.gwt.user.client.EventListener;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.gwt.home.client.BoatClassImageResolver;
|
||||
import com.sap.sailing.gwt.home.client.BoatClassImageResources;
|
||||
import com.sap.sailing.gwt.home.client.place.event.EventPageNavigator;
|
||||
import com.sap.sailing.gwt.home.client.shared.LongNamesUtil;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDTO;
|
||||
@@ -31,6 +34,7 @@ public class Regatta extends Composite {
|
||||
interface RegattaUiBinder extends UiBinder<Widget, Regatta> {
|
||||
}
|
||||
|
||||
private final boolean isNavigatable;
|
||||
private final EventDTO event;
|
||||
private final Timer timerForClientServerOffset;
|
||||
private final EventPageNavigator pageNavigator;
|
||||
@@ -64,11 +68,14 @@ public class Regatta extends Composite {
|
||||
|
||||
@UiField DivElement regattaImageWithoutLink;
|
||||
@UiField AnchorElement regattaImageWithLink;
|
||||
|
||||
@UiField AnchorElement regattaNameLink;
|
||||
|
||||
@UiField Image boatClassImage1;
|
||||
@UiField Image boatClassImage2;
|
||||
|
||||
public Regatta(EventDTO event, boolean isNavigatable, Timer timerForClientServerOffset, EventPageNavigator pageNavigator) {
|
||||
this.event = event;
|
||||
this.isNavigatable = isNavigatable;
|
||||
this.timerForClientServerOffset = timerForClientServerOffset;
|
||||
this.pageNavigator = pageNavigator;
|
||||
|
||||
@@ -105,10 +112,12 @@ public class Regatta extends Composite {
|
||||
isLiveDiv.getStyle().setDisplay(Display.NONE);
|
||||
}
|
||||
|
||||
boolean isFinished = !hasLiveRace;
|
||||
if(!isFinished) {
|
||||
// isFinishedDiv.getStyle().setDisplay(Display.NONE);
|
||||
// isFinishedDiv2.getStyle().setDisplay(Display.NONE);
|
||||
// boolean isFinished... TODO
|
||||
Image boatClassImageToSet = isNavigatable ? boatClassImage1 : boatClassImage2;
|
||||
if(raceGroup.boatClass != null) {
|
||||
boatClassImageToSet.setResource(BoatClassImageResolver.getBoatClassIconResource(raceGroup.boatClass));
|
||||
} else {
|
||||
boatClassImageToSet.setResource(BoatClassImageResources.INSTANCE.genericBoatClass());
|
||||
}
|
||||
|
||||
String regattaDisplayName = leaderboard.displayName != null ? leaderboard.displayName : leaderboard.name;
|
||||
|
||||
+2
-2
@@ -12,10 +12,10 @@
|
||||
<div class="{res.mediaCss.small12} {res.mediaCss.columns}">
|
||||
<div class="{local_res.css.regatta_intro}">
|
||||
<a href="javascript:;" ui:field="regattaImageWithLink">
|
||||
<img src="images/home/regatta-boatclass_sample.png" alt="" height="140" width="140" class="{local_res.css.regatta_intro_image}"></img>
|
||||
<g:Image ui:field="boatClassImage1" height="140" width="140" styleName="{local_res.css.regatta_intro_image}"></g:Image>
|
||||
</a>
|
||||
<div ui:field="regattaImageWithoutLink">
|
||||
<img src="images/home/regatta-boatclass_sample.png" alt="" height="140" width="140" class="{local_res.css.regatta_intro_image}"></img>
|
||||
<g:Image ui:field="boatClassImage2" height="140" width="140" styleName="{local_res.css.regatta_intro_image}"></g:Image>
|
||||
</div>
|
||||
<div class="{local_res.css.regatta_intro_header}">
|
||||
<div class="{res.mainCss.grid}">
|
||||
|
||||
+7
-1
@@ -777,7 +777,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
regattaDTO.series = convertToSeriesDTOs(regatta);
|
||||
BoatClass boatClass = regatta.getBoatClass();
|
||||
if (boatClass != null) {
|
||||
regattaDTO.boatClass = new BoatClassDTO(boatClass.getName(), boatClass.getHullLength().getMeters());
|
||||
regattaDTO.boatClass = new BoatClassDTO(boatClass.getName(), boatClass.getDisplayName(), boatClass.getHullLength().getMeters());
|
||||
}
|
||||
if (regatta.getDefaultCourseArea() != null) {
|
||||
regattaDTO.defaultCourseAreaUuid = regatta.getDefaultCourseArea().getId();
|
||||
@@ -3320,6 +3320,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
}
|
||||
if (leaderboard instanceof RegattaLeaderboard) {
|
||||
RegattaLeaderboard regattaLeaderboard = (RegattaLeaderboard) leaderboard;
|
||||
raceGroup.boatClass = regattaLeaderboard.getRegatta().getBoatClass().getDisplayName();
|
||||
for (Series series : regattaLeaderboard.getRegatta().getSeries()) {
|
||||
RaceGroupSeriesDTO seriesDTO = new RaceGroupSeriesDTO(series.getName());
|
||||
raceGroup.getSeries().add(seriesDTO);
|
||||
@@ -3335,6 +3336,11 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
FleetDTO fleetDTO = new FleetDTO(LeaderboardNameConstants.DEFAULT_FLEET_NAME, 0, null);
|
||||
seriesDTO.getFleets().add(fleetDTO);
|
||||
seriesDTO.getRaceColumns().addAll(convertToRaceColumnDTOs(leaderboard.getRaceColumns()));
|
||||
for(Competitor c: leaderboard.getCompetitors()) {
|
||||
if(c.getBoat() != null && c.getBoat().getBoatClass() != null) {
|
||||
raceGroup.boatClass = c.getBoat().getBoatClass().getDisplayName();
|
||||
}
|
||||
}
|
||||
}
|
||||
raceGroups.add(raceGroup);
|
||||
}
|
||||
|
||||
+1
-1
@@ -320,7 +320,7 @@ public class SimulatorServiceImpl extends RemoteServiceServlet implements Simula
|
||||
}
|
||||
|
||||
for (BoatClassProperties tuple : ConfigurationManager.INSTANCE.getBoatClassesInfo()) {
|
||||
boatClassesDTOs.add(new BoatClassDTO(tuple.getName(), tuple.getLength()));
|
||||
boatClassesDTOs.add(new BoatClassDTO(tuple.getName(), null, tuple.getLength()));
|
||||
}
|
||||
|
||||
result.setBoatClassDTOs(boatClassesDTOs.toArray(new BoatClassDTO[boatClassesDTOs.size()]));
|
||||
|
||||
+1
@@ -12,6 +12,7 @@ public class RaceGroupDTO extends NamedDTO implements IsSerializable {
|
||||
public String courseAreaIdAsString;
|
||||
public String displayName;
|
||||
public String leaderboardGroupName;
|
||||
public String boatClass;
|
||||
private List<RaceGroupSeriesDTO> series = new ArrayList<RaceGroupSeriesDTO>();
|
||||
|
||||
public RaceGroupDTO() {}
|
||||
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
Reference in new issue
Block a user