mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-10 22:30:56 +00:00
display in event/regatta/race tree whether a race is currently being tracked
This makes the "Remove" button slightly better to understand
This commit is contained in:
1 parent
d3af3b5845
commit
638fdcbd06
10 files changed
+57
-12
No files matched your search
Binary file not shown.
@@ -14,7 +14,8 @@ Require-Bundle: javax.servlet;bundle-version="2.5.0",
|
||||
com.sap.sailing.domain.tractracadapter,
|
||||
org.json.simple;bundle-version="1.1.0",
|
||||
com.sap.sailing.mongodb,
|
||||
com.mongodb.driver;bundle-version="2.6.2"
|
||||
com.mongodb.driver;bundle-version="2.6.2",
|
||||
com.sap.sailing.declination
|
||||
Bundle-ClassPath: war/WEB-INF/classes/,
|
||||
.
|
||||
Bundle-Activator: com.sap.sailing.gwt.ui.server.Activator
|
||||
|
||||
@@ -26,4 +26,6 @@ public interface SailingService extends RemoteService {
|
||||
void stopTrackingEvent(String eventName) throws Exception;
|
||||
|
||||
void stopTrackingRace(String eventName, String raceName) throws Exception;
|
||||
|
||||
void startTrackingWind(String eventName, String raceName, int port, boolean correctByDeclination) throws Exception;
|
||||
}
|
||||
@@ -25,4 +25,7 @@ public interface SailingServiceAsync {
|
||||
void stopTrackingEvent(String eventName, AsyncCallback<Void> callback);
|
||||
|
||||
void stopTrackingRace(String eventName, String raceName, AsyncCallback<Void> asyncCallback);
|
||||
|
||||
void startTrackingWind(String eventName, String raceName, int port, boolean correctDeclination,
|
||||
AsyncCallback<Void> callback);
|
||||
}
|
||||
+3
@@ -77,6 +77,9 @@ public class TrackedEventsTreeModel implements TreeViewModel {
|
||||
@Override
|
||||
public void render(com.google.gwt.cell.client.Cell.Context context, RaceDAO value, SafeHtmlBuilder sb) {
|
||||
sb.appendEscaped(value.name);
|
||||
if (value.currentlyTracked) {
|
||||
sb.appendEscaped(" (tracked)");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+22
-5
@@ -16,6 +16,7 @@ import org.osgi.framework.BundleContext;
|
||||
import org.osgi.util.tracker.ServiceTracker;
|
||||
|
||||
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||
import com.sap.sailing.declination.DeclinationService;
|
||||
import com.sap.sailing.domain.base.BoatClass;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.Event;
|
||||
@@ -91,7 +92,7 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
private List<RaceDAO> getRaceDAOs(Set<RaceDefinition> races) {
|
||||
List<RaceDAO> result = new ArrayList<RaceDAO>();
|
||||
for (RaceDefinition r : races) {
|
||||
result.add(new RaceDAO(r.getName(), getCompetitorDAOs(r.getCompetitors())));
|
||||
result.add(new RaceDAO(r.getName(), getCompetitorDAOs(r.getCompetitors()), service.isRaceBeingTracked(r)));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -151,14 +152,30 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
service.stopTracking(service.getEventByName(eventName));
|
||||
}
|
||||
|
||||
private RaceDefinition getRaceByName(Event event, String raceName) {
|
||||
for (RaceDefinition r : event.getAllRaces()) {
|
||||
if (r.getName().equals(raceName)) {
|
||||
return r;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopTrackingRace(String eventName, String raceName) throws Exception {
|
||||
Event event = service.getEventByName(eventName);
|
||||
for (RaceDefinition r : event.getAllRaces()) {
|
||||
if (r.getName().equals(raceName)) {
|
||||
service.stopTracking(event, r);
|
||||
}
|
||||
RaceDefinition r = getRaceByName(event, raceName);
|
||||
if (r != null) {
|
||||
service.stopTracking(event, r);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startTrackingWind(String eventName, String raceName, int port, boolean correctByDeclination) throws Exception {
|
||||
Event event = service.getEventByName(eventName);
|
||||
RaceDefinition race = getRaceByName(event, raceName);
|
||||
service.startTrackingWind(event, race, port,
|
||||
correctByDeclination ? DeclinationService.INSTANCE : null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,17 +1,27 @@
|
||||
package com.sap.sailing.gwt.ui.shared;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
import com.sap.sailing.domain.tracking.TrackedRace;
|
||||
import com.sap.sailing.domain.tractracadapter.RaceTracker;
|
||||
|
||||
public class RaceDAO implements IsSerializable {
|
||||
public String name;
|
||||
public Iterable<CompetitorDAO> competitors;
|
||||
|
||||
/**
|
||||
* Tells if this race is currently being tracked live, meaning that a {@link RaceTracker} is
|
||||
* listening for incoming GPS fixes, mark passings etc., to update a {@link TrackedRace} object
|
||||
* accordingly.
|
||||
*/
|
||||
public boolean currentlyTracked;
|
||||
|
||||
public RaceDAO() {}
|
||||
|
||||
public RaceDAO(String name, Iterable<CompetitorDAO> competitors) {
|
||||
public RaceDAO(String name, Iterable<CompetitorDAO> competitors, boolean currentlyTracked) {
|
||||
super();
|
||||
this.name = name;
|
||||
this.competitors = competitors;
|
||||
this.currentlyTracked = currentlyTracked;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -120,4 +120,6 @@ public interface RacingEventService {
|
||||
*/
|
||||
List<RaceRecord> getRaceRecords(URL jsonURL) throws IOException, ParseException, org.json.simple.parser.ParseException;
|
||||
|
||||
boolean isRaceBeingTracked(RaceDefinition r);
|
||||
|
||||
}
|
||||
@@ -74,6 +74,18 @@ public class RacingEventServiceImpl implements RacingEventService {
|
||||
public Iterable<Event> getAllEvents() {
|
||||
return Collections.unmodifiableCollection(eventsByName.values());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRaceBeingTracked(RaceDefinition r) {
|
||||
for (Set<RaceTracker> trackers : raceTrackersByEvent.values()) {
|
||||
for (RaceTracker tracker : trackers) {
|
||||
if (tracker.getRace() == r) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Event getEventByName(String name) {
|
||||
|
||||
Reference in new issue
Block a user