Implemented error page for new series UI if service call fails

This commit is contained in:
Steffen Schaefer committed 2015-03-17 11:11:39 +01:00
1 parent e1d70945b9
commit 3a80ebd904
5 files changed
+25 -11

No files matched your search

@@ -51,7 +51,7 @@ public class EventActivityProxy extends AbstractActivityProxy {
@Override
public void onFailure(Throwable caught) {
// TODO @FM: extract text?
ErrorPlace errorPlace = new ErrorPlace("Error while loading the event with service getEventById()");
ErrorPlace errorPlace = new ErrorPlace("Error while loading the event with service getEventViewById()");
// TODO @FM: reload sinnvoll hier?
errorPlace.setComingFrom(place);
clientFactory.getPlaceController().goTo(errorPlace);
@@ -17,6 +17,7 @@ import com.sap.sailing.gwt.home.client.place.events.EventsPlace;
import com.sap.sailing.gwt.home.client.place.series.SeriesClientFactory;
import com.sap.sailing.gwt.home.client.place.start.StartPlace;
import com.sap.sailing.gwt.ui.shared.media.MediaDTO;
import com.sap.sse.gwt.client.mvp.ErrorView;
public abstract class AbstractSeriesActivity<PLACE extends AbstractSeriesPlace> extends AbstractActivity implements SeriesView.Presenter {
@@ -85,7 +86,11 @@ public abstract class AbstractSeriesActivity<PLACE extends AbstractSeriesPlace>
clientFactory.getSailingService().getMediaForEventSeries(ctx.getSeriesDTO().getId(), new AsyncCallback<MediaDTO>() {
@Override
public void onFailure(Throwable caught) {
callback.onFailure(caught);
// TODO @FM: extract error message
ErrorView errorView = clientFactory.createErrorView("Load media failure for series", caught);
getView().showErrorInCurrentTab(errorView);
// TODO: notify callback of failure?
// callback.onFailure(caught);
}
@Override
@@ -100,4 +105,6 @@ public abstract class AbstractSeriesActivity<PLACE extends AbstractSeriesPlace>
public boolean hasMedia() {
return ctx.getSeriesDTO().isHasMedia();
}
protected abstract SeriesView<PLACE, ?> getView();
}
@@ -5,6 +5,7 @@ import java.util.UUID;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.sap.sailing.gwt.home.client.app.HomePlacesNavigator;
import com.sap.sailing.gwt.home.client.place.error.ErrorPlace;
import com.sap.sailing.gwt.home.client.place.fakeseries.tabs.SeriesEventsPlace;
import com.sap.sailing.gwt.home.client.place.series.SeriesClientFactory;
import com.sap.sailing.gwt.ui.shared.fakeseries.EventSeriesViewDTO;
@@ -35,19 +36,17 @@ public class SeriesActivityProxy extends AbstractActivityProxy {
clientFactory.getSailingService().getEventSeriesViewById(seriesUUID, new AsyncCallback<EventSeriesViewDTO>() {
@Override
public void onSuccess(final EventSeriesViewDTO event) {
if (event != null) {
ctx.updateContext(event);
afterLoad();
} else {
// TODO
// createErrorView("No such event with UUID " + eventUUID, null, panel);
}
ctx.updateContext(event);
afterLoad();
}
@Override
public void onFailure(Throwable caught) {
// TODO
// createErrorView("Error while loading the event with service getEventById()", caught, panel);
// TODO @FM: extract text?
ErrorPlace errorPlace = new ErrorPlace("Error while loading the series with service getEventSeriesViewById()");
// TODO @FM: reload sinnvoll hier?
errorPlace.setComingFrom(place);
clientFactory.getPlaceController().goTo(errorPlace);
}
});
@@ -50,4 +50,6 @@ public interface SeriesView<PLACE extends AbstractSeriesPlace, PRES extends Seri
*/
void navigateTabsTo(PLACE place);
void showErrorInCurrentTab(IsWidget errorView);
}
@@ -5,6 +5,7 @@ import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.Widget;
import com.sap.sailing.gwt.common.client.controls.tabbar.TabPanel;
import com.sap.sailing.gwt.common.client.controls.tabbar.TabPanelPlaceSelectionEvent;
@@ -72,4 +73,9 @@ public class TabletAndDesktopSeriesView extends Composite implements SeriesView<
}
});
}
@Override
public void showErrorInCurrentTab(IsWidget errorView) {
tabPanelUi.overrideCurrentContentInTab(errorView);
}
}