mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-27 22:37:15 +00:00
Merged abstracted event views activity proxies in to one
This commit is contained in:
1 parent
01b81ba892
commit
41de994a5c
9 files changed
+46
-205
No files matched your search
-12
@@ -5,18 +5,12 @@ import com.google.gwt.activity.shared.ActivityMapper;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.place.shared.Place;
|
||||
import com.sap.sailing.gwt.home.client.place.event.AbstractEventPlace;
|
||||
import com.sap.sailing.gwt.home.client.place.event.regatta.tabs.RegattaRacesPlace;
|
||||
import com.sap.sailing.gwt.home.client.place.events.EventsPlace;
|
||||
import com.sap.sailing.gwt.home.client.place.fakeseries.AbstractSeriesPlace;
|
||||
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsPlace;
|
||||
import com.sap.sailing.gwt.home.client.place.start.StartPlace;
|
||||
import com.sap.sailing.gwt.home.mobile.places.event.EventActivityProxy;
|
||||
import com.sap.sailing.gwt.home.mobile.places.events.EventsActivityProxy;
|
||||
import com.sap.sailing.gwt.home.mobile.places.latestnews.LatestNewsActivityProxy;
|
||||
import com.sap.sailing.gwt.home.mobile.places.latestnews.LatestNewsPlace;
|
||||
import com.sap.sailing.gwt.home.mobile.places.minileaderboard.MiniLeaderboardActivityProxy;
|
||||
import com.sap.sailing.gwt.home.mobile.places.minileaderboard.MiniLeaderboardPlace;
|
||||
import com.sap.sailing.gwt.home.mobile.places.races.RacesActivityProxy;
|
||||
import com.sap.sailing.gwt.home.mobile.places.series.SeriesActivityProxy;
|
||||
import com.sap.sailing.gwt.home.mobile.places.series.minileaderboard.SeriesMiniOverallLeaderboardActivityProxy;
|
||||
import com.sap.sailing.gwt.home.mobile.places.series.minileaderboard.SeriesMiniOverallLeaderboardPlace;
|
||||
@@ -46,12 +40,6 @@ public class MobileActivityMapper implements ActivityMapper {
|
||||
return new StartActivityProxy((StartPlace) place, clientFactory);
|
||||
} else if (place instanceof EventsPlace) {
|
||||
return new EventsActivityProxy((EventsPlace) place, clientFactory);
|
||||
} else if (place instanceof RegattaRacesPlace) {
|
||||
return new RacesActivityProxy((RegattaRacesPlace) place, clientFactory);
|
||||
} else if (place instanceof MiniLeaderboardPlace) {
|
||||
return new MiniLeaderboardActivityProxy((MiniLeaderboardPlace) place, clientFactory);
|
||||
} else if (place instanceof LatestNewsPlace) {
|
||||
return new LatestNewsActivityProxy((LatestNewsPlace) place, clientFactory);
|
||||
} else if (place instanceof AbstractEventPlace) {
|
||||
return new EventActivityProxy((AbstractEventPlace) place, clientFactory);
|
||||
} else if (place instanceof SeriesMiniOverallLeaderboardPlace) {
|
||||
|
||||
-27
@@ -12,7 +12,6 @@ import com.google.gwt.core.shared.GWT;
|
||||
import com.google.gwt.event.shared.EventBus;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.AcceptsOneWidget;
|
||||
import com.sap.sailing.gwt.home.client.place.error.ErrorPlace;
|
||||
import com.sap.sailing.gwt.home.client.place.event.AbstractEventPlace;
|
||||
import com.sap.sailing.gwt.home.client.place.event.EventContext;
|
||||
import com.sap.sailing.gwt.home.client.place.event.EventDefaultPlace;
|
||||
@@ -28,7 +27,6 @@ import com.sap.sailing.gwt.home.mobile.places.series.minileaderboard.SeriesMiniO
|
||||
import com.sap.sailing.gwt.home.shared.app.PlaceNavigation;
|
||||
import com.sap.sailing.gwt.home.shared.dispatch.DispatchSystem;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.event.GetEventViewAction;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.news.LeaderboardNewsEntryDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.news.NewsEntryDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.eventview.EventViewDTO;
|
||||
@@ -49,31 +47,6 @@ public class EventActivity extends AbstractActivity implements Presenter {
|
||||
|
||||
@Override
|
||||
public void start(final AcceptsOneWidget panel, final EventBus eventBus) {
|
||||
if(place.getCtx().getEventDTO() == null) {
|
||||
currentEventUUId = UUID.fromString(place.getCtx().getEventId());
|
||||
|
||||
clientFactory.getDispatch().execute(new GetEventViewAction(currentEventUUId), new AsyncCallback<EventViewDTO>() {
|
||||
@Override
|
||||
public void onSuccess(final EventViewDTO event) {
|
||||
place.getCtx().updateContext(event);
|
||||
initUi(panel, eventBus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
// TODO @FM: extract text?
|
||||
ErrorPlace errorPlace = new ErrorPlace("Error while loading the event with service getEventViewById()");
|
||||
// TODO @FM: reload sinnvoll hier?
|
||||
errorPlace.setComingFrom(place);
|
||||
clientFactory.getPlaceController().goTo(errorPlace);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
initUi(panel, eventBus);
|
||||
}
|
||||
}
|
||||
|
||||
private void initUi(final AcceptsOneWidget panel, EventBus eventBus) {
|
||||
final EventView view = new EventViewImpl(this);
|
||||
panel.setWidget(view.asWidget());
|
||||
EventViewDTO event = getCtx().getEventDTO();
|
||||
|
||||
+46
-1
@@ -1,8 +1,21 @@
|
||||
package com.sap.sailing.gwt.home.mobile.places.event;
|
||||
|
||||
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.place.error.ErrorPlace;
|
||||
import com.sap.sailing.gwt.home.client.place.event.AbstractEventPlace;
|
||||
import com.sap.sailing.gwt.home.client.place.event.EventDefaultPlace;
|
||||
import com.sap.sailing.gwt.home.client.place.event.regatta.tabs.RegattaRacesPlace;
|
||||
import com.sap.sailing.gwt.home.mobile.app.MobileApplicationClientFactory;
|
||||
import com.sap.sailing.gwt.home.mobile.places.latestnews.LatestNewsActivity;
|
||||
import com.sap.sailing.gwt.home.mobile.places.latestnews.LatestNewsPlace;
|
||||
import com.sap.sailing.gwt.home.mobile.places.minileaderboard.MiniLeaderboardActivity;
|
||||
import com.sap.sailing.gwt.home.mobile.places.minileaderboard.MiniLeaderboardPlace;
|
||||
import com.sap.sailing.gwt.home.mobile.places.races.RacesActivity;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.event.GetEventViewAction;
|
||||
import com.sap.sailing.gwt.ui.shared.eventview.EventViewDTO;
|
||||
import com.sap.sse.gwt.client.mvp.AbstractActivityProxy;
|
||||
|
||||
public class EventActivityProxy extends AbstractActivityProxy {
|
||||
@@ -17,10 +30,42 @@ public class EventActivityProxy extends AbstractActivityProxy {
|
||||
|
||||
@Override
|
||||
protected void startAsync() {
|
||||
if(currentPlace.getCtx().getEventDTO() != null) {
|
||||
afterEventLoad();
|
||||
return;
|
||||
}
|
||||
UUID eventId = UUID.fromString(currentPlace.getCtx().getEventId());
|
||||
clientFactory.getDispatch().execute(new GetEventViewAction(eventId), new AsyncCallback<EventViewDTO>() {
|
||||
@Override
|
||||
public void onSuccess(final EventViewDTO event) {
|
||||
currentPlace.getCtx().updateContext(event);
|
||||
afterEventLoad();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
// TODO @FM: extract text?
|
||||
ErrorPlace errorPlace = new ErrorPlace("Error while loading the event with service getEventViewById()");
|
||||
// TODO @FM: reload sinnvoll hier?
|
||||
errorPlace.setComingFrom(currentPlace);
|
||||
clientFactory.getPlaceController().goTo(errorPlace);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void afterEventLoad() {
|
||||
GWT.runAsync(new AbstractRunAsyncCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
super.onSuccess(new EventActivity(currentPlace, clientFactory));
|
||||
if (currentPlace instanceof EventDefaultPlace) {
|
||||
super.onSuccess(new EventActivity(currentPlace, clientFactory));
|
||||
} else if (currentPlace instanceof RegattaRacesPlace) {
|
||||
super.onSuccess(new RacesActivity((RegattaRacesPlace) currentPlace, clientFactory));
|
||||
} else if (currentPlace instanceof MiniLeaderboardPlace) {
|
||||
super.onSuccess(new MiniLeaderboardActivity((MiniLeaderboardPlace) currentPlace, clientFactory));
|
||||
} else if (currentPlace instanceof LatestNewsPlace) {
|
||||
super.onSuccess(new LatestNewsActivity((LatestNewsPlace) currentPlace, clientFactory));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
-28
@@ -6,9 +6,7 @@ import java.util.UUID;
|
||||
import com.google.gwt.activity.shared.AbstractActivity;
|
||||
import com.google.gwt.event.shared.EventBus;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.AcceptsOneWidget;
|
||||
import com.sap.sailing.gwt.home.client.place.error.ErrorPlace;
|
||||
import com.sap.sailing.gwt.home.client.place.event.EventContext;
|
||||
import com.sap.sailing.gwt.home.client.place.event.EventDefaultPlace;
|
||||
import com.sap.sailing.gwt.home.client.place.fakeseries.SeriesContext;
|
||||
@@ -19,10 +17,8 @@ import com.sap.sailing.gwt.home.mobile.places.minileaderboard.MiniLeaderboardPla
|
||||
import com.sap.sailing.gwt.home.mobile.places.series.minileaderboard.SeriesMiniOverallLeaderboardPlace;
|
||||
import com.sap.sailing.gwt.home.shared.app.PlaceNavigation;
|
||||
import com.sap.sailing.gwt.home.shared.dispatch.DispatchSystem;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.event.GetEventViewAction;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.news.LeaderboardNewsEntryDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.news.NewsEntryDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.eventview.EventViewDTO;
|
||||
|
||||
public class LatestNewsActivity extends AbstractActivity implements Presenter, NewsItemLinkProvider {
|
||||
private final MobileApplicationClientFactory clientFactory;
|
||||
@@ -35,30 +31,6 @@ public class LatestNewsActivity extends AbstractActivity implements Presenter, N
|
||||
|
||||
@Override
|
||||
public void start(final AcceptsOneWidget panel, final EventBus eventBus) {
|
||||
if(place.getCtx().getEventDTO() == null) {
|
||||
UUID currentEventUUId = UUID.fromString(place.getCtx().getEventId());
|
||||
clientFactory.getDispatch().execute(new GetEventViewAction(currentEventUUId), new AsyncCallback<EventViewDTO>() {
|
||||
@Override
|
||||
public void onSuccess(final EventViewDTO event) {
|
||||
place.getCtx().updateContext(event);
|
||||
initUi(panel, eventBus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
// TODO @FM: extract text?
|
||||
ErrorPlace errorPlace = new ErrorPlace("Error while loading the event with service getEventViewById()");
|
||||
// TODO @FM: reload sinnvoll hier?
|
||||
errorPlace.setComingFrom(place);
|
||||
clientFactory.getPlaceController().goTo(errorPlace);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
initUi(panel, eventBus);
|
||||
}
|
||||
}
|
||||
|
||||
private void initUi(AcceptsOneWidget panel, EventBus eventBus) {
|
||||
final LatestNewsView view = new LatestNewsViewImpl(this);
|
||||
panel.setWidget(view.asWidget());
|
||||
Window.setTitle(place.getTitle());
|
||||
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
package com.sap.sailing.gwt.home.mobile.places.latestnews;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.sap.sailing.gwt.home.mobile.app.MobileApplicationClientFactory;
|
||||
import com.sap.sse.gwt.client.mvp.AbstractActivityProxy;
|
||||
|
||||
public class LatestNewsActivityProxy extends AbstractActivityProxy {
|
||||
|
||||
private final MobileApplicationClientFactory clientFactory;
|
||||
private final LatestNewsPlace currentPlace;
|
||||
|
||||
public LatestNewsActivityProxy(LatestNewsPlace place, MobileApplicationClientFactory clientFactory) {
|
||||
this.currentPlace = place;
|
||||
this.clientFactory = clientFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startAsync() {
|
||||
GWT.runAsync(new AbstractRunAsyncCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
super.onSuccess(new LatestNewsActivity(currentPlace, clientFactory));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
-29
@@ -4,9 +4,7 @@ import java.util.UUID;
|
||||
|
||||
import com.google.gwt.activity.shared.AbstractActivity;
|
||||
import com.google.gwt.event.shared.EventBus;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.AcceptsOneWidget;
|
||||
import com.sap.sailing.gwt.home.client.place.error.ErrorPlace;
|
||||
import com.sap.sailing.gwt.home.client.place.event.EventContext;
|
||||
import com.sap.sailing.gwt.home.client.place.event.EventDefaultPlace;
|
||||
import com.sap.sailing.gwt.home.client.place.event.regatta.tabs.RegattaLeaderboardPlace;
|
||||
@@ -16,7 +14,6 @@ import com.sap.sailing.gwt.home.mobile.places.minileaderboard.MiniLeaderboardVie
|
||||
import com.sap.sailing.gwt.home.mobile.places.series.minileaderboard.SeriesMiniOverallLeaderboardPlace;
|
||||
import com.sap.sailing.gwt.home.shared.app.PlaceNavigation;
|
||||
import com.sap.sailing.gwt.home.shared.dispatch.DispatchSystem;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.event.GetEventViewAction;
|
||||
import com.sap.sailing.gwt.ui.shared.eventview.EventViewDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.eventview.EventViewDTO.EventType;
|
||||
|
||||
@@ -31,32 +28,6 @@ public class MiniLeaderboardActivity extends AbstractActivity implements Present
|
||||
|
||||
@Override
|
||||
public void start(final AcceptsOneWidget panel, final EventBus eventBus) {
|
||||
if (place.getCtx().getEventDTO() == null) {
|
||||
UUID currentEventUUId = UUID.fromString(place.getCtx().getEventId());
|
||||
clientFactory.getDispatch().execute(new GetEventViewAction(currentEventUUId),
|
||||
new AsyncCallback<EventViewDTO>() {
|
||||
@Override
|
||||
public void onSuccess(final EventViewDTO event) {
|
||||
place.getCtx().updateContext(event);
|
||||
initUi(panel, eventBus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
// TODO @FM: extract text?
|
||||
ErrorPlace errorPlace = new ErrorPlace(
|
||||
"Error while loading the event with service getEventViewById()");
|
||||
// TODO @FM: reload sinnvoll hier?
|
||||
errorPlace.setComingFrom(place);
|
||||
clientFactory.getPlaceController().goTo(errorPlace);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
initUi(panel, eventBus);
|
||||
}
|
||||
}
|
||||
|
||||
private void initUi(AcceptsOneWidget panel, EventBus eventBus) {
|
||||
final MiniLeaderboardView view = new MiniLeaderboardViewImpl(this);
|
||||
EventViewDTO event = place.getCtx().getEventDTO();
|
||||
if(event.getType() == EventType.MULTI_REGATTA) {
|
||||
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
package com.sap.sailing.gwt.home.mobile.places.minileaderboard;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.sap.sailing.gwt.home.mobile.app.MobileApplicationClientFactory;
|
||||
import com.sap.sse.gwt.client.mvp.AbstractActivityProxy;
|
||||
|
||||
public class MiniLeaderboardActivityProxy extends AbstractActivityProxy {
|
||||
|
||||
private final MobileApplicationClientFactory clientFactory;
|
||||
private final MiniLeaderboardPlace currentPlace;
|
||||
|
||||
public MiniLeaderboardActivityProxy(MiniLeaderboardPlace place, MobileApplicationClientFactory clientFactory) {
|
||||
this.currentPlace = place;
|
||||
this.clientFactory = clientFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startAsync() {
|
||||
GWT.runAsync(new AbstractRunAsyncCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
super.onSuccess(new MiniLeaderboardActivity(currentPlace, clientFactory));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
-29
@@ -4,9 +4,7 @@ import java.util.UUID;
|
||||
|
||||
import com.google.gwt.activity.shared.AbstractActivity;
|
||||
import com.google.gwt.event.shared.EventBus;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.AcceptsOneWidget;
|
||||
import com.sap.sailing.gwt.home.client.place.error.ErrorPlace;
|
||||
import com.sap.sailing.gwt.home.client.place.event.EventContext;
|
||||
import com.sap.sailing.gwt.home.client.place.event.EventDefaultPlace;
|
||||
import com.sap.sailing.gwt.home.client.place.event.regatta.tabs.RegattaLeaderboardPlace;
|
||||
@@ -18,7 +16,6 @@ import com.sap.sailing.gwt.home.mobile.places.races.RacesView.Presenter;
|
||||
import com.sap.sailing.gwt.home.mobile.places.series.minileaderboard.SeriesMiniOverallLeaderboardPlace;
|
||||
import com.sap.sailing.gwt.home.shared.app.PlaceNavigation;
|
||||
import com.sap.sailing.gwt.home.shared.dispatch.DispatchSystem;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.event.GetEventViewAction;
|
||||
import com.sap.sailing.gwt.ui.shared.eventview.EventViewDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.eventview.EventViewDTO.EventType;
|
||||
|
||||
@@ -33,32 +30,6 @@ public class RacesActivity extends AbstractActivity implements Presenter {
|
||||
|
||||
@Override
|
||||
public void start(final AcceptsOneWidget panel, final EventBus eventBus) {
|
||||
if (place.getCtx().getEventDTO() == null) {
|
||||
UUID currentEventUUId = UUID.fromString(place.getCtx().getEventId());
|
||||
clientFactory.getDispatch().execute(new GetEventViewAction(currentEventUUId),
|
||||
new AsyncCallback<EventViewDTO>() {
|
||||
@Override
|
||||
public void onSuccess(final EventViewDTO event) {
|
||||
place.getCtx().updateContext(event);
|
||||
initUi(panel, eventBus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
// TODO @FM: extract text?
|
||||
ErrorPlace errorPlace = new ErrorPlace(
|
||||
"Error while loading the event with service getEventViewById()");
|
||||
// TODO @FM: reload sinnvoll hier?
|
||||
errorPlace.setComingFrom(place);
|
||||
clientFactory.getPlaceController().goTo(errorPlace);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
initUi(panel, eventBus);
|
||||
}
|
||||
}
|
||||
|
||||
private void initUi(AcceptsOneWidget panel, EventBus eventBus) {
|
||||
final RacesView view = new RacesViewImpl(this);
|
||||
EventViewDTO event = place.getCtx().getEventDTO();
|
||||
if(event.getType() == EventType.MULTI_REGATTA) {
|
||||
|
||||
-27
@@ -1,27 +0,0 @@
|
||||
package com.sap.sailing.gwt.home.mobile.places.races;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.sap.sailing.gwt.home.client.place.event.regatta.tabs.RegattaRacesPlace;
|
||||
import com.sap.sailing.gwt.home.mobile.app.MobileApplicationClientFactory;
|
||||
import com.sap.sse.gwt.client.mvp.AbstractActivityProxy;
|
||||
|
||||
public class RacesActivityProxy extends AbstractActivityProxy {
|
||||
|
||||
private final MobileApplicationClientFactory clientFactory;
|
||||
private final RegattaRacesPlace currentPlace;
|
||||
|
||||
public RacesActivityProxy(RegattaRacesPlace place, MobileApplicationClientFactory clientFactory) {
|
||||
this.currentPlace = place;
|
||||
this.clientFactory = clientFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startAsync() {
|
||||
GWT.runAsync(new AbstractRunAsyncCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
super.onSuccess(new RacesActivity(currentPlace, clientFactory));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user