mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-28 06:47:15 +00:00
improved error handling for GPS file import
Change-Id: I4941d73475c6ed3ce8df61210b0161f0ac197303
This commit is contained in:
1 parent
fbb1a102d7
commit
14d8e93fdf
4 files changed
+24
-18
No files matched your search
+21
-18
@@ -7,6 +7,7 @@ import java.util.List;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Button;
|
||||
import com.google.gwt.user.client.ui.FileUpload;
|
||||
@@ -30,30 +31,32 @@ public class TrackFileImportWidget implements IsWidget {
|
||||
private static AdminConsoleResources resources = GWT.create(AdminConsoleResources.class);
|
||||
private static Image loaderImage = new Image(resources.loaderGif());
|
||||
|
||||
public TrackFileImportWidget(final TrackFileImportDeviceIdentifierTableWrapper table, StringMessages stringMessages,
|
||||
public TrackFileImportWidget(final TrackFileImportDeviceIdentifierTableWrapper table, final StringMessages stringMessages,
|
||||
final SailingServiceAsync sailingService, final ErrorReporter errorReporter) {
|
||||
this(new SubmitCompleteHandler() {
|
||||
@Override
|
||||
public void onSubmitComplete(SubmitCompleteEvent event) {
|
||||
table.getDataProvider().getList().clear();
|
||||
|
||||
String[] uuids = event.getResults().split("\\n");
|
||||
sailingService.getTrackFileImportDeviceIds(Arrays.asList(uuids),
|
||||
new AsyncCallback<List<TrackFileImportDeviceIdentifierDTO>>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<TrackFileImportDeviceIdentifierDTO> result) {
|
||||
table.getDataProvider().getList().addAll(result);
|
||||
loaderImage.setResource(resources.transparentGif());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError("Could not load TrackFileImportDeviceIds: " + caught.getMessage());
|
||||
loaderImage.setResource(resources.transparentGif());
|
||||
}
|
||||
});
|
||||
|
||||
if (uuids.length != 1 || (uuids.length > 0 && !uuids[0].isEmpty())) {
|
||||
sailingService.getTrackFileImportDeviceIds(Arrays.asList(uuids),
|
||||
new AsyncCallback<List<TrackFileImportDeviceIdentifierDTO>>() {
|
||||
@Override
|
||||
public void onSuccess(List<TrackFileImportDeviceIdentifierDTO> result) {
|
||||
table.getDataProvider().getList().addAll(result);
|
||||
loaderImage.setResource(resources.transparentGif());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError("Could not load TrackFileImportDeviceIds: " + caught.getMessage());
|
||||
loaderImage.setResource(resources.transparentGif());
|
||||
}
|
||||
});
|
||||
} else {
|
||||
loaderImage.setResource(resources.transparentGif());
|
||||
Window.alert(stringMessages.noTracksFound());
|
||||
}
|
||||
}
|
||||
}, stringMessages, sailingService, errorReporter);
|
||||
}
|
||||
|
||||
+1
@@ -1586,4 +1586,5 @@ public interface StringMessages extends com.sap.sse.gwt.client.StringMessages,
|
||||
String current();
|
||||
String simulationLegendAlgorithmTimedOutText();
|
||||
String simulationLegendMixedLegText();
|
||||
String noTracksFound();
|
||||
}
|
||||
+1
@@ -1561,3 +1561,4 @@ oneTurnerRight=1-Turner Right
|
||||
current=Current
|
||||
simulationLegendAlgorithmTimedOutText=out-of-bounds
|
||||
simulationLegendMixedLegText=ambiguous wind
|
||||
noTracksFound=No tracks found
|
||||
+1
@@ -1546,3 +1546,4 @@ oneTurnerRight=1-Wenden-Kurs rechts
|
||||
current=Strömung
|
||||
simulationLegendAlgorithmTimedOutText=außerhalb des zul. Bereichs
|
||||
simulationLegendMixedLegText=mehrdeutiger Wind
|
||||
noTracksFound=Keine Tracks gefunden
|
||||
Reference in new issue
Block a user