mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-07 12:51:02 +00:00
fix for history management for event subpages
This commit is contained in:
1 parent
f8ff390976
commit
efa5aae5b0
3 files changed
+50
-6
No files matched your search
+3
-2
@@ -7,6 +7,7 @@ import com.google.gwt.user.client.Window;
|
||||
import com.sap.sailing.gwt.home.client.place.aboutus.AboutUsPlace;
|
||||
import com.sap.sailing.gwt.home.client.place.contact.ContactPlace;
|
||||
import com.sap.sailing.gwt.home.client.place.event.EventPlace;
|
||||
import com.sap.sailing.gwt.home.client.place.event.EventPlace.NavigationTabs;
|
||||
import com.sap.sailing.gwt.home.client.place.events.EventsPlace;
|
||||
import com.sap.sailing.gwt.home.client.place.searchresult.SearchResultPlace;
|
||||
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsPlace;
|
||||
@@ -30,13 +31,13 @@ public class PlaceNavigatorImpl implements PlaceNavigator {
|
||||
|
||||
@Override
|
||||
public void goToEvent(String eventUuidAsString, String baseUrl, boolean isOnRemoteServer) {
|
||||
EventPlace eventPlace = new EventPlace(eventUuidAsString, null);
|
||||
EventPlace eventPlace = new EventPlace(eventUuidAsString, NavigationTabs.Regattas, null);
|
||||
gotoPlace(baseUrl, isOnRemoteServer, eventPlace, new EventPlace.Tokenizer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void goToRegattaOfEvent(String eventUuidAsString, String leaderboardIdAsNameString, String baseUrl, boolean isOnRemoteServer) {
|
||||
EventPlace eventPlace = new EventPlace(eventUuidAsString, leaderboardIdAsNameString);
|
||||
EventPlace eventPlace = new EventPlace(eventUuidAsString, NavigationTabs.Regatta, leaderboardIdAsNameString);
|
||||
gotoPlace(baseUrl, isOnRemoteServer, eventPlace, new EventPlace.Tokenizer());
|
||||
}
|
||||
|
||||
|
||||
+22
-4
@@ -6,16 +6,30 @@ import com.sap.sailing.gwt.home.client.AbstractBasePlace;
|
||||
public class EventPlace extends AbstractBasePlace {
|
||||
private final String eventUuidAsString;
|
||||
private final String leaderboardIdAsNameString;
|
||||
private final NavigationTabs navigationTab;
|
||||
|
||||
private final static String PARAM_EVENTID = "eventId";
|
||||
private final static String PARAM_LEADEROARD_NAME = "leaderboardName";
|
||||
private final static String PARAM_NAVIGATION_TAB = "navigationTab";
|
||||
|
||||
public enum NavigationTabs { Overview, Regattas, Regatta, Media, Schedule };
|
||||
|
||||
public EventPlace(String url) {
|
||||
super(url);
|
||||
eventUuidAsString = getParameter("eventId");
|
||||
leaderboardIdAsNameString = getParameter("leaderboardName");
|
||||
eventUuidAsString = getParameter(PARAM_EVENTID);
|
||||
leaderboardIdAsNameString = getParameter(PARAM_LEADEROARD_NAME);
|
||||
String paramNavTab = getParameter(PARAM_NAVIGATION_TAB);
|
||||
if(paramNavTab != null) {
|
||||
navigationTab = NavigationTabs.valueOf(paramNavTab);
|
||||
} else {
|
||||
navigationTab = NavigationTabs.Regattas;
|
||||
}
|
||||
}
|
||||
|
||||
public EventPlace(String eventUuidAsString, String leaderboardIdAsNameString) {
|
||||
super("eventId", eventUuidAsString, "leaderboardName", leaderboardIdAsNameString);
|
||||
public EventPlace(String eventUuidAsString, NavigationTabs navigationTab, String leaderboardIdAsNameString) {
|
||||
super(PARAM_EVENTID, eventUuidAsString, PARAM_NAVIGATION_TAB, navigationTab.name(), PARAM_LEADEROARD_NAME, leaderboardIdAsNameString);
|
||||
this.eventUuidAsString = eventUuidAsString;
|
||||
this.navigationTab = navigationTab;
|
||||
this.leaderboardIdAsNameString = leaderboardIdAsNameString;
|
||||
}
|
||||
|
||||
@@ -27,6 +41,10 @@ public class EventPlace extends AbstractBasePlace {
|
||||
return leaderboardIdAsNameString;
|
||||
}
|
||||
|
||||
public NavigationTabs getNavigationTab() {
|
||||
return navigationTab;
|
||||
}
|
||||
|
||||
public static class Tokenizer implements PlaceTokenizer<EventPlace> {
|
||||
@Override
|
||||
public String getToken(EventPlace place) {
|
||||
|
||||
+25
@@ -6,14 +6,18 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.place.shared.Place;
|
||||
import com.google.gwt.place.shared.PlaceTokenizer;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.History;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.domain.common.LeaderboardNameConstants;
|
||||
import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
|
||||
import com.sap.sailing.domain.common.dto.RaceDTO;
|
||||
import com.sap.sailing.gwt.home.client.place.event.EventPlace.NavigationTabs;
|
||||
import com.sap.sailing.gwt.home.client.place.event.header.EventHeader;
|
||||
import com.sap.sailing.gwt.home.client.place.event.media.EventMedia;
|
||||
import com.sap.sailing.gwt.home.client.place.event.overview.EventOverview;
|
||||
@@ -99,12 +103,18 @@ public class TabletAndDesktopEventView extends Composite implements EventView, E
|
||||
public void goToOverview() {
|
||||
setVisibleEventElement(eventOverview);
|
||||
eventHeader.setDataNavigationType("normal");
|
||||
|
||||
EventPlace place = new EventPlace(event.id.toString(), NavigationTabs.Overview, null);
|
||||
pushPlaceToHistoryStack(place, new EventPlace.Tokenizer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void goToRegattas() {
|
||||
setVisibleEventElement(eventRegattaList);
|
||||
eventHeader.setDataNavigationType("normal");
|
||||
|
||||
EventPlace place = new EventPlace(event.id.toString(), NavigationTabs.Regattas, null);
|
||||
pushPlaceToHistoryStack(place, new EventPlace.Tokenizer());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -112,18 +122,27 @@ public class TabletAndDesktopEventView extends Composite implements EventView, E
|
||||
eventRegattaRaces.setRaces(leaderboardGroup, leaderboard, raceGroup);
|
||||
eventHeader.setDataNavigationType("compact");
|
||||
setVisibleEventElement(eventRegattaRaces);
|
||||
|
||||
EventPlace place = new EventPlace(event.id.toString(), NavigationTabs.Regatta, leaderboard.name);
|
||||
pushPlaceToHistoryStack(place, new EventPlace.Tokenizer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void goToSchedule() {
|
||||
setVisibleEventElement(eventSchedule);
|
||||
eventHeader.setDataNavigationType("normal");
|
||||
|
||||
EventPlace place = new EventPlace(event.id.toString(), NavigationTabs.Schedule, null);
|
||||
pushPlaceToHistoryStack(place, new EventPlace.Tokenizer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void goToMedia() {
|
||||
setVisibleEventElement(eventMedia);
|
||||
eventHeader.setDataNavigationType("normal");
|
||||
|
||||
EventPlace place = new EventPlace(event.id.toString(), NavigationTabs.Media, null);
|
||||
pushPlaceToHistoryStack(place, new EventPlace.Tokenizer());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -205,4 +224,10 @@ public class TabletAndDesktopEventView extends Composite implements EventView, E
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private <T extends Place> void pushPlaceToHistoryStack(T destinationPlace, PlaceTokenizer<T> tokenizer) {
|
||||
String placeHistoryToken = destinationPlace.getClass().getSimpleName() + ":" + tokenizer.getToken(destinationPlace);
|
||||
History.newItem(placeHistoryToken, false);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user