mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-03 02:43:53 +00:00
Merge branch 'gwt' into mak-raceboard
This commit is contained in:
commit
0a4604aee2
20 files changed
+254
-76
No files matched your search
+2
-5
@@ -1,9 +1,6 @@
|
||||
package com.sap.sailing.domain.common.impl;
|
||||
package com.sap.sailing.domain.common;
|
||||
|
||||
import com.sap.sailing.domain.common.Distance;
|
||||
import com.sap.sailing.domain.common.Mile;
|
||||
import com.sap.sailing.domain.common.Speed;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.common.impl.NauticalMileDistance;
|
||||
|
||||
public abstract class AbstractSpeedImpl implements Speed {
|
||||
|
||||
+1
@@ -1,5 +1,6 @@
|
||||
package com.sap.sailing.domain.common.impl;
|
||||
|
||||
import com.sap.sailing.domain.common.AbstractSpeedImpl;
|
||||
import com.sap.sailing.domain.common.Mile;
|
||||
import com.sap.sailing.domain.common.Speed;
|
||||
|
||||
|
||||
+4
-3
@@ -19,6 +19,7 @@ import org.junit.Before;
|
||||
|
||||
import com.maptrack.client.io.TypeController;
|
||||
import com.sap.sailing.domain.tractracadapter.Receiver;
|
||||
import com.sap.sailing.domain.tractracadapter.TracTracConnectionConstants;
|
||||
import com.sap.tractrac.clientmodule.util.Base64;
|
||||
import com.tractrac.clientmodule.Event;
|
||||
import com.tractrac.clientmodule.data.DataController;
|
||||
@@ -54,9 +55,9 @@ public abstract class AbstractTracTracLiveTest extends StoredTrackBasedTest impl
|
||||
*/
|
||||
@Before
|
||||
public void setUp() throws MalformedURLException, IOException, InterruptedException, URISyntaxException {
|
||||
setUp(new URL("http://germanmaster.traclive.dk/events/event_20110505_SailingTea/clientparams.php?event=event_20110505_SailingTea&race=bd8c778e-7c65-11e0-8236-406186cbf87c"),
|
||||
tractracTunnel ? new URI("tcp://"+tractracTunnelHost+":1520") : new URI("tcp://germanmaster.traclive.dk:1520"),
|
||||
tractracTunnel ? new URI("tcp://"+tractracTunnelHost+":1521") : new URI("tcp://germanmaster.traclive.dk:1521"));
|
||||
setUp(new URL("http://" + TracTracConnectionConstants.HOST_NAME + "/events/event_20110505_SailingTea/clientparams.php?event=event_20110505_SailingTea&race=bd8c778e-7c65-11e0-8236-406186cbf87c"),
|
||||
tractracTunnel ? new URI("tcp://"+tractracTunnelHost+":"+TracTracConnectionConstants.PORT_TUNNEL_LIVE) : new URI("tcp://" + TracTracConnectionConstants.HOST_NAME + ":" + TracTracConnectionConstants.PORT_LIVE),
|
||||
tractracTunnel ? new URI("tcp://"+tractracTunnelHost+":"+TracTracConnectionConstants.PORT_TUNNEL_STORED) : new URI("tcp://" + TracTracConnectionConstants.HOST_NAME + ":" + TracTracConnectionConstants.PORT_STORED));
|
||||
}
|
||||
|
||||
protected void setUp(URL paramUrl, URI liveUri, URI storedUri) throws FileNotFoundException, MalformedURLException {
|
||||
|
||||
+6
-5
@@ -17,6 +17,7 @@ import org.junit.Test;
|
||||
|
||||
import com.sap.sailing.domain.tracking.impl.EmptyWindStore;
|
||||
import com.sap.sailing.domain.tractracadapter.DomainFactory;
|
||||
import com.sap.sailing.domain.tractracadapter.TracTracConnectionConstants;
|
||||
import com.sap.sailing.domain.tractracadapter.TracTracRaceTracker;
|
||||
import com.sap.sailing.domain.tractracadapter.impl.DomainFactoryImpl;
|
||||
|
||||
@@ -36,12 +37,12 @@ public class MultipleClassesInEventTest {
|
||||
|
||||
@Test
|
||||
public void testLoadTwoRacesWithEqualEventNameButDifferentClasses() throws MalformedURLException, FileNotFoundException, URISyntaxException {
|
||||
String httpAndHost = "http://germanmaster.traclive.dk";
|
||||
String liveURI = "tcp://germanmaster.traclive.dk:1520";
|
||||
String storedURI = "tcp://germanmaster.traclive.dk:1521";
|
||||
String httpAndHost = "http://" + TracTracConnectionConstants.HOST_NAME;
|
||||
String liveURI = "tcp://" + TracTracConnectionConstants.HOST_NAME + ":" + TracTracConnectionConstants.PORT_LIVE;
|
||||
String storedURI = "tcp://" + TracTracConnectionConstants.HOST_NAME + ":" + TracTracConnectionConstants.PORT_STORED;
|
||||
if (tractracTunnel) {
|
||||
liveURI = "tcp://"+tractracTunnelHost+":1520";
|
||||
storedURI = "tcp://"+tractracTunnelHost+":1521";
|
||||
liveURI = "tcp://"+tractracTunnelHost+":"+TracTracConnectionConstants.PORT_TUNNEL_LIVE;
|
||||
storedURI = "tcp://"+tractracTunnelHost+":"+TracTracConnectionConstants.PORT_TUNNEL_STORED;
|
||||
}
|
||||
kiwotest1 = domainFactory
|
||||
.createRaceTracker(
|
||||
|
||||
+4
-3
@@ -35,6 +35,7 @@ import com.sap.sailing.domain.tracking.impl.GPSFixImpl;
|
||||
import com.sap.sailing.domain.tracking.impl.TrackedLegImpl;
|
||||
import com.sap.sailing.domain.tractracadapter.Receiver;
|
||||
import com.sap.sailing.domain.tractracadapter.ReceiverType;
|
||||
import com.sap.sailing.domain.tractracadapter.TracTracConnectionConstants;
|
||||
import com.sap.sailing.domain.tractracadapter.impl.DomainFactoryImpl;
|
||||
import com.tractrac.clientmodule.Race;
|
||||
|
||||
@@ -124,9 +125,9 @@ public abstract class OnlineTracTracBasedTest extends AbstractTracTracLiveTest {
|
||||
|
||||
protected void setUpWithoutLaunchingController(String eventName, String raceId) throws FileNotFoundException, MalformedURLException,
|
||||
URISyntaxException {
|
||||
super.setUp(new URL("http://germanmaster.traclive.dk/events/"+eventName+"/clientparams.php?event="+eventName+"&race="+raceId),
|
||||
tractracTunnel ? new URI("tcp://"+tractracTunnelHost+":1520") : new URI("tcp://germanmaster.traclive.dk:1520"),
|
||||
tractracTunnel ? new URI("tcp://"+tractracTunnelHost+":1521") : new URI("tcp://germanmaster.traclive.dk:1521"));
|
||||
super.setUp(new URL("http://" + TracTracConnectionConstants.HOST_NAME + "/events/"+eventName+"/clientparams.php?event="+eventName+"&race="+raceId),
|
||||
tractracTunnel ? new URI("tcp://"+tractracTunnelHost+":"+TracTracConnectionConstants.PORT_TUNNEL_LIVE) : new URI("tcp://" + TracTracConnectionConstants.HOST_NAME + ":" + TracTracConnectionConstants.PORT_LIVE),
|
||||
tractracTunnel ? new URI("tcp://"+tractracTunnelHost+":"+TracTracConnectionConstants.PORT_TUNNEL_STORED) : new URI("tcp://" + TracTracConnectionConstants.HOST_NAME + ":" + TracTracConnectionConstants.PORT_STORED));
|
||||
if (domainFactory == null) {
|
||||
domainFactory = new DomainFactoryImpl(new com.sap.sailing.domain.base.impl.DomainFactoryImpl());
|
||||
}
|
||||
|
||||
+6
-5
@@ -23,6 +23,7 @@ import org.junit.Test;
|
||||
import com.sap.sailing.domain.tractracadapter.DomainFactory;
|
||||
import com.sap.sailing.domain.tractracadapter.JSONService;
|
||||
import com.sap.sailing.domain.tractracadapter.RaceRecord;
|
||||
import com.sap.sailing.domain.tractracadapter.TracTracConnectionConstants;
|
||||
|
||||
public class ParseTracTracJSONServiceOutputTest {
|
||||
@Test
|
||||
@@ -73,7 +74,7 @@ public class ParseTracTracJSONServiceOutputTest {
|
||||
@Test
|
||||
public void testWeymouthOnline() throws MalformedURLException, IOException, java.text.ParseException, ParseException, URISyntaxException {
|
||||
JSONService jsonService = DomainFactory.INSTANCE.parseJSONURL(new URL(
|
||||
"http://germanmaster.traclive.dk/events/event_20110505_SailingTea/jsonservice.php"));
|
||||
"http://" + TracTracConnectionConstants.HOST_NAME + "/events/event_20110505_SailingTea/jsonservice.php"));
|
||||
assertEquals("Sailing Team Germany", jsonService.getEventName());
|
||||
List<RaceRecord> races = jsonService.getRaceRecords();
|
||||
assertTrue(races.size()>=28);
|
||||
@@ -90,19 +91,19 @@ public class ParseTracTracJSONServiceOutputTest {
|
||||
@Test
|
||||
public void testWeymouthURIsOnline() throws MalformedURLException, IOException, java.text.ParseException, ParseException, URISyntaxException {
|
||||
JSONService jsonService = DomainFactory.INSTANCE.parseJSONURL(new URL(
|
||||
"http://germanmaster.traclive.dk/events/event_20110505_SailingTea/jsonservice.php"));
|
||||
"http://" + TracTracConnectionConstants.HOST_NAME + "/events/event_20110505_SailingTea/jsonservice.php"));
|
||||
List<RaceRecord> races = jsonService.getRaceRecords();
|
||||
assertFalse(races.isEmpty());
|
||||
for (RaceRecord race : races) {
|
||||
assertEquals(new URI("tcp://germanmaster.traclive.dk:4400"), race.getLiveURI());
|
||||
assertEquals(new URI("tcp://germanmaster.traclive.dk:4401"), race.getStoredURI());
|
||||
assertEquals(new URI("tcp://" + TracTracConnectionConstants.HOST_NAME + ":" + TracTracConnectionConstants.PORT_LIVE), race.getLiveURI());
|
||||
assertEquals(new URI("tcp://" + TracTracConnectionConstants.HOST_NAME + ":" + TracTracConnectionConstants.PORT_STORED), race.getStoredURI());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHamiltonOnline() throws MalformedURLException, IOException, java.text.ParseException, ParseException, URISyntaxException {
|
||||
JSONService jsonService = DomainFactory.INSTANCE.parseJSONURL(new URL(
|
||||
"http://germanmaster.traclive.dk/events/event_20110308_SAPWorldCh/jsonservice.php"));
|
||||
"http://" + TracTracConnectionConstants.HOST_NAME + "/events/event_20110308_SAPWorldCh/jsonservice.php"));
|
||||
assertEquals("SAP 2011 505 World Championship", jsonService.getEventName());
|
||||
List<RaceRecord> races = jsonService.getRaceRecords();
|
||||
assertEquals(14, races.size());
|
||||
|
||||
+5
-4
@@ -16,6 +16,7 @@ import org.junit.Test;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.tracking.impl.EmptyWindStore;
|
||||
import com.sap.sailing.domain.tractracadapter.DomainFactory;
|
||||
import com.sap.sailing.domain.tractracadapter.TracTracConnectionConstants;
|
||||
import com.sap.sailing.domain.tractracadapter.TracTracRaceTracker;
|
||||
import com.sap.sailing.domain.tractracadapter.impl.DomainFactoryImpl;
|
||||
|
||||
@@ -41,9 +42,9 @@ public class UnicodeCharactersInCompetitorNamesTest {
|
||||
TracTracRaceTracker fourtyninerYellow_2 = domainFactory
|
||||
.createRaceTracker(
|
||||
new URL(
|
||||
"http://germanmaster.traclive.dk/events/event_20110609_KielerWoch/clientparams.php?event=event_20110609_KielerWoch&race=5b08a9ee-9933-11e0-85be-406186cbf87c"),
|
||||
tractracTunnel ? new URI("tcp://"+tractracTunnelHost+":1520") : new URI("tcp://germanmaster.traclive.dk:1520"),
|
||||
tractracTunnel ? new URI("tcp://"+tractracTunnelHost+":1521") : new URI("tcp://germanmaster.traclive.dk:1521"),
|
||||
"http://" + TracTracConnectionConstants.HOST_NAME + "/events/event_20110609_KielerWoch/clientparams.php?event=event_20110609_KielerWoch&race=5b08a9ee-9933-11e0-85be-406186cbf87c"),
|
||||
tractracTunnel ? new URI("tcp://"+tractracTunnelHost+":"+TracTracConnectionConstants.PORT_TUNNEL_LIVE) : new URI("tcp://" + TracTracConnectionConstants.HOST_NAME + ":" + TracTracConnectionConstants.PORT_LIVE),
|
||||
tractracTunnel ? new URI("tcp://"+tractracTunnelHost+":"+TracTracConnectionConstants.PORT_TUNNEL_STORED) : new URI("tcp://" + TracTracConnectionConstants.HOST_NAME + ":" + TracTracConnectionConstants.PORT_STORED),
|
||||
EmptyWindStore.INSTANCE, new DummyTrackedEventRegistry());
|
||||
|
||||
Iterable<Competitor> competitors = fourtyninerYellow_2.getRacesHandle().getRaces().iterator().next().getCompetitors();
|
||||
@@ -62,7 +63,7 @@ public class UnicodeCharactersInCompetitorNamesTest {
|
||||
BufferedReader localBufferedReader = new BufferedReader(
|
||||
new InputStreamReader(
|
||||
new URL(
|
||||
"http://germanmaster.traclive.dk/events/event_20110609_KielerWoch/clientparams.php?event=event_20110609_KielerWoch&race=5b08a9ee-9933-11e0-85be-406186cbf87c")
|
||||
"http://" + TracTracConnectionConstants.HOST_NAME + "/events/event_20110609_KielerWoch/clientparams.php?event=event_20110609_KielerWoch&race=5b08a9ee-9933-11e0-85be-406186cbf87c")
|
||||
.openStream(), charsetname));
|
||||
String line;
|
||||
while ((line=localBufferedReader.readLine()) != null) {
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package com.sap.sailing.domain.tractracadapter;
|
||||
|
||||
public interface TracTracConnectionConstants {
|
||||
|
||||
final String HOST_NAME = "germanmaster.traclive.dk";
|
||||
|
||||
final int PORT_TUNNEL_LIVE = 1520; //For official usage use 4412;
|
||||
final int PORT_TUNNEL_STORED = PORT_TUNNEL_LIVE + 1; //For official usage use 4413;
|
||||
|
||||
final int PORT_LIVE = 1520; //For official usage use 4400;
|
||||
final int PORT_STORED = PORT_LIVE + 1; //For official usage use 4401;
|
||||
|
||||
}
|
||||
+1
-1
@@ -2,10 +2,10 @@ package com.sap.sailing.domain.base.impl;
|
||||
|
||||
import com.sap.sailing.domain.base.CourseChange;
|
||||
import com.sap.sailing.domain.base.SpeedWithBearing;
|
||||
import com.sap.sailing.domain.common.AbstractSpeedImpl;
|
||||
import com.sap.sailing.domain.common.Bearing;
|
||||
import com.sap.sailing.domain.common.Position;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.common.impl.AbstractSpeedImpl;
|
||||
import com.sap.sailing.domain.common.impl.DegreeBearingImpl;
|
||||
|
||||
public abstract class AbstractSpeedWithBearingImpl extends AbstractSpeedImpl implements SpeedWithBearing {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.sap.sailing.domain.base.impl;
|
||||
|
||||
import com.sap.sailing.domain.common.AbstractSpeedImpl;
|
||||
import com.sap.sailing.domain.common.Speed;
|
||||
import com.sap.sailing.domain.common.impl.AbstractSpeedImpl;
|
||||
|
||||
public class KnotSpeedImpl extends AbstractSpeedImpl implements Speed {
|
||||
private final double knots;
|
||||
|
||||
+1
-1
@@ -4,10 +4,10 @@ import com.sap.sailing.domain.base.CourseChange;
|
||||
import com.sap.sailing.domain.base.SpeedWithBearing;
|
||||
import com.sap.sailing.domain.base.impl.AbstractSpeedWithBearingImpl;
|
||||
import com.sap.sailing.domain.common.AbstractBearing;
|
||||
import com.sap.sailing.domain.common.AbstractSpeedImpl;
|
||||
import com.sap.sailing.domain.common.Bearing;
|
||||
import com.sap.sailing.domain.common.Position;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.common.impl.AbstractSpeedImpl;
|
||||
import com.sap.sailing.domain.tracking.GPSFixMoving;
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,7 +10,8 @@ Require-Bundle: com.sap.sailing.gwt.ui,
|
||||
com.sap.sailing.server,
|
||||
com.google.gwt.osgi;bundle-version="2.4.0",
|
||||
com.sap.sailing.server.api,
|
||||
com.sap.sailing.domain.common
|
||||
com.sap.sailing.domain.common,
|
||||
com.sap.sailing.domain.tractracadapter
|
||||
Bundle-ClassPath: .
|
||||
Import-Package: javax.servlet;version="2.5.0",
|
||||
javax.servlet.http;version="2.5.0",
|
||||
|
||||
+4
-3
@@ -9,6 +9,7 @@ import com.google.gwt.junit.client.GWTTestCase;
|
||||
import com.google.gwt.user.cellview.client.Column;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.sap.sailing.domain.common.impl.Util.Pair;
|
||||
import com.sap.sailing.domain.tractracadapter.TracTracConnectionConstants;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.leaderboard.ExpandableSortableColumn;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardDTO;
|
||||
@@ -29,7 +30,7 @@ public class GwtTestCaseColumnToggling extends GWTTestCase {
|
||||
private final String EVENT_NAME = "Sailing Team Germany (STG)";
|
||||
protected static final boolean tractracTunnel = true; // Boolean.valueOf(System.getProperty("tractrac.tunnel", "false"));
|
||||
protected static final String tractracTunnelHost = "10.18.10.38"; // System.getProperty("tractrac.tunnel.host", "localhost");
|
||||
private final String JSON_URL= "http://germanmaster.traclive.dk/events/event_20110505_SailingTea/jsonservice.php";
|
||||
private final String JSON_URL= "http://" + TracTracConnectionConstants.HOST_NAME + "/events/event_20110505_SailingTea/jsonservice.php";
|
||||
private final String TRACKED_RACE = "schwerttest";
|
||||
|
||||
|
||||
@@ -77,8 +78,8 @@ public class GwtTestCaseColumnToggling extends GWTTestCase {
|
||||
}
|
||||
|
||||
private void trackRace(){
|
||||
service.track(rrDao, tractracTunnel ? "tcp://"+tractracTunnelHost+":1520" : "tcp://germanmaster.traclive.dk:1520",
|
||||
tractracTunnel ? "tcp://"+tractracTunnelHost+":1521" : "tcp://germanmaster.traclive.dk:1521", false, false, new AsyncCallback<Void>() {
|
||||
service.track(rrDao, tractracTunnel ? "tcp://"+tractracTunnelHost+":"+TracTracConnectionConstants.PORT_TUNNEL_LIVE : "tcp://" + TracTracConnectionConstants.HOST_NAME + ":" + TracTracConnectionConstants.PORT_LIVE,
|
||||
tractracTunnel ? "tcp://"+tractracTunnelHost+":"+TracTracConnectionConstants.PORT_TUNNEL_STORED : "tcp://" + TracTracConnectionConstants.HOST_NAME + ":" + TracTracConnectionConstants.PORT_STORED, false, false, new AsyncCallback<Void>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
||||
+3
-2
@@ -35,6 +35,7 @@ import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.view.client.ListDataProvider;
|
||||
import com.google.gwt.view.client.MultiSelectionModel;
|
||||
import com.sap.sailing.domain.common.impl.Util.Pair;
|
||||
import com.sap.sailing.domain.tractracadapter.TracTracConnectionConstants;
|
||||
import com.sap.sailing.gwt.ui.client.ErrorReporter;
|
||||
import com.sap.sailing.gwt.ui.client.EventRefresher;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
@@ -133,7 +134,7 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel {
|
||||
grid.setWidget(3, 0, lblHostname);
|
||||
|
||||
hostnameTextbox = new TextBox();
|
||||
hostnameTextbox.setText("germanmaster.traclive.dk");
|
||||
hostnameTextbox.setText(TracTracConnectionConstants.HOST_NAME);
|
||||
hostnameTextbox.addKeyUpHandler(new KeyUpHandler() {
|
||||
@Override
|
||||
public void onKeyUp(KeyUpEvent event) {
|
||||
@@ -169,7 +170,7 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel {
|
||||
horizontalPanel_1.setCellVerticalAlignment(lblLiveDataPort, HasVerticalAlignment.ALIGN_MIDDLE);
|
||||
|
||||
livePortIntegerbox = new IntegerBox();
|
||||
livePortIntegerbox.setText("1520");
|
||||
livePortIntegerbox.setText(Integer.toString(TracTracConnectionConstants.PORT_LIVE));
|
||||
livePortIntegerbox.addKeyUpHandler(new KeyUpHandler() {
|
||||
@Override
|
||||
public void onKeyUp(KeyUpEvent event) {
|
||||
|
||||
java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/leaderboard/AbstractChartPanel.java
Executable → Regular
+51
-18
@@ -1,6 +1,8 @@
|
||||
package com.sap.sailing.gwt.ui.leaderboard;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@@ -375,7 +377,7 @@ public abstract class AbstractChartPanel<SettingsType extends ChartSettings> ext
|
||||
|
||||
private Widget createChart() {
|
||||
final Label selectedPointLabel = new Label(getStringMessages().hoverOverAPoint());
|
||||
PlotWithOverviewModel model = new PlotWithOverviewModel(PlotModelStrategy.defaultStrategy());
|
||||
final PlotWithOverviewModel model = new PlotWithOverviewModel(PlotModelStrategy.defaultStrategy());
|
||||
PlotOptions plotOptions = new PlotOptions();
|
||||
plotOptions.setDefaultLineSeriesOptions(new LineSeriesOptions().setLineWidth(1).setShow(true));
|
||||
plotOptions.setDefaultPointsOptions(new PointsSeriesOptions().setShow(false));
|
||||
@@ -409,8 +411,7 @@ public abstract class AbstractChartPanel<SettingsType extends ChartSettings> ext
|
||||
// add hover listener
|
||||
plot.addHoverListener(new PlotHoverListener() {
|
||||
public void onPlotHover(Plot plot, PlotPosition position, PlotItem item) {
|
||||
// FIXME can the indexOf ever find anything? seriesID is a List<SeriesHandler>; item.getSeries() returns a Series object
|
||||
CompetitorDTO competitor = competitorID.get(seriesID.indexOf(item.getSeries()));
|
||||
CompetitorDTO competitor = competitorID.get(item.getSeriesIndex() / 2);
|
||||
if (item != null && competitor != null) {
|
||||
if (item.getSeries().getLabel().toLowerCase().contains("mark")) {
|
||||
selectedPointLabel.setText(stringMessages.competitorPassedMarkAtDate(competitor.name,
|
||||
@@ -452,25 +453,57 @@ public abstract class AbstractChartPanel<SettingsType extends ChartSettings> ext
|
||||
}
|
||||
}, true);
|
||||
plot.addSelectionListener(new SelectionListener() {
|
||||
|
||||
public void selected(double x1, double y1, double x2, double y2) {
|
||||
/* TODO Remove not visible buoys from the series when user is zooming in or add them if he is zooming out.
|
||||
for (CompetitorDTO competitor : competitorsAndTimePointsDTO.getCompetitor()){
|
||||
long[] markPassingTimes = competitorsAndTimePointsDTO.getMarkPassings(competitor);
|
||||
//Refactoring the selection range, if there is no mark passing between x1 and x2
|
||||
//Needed to prevent white space in the displayed selection
|
||||
ArrayList<Double> x1Values = new ArrayList<Double>();
|
||||
ArrayList<Double> x2Values = new ArrayList<Double>();
|
||||
boolean markPassingInRange = false;
|
||||
|
||||
competitorLoop:
|
||||
for (CompetitorDTO competitor : competitorID) {
|
||||
ArrayList<Pair<Double, Double>> negativeDeltas = new ArrayList<Pair<Double, Double>>();
|
||||
ArrayList<Pair<Double, Double>> positiveDeltas = new ArrayList<Pair<Double, Double>>();
|
||||
Pair<String, Long>[] markPassingTimes = competitorsAndTimePointsDTO.getMarkPassings(competitor);
|
||||
Double[] markPassingValues = chartData.getMarkPassings(competitor);
|
||||
SeriesHandler markSeries = getCompetitorMarkPassingSeries(competitor);
|
||||
markSeries.clear();
|
||||
int visibleMarkPassings = 0;
|
||||
for (int j = 0; j < markPassingTimes.length; j++){
|
||||
if (markPassingValues[j] != null && markPassingTimes[j] > x1 && markPassingTimes[j] < x2) {
|
||||
markSeries.add(new DataPoint(markPassingTimes[j],markPassingValues[j]));
|
||||
visibleMarkPassings++;
|
||||
|
||||
for (int i = 0; i < markPassingValues.length; i++) {
|
||||
double markPassing = markPassingTimes[i].getB().doubleValue();
|
||||
if (markPassingValues[i] != null && (markPassing < x1 || markPassing > x2)) {
|
||||
double delta = markPassing < x1 ? markPassing - x1 : markPassing - x2;
|
||||
Pair<Double, Double> p = new Pair<Double, Double>(delta, markPassing);
|
||||
if (delta < 0) {
|
||||
negativeDeltas.add(p);
|
||||
} else {
|
||||
positiveDeltas.add(p);
|
||||
}
|
||||
} else if (markPassingValues[i] != null) {
|
||||
markPassingInRange = true;
|
||||
break competitorLoop;
|
||||
}
|
||||
}
|
||||
if (visibleMarkPassings == 0){
|
||||
markSeries.setVisible(false);
|
||||
}
|
||||
}*/
|
||||
|
||||
Comparator<Pair<Double, Double>> comp = new Comparator<Pair<Double,Double>>() {
|
||||
@Override
|
||||
public int compare(Pair<Double, Double> p1, Pair<Double, Double> p2) {
|
||||
return p1.getA().compareTo(p2.getA());
|
||||
}
|
||||
};
|
||||
|
||||
Collections.sort(negativeDeltas, comp);
|
||||
x1Values.add(negativeDeltas.get(negativeDeltas.size() - 1).getB());
|
||||
Collections.sort(positiveDeltas, comp);
|
||||
x2Values.add(positiveDeltas.get(0).getB());
|
||||
}
|
||||
|
||||
//If there are mark passings between x1 and x2 no refactoring is needed
|
||||
if (!markPassingInRange) {
|
||||
Collections.sort(x1Values);
|
||||
x1 = x1Values.get(0) - 2000; //Increase x1 by 2 seconds prevent small blank space
|
||||
Collections.sort(x2Values);
|
||||
x2 = x2Values.get(x2Values.size() - 1) + 2000; //Increase x2 by 2 seconds prevent small blank space
|
||||
}
|
||||
|
||||
plot.setLinearSelection(x1, x2);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -78,4 +78,36 @@ public class EventDTO extends NamedDTO implements IsSerializable {
|
||||
|
||||
return tracked;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + ((competitors == null) ? 0 : competitors.hashCode());
|
||||
result = prime * result + ((locations == null) ? 0 : locations.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (!super.equals(obj))
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
EventDTO other = (EventDTO) obj;
|
||||
if (competitors == null) {
|
||||
if (other.competitors != null)
|
||||
return false;
|
||||
} else if (!competitors.equals(other.competitors))
|
||||
return false;
|
||||
if (locations == null) {
|
||||
if (other.locations != null)
|
||||
return false;
|
||||
} else if (!locations.equals(other.locations))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,5 +15,30 @@ public class NamedDTO implements IsSerializable {
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
NamedDTO other = (NamedDTO) obj;
|
||||
if (name == null) {
|
||||
if (other.name != null)
|
||||
return false;
|
||||
} else if (!name.equals(other.name))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
+85
-19
@@ -55,7 +55,7 @@ public class OverviewEventPanel extends AbstractEventPanel {
|
||||
private Button btnShowLeaderboards;
|
||||
private CellTable<EventDTO> eventTable;
|
||||
private ListDataProvider<EventDTO> eventTableProvider;
|
||||
private SingleSelectionModel<EventDTO> eventSelectionModel;
|
||||
private SingleSelectionModel<EventDTO> eventTableSelectionModel;
|
||||
|
||||
private CaptionPanel captionPanelLeaderboards;
|
||||
|
||||
@@ -132,11 +132,11 @@ public class OverviewEventPanel extends AbstractEventPanel {
|
||||
});
|
||||
panelSearch.add(textBoxUntil);
|
||||
|
||||
// Build events GUI
|
||||
HorizontalPanel listsSplitPanel = new HorizontalPanel();
|
||||
mainPanel.add(listsSplitPanel);
|
||||
listsSplitPanel.setWidth("100%");
|
||||
|
||||
// Build events GUI
|
||||
captionPanelEvents = new CaptionPanel(stringConstants.events());
|
||||
captionPanelEvents.setWidth("100%");
|
||||
listsSplitPanel.add(captionPanelEvents);
|
||||
@@ -150,13 +150,22 @@ public class OverviewEventPanel extends AbstractEventPanel {
|
||||
functionPanelEvents.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
|
||||
functionPanelEvents.setSpacing(5);
|
||||
eventsPanel.add(functionPanelEvents);
|
||||
|
||||
Button btnRefreshEventList = new Button(stringConstants.refresh());
|
||||
btnRefreshEventList.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
refreshEventsTable();
|
||||
}
|
||||
});
|
||||
functionPanelEvents.add(btnRefreshEventList);
|
||||
|
||||
btnShowLeaderboards = new Button(">");
|
||||
btnShowLeaderboards.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent c) {
|
||||
if (eventSelectionModel.getSelectedObject() != null) {
|
||||
captionPanelLeaderboards.setVisible(true);
|
||||
if (eventTableSelectionModel.getSelectedObject() != null) {
|
||||
setLeaderboardsPanelVisible(true);
|
||||
} else {
|
||||
Window.alert(stringConstants.noEventSelected());
|
||||
}
|
||||
@@ -208,9 +217,9 @@ public class OverviewEventPanel extends AbstractEventPanel {
|
||||
eventTable.addColumnSortHandler(eventSortHandler);
|
||||
|
||||
//Adding the selection model
|
||||
eventSelectionModel = new SingleSelectionModel<EventDTO>();
|
||||
eventTable.setSelectionModel(eventSelectionModel);
|
||||
eventSelectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
|
||||
eventTableSelectionModel = new SingleSelectionModel<EventDTO>();
|
||||
eventTable.setSelectionModel(eventTableSelectionModel);
|
||||
eventTableSelectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
|
||||
@Override
|
||||
public void onSelectionChange(SelectionChangeEvent event) {
|
||||
eventSelectionChanged(event);
|
||||
@@ -223,7 +232,7 @@ public class OverviewEventPanel extends AbstractEventPanel {
|
||||
// Build leaderboards GUI
|
||||
captionPanelLeaderboards = new CaptionPanel(stringConstants.leaderboards());
|
||||
captionPanelLeaderboards.setVisible(false);
|
||||
captionPanelLeaderboards.setWidth("95%");
|
||||
captionPanelLeaderboards.setWidth("100%");
|
||||
listsSplitPanel.add(captionPanelLeaderboards);
|
||||
|
||||
VerticalPanel leaderboardsPanel = new VerticalPanel();
|
||||
@@ -240,15 +249,22 @@ public class OverviewEventPanel extends AbstractEventPanel {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
captionPanelLeaderboards.setVisible(false);
|
||||
setLeaderboardsPanelVisible(false);
|
||||
}
|
||||
});
|
||||
functionPanelLeaderboards.add(btnHideLeaderboards);
|
||||
|
||||
// Create leaderboard list
|
||||
// TODO
|
||||
|
||||
loadEvents();
|
||||
|
||||
Runnable displayEvents = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
eventTableProvider.getList().clear();
|
||||
eventTableProvider.getList().addAll(availableEvents);
|
||||
}
|
||||
};
|
||||
loadEvents(displayEvents);
|
||||
|
||||
//Set checkbox as true, because we can't search for old events right now
|
||||
//TODO Remove after searching for old events is possible
|
||||
@@ -267,8 +283,6 @@ public class OverviewEventPanel extends AbstractEventPanel {
|
||||
} else {
|
||||
availableEvents.clear();
|
||||
}
|
||||
eventTableProvider.getList().clear();
|
||||
eventTableProvider.getList().addAll(availableEvents);
|
||||
if (actionAfterLoading != null) {
|
||||
actionAfterLoading.run();
|
||||
}
|
||||
@@ -280,20 +294,72 @@ public class OverviewEventPanel extends AbstractEventPanel {
|
||||
}
|
||||
});
|
||||
}
|
||||
private void loadEvents() {
|
||||
loadEvents(null);
|
||||
|
||||
private void refreshEventsTable() {
|
||||
final EventDTO selectedEvent = eventTableSelectionModel.getSelectedObject();
|
||||
|
||||
//Clear Search criteria
|
||||
textBoxLocation.setText("");
|
||||
textBoxName.setText("");
|
||||
textBoxFrom.setText("");
|
||||
textBoxUntil.setText("");
|
||||
//TODO Switch the value of checkBoxLive to false, as soon as searching for old events is possible
|
||||
checkBoxLive.setValue(true);
|
||||
|
||||
//Load all available events and reselect the event
|
||||
Runnable displayAndReselect = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
eventTableProvider.getList().clear();
|
||||
eventTableProvider.getList().addAll(availableEvents);
|
||||
//Now sort again according to selected criterion
|
||||
ColumnSortEvent.fire(eventTable, eventTable.getColumnSortList());
|
||||
//Reselect the event
|
||||
if (selectedEvent != null) {
|
||||
for (EventDTO event : eventTableProvider.getList()) {
|
||||
if (event.equals(selectedEvent)) {
|
||||
eventTableSelectionModel.setSelected(selectedEvent, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
loadEvents(displayAndReselect);
|
||||
//Now sort again according to selected criterion
|
||||
ColumnSortEvent.fire(eventTable, eventTable.getColumnSortList());
|
||||
}
|
||||
|
||||
protected void eventSelectionChanged(SelectionChangeEvent event) {
|
||||
private void setLeaderboardsPanelVisible(boolean visible) {
|
||||
captionPanelLeaderboards.setVisible(visible);
|
||||
captionPanelEvents.setWidth(visible ? "95%" : "100%");
|
||||
btnShowLeaderboards.setEnabled(!visible);
|
||||
}
|
||||
|
||||
private void eventSelectionChanged(SelectionChangeEvent event) {
|
||||
// TODO Actions when the event selection changed
|
||||
EventDTO selectedEvent = eventTableSelectionModel.getSelectedObject();
|
||||
if (selectedEvent != null) {
|
||||
setLeaderboardsPanelVisible(true);
|
||||
//TODO Display data in leaderboard list
|
||||
} else {
|
||||
setLeaderboardsPanelVisible(false);
|
||||
btnShowLeaderboards.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void onCheckBoxLiveChange() {
|
||||
if (checkBoxLive.getValue()) {
|
||||
String today = DateTimeFormat.getFormat("dd.MM.yyyy").format(new Date()).toString();
|
||||
|
||||
textBoxFrom.setText(today);
|
||||
textBoxFrom.setEnabled(false);
|
||||
textBoxUntil.setText(today);
|
||||
textBoxUntil.setEnabled(false);
|
||||
} else {
|
||||
textBoxFrom.setText("");
|
||||
textBoxFrom.setEnabled(true);
|
||||
textBoxUntil.setText("");
|
||||
textBoxUntil.setEnabled(true);
|
||||
}
|
||||
onSearchCriteriaChange();
|
||||
@@ -310,7 +376,7 @@ public class OverviewEventPanel extends AbstractEventPanel {
|
||||
from = DateTimeFormat.getFormat("dd.MM.yyyy").parse(textBoxFrom.getText());
|
||||
until = DateTimeFormat.getFormat("dd.MM.yyyy").parse(textBoxUntil.getText());
|
||||
//Adding 24 hours to until, so that it doesn't result in an empty table if 'from' and 'until' are equal.
|
||||
//Instead you would have a 24 hour range
|
||||
//Instead you'll have a 24 hour range
|
||||
long time = until.getTime() + 24 * 60 * 60 * 1000;
|
||||
until = new Date(time);
|
||||
} catch (IllegalArgumentException e) {}
|
||||
@@ -321,7 +387,7 @@ public class OverviewEventPanel extends AbstractEventPanel {
|
||||
eventTableProvider.getList().add(event);
|
||||
}
|
||||
}
|
||||
// now sort again according to selected criterion
|
||||
//Now sort again according to selected criterion
|
||||
ColumnSortEvent.fire(eventTable, eventTable.getColumnSortList());
|
||||
}
|
||||
|
||||
@@ -353,7 +419,7 @@ public class OverviewEventPanel extends AbstractEventPanel {
|
||||
|
||||
private ListHandler<EventDTO> getEventSortHandler(List<EventDTO> list, TextColumn<EventDTO> locationColumn,
|
||||
TextColumn<EventDTO> nameColumn, TextColumn<EventDTO> startDateColumn) {
|
||||
//TODO Check if comparators are correct
|
||||
|
||||
ListHandler<EventDTO> sortHandler = new ListHandler<EventDTO>(list);
|
||||
sortHandler.setComparator(locationColumn, new Comparator<EventDTO>() {
|
||||
@Override
|
||||
|
||||
+6
-5
@@ -23,6 +23,7 @@ import com.sap.sailing.domain.tracking.RacesHandle;
|
||||
import com.sap.sailing.domain.tracking.TrackedEvent;
|
||||
import com.sap.sailing.domain.tracking.TrackedRace;
|
||||
import com.sap.sailing.domain.tracking.impl.EmptyWindStore;
|
||||
import com.sap.sailing.domain.tractracadapter.TracTracConnectionConstants;
|
||||
import com.sap.sailing.server.impl.RacingEventServiceImpl;
|
||||
|
||||
public class RaceTrackerTest {
|
||||
@@ -40,15 +41,15 @@ public class RaceTrackerTest {
|
||||
// liveUri = new URI("tcp://sapsimulation.tracdev.dk:4420"); // or with tunneling: tcp://localhost:4420
|
||||
// storedUri = new URI("tcp://sapsimulation.tracdev.dk:4421"); // or with tunneling: tcp://localhost:4421
|
||||
// for stored race, non-real-time simulation:
|
||||
paramUrl = new URL("http://germanmaster.traclive.dk/events/event_20110505_SailingTea/clientparams.php?event=event_20110505_SailingTea&race=bd8c778e-7c65-11e0-8236-406186cbf87c");
|
||||
paramUrl = new URL("http://" + TracTracConnectionConstants.HOST_NAME + "/events/event_20110505_SailingTea/clientparams.php?event=event_20110505_SailingTea&race=bd8c778e-7c65-11e0-8236-406186cbf87c");
|
||||
|
||||
if (tractracTunnel) {
|
||||
liveUri = new URI("tcp://"+tractracTunnelHost+":1520");
|
||||
storedUri = new URI("tcp://"+tractracTunnelHost+":1521");
|
||||
liveUri = new URI("tcp://"+tractracTunnelHost+":"+TracTracConnectionConstants.PORT_TUNNEL_LIVE);
|
||||
storedUri = new URI("tcp://"+tractracTunnelHost+":"+TracTracConnectionConstants.PORT_TUNNEL_STORED);
|
||||
} else {
|
||||
// no tunnel:
|
||||
liveUri = new URI("tcp://germanmaster.traclive.dk:1520");
|
||||
storedUri = new URI("tcp://germanmaster.traclive.dk:1521");
|
||||
liveUri = new URI("tcp://" + TracTracConnectionConstants.HOST_NAME + ":" + TracTracConnectionConstants.PORT_LIVE);
|
||||
storedUri = new URI("tcp://" + TracTracConnectionConstants.HOST_NAME + ":" + TracTracConnectionConstants.PORT_STORED);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,6 +47,8 @@ public class ResultAPITester {
|
||||
int speedup = 40;
|
||||
|
||||
// Instance the resultgenerator using a URL for a specific race
|
||||
//Hardcoded host name 'germanmaster.traclive.dk' necessary, because an import of TracTracConnectionConstants causes a dependencies cycly
|
||||
//For the reasen that this code is nearly never used the effort of a bigger refactoring is saved
|
||||
ResultGenerator generator = new ResultGenerator(new URL("http://germanmaster.traclive.dk/events/event_20110308_SAPWorldCh/clientparams.php?event=event_20110308_SAPWorldCh&race=5ffe619e-4962-11e0-8236-406186cbf87c&ci=&minimize=&LiveDelaySecs="));
|
||||
|
||||
// Start out not using custom wind
|
||||
|
||||
Reference in new issue
Block a user