Error handling (error view) on new event implementation

This commit is contained in:
Papick Garcia Taboada committed 2015-03-17 10:06:04 +01:00
1 parent e1462316e5
commit a6ab15c8f3
23 files changed
+264 -136

No files matched your search

@@ -15,6 +15,7 @@ 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.FlowPanel;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;
import com.sap.sailing.gwt.common.client.controls.tabbar.TabView.State;
@@ -129,6 +130,15 @@ public class TabPanel<PRESENTER> extends Composite {
}
/**
* Directly sets the content of the current widget until it is reloaded/ reset
*
* @param widget
*/
public void overrideCurrentContentInTab(IsWidget widget) {
tabContentPanelUi.setWidget(widget);
}
public void addBreadcrumbItem(String title, String link, final Runnable runnable) {
breadcrumbs.addBreadcrumbItem(title, link, runnable);
}
@@ -7,6 +7,8 @@ import com.sap.sailing.gwt.home.client.place.aboutus.AboutUsActivityProxy;
import com.sap.sailing.gwt.home.client.place.aboutus.AboutUsPlace;
import com.sap.sailing.gwt.home.client.place.contact.ContactActivityProxy;
import com.sap.sailing.gwt.home.client.place.contact.ContactPlace;
import com.sap.sailing.gwt.home.client.place.error.ErrorActivityProxy;
import com.sap.sailing.gwt.home.client.place.error.ErrorPlace;
import com.sap.sailing.gwt.home.client.place.event.EventPlace;
import com.sap.sailing.gwt.home.client.place.event2.AbstractEventPlace;
import com.sap.sailing.gwt.home.client.place.event2.EventActivityProxy;
@@ -48,6 +50,8 @@ public class ApplicationActivityMapper implements ActivityMapper {
public Activity getActivity(Place place) {
if (place instanceof AboutUsPlace) {
return new AboutUsActivityProxy((AboutUsPlace) place, clientFactory);
} else if (place instanceof ErrorPlace) {
return new ErrorActivityProxy((ErrorPlace) place, clientFactory);
} else if (place instanceof ContactPlace) {
return new ContactActivityProxy((ContactPlace) place, clientFactory);
} else if (place instanceof EventPlace) {
@@ -2,6 +2,7 @@ package com.sap.sailing.gwt.home.client.app;
import com.sap.sailing.gwt.home.client.place.aboutus.AboutUsClientFactory;
import com.sap.sailing.gwt.home.client.place.contact.ContactClientFactory;
import com.sap.sailing.gwt.home.client.place.error.ErrorClientFactory;
import com.sap.sailing.gwt.home.client.place.event.EventClientFactory;
import com.sap.sailing.gwt.home.client.place.events.EventsClientFactory;
import com.sap.sailing.gwt.home.client.place.regatta.RegattaClientFactory;
@@ -14,6 +15,6 @@ import com.sap.sailing.gwt.home.client.place.whatsnew.WhatsNewClientFactory;
public interface ApplicationClientFactory extends AboutUsClientFactory, ContactClientFactory, EventClientFactory,
EventsClientFactory, StartClientFactory, SponsoringClientFactory, SolutionsClientFactory, SearchResultClientFactory,
WhatsNewClientFactory, RegattaClientFactory, SeriesClientFactory {
WhatsNewClientFactory, RegattaClientFactory, SeriesClientFactory, ErrorClientFactory {
HomePlacesNavigator getHomePlacesNavigator();
}
@@ -28,9 +28,9 @@ import com.sap.sailing.gwt.home.client.place.sponsoring.SponsoringView;
import com.sap.sailing.gwt.home.client.place.sponsoring.TabletAndDesktopSponsoringView;
import com.sap.sailing.gwt.home.client.place.start.StartView;
import com.sap.sailing.gwt.home.client.place.start.TabletAndDesktopStartView;
import com.sap.sailing.gwt.home.client.place.whatsnew.TabletAndDesktopWhatsNewView;
import com.sap.sailing.gwt.home.client.place.whatsnew.WhatsNewPlace.WhatsNewNavigationTabs;
import com.sap.sailing.gwt.home.client.place.whatsnew.WhatsNewView;
import com.sap.sailing.gwt.home.client.place.whatsnew.TabletAndDesktopWhatsNewView;
import com.sap.sailing.gwt.ui.shared.EventDTO;
import com.sap.sailing.gwt.ui.shared.RaceGroupDTO;
import com.sap.sse.gwt.client.player.Timer;
@@ -66,7 +66,7 @@ public class SmartphoneApplicationClientFactory extends AbstractApplicationClien
@Override
public TabletAndDesktopErrorView createErrorView(String errorMessage, Throwable errorReason) {
return new TabletAndDesktopErrorView(errorMessage, errorReason);
return new TabletAndDesktopErrorView(errorMessage, errorReason, null);
}
@Override
@@ -28,9 +28,9 @@ import com.sap.sailing.gwt.home.client.place.sponsoring.SponsoringView;
import com.sap.sailing.gwt.home.client.place.sponsoring.TabletAndDesktopSponsoringView;
import com.sap.sailing.gwt.home.client.place.start.StartView;
import com.sap.sailing.gwt.home.client.place.start.TabletAndDesktopStartView;
import com.sap.sailing.gwt.home.client.place.whatsnew.WhatsNewView;
import com.sap.sailing.gwt.home.client.place.whatsnew.TabletAndDesktopWhatsNewView;
import com.sap.sailing.gwt.home.client.place.whatsnew.WhatsNewPlace.WhatsNewNavigationTabs;
import com.sap.sailing.gwt.home.client.place.whatsnew.WhatsNewView;
import com.sap.sailing.gwt.ui.shared.EventDTO;
import com.sap.sailing.gwt.ui.shared.RaceGroupDTO;
import com.sap.sse.gwt.client.player.Timer;
@@ -56,7 +56,7 @@ public class TabletAndDesktopApplicationClientFactory extends AbstractApplicatio
@Override
public TabletAndDesktopErrorView createErrorView(String errorMessage, Throwable errorReason) {
return new TabletAndDesktopErrorView(errorMessage, errorReason);
return new TabletAndDesktopErrorView(errorMessage, errorReason, null);
}
@Override
@@ -2,17 +2,46 @@ package com.sap.sailing.gwt.home.client.place.error;
import com.google.gwt.activity.shared.AbstractActivity;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
public class ErrorActivity extends AbstractActivity {
private ErrorPlace currentPlace;
private ErrorClientFactory clientFactory;
public ErrorActivity(ErrorPlace place, ErrorClientFactory clientFactory) {
this.currentPlace = place;
this.clientFactory = clientFactory;
}
@Override
public void start(AcceptsOneWidget panel, EventBus eventBus) {
// TODO: the error place should get the error message from the place
panel.setWidget(new TabletAndDesktopErrorView(null, null));
final TabletAndDesktopErrorView view;
Command reloadCommand = null;
if (currentPlace.getComingFrom() != null) {
reloadCommand = new Command() {
@Override
public void execute() {
clientFactory.getPlaceController().goTo(currentPlace.getComingFrom());
}
};
}
if (currentPlace.hasCustomErrorMessages()) {
view = new TabletAndDesktopErrorView(
currentPlace.getErrorMessage(),
currentPlace.getErrorMessageDetail(),
currentPlace.getException(), reloadCommand);
} else {
view = new TabletAndDesktopErrorView(currentPlace.getErrorMessageDetail(), currentPlace.getException(),
reloadCommand);
}
panel.setWidget(view);
}
}
@@ -1,10 +1,62 @@
package com.sap.sailing.gwt.home.client.place.error;
import com.google.gwt.place.shared.Place;
import com.google.gwt.place.shared.PlaceTokenizer;
import com.sap.sailing.gwt.common.client.AbstractBasePlace;
public class ErrorPlace extends AbstractBasePlace {
/**
* Place provided for reload action
*/
private Place comingFrom;
/**
* Custom error messages
*/
private String errorMessage;
/**
* Detail error message
*/
private final String errorMessageDetail;
public ErrorPlace(String errorMessageDetail) {
this.errorMessageDetail = errorMessageDetail;
}
/**
* Exception ocurred
*/
private Throwable exception;
public Place getComingFrom() {
return comingFrom;
}
public void setComingFrom(Place comingFrom) {
this.comingFrom = comingFrom;
}
public String getErrorMessage() {
return errorMessage;
}
public String getErrorMessageDetail() {
return errorMessageDetail;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
public Throwable getException() {
return exception;
}
public void setException(Throwable exception) {
this.exception = exception;
}
public static class Tokenizer implements PlaceTokenizer<ErrorPlace> {
@Override
public String getToken(ErrorPlace place) {
@@ -13,7 +65,12 @@ public class ErrorPlace extends AbstractBasePlace {
@Override
public ErrorPlace getPlace(String token) {
return new ErrorPlace();
return new ErrorPlace("");
}
}
public boolean hasCustomErrorMessages() {
return errorMessage != null && !errorMessage.isEmpty();
}
}
@@ -3,6 +3,7 @@ package com.sap.sailing.gwt.home.client.place.error;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.sap.sailing.gwt.home.client.shared.error.ErrorMessage;
@@ -16,9 +17,14 @@ public class TabletAndDesktopErrorView extends Composite implements ErrorView {
@UiField(provided=true) ErrorMessage errorMessage;
public TabletAndDesktopErrorView(String errorMessageText, Throwable errorReason) {
errorMessage = new ErrorMessage(errorMessageText, errorReason);
public TabletAndDesktopErrorView(String errorMessageTextDetail, Throwable errorReason, Command reloadCommand) {
errorMessage = new ErrorMessage(errorMessageTextDetail, errorReason, reloadCommand);
initWidget(uiBinder.createAndBindUi(this));
}
public TabletAndDesktopErrorView(String customMessageText, String errorMessageTextDetail, Throwable errorReason,
Command reloadCommand) {
errorMessage = new ErrorMessage(customMessageText, errorMessageTextDetail, errorReason, reloadCommand);
initWidget(uiBinder.createAndBindUi(this));
}
}
@@ -31,10 +31,12 @@ import com.sap.sailing.gwt.ui.shared.StrippedLeaderboardDTO;
import com.sap.sailing.gwt.ui.shared.eventview.EventViewDTO;
import com.sap.sailing.gwt.ui.shared.eventview.HasRegattaMetadata;
import com.sap.sailing.gwt.ui.shared.media.MediaDTO;
import com.sap.sse.gwt.client.mvp.ErrorView;
import com.sap.sse.gwt.client.player.Timer;
import com.sap.sse.gwt.client.player.Timer.PlayModes;
public abstract class AbstractEventActivity<PLACE extends AbstractEventPlace> extends AbstractActivity implements EventView.Presenter {
public abstract class AbstractEventActivity<PLACE extends AbstractEventPlace> extends AbstractActivity implements
EventView.Presenter {
protected final PLACE currentPlace;
@@ -45,7 +47,7 @@ public abstract class AbstractEventActivity<PLACE extends AbstractEventPlace> ex
private final Timer timerForClientServerOffset;
protected final HomePlacesNavigator homePlacesNavigator;
private static final ApplicationHistoryMapper historyMapper = GWT.create(ApplicationHistoryMapper.class);
public AbstractEventActivity(PLACE place, EventClientFactory clientFactory, HomePlacesNavigator homePlacesNavigator) {
@@ -71,11 +73,11 @@ public abstract class AbstractEventActivity<PLACE extends AbstractEventPlace> ex
Place tabPlaceToGo = selectedActivity.placeToFire();
clientFactory.getPlaceController().goTo(tabPlaceToGo);
}
public void navigateTo(Place place) {
clientFactory.getPlaceController().goTo(place);
}
@Override
public SafeUri getUrl(AbstractEventPlace place) {
String token = historyMapper.getToken(place);
@@ -91,14 +93,14 @@ public abstract class AbstractEventActivity<PLACE extends AbstractEventPlace> ex
public Timer getTimerForClientServerOffset() {
return timerForClientServerOffset;
}
@Override
public AbstractEventRegattaPlace getPlaceForRegatta(String regattaId) {
// TODO Overview isn't implemented yet
// return new RegattaOverviewPlace(contextForRegatta(regattaId));
// return new RegattaOverviewPlace(contextForRegatta(regattaId));
return new RegattaRacesPlace(contextForRegatta(regattaId));
}
@Override
public RegattaRacesPlace getPlaceForRegattaRaces(String regattaId) {
return new RegattaRacesPlace(contextForRegatta(regattaId));
@@ -107,25 +109,27 @@ public abstract class AbstractEventActivity<PLACE extends AbstractEventPlace> ex
protected EventContext contextForRegatta(String regattaId) {
return new EventContext(ctx).withRegattaId(regattaId);
}
public String getRaceViewerURL(StrippedLeaderboardDTO leaderboard, RaceDTO race) {
RegattaAndRaceIdentifier raceIdentifier = race.getRaceIdentifier();
return EntryPointLinkFactory.createRaceBoardLink(createRaceBoardLinkParameters(leaderboard.name, raceIdentifier));
return EntryPointLinkFactory
.createRaceBoardLink(createRaceBoardLinkParameters(leaderboard.name, raceIdentifier));
}
private Map<String, String> createRaceBoardLinkParameters(String leaderboardName, RegattaAndRaceIdentifier raceIdentifier) {
private Map<String, String> createRaceBoardLinkParameters(String leaderboardName,
RegattaAndRaceIdentifier raceIdentifier) {
Map<String, String> linkParams = new HashMap<String, String>();
linkParams.put("eventId", ctx.getEventId());
linkParams.put("leaderboardName", leaderboardName);
linkParams.put("raceName", raceIdentifier.getRaceName());
// TODO this must only be forwarded if there is a logged-on user
// linkParams.put(RaceBoardViewConfiguration.PARAM_CAN_REPLAY_DURING_LIVE_RACES, "true");
// linkParams.put(RaceBoardViewConfiguration.PARAM_CAN_REPLAY_DURING_LIVE_RACES, "true");
linkParams.put(RaceBoardViewConfiguration.PARAM_VIEW_SHOW_MAPCONTROLS, "true");
linkParams.put(RaceBoardViewConfiguration.PARAM_VIEW_SHOW_NAVIGATION_PANEL, "true");
linkParams.put("regattaName", raceIdentifier.getRegattaName());
return linkParams;
}
@Override
public PlaceNavigation<StartPlace> getHomeNavigation() {
return homePlacesNavigator.getHomeNavigation();
@@ -135,82 +139,95 @@ public abstract class AbstractEventActivity<PLACE extends AbstractEventPlace> ex
public PlaceNavigation<EventsPlace> getEventsNavigation() {
return homePlacesNavigator.getEventsNavigation();
}
@Override
public PlaceNavigation<EventDefaultPlace> getCurrentEventNavigation() {
return homePlacesNavigator.getEventNavigation(ctx.getEventId(), ctx.getEventDTO().getBaseURL(), ctx.getEventDTO().isOnRemoteServer());
return homePlacesNavigator.getEventNavigation(ctx.getEventId(), ctx.getEventDTO().getBaseURL(), ctx
.getEventDTO().isOnRemoteServer());
}
@Override
public PlaceNavigation<SeriesDefaultPlace> getCurrentEventSeriesNavigation() {
return homePlacesNavigator.getEventSeriesNavigation(ctx.getEventId(), ctx.getEventDTO().getBaseURL(), ctx.getEventDTO().isOnRemoteServer());
return homePlacesNavigator.getEventSeriesNavigation(ctx.getEventId(), ctx.getEventDTO().getBaseURL(), ctx
.getEventDTO().isOnRemoteServer());
}
@Override
public PlaceNavigation<RegattaRacesPlace> getRegattaRacesNavigation(String regattaId) {
return homePlacesNavigator.getEventNavigation(getPlaceForRegattaRaces(regattaId), new RegattaRacesPlace.Tokenizer(), ctx.getEventDTO().getBaseURL(), ctx.getEventDTO().isOnRemoteServer());
return homePlacesNavigator
.getEventNavigation(getPlaceForRegattaRaces(regattaId), new RegattaRacesPlace.Tokenizer(), ctx
.getEventDTO().getBaseURL(), ctx.getEventDTO().isOnRemoteServer());
}
@Override
public PlaceNavigation<RegattaRacesPlace> getRegattaNavigation(String regattaId) {
return homePlacesNavigator.getEventNavigation(getPlaceForRegattaRaces(regattaId), new RegattaRacesPlace.Tokenizer(), ctx.getEventDTO().getBaseURL(), ctx.getEventDTO().isOnRemoteServer());
return homePlacesNavigator
.getEventNavigation(getPlaceForRegattaRaces(regattaId), new RegattaRacesPlace.Tokenizer(), ctx
.getEventDTO().getBaseURL(), ctx.getEventDTO().isOnRemoteServer());
}
@Override
public void ensureRegattaStructure(final AsyncCallback<List<RaceGroupDTO>> callback) {
if(ctx.getRaceGroups() != null) {
if (ctx.getRaceGroups() != null) {
callback.onSuccess(ctx.getRaceGroups());
return;
}
final long clientTimeWhenRequestWasSent = System.currentTimeMillis();
final EventViewDTO eventDTO = ctx.getEventDTO();
getSailingService().getRegattaStructureOfEvent(eventDTO.id,
new AsyncCallback<List<RaceGroupDTO>>() {
@Override
public void onSuccess(List<RaceGroupDTO> raceGroups) {
if (raceGroups.size() > 0) {
for (LeaderboardGroupDTO leaderboardGroupDTO : eventDTO.getLeaderboardGroups()) {
final long clientTimeWhenResponseWasReceived = System.currentTimeMillis();
if (leaderboardGroupDTO.getAverageDelayToLiveInMillis() != null) {
timerForClientServerOffset.setLivePlayDelayInMillis(
leaderboardGroupDTO
.getAverageDelayToLiveInMillis());
}
timerForClientServerOffset.adjustClientServerOffset(
clientTimeWhenRequestWasSent,
leaderboardGroupDTO.getCurrentServerTime(), clientTimeWhenResponseWasReceived);
}
ctx.withRaceGroups(raceGroups);
callback.onSuccess(raceGroups);
} else {
// TODO
// createEventWithoutRegattasView(event, panel);
@Override
public void onSuccess(List<RaceGroupDTO> raceGroups) {
if (raceGroups.size() > 0) {
for (LeaderboardGroupDTO leaderboardGroupDTO : eventDTO.getLeaderboardGroups()) {
final long clientTimeWhenResponseWasReceived = System.currentTimeMillis();
if (leaderboardGroupDTO.getAverageDelayToLiveInMillis() != null) {
timerForClientServerOffset.setLivePlayDelayInMillis(leaderboardGroupDTO
.getAverageDelayToLiveInMillis());
}
timerForClientServerOffset.adjustClientServerOffset(clientTimeWhenRequestWasSent,
leaderboardGroupDTO.getCurrentServerTime(), clientTimeWhenResponseWasReceived);
}
ctx.withRaceGroups(raceGroups);
callback.onSuccess(raceGroups);
} else {
// TODO @FM: extract error message
ErrorView errorView = clientFactory.createErrorView("No race data available", null);
getView().showErrorInCurrentTab(errorView);
}
}
@Override
public void onFailure(Throwable caught) {
// createErrorView(
// "Error while loading the regatta structure with service getRegattaStructureOfEvent()",
// caught, panel);
callback.onFailure(caught);
}
});
@Override
public void onFailure(Throwable caught) {
// TODO @FM: extract error message
ErrorView errorView = clientFactory.createErrorView(
"Error while loading the regatta structure with service getRegattaStructureOfEvent()", caught);
getView().showErrorInCurrentTab(errorView);
// TODO: notify callback of failure?
// callback.onFailure(caught);
}
});
}
@Override
public void ensureMedia(final AsyncCallback<MediaDTO> callback) {
if(ctx.getMedia() != null) {
if (ctx.getMedia() != null) {
callback.onSuccess(ctx.getMedia());
return;
}
getSailingService().getMediaForEvent(ctx.getEventDTO().id, 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 event", caught);
getView().showErrorInCurrentTab(errorView);
// TODO: notify callback of failure?
// callback.onFailure(caught);
}
@Override
@@ -220,12 +237,15 @@ public abstract class AbstractEventActivity<PLACE extends AbstractEventPlace> ex
}
});
}
@Override
public boolean hasMedia() {
if(showRegattaMetadata()) {
if (showRegattaMetadata()) {
return false;
}
return ctx.getEventDTO().isHasMedia();
}
protected abstract EventView<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.event.EventClientFactory;
import com.sap.sailing.gwt.home.client.place.event2.multiregatta.AbstractMultiregattaEventPlace;
import com.sap.sailing.gwt.home.client.place.event2.multiregatta.EventMultiregattaActivity;
@@ -27,7 +28,7 @@ public class EventActivityProxy extends AbstractActivityProxy {
HomePlacesNavigator homePlacesNavigator) {
this.place = place;
this.homePlacesNavigator = homePlacesNavigator;
ctx = this.place.getCtx();
this.ctx = this.place.getCtx();
this.clientFactory = clientFactory;
}
@@ -41,75 +42,28 @@ public class EventActivityProxy extends AbstractActivityProxy {
clientFactory.getSailingService().getEventViewById(eventUUID, new AsyncCallback<EventViewDTO>() {
@Override
public void onSuccess(final EventViewDTO event) {
if (event != null) {
ctx.updateContext(event);
afterEventLoad();
} else {
// TODO
// createErrorView("No such event with UUID " + eventUUID, null, panel);
}
ctx.updateContext(event);
afterEventLoad();
}
@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 event with service getEventById()");
// TODO @FM: reload sinnvoll hier?
errorPlace.setComingFrom(place);
clientFactory.getPlaceController().goTo(errorPlace);
}
});
}
}
private void afterEventLoad() {
if(place instanceof EventDefaultPlace) {
place = getRealPlace();
}
loadRegattaStructureIfNeeded();
}
protected void loadRegattaStructureIfNeeded() {
// // TODO do this in a nicer way
// if(place instanceof MultiregattaRegattasPlace || place instanceof RegattaRacesPlace) {
// final long clientTimeWhenRequestWasSent = System.currentTimeMillis();
//
// final EventViewDTO eventDTO = ctx.getEventDTO();
//
// clientFactory.getSailingService().getRegattaStructureOfEvent(eventDTO.id,
// new AsyncCallback<List<RaceGroupDTO>>() {
// @Override
// public void onSuccess(List<RaceGroupDTO> raceGroups) {
// if (raceGroups.size() > 0) {
// for (LeaderboardGroupDTO leaderboardGroupDTO : eventDTO.getLeaderboardGroups()) {
// final long clientTimeWhenResponseWasReceived = System.currentTimeMillis();
// if (leaderboardGroupDTO.getAverageDelayToLiveInMillis() != null) {
// currentPresenter.getTimerForClientServerOffset().setLivePlayDelayInMillis(
// leaderboardGroupDTO
// .getAverageDelayToLiveInMillis());
// }
// currentPresenter.getTimerForClientServerOffset().adjustClientServerOffset(
// clientTimeWhenRequestWasSent,
// leaderboardGroupDTO.getCurrentServerTime(), clientTimeWhenResponseWasReceived);
// }
// afterLoad();
// } else {
// // createEventWithoutRegattasView(event, panel);
// }
// }
//
// @Override
// public void onFailure(Throwable caught) {
// // createErrorView(
// // "Error while loading the regatta structure with service getRegattaStructureOfEvent()",
// // caught, panel);
// }
// });
// } else {
afterLoad();
// }
afterLoad();
}
private void afterLoad() {
@@ -75,4 +75,6 @@ public interface EventView<PLACE extends AbstractEventPlace, PRES extends EventV
*/
void navigateTabsTo(PLACE place);
void showErrorInCurrentTab(IsWidget errorView);
}
@@ -5,6 +5,7 @@ import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.sap.sailing.gwt.home.client.app.HomePlacesNavigator;
import com.sap.sailing.gwt.home.client.place.event.EventClientFactory;
import com.sap.sailing.gwt.home.client.place.event2.AbstractEventActivity;
import com.sap.sailing.gwt.home.client.place.event2.EventView;
import com.sap.sailing.gwt.home.client.place.event2.EventView.PlaceCallback;
public class EventMultiregattaActivity extends AbstractEventActivity<AbstractMultiregattaEventPlace> implements EventMultiregattaView.Presenter {
@@ -36,4 +37,10 @@ public class EventMultiregattaActivity extends AbstractEventActivity<AbstractMul
public boolean showRegattaMetadata() {
return false;
}
@Override
protected EventView<AbstractMultiregattaEventPlace, ?> getView() {
return currentView;
}
}
@@ -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;
@@ -74,4 +75,8 @@ public class TabletAndDesktopEventView extends Composite implements EventMultire
});
}
@Override
public void showErrorInCurrentTab(IsWidget errorView) {
tabPanelUi.overrideCurrentContentInTab(errorView);
}
}
@@ -9,6 +9,7 @@ import com.sap.sailing.gwt.home.client.place.event.EventClientFactory;
import com.sap.sailing.gwt.home.client.place.event.regattaanalytics.RegattaAnalyticsDataManager;
import com.sap.sailing.gwt.home.client.place.event2.AbstractEventActivity;
import com.sap.sailing.gwt.home.client.place.event2.EventContext;
import com.sap.sailing.gwt.home.client.place.event2.EventView;
import com.sap.sailing.gwt.home.client.place.event2.EventView.PlaceCallback;
import com.sap.sailing.gwt.home.client.place.event2.regatta.tabs.RegattaRacesPlace;
import com.sap.sailing.gwt.ui.shared.eventview.EventViewDTO;
@@ -95,4 +96,9 @@ public class EventRegattaActivity extends AbstractEventActivity<AbstractEventReg
return autoRefreshTimer;
}
@Override
protected EventView<AbstractEventRegattaPlace, ?> getView() {
return currentView;
}
}
@@ -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;
@@ -83,4 +84,9 @@ public class TabletAndDesktopEventView extends Composite implements EventRegatta
});
}
@Override
public void showErrorInCurrentTab(IsWidget errorView) {
tabPanelUi.overrideCurrentContentInTab(errorView);
}
}
@@ -14,10 +14,10 @@ import com.sap.sailing.domain.common.dto.RaceColumnDTO;
import com.sap.sailing.gwt.common.client.controls.tabbar.TabView;
import com.sap.sailing.gwt.home.client.place.event.oldleaderboard.OldLeaderboard;
import com.sap.sailing.gwt.home.client.place.event.regattaanalytics.RegattaAnalyticsDataManager;
import com.sap.sailing.gwt.home.client.place.event2.EventParamUtils;
import com.sap.sailing.gwt.home.client.place.event2.regatta.EventRegattaView;
import com.sap.sailing.gwt.home.client.place.event2.regatta.EventRegattaView.Presenter;
import com.sap.sailing.gwt.home.client.place.event2.regatta.RegattaTabView;
import com.sap.sailing.gwt.home.client.place.event2.utils.EventParamUtils;
import com.sap.sailing.gwt.home.client.shared.placeholder.Placeholder;
import com.sap.sailing.gwt.ui.client.LeaderboardUpdateListener;
import com.sap.sailing.gwt.ui.leaderboard.LeaderboardPanel;
@@ -1,4 +1,4 @@
package com.sap.sailing.gwt.home.client.place.event2;
package com.sap.sailing.gwt.home.client.place.event2.utils;
import java.util.ArrayList;
import java.util.Collections;
@@ -1,4 +1,4 @@
package com.sap.sailing.gwt.home.client.place.event2;
package com.sap.sailing.gwt.home.client.place.event2.utils;
import com.google.gwt.user.client.Window;
@@ -14,7 +14,7 @@ import com.sap.sailing.domain.common.dto.RaceColumnDTO;
import com.sap.sailing.gwt.common.client.controls.tabbar.TabView;
import com.sap.sailing.gwt.home.client.place.event.oldleaderboard.OldLeaderboard;
import com.sap.sailing.gwt.home.client.place.event.seriesanalytics.EventSeriesAnalyticsDataManager;
import com.sap.sailing.gwt.home.client.place.event2.EventParamUtils;
import com.sap.sailing.gwt.home.client.place.event2.utils.EventParamUtils;
import com.sap.sailing.gwt.home.client.place.fakeseries.SeriesTabView;
import com.sap.sailing.gwt.home.client.place.fakeseries.SeriesView;
import com.sap.sailing.gwt.home.client.shared.placeholder.Placeholder;
@@ -8,8 +8,10 @@
}
.error_message_detail {
font-size: 15px;
margin-top: 20px;
}
.reload_page_message {
font-size: 20px;
margin-right: 20px;
margin-bottom: 20px;
}
@@ -6,6 +6,7 @@ import com.google.gwt.event.dom.client.ClickEvent;
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.Command;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Composite;
@@ -22,19 +23,37 @@ public class ErrorMessage extends Composite {
@UiField DivElement errorMessage;
@UiField DivElement errorMessageDetail;
@UiField Anchor reloadPageAnchor;
private Command reloadCommand;
public ErrorMessage(String errorMessageDetail, Throwable errorReason, Command reloadCommand) {
this(TextMessages.INSTANCE.errorMessageLoadingData(), errorMessageDetail, errorReason, reloadCommand);
}
public ErrorMessage(String detailMessage, Throwable errorReason) {
public ErrorMessage(String errorMessage, String errorMessageDetail, Throwable errorReason, Command reloadCommand) {
ErrorMessageResources.INSTANCE.css().ensureInjected();
initWidget(uiBinder.createAndBindUi(this));
this.reloadCommand = reloadCommand;
this.setHeight(Window.getClientHeight() + "px");
errorMessage.setInnerText(TextMessages.INSTANCE.errorMessageLoadingData());
Window.setStatus(detailMessage);
if (errorMessage != null && !errorMessage.isEmpty()) {
this.errorMessage.setInnerText(errorMessage);
} else {
this.errorMessage.setInnerText(TextMessages.INSTANCE.errorMessageLoadingData());
}
this.errorMessageDetail.setInnerText(errorMessageDetail);
Window.setStatus(errorMessageDetail);
}
@UiHandler("reloadPageAnchor")
void reloadPage(ClickEvent e) {
Window.Location.reload();
if (reloadCommand != null) {
reloadCommand.execute();
} else {
Window.Location.reload();
}
}
}
@@ -13,7 +13,7 @@
<div ui:field="errorMessageDetail" class="{local_res.css.error_message_detail}"></div>
</div>
<div>
<span class="{local_res.css.reload_page_message}"><ui:text from='{i18n.pleaseTryAgain}'/></span>
<div class="{local_res.css.reload_page_message}"><ui:text from='{i18n.pleaseTryAgain}'/></div>
<g:Anchor ui:field="reloadPageAnchor" href="javascript:;" styleName="{res.mainCss.button}"><ui:text from='{i18n.reloadPage}'/></g:Anchor>
</div>
</div>
@@ -1,7 +1,7 @@
package com.sap.sse.gwt.client.mvp;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.IsWidget;
public interface ErrorView extends IsWidget {
public interface ErrorView {
Widget asWidget();
}