Implemented latest news place updating for desktop

This commit is contained in:
Steffen Schaefer committed 2015-07-06 18:08:54 +02:00
1 parent 7a1784f808
commit 7b96310309
2 files changed
+23 -27

No files matched your search

@@ -17,6 +17,7 @@ import com.sap.sailing.gwt.home.client.place.event.regatta.tabs.RegattaMediaPlac
import com.sap.sailing.gwt.home.client.place.event.regatta.tabs.RegattaOverviewPlace;
import com.sap.sailing.gwt.home.client.place.event.regatta.tabs.RegattaRacesPlace;
import com.sap.sailing.gwt.home.desktop.app.DesktopPlacesNavigator;
import com.sap.sailing.gwt.home.mobile.places.latestnews.LatestNewsPlace;
import com.sap.sailing.gwt.home.mobile.places.minileaderboard.MiniLeaderboardPlace;
import com.sap.sailing.gwt.ui.shared.dispatch.event.GetEventViewAction;
import com.sap.sailing.gwt.ui.shared.eventview.EventViewDTO;
@@ -135,6 +136,13 @@ public class EventActivityProxy extends AbstractActivityProxy {
return new MultiregattaMediaPlace(new EventContext(ctx).withRegattaId(null));
}
if(place instanceof LatestNewsPlace) {
if(ctx.getEventDTO().getType() == EventType.MULTI_REGATTA) {
return new MultiregattaOverviewPlace(new EventContext(ctx).withRegattaId(null));
}
return new RegattaOverviewPlace(new EventContext(ctx).withRegattaId(null));
}
if(place instanceof MiniLeaderboardPlace) {
return new RegattaLeaderboardPlace(place.getCtx());
}
@@ -4,28 +4,28 @@ import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import com.google.gwt.place.shared.Place;
import com.google.gwt.place.shared.PlaceTokenizer;
import com.google.gwt.place.shared.Prefix;
import com.sap.sailing.gwt.common.client.i18n.TextMessages;
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.EventPrefixes;
import com.sap.sailing.gwt.home.shared.app.HasLocationTitle;
import com.sap.sailing.gwt.home.shared.app.HasMobileVersion;
import com.sap.sailing.gwt.ui.shared.dispatch.news.NewsEntryDTO;
public class LatestNewsPlace extends Place implements HasLocationTitle, HasMobileVersion {
public class LatestNewsPlace extends AbstractEventPlace implements HasMobileVersion {
private List<NewsEntryDTO> news = new LinkedList<NewsEntryDTO>();
private final EventContext ctx;
public LatestNewsPlace(String eventUuidAsString) {
this.ctx = new EventContext();
ctx.withId(eventUuidAsString);
super(eventUuidAsString);
}
public LatestNewsPlace(EventContext ctx) {
super(ctx);
}
public LatestNewsPlace(EventContext ctx, Collection<NewsEntryDTO> newsEntries) {
super(ctx);
news.addAll(newsEntries);
this.ctx = ctx;
}
public List<NewsEntryDTO> getNews() {
@@ -35,29 +35,17 @@ public class LatestNewsPlace extends Place implements HasLocationTitle, HasMobil
public String getTitle() {
return TextMessages.INSTANCE.sapSailing();
}
@Prefix(EventPrefixes.EventNews)
public static class Tokenizer implements PlaceTokenizer<LatestNewsPlace> {
@Override
public String getToken(LatestNewsPlace place) {
return place.getCtx().getEventId();
}
@Override
public LatestNewsPlace getPlace(String token) {
if (token == null || token.isEmpty()) {
return null;
}
return new LatestNewsPlace(token);
}
}
@Override
public String getLocationTitle() {
return TextMessages.INSTANCE.headerLogo();
}
public EventContext getCtx() {
return ctx;
@Prefix(EventPrefixes.EventNews)
public static class Tokenizer extends AbstractEventPlace.Tokenizer<LatestNewsPlace> {
@Override
protected LatestNewsPlace getRealPlace(EventContext context) {
return new LatestNewsPlace(context);
}
}
}