mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-27 22:37:15 +00:00
Refactored LatestNewsActivity to use mobile event activities abstraction
This commit is contained in:
1 parent
d36d7d48e2
commit
c751e8e68d
1 file changed
+9
-75
+9
-75
@@ -1,90 +1,24 @@
|
||||
package com.sap.sailing.gwt.home.mobile.places.latestnews;
|
||||
|
||||
import java.util.List;
|
||||
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.ui.AcceptsOneWidget;
|
||||
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;
|
||||
import com.sap.sailing.gwt.home.mobile.app.MobileApplicationClientFactory;
|
||||
import com.sap.sailing.gwt.home.mobile.partials.updatesBox.NewsItemLinkProvider;
|
||||
import com.sap.sailing.gwt.home.mobile.places.event.AbstractEventActivity;
|
||||
import com.sap.sailing.gwt.home.mobile.places.event.EventViewBase;
|
||||
import com.sap.sailing.gwt.home.mobile.places.latestnews.LatestNewsView.Presenter;
|
||||
import com.sap.sailing.gwt.home.mobile.places.minileaderboard.MiniLeaderboardPlace;
|
||||
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.news.LeaderboardNewsEntryDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.news.NewsEntryDTO;
|
||||
|
||||
public class LatestNewsActivity extends AbstractActivity implements Presenter, NewsItemLinkProvider {
|
||||
private final MobileApplicationClientFactory clientFactory;
|
||||
private final LatestNewsPlace place;
|
||||
public class LatestNewsActivity extends AbstractEventActivity<LatestNewsPlace> implements Presenter {
|
||||
|
||||
public LatestNewsActivity(LatestNewsPlace place, MobileApplicationClientFactory clientFactory) {
|
||||
this.clientFactory = clientFactory;
|
||||
this.place = place;
|
||||
super(place, clientFactory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(final AcceptsOneWidget panel, final EventBus eventBus) {
|
||||
protected EventViewBase initView() {
|
||||
final LatestNewsView view = new LatestNewsViewImpl(this);
|
||||
panel.setWidget(view.asWidget());
|
||||
Window.setTitle(place.getTitle());
|
||||
view.hideQuickfinder();
|
||||
view.showNews(place.getNews());
|
||||
Window.setTitle(getPlace().getTitle());
|
||||
initQuickfinder(view, false);
|
||||
view.showNews(getPlace().getNews());
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlaceNavigation<?> getNewsEntryPlaceNavigation(NewsEntryDTO entry) {
|
||||
if (entry instanceof LeaderboardNewsEntryDTO) {
|
||||
final LeaderboardNewsEntryDTO dto = (LeaderboardNewsEntryDTO) entry;
|
||||
return getRegattaLeaderboardNavigation(dto.getLeaderboardName());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public PlaceNavigation<?> getRegattaLeaderboardNavigation(String leaderboardName) {
|
||||
EventContext ctx = new EventContext(getCtx()).withRegattaId(leaderboardName).withRegattaAnalyticsManager(null);
|
||||
return clientFactory.getNavigator().getEventNavigation(new MiniLeaderboardPlace(ctx), null, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlaceNavigation<?> getNewsPlaceNavigation(List<NewsEntryDTO> values) {
|
||||
return clientFactory.getNavigator().getEventLastestNewsNavigation(getCtx(), values, null, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlaceNavigation<?> getEventNavigation() {
|
||||
return clientFactory.getNavigator().getEventNavigation(new EventDefaultPlace(getCtx()), null, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EventContext getCtx() {
|
||||
return place.getCtx();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DispatchSystem getDispatch() {
|
||||
return clientFactory.getDispatch();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlaceNavigation<?> getRegattaMiniLeaderboardNavigation(String leaderboardName) {
|
||||
EventContext ctx = new EventContext(getCtx()).withRegattaId(leaderboardName).withRegattaAnalyticsManager(null);
|
||||
return clientFactory.getNavigator().getEventNavigation(new MiniLeaderboardPlace(ctx), null, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlaceNavigation<?> getMiniOverallLeaderboardNavigation() {
|
||||
return clientFactory.getNavigator().getSeriesNavigation(new SeriesMiniOverallLeaderboardPlace(new SeriesContext().withId(getCtx().getEventId())), null, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlaceNavigation<?> getMiniLeaderboardNavigation(UUID eventId) {
|
||||
return clientFactory.getNavigator().getEventNavigation(new MiniLeaderboardPlace(eventId.toString(), null), null, false);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user