mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-08 20:12:23 +00:00
Fixed a bug that no data was shown when SailingService returned before
chart was loaded.
This commit is contained in:
1 parent
6e88ccf74c
commit
8e0fee1de9
4 files changed
+33
-45
No files matched your search
@@ -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="-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.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>
|
||||
+30
-39
@@ -39,7 +39,10 @@ public class CompareCompetitorsPanel extends FormPanel {
|
||||
private final SailingServiceAsync sailingService;
|
||||
private HorizontalPanel mainPanel;
|
||||
private VerticalPanel chartPanel;
|
||||
private final DeckPanel deckPanel;
|
||||
private String leaderboardName;
|
||||
private String raceName;
|
||||
private int stepsToLoad = 100;
|
||||
public static final int DECK_PANEL_INDEX_LOADING = 0;
|
||||
public static final int DECK_PANEL_INDEX_CHART = 1;
|
||||
|
||||
@@ -55,6 +58,7 @@ public class CompareCompetitorsPanel extends FormPanel {
|
||||
String raceName, final String leaderboardName) {
|
||||
this.sailingService = sailingService;
|
||||
this.competitors = competitors;
|
||||
this.leaderboardName = leaderboardName;
|
||||
this.raceName = raceName;
|
||||
mainPanel = new HorizontalPanel();
|
||||
chartPanel = new VerticalPanel();
|
||||
@@ -66,7 +70,7 @@ public class CompareCompetitorsPanel extends FormPanel {
|
||||
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 = new DeckPanel();
|
||||
|
||||
deckPanel.add(loadingPanel);
|
||||
final CaptionPanel configCaption = new CaptionPanel("Configuration");
|
||||
@@ -115,27 +119,9 @@ public class CompareCompetitorsPanel extends FormPanel {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
stepsToLoad = Integer.parseInt(txtbSteps.getText());
|
||||
deckPanel.showWidget(DECK_PANEL_INDEX_LOADING);
|
||||
CompareCompetitorsPanel.this.sailingService.getCompetitorRaceData(leaderboardName,
|
||||
CompareCompetitorsPanel.this.raceName, competitors, Integer.parseInt(txtbSteps.getText()),
|
||||
new AsyncCallback<CompetitorWithRaceDAO[][]>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(CompetitorWithRaceDAO[][] result) {
|
||||
fireEvent(new DataLoadedEvent());
|
||||
chartData = result;
|
||||
if (chart != null) {
|
||||
deckPanel.showWidget(DECK_PANEL_INDEX_CHART);
|
||||
chart.draw(prepareTableData(), getOptions());
|
||||
}
|
||||
}
|
||||
});
|
||||
loadData();
|
||||
}
|
||||
});
|
||||
configPanel.add(bttSteps);
|
||||
@@ -148,30 +134,14 @@ public class CompareCompetitorsPanel extends FormPanel {
|
||||
chart = new LineChart(prepareTableData(), getOptions());
|
||||
deckPanel.add(chart);
|
||||
fireEvent(new DataLoadedEvent());
|
||||
loadData();
|
||||
// chartLoaded = true;
|
||||
}
|
||||
};
|
||||
VisualizationUtils.loadVisualizationApi(onLoadCallback, LineChart.PACKAGE);
|
||||
|
||||
deckPanel.showWidget(DECK_PANEL_INDEX_LOADING);
|
||||
this.sailingService.getCompetitorRaceData(leaderboardName, this.raceName, competitors, 100,
|
||||
new AsyncCallback<CompetitorWithRaceDAO[][]>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
Window.alert("Failed to laod race data.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(CompetitorWithRaceDAO[][] result) {
|
||||
fireEvent(new DataLoadedEvent());
|
||||
chartData = result;
|
||||
if (chart != null) {
|
||||
deckPanel.showWidget(DECK_PANEL_INDEX_CHART);
|
||||
chart.draw(prepareTableData(), getOptions());
|
||||
}
|
||||
}
|
||||
});
|
||||
loadData();
|
||||
chartPanel.add(deckPanel);
|
||||
mainPanel.add(chartPanel);
|
||||
mainPanel.add(configCaption);
|
||||
@@ -223,6 +193,27 @@ public class CompareCompetitorsPanel extends FormPanel {
|
||||
opt.setVAxisOptions(vAxisOptions);
|
||||
return opt;
|
||||
}
|
||||
|
||||
private void loadData(){
|
||||
this.sailingService.getCompetitorRaceData(leaderboardName, this.raceName, competitors, stepsToLoad,
|
||||
new AsyncCallback<CompetitorWithRaceDAO[][]>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
Window.alert("Failed to laod race data.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(CompetitorWithRaceDAO[][] result) {
|
||||
fireEvent(new DataLoadedEvent());
|
||||
chartData = result;
|
||||
if (chart != null) {
|
||||
deckPanel.showWidget(DECK_PANEL_INDEX_CHART);
|
||||
chart.draw(prepareTableData(), getOptions());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private AbstractDataTable prepareTableData() {
|
||||
DataTable data = DataTable.create();
|
||||
|
||||
+2
-4
@@ -1159,11 +1159,9 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
}
|
||||
competitorData[i++] = entries.toArray(new CompetitorWithRaceDAO[0]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return competitorData;
|
||||
}
|
||||
|
||||
public Map<CompetitorDAO, List<GPSFixDAO>> getDouglasPoints(String eventName, String raceName,
|
||||
Map<CompetitorDAO, Date> from, Map<CompetitorDAO, Date> to,
|
||||
double meters) {
|
||||
|
||||
-1
@@ -1,7 +1,6 @@
|
||||
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;
|
||||
|
||||
Reference in new issue
Block a user