mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-05 20:03:52 +00:00
Improved "CompareCompetitorPanel" and added inheriting for moduls of
visualization.jar.
This commit is contained in:
1 parent
55df944886
commit
2901f2104c
11 files changed
+88
-29
No files matched your search
@@ -1,7 +1,7 @@
|
||||
#Wed Nov 23 14:14:33 CET 2011
|
||||
#Tue Nov 29 17:19:34 CET 2011
|
||||
eclipse.preferences.version=1
|
||||
jarsExcludedFromWebInfLib=
|
||||
lastWarOutDir=C\:/Users/d056995/git/git/java/com.sap.sailing.gwt.ui/war
|
||||
lastWarOutDir=C\:/Users/d056866/git/git/java/com.sap.sailing.gwt.ui/war
|
||||
launchConfigExternalUrlPrefix=
|
||||
warSrcDir=war
|
||||
warSrcDirIsOutput=false
|
||||
@@ -1,5 +1,5 @@
|
||||
#Wed Nov 09 12:43:38 CET 2011
|
||||
#Tue Nov 29 17:28:42 CET 2011
|
||||
eclipse.preferences.version=1
|
||||
entryPointModules=
|
||||
filesCopiedToWebInfLib=gwt-servlet.jar
|
||||
gwtCompileSettings=PGd3dC1jb21waWxlLXNldHRpbmdzPjxsb2ctbGV2ZWw+SU5GTzwvbG9nLWxldmVsPjxvdXRwdXQtc3R5bGU+T0JGVVNDQVRFRDwvb3V0cHV0LXN0eWxlPjxleHRyYS1hcmdzPjwhW0NEQVRBW11dPjwvZXh0cmEtYXJncz48dm0tYXJncz48IVtDREFUQVstWG14NTEybV1dPjwvdm0tYXJncz48ZW50cnktcG9pbnQtbW9kdWxlPmNvbS5zYXAuc2FpbGluZy5nd3QudWkuQWRtaW5Db25zb2xlPC9lbnRyeS1wb2ludC1tb2R1bGU+PC9nd3QtY29tcGlsZS1zZXR0aW5ncz4\=
|
||||
gwtCompileSettings=PGd3dC1jb21waWxlLXNldHRpbmdzPjxsb2ctbGV2ZWw+SU5GTzwvbG9nLWxldmVsPjxvdXRwdXQtc3R5bGU+T0JGVVNDQVRFRDwvb3V0cHV0LXN0eWxlPjxleHRyYS1hcmdzPjwhW0NEQVRBW11dPjwvZXh0cmEtYXJncz48dm0tYXJncz48IVtDREFUQVstWG14NTEybV1dPjwvdm0tYXJncz48ZW50cnktcG9pbnQtbW9kdWxlPmNvbS5zYXAuc2FpbGluZy5nd3QudWkuQWRtaW5Db25zb2xlPC9lbnRyeS1wb2ludC1tb2R1bGU+PGVudHJ5LXBvaW50LW1vZHVsZT5jb20uc2FwLnNhaWxpbmcuZ3d0LnVpLkxlYWRlcmJvYXJkPC9lbnRyeS1wb2ludC1tb2R1bGU+PGVudHJ5LXBvaW50LW1vZHVsZT5jb20uc2FwLnNhaWxpbmcuZ3d0LnVpLkxlYWRlcmJvYXJkRWRpdGluZzwvZW50cnktcG9pbnQtbW9kdWxlPjxlbnRyeS1wb2ludC1tb2R1bGU+Y29tLnNhcC5zYWlsaW5nLmd3dC51aS5Vc2VyTWFuYWdlbWVudDwvZW50cnktcG9pbnQtbW9kdWxlPjwvZ3d0LWNvbXBpbGUtc2V0dGluZ3M+
|
||||
@@ -21,7 +21,7 @@
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gwt.eclipse.core.moduleClasspathProvider"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.DevMode"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-war "${project_loc:com.sap.sailing.gwt.ui}/war" -noserver -remoteUI "${gwt_remote_ui_server_port}:${unique_id}" -logLevel INFO -codeServerPort 9997 com.sap.sailing.gwt.ui.AdminConsole com.sap.sailing.gwt.ui.Leaderboard com.sap.sailing.gwt.ui.LeaderboardEditing com.sap.sailing.gwt.ui.UserManagement"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-war C:\Users\d056866\git\git\java\com.sap.sailing.gwt.ui\war -noserver -remoteUI "${gwt_remote_ui_server_port}:${unique_id}" -logLevel INFO -codeServerPort 9997 com.sap.sailing.gwt.ui.UserManagement com.sap.sailing.gwt.ui.AdminConsole com.sap.sailing.gwt.ui.LeaderboardEditing com.sap.sailing.gwt.ui.Leaderboard"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.sap.sailing.gwt.ui"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx1024m"/>
|
||||
</launchConfiguration>
|
||||
+1
-1
@@ -42,6 +42,6 @@ public class CompareCompetitorsChartDialog extends DialogBox {
|
||||
this.add(mainPanel);
|
||||
|
||||
this.setTitle("Compare competitors");
|
||||
this.center();
|
||||
this.setPopupPosition(5, 5);
|
||||
}
|
||||
}
|
||||
+56
-12
@@ -1,6 +1,5 @@
|
||||
package com.sap.sailing.gwt.ui.client;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gwt.event.dom.client.ChangeEvent;
|
||||
@@ -8,15 +7,16 @@ import com.google.gwt.event.dom.client.ChangeHandler;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
import com.google.gwt.i18n.client.DateTimeFormat;
|
||||
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.AbsolutePanel;
|
||||
import com.google.gwt.user.client.ui.Anchor;
|
||||
import com.google.gwt.user.client.ui.Button;
|
||||
import com.google.gwt.user.client.ui.CaptionPanel;
|
||||
import com.google.gwt.user.client.ui.DeckPanel;
|
||||
import com.google.gwt.user.client.ui.FormPanel;
|
||||
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
|
||||
import com.google.gwt.user.client.ui.Anchor;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.ListBox;
|
||||
@@ -40,24 +40,35 @@ public class CompareCompetitorsPanel extends FormPanel {
|
||||
private HorizontalPanel mainPanel;
|
||||
private VerticalPanel chartPanel;
|
||||
private String raceName;
|
||||
private DateTimeFormat dateTimeFormat;
|
||||
public static final int DECK_PANEL_INDEX_LOADING = 0;
|
||||
public static final int DECK_PANEL_INDEX_CHART = 1;
|
||||
|
||||
public static final int SHOW_CURRENT_SPEED_OVER_GROUND = 0;
|
||||
public static final int SHOW_VELOCITY_MADE_GOOD = 1;
|
||||
public static final int SHOW_GAP_TO_LEADER = 2;
|
||||
public static final int SHOW_WINDWARD_DISTANCE_TO_GO = 3;
|
||||
public static final int SHOW_DISTANCE_TRAVELED = 4;
|
||||
private int dataToShow = SHOW_CURRENT_SPEED_OVER_GROUND;
|
||||
private AbsolutePanel loadingPanel;
|
||||
|
||||
public CompareCompetitorsPanel(SailingServiceAsync sailingService, final List<CompetitorDAO> competitors,
|
||||
String raceName, final String leaderboardName) {
|
||||
this.sailingService = sailingService;
|
||||
this.competitors = competitors;
|
||||
this.raceName = raceName;
|
||||
this.dateTimeFormat = DateTimeFormat.getFormat("HH:mm:ss");
|
||||
mainPanel = new HorizontalPanel();
|
||||
chartPanel = new VerticalPanel();
|
||||
loadingPanel = new AbsolutePanel ();
|
||||
loadingPanel.setSize("800px", "600px");
|
||||
|
||||
Anchor a = new Anchor(new SafeHtmlBuilder().appendHtmlConstant(
|
||||
"<img src=\"/images/ajax-loader.gif\"/>").toSafeHtml());
|
||||
loadingPanel.add(a,800/2-32/2,600/2-32-2);
|
||||
chartPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
|
||||
chartPanel.setSpacing(5);
|
||||
|
||||
final DeckPanel deckPanel = new DeckPanel();
|
||||
|
||||
deckPanel.add(loadingPanel);
|
||||
final CaptionPanel configCaption = new CaptionPanel("Configuration");
|
||||
configCaption.setHeight("100%");
|
||||
configCaption.setVisible(false);
|
||||
@@ -79,6 +90,7 @@ public class CompareCompetitorsPanel extends FormPanel {
|
||||
configPanel.add(lblChart);
|
||||
final ListBox dataSelection = new ListBox();
|
||||
dataSelection.addItem("Speed over ground", "" + SHOW_CURRENT_SPEED_OVER_GROUND);
|
||||
dataSelection.addItem("Distance traveled", "" + SHOW_DISTANCE_TRAVELED);
|
||||
dataSelection.addItem("Velocity made good", "" + SHOW_VELOCITY_MADE_GOOD);
|
||||
dataSelection.addItem("Gap to leader", "" + SHOW_GAP_TO_LEADER);
|
||||
dataSelection.addItem("Windward distance to go", "" + SHOW_WINDWARD_DISTANCE_TO_GO);
|
||||
@@ -96,12 +108,14 @@ public class CompareCompetitorsPanel extends FormPanel {
|
||||
Label lblSteps = new Label("Points to load:");
|
||||
configPanel.add(lblSteps);
|
||||
final TextBox txtbSteps = new TextBox();
|
||||
txtbSteps.setText("100");
|
||||
configPanel.add(txtbSteps);
|
||||
Button bttSteps = new Button("Refresh");
|
||||
bttSteps.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
deckPanel.showWidget(DECK_PANEL_INDEX_LOADING);
|
||||
CompareCompetitorsPanel.this.sailingService.getCompetitorRaceData(leaderboardName,
|
||||
CompareCompetitorsPanel.this.raceName, competitors, Integer.parseInt(txtbSteps.getText()),
|
||||
new AsyncCallback<CompetitorWithRaceDAO[][]>() {
|
||||
@@ -117,6 +131,7 @@ public class CompareCompetitorsPanel extends FormPanel {
|
||||
fireEvent(new DataLoadedEvent());
|
||||
chartData = result;
|
||||
if (chart != null) {
|
||||
deckPanel.showWidget(DECK_PANEL_INDEX_CHART);
|
||||
chart.draw(prepareTableData(), getOptions());
|
||||
}
|
||||
}
|
||||
@@ -131,14 +146,15 @@ public class CompareCompetitorsPanel extends FormPanel {
|
||||
public void run() {
|
||||
|
||||
chart = new LineChart(prepareTableData(), getOptions());
|
||||
chartPanel.add(chart);
|
||||
deckPanel.add(chart);
|
||||
fireEvent(new DataLoadedEvent());
|
||||
// chartLoaded = true;
|
||||
}
|
||||
};
|
||||
VisualizationUtils.loadVisualizationApi(onLoadCallback, LineChart.PACKAGE);
|
||||
|
||||
this.sailingService.getCompetitorRaceData(leaderboardName, this.raceName, competitors, 150,
|
||||
deckPanel.showWidget(DECK_PANEL_INDEX_LOADING);
|
||||
this.sailingService.getCompetitorRaceData(leaderboardName, this.raceName, competitors, 100,
|
||||
new AsyncCallback<CompetitorWithRaceDAO[][]>() {
|
||||
|
||||
@Override
|
||||
@@ -151,11 +167,12 @@ public class CompareCompetitorsPanel extends FormPanel {
|
||||
fireEvent(new DataLoadedEvent());
|
||||
chartData = result;
|
||||
if (chart != null) {
|
||||
deckPanel.showWidget(DECK_PANEL_INDEX_CHART);
|
||||
chart.draw(prepareTableData(), getOptions());
|
||||
}
|
||||
}
|
||||
});
|
||||
// while (!chartLoaded){}
|
||||
chartPanel.add(deckPanel);
|
||||
mainPanel.add(chartPanel);
|
||||
mainPanel.add(configCaption);
|
||||
this.add(mainPanel);
|
||||
@@ -175,6 +192,9 @@ public class CompareCompetitorsPanel extends FormPanel {
|
||||
case SHOW_WINDWARD_DISTANCE_TO_GO:
|
||||
opt.setTitle("Windward distance to go");
|
||||
break;
|
||||
case SHOW_DISTANCE_TRAVELED:
|
||||
opt.setTitle("Distance Traveled");
|
||||
break;
|
||||
default:
|
||||
opt.setTitle("Speed over ground");
|
||||
}
|
||||
@@ -193,6 +213,9 @@ public class CompareCompetitorsPanel extends FormPanel {
|
||||
case SHOW_WINDWARD_DISTANCE_TO_GO:
|
||||
vAxisOptions.setTitle("distance in m");
|
||||
break;
|
||||
case SHOW_DISTANCE_TRAVELED:
|
||||
vAxisOptions.setTitle("distance in m");
|
||||
break;
|
||||
default:
|
||||
vAxisOptions.setTitle("speed in kts");
|
||||
break;
|
||||
@@ -217,17 +240,28 @@ public class CompareCompetitorsPanel extends FormPanel {
|
||||
length = (length < chartData[i].length) ? chartData[i].length : length;
|
||||
}
|
||||
data.addRows(length);
|
||||
long startTime = chartData[0][0].getStartTime();
|
||||
for (int n = 0; n < chartData[0].length; n++) {
|
||||
Date d = new Date(chartData[0][n].getLegEntry().timeInMilliseconds);
|
||||
String time = "" + ((chartData[0][n] == null) ? 0 : dateTimeFormat.format(d));
|
||||
data.setValue(n, 0, time);
|
||||
long time = chartData[0][n].getLegEntry().timeInMilliseconds - startTime;
|
||||
String minutes = "" + Math.abs((time/60000));
|
||||
if (minutes.length() < 2){
|
||||
minutes = ((time < 0)? "-" : "") +"0" + minutes;
|
||||
}
|
||||
String seconds = "" + Math.abs((time/1000)%60);
|
||||
if (seconds.length() < 2){
|
||||
seconds= "0" + seconds;
|
||||
}
|
||||
data.setValue(n, 0, minutes + ":" + seconds);
|
||||
}
|
||||
for (int i = 0; i < chartData.length; i++) {
|
||||
double distanceTraveledOnPreviousLegs = 0;
|
||||
double lastTraveledDistance = 0;
|
||||
for (int j = 0; j < chartData[i].length; j++) {
|
||||
Double value = null;
|
||||
switch (dataToShow) {
|
||||
case SHOW_GAP_TO_LEADER:
|
||||
value = chartData[i][j].getLegEntry().gapToLeaderInSeconds;
|
||||
//value = (value != null && value < 1000)?value:null;
|
||||
break;
|
||||
case SHOW_VELOCITY_MADE_GOOD:
|
||||
value = chartData[i][j].getLegEntry().velocityMadeGoodInKnots;
|
||||
@@ -235,6 +269,16 @@ public class CompareCompetitorsPanel extends FormPanel {
|
||||
case SHOW_WINDWARD_DISTANCE_TO_GO:
|
||||
value = chartData[i][j].getLegEntry().windwardDistanceToGoInMeters;
|
||||
break;
|
||||
case SHOW_DISTANCE_TRAVELED:
|
||||
value = chartData[i][j].getLegEntry().distanceTraveledInMeters;
|
||||
if (value != null){
|
||||
if (lastTraveledDistance > value){
|
||||
distanceTraveledOnPreviousLegs += lastTraveledDistance;
|
||||
}
|
||||
lastTraveledDistance = value;
|
||||
value += distanceTraveledOnPreviousLegs;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
value = chartData[i][j].getLegEntry().currentSpeedOverGroundInKnots;
|
||||
}
|
||||
|
||||
+8
-11
@@ -1119,7 +1119,7 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
List<Competitor> selectedCompetitor = new ArrayList<Competitor>();
|
||||
for (Competitor c : competitors){
|
||||
for (CompetitorDAO cDAO : competitorDAOs){
|
||||
if (c.getName().equals(cDAO.name)){
|
||||
if (c.getId().toString().equals(cDAO.id)){
|
||||
selectedCompetitor.add(c);
|
||||
}
|
||||
}
|
||||
@@ -1128,23 +1128,20 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
int i = 0;
|
||||
for (Competitor c : selectedCompetitor){
|
||||
List<CompetitorWithRaceDAO> entries = new ArrayList<CompetitorWithRaceDAO>();
|
||||
for (long time = trackedRace.getStart().asMillis(); time < trackedRace.getTimePointOfNewestEvent().asMillis(); time += (trackedRace.getTimePointOfNewestEvent().asMillis()-trackedRace.getStart().asMillis())/steps){
|
||||
for (long time = trackedRace.getStart().asMillis()-20000; time < trackedRace.getTimePointOfNewestEvent().asMillis(); time += (trackedRace.getTimePointOfNewestEvent().asMillis()-trackedRace.getStart().asMillis()-20000)/steps){
|
||||
MillisecondsTimePoint timePoint = new MillisecondsTimePoint(time);
|
||||
CompetitorWithRaceDAO competitorWithRaceEntry = new CompetitorWithRaceDAO();
|
||||
competitorWithRaceEntry.setCompetitor(getCompetitorDAO(c));
|
||||
competitorWithRaceEntry.setStartTime(trackedRace.getStart().asMillis());
|
||||
if (trackedRace != null){
|
||||
LegEntryDAO legEntry = createLegEntry(trackedRace.getTrackedLeg(c, timePoint), timePoint);
|
||||
if (legEntry != null){
|
||||
legEntry.timeInMilliseconds = time;
|
||||
if (competitorWithRaceEntry.getLegEntry() == null){
|
||||
competitorWithRaceEntry.setLegEntry(legEntry);
|
||||
entries.add(competitorWithRaceEntry);
|
||||
}
|
||||
else {
|
||||
competitorWithRaceEntry.updateLegEntry(legEntry);
|
||||
}
|
||||
if (legEntry == null){
|
||||
legEntry = new LegEntryDAO();
|
||||
}
|
||||
legEntry.timeInMilliseconds = time;
|
||||
competitorWithRaceEntry.setLegEntry(legEntry);
|
||||
}
|
||||
entries.add(competitorWithRaceEntry);
|
||||
}
|
||||
competitorData[i++] = entries.toArray(new CompetitorWithRaceDAO[0]);
|
||||
}
|
||||
|
||||
+9
@@ -1,10 +1,19 @@
|
||||
package com.sap.sailing.gwt.ui.shared;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
import com.sap.sailing.domain.base.TimePoint;
|
||||
|
||||
public class CompetitorWithRaceDAO implements IsSerializable {
|
||||
private CompetitorDAO competitor;
|
||||
private LegEntryDAO legEntry;
|
||||
private long startTime;
|
||||
|
||||
public long getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
public void setStartTime(long startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
public CompetitorDAO getCompetitor() {
|
||||
return competitor;
|
||||
}
|
||||
|
||||
+3
@@ -17,6 +17,9 @@
|
||||
<!-- Google Maps API -->
|
||||
<inherits name='com.google.gwt.maps.GoogleMaps' />
|
||||
|
||||
<!-- Google Visualization API -->
|
||||
<inherits name='com.google.gwt.visualization.Visualization'/>
|
||||
|
||||
<!-- Phoenix Stuff -->
|
||||
<inherits name='com.sap.ui.commons.Module' />
|
||||
|
||||
|
||||
+3
@@ -17,6 +17,9 @@
|
||||
<!-- Google Maps API -->
|
||||
<inherits name='com.google.gwt.maps.GoogleMaps' />
|
||||
|
||||
<!-- Google Visualization API -->
|
||||
<inherits name='com.google.gwt.visualization.Visualization'/>
|
||||
|
||||
<!-- Phoenix Stuff -->
|
||||
<inherits name='com.sap.ui.commons.Module' />
|
||||
|
||||
|
||||
+3
@@ -17,6 +17,9 @@
|
||||
<!-- Google Maps API -->
|
||||
<inherits name='com.google.gwt.maps.GoogleMaps' />
|
||||
|
||||
<!-- Google Visualization API -->
|
||||
<inherits name='com.google.gwt.visualization.Visualization'/>
|
||||
|
||||
<!-- Phoenix Stuff -->
|
||||
<inherits name='com.sap.ui.commons.Module' />
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
Reference in new issue
Block a user