Merge branch 'master' into bug2409

This commit is contained in:
Axel Uhl committed 2014-11-19 10:17:25 +01:00
commit cffee9e046
65 files changed
+1031 -347

No files matched your search

+1 -1
View File
@@ -19,7 +19,7 @@
<!-- -->
<!-- Any title is fine -->
<!-- -->
<title>SAP Sailing Analytics Homepage</title>
<title>SAP Sailing - Homepage</title>
<!-- -->
<!-- This script loads your compiled module. -->
-3
View File
@@ -9,9 +9,6 @@
</parent>
<artifactId>com.sap.sailing.gwt.ui</artifactId>
<packaging>eclipse-plugin</packaging>
<properties>
<gwt.version>2.6.1</gwt.version>
</properties>
<repositories>
<repository>
@@ -7,7 +7,6 @@ import java.util.Map;
import java.util.logging.Logger;
import com.google.gwt.place.shared.Place;
import com.sap.sse.gwt.client.URLEncoder;
/**
* An abstract Place which is able to manage and parse place parameters.
@@ -34,7 +33,7 @@ public abstract class AbstractBasePlace extends Place {
if(stringBuilder.length() > 0) {
stringBuilder.append("&");
}
stringBuilder.append(paramName + "=" + URLEncoder.encode(paramValue));
stringBuilder.append(paramName + "=" + paramValue);
}
}
@@ -48,7 +47,7 @@ public abstract class AbstractBasePlace extends Place {
if (url != null && !url.isEmpty()) {
this.placeParametersAsToken = url;
List<String> list = Arrays.asList(url.split("&"));
List<String> list = Arrays.asList(placeParametersAsToken.split("&"));
if (list == null || list.size() < 1) {
logger.warning("Token empty, no-op");
@@ -34,6 +34,8 @@ public interface TextMessages extends Messages {
String chooseChart();
String series();
String regattaLeaderboards();
String sapSailing();
String search();
String countdownDays();
String countdownHours();
@@ -26,6 +26,8 @@ competitorsAnalytics=Competitors Analytics
chooseChart=Choose chart type
series=Series
regattaLeaderboards=Regatta leaderboards
sapSailing=SAP Sailing
search=Search
countdownDays=Days
countdownHours=Hrs
@@ -26,6 +26,8 @@ competitorsAnalytics=Teilnehmeranalysen
chooseChart=Wähle einen Diagrammtyp aus
series=Serie
regattaLeaderboards=Regattaergebnisse
sapSailing=SAP Sailing
search=Suche
countdownDays=Tage
countdownHours=Std.
@@ -18,26 +18,25 @@ public abstract class AbstractPlaceNavigator implements PlaceNavigator {
public <T extends Place> void goToPlace(PlaceNavigation<T> placeNavigation) {
if(placeNavigation.isRemotePlace()) {
String destinationUrl = placeNavigation.getTargetUrl();
History.newItem(History.getToken());
History.newItem(History.getToken(), false);
Window.Location.replace(destinationUrl);
} else {
placeController.goTo(placeNavigation.getPlace());
placeController.goTo(placeNavigation.getPlace());
}
}
protected <T extends Place> PlaceNavigation<T> createPlaceNavigation(String baseUrl, T destinationPlace, PlaceTokenizer<T> tokenizer) {
return new PlaceNavigation<T>(baseUrl, destinationPlace, tokenizer);
protected <T extends Place> PlaceNavigation<T> createLocalPlaceNavigation(T destinationPlace, PlaceTokenizer<T> tokenizer) {
return new PlaceNavigation<T>(null, destinationPlace, tokenizer, false);
}
protected <T extends Place> PlaceNavigation<T> createGlobalPlaceNavigation(T destinationPlace, PlaceTokenizer<T> tokenizer) {
return new PlaceNavigation<T>(destinationPlace, tokenizer);
}
protected <T extends Place> PlaceNavigation<T> createPlaceNavigation(String baseUrl, boolean isOnRemoteServer, T destinationPlace, PlaceTokenizer<T> tokenizer) {
return new PlaceNavigation<T>(baseUrl, destinationPlace, tokenizer, isOnRemoteServer);
}
protected String getLocationURL() {
return Window.Location.getProtocol() + "//" + Window.Location.getHostName();
}
public <T extends Place> void pushPlaceToHistoryStack(T destinationPlace, PlaceTokenizer<T> tokenizer) {
String placeHistoryToken = destinationPlace.getClass().getSimpleName() + ":" + tokenizer.getToken(destinationPlace);
History.newItem(placeHistoryToken, false);
@@ -11,10 +11,12 @@ import com.sap.sailing.gwt.home.client.place.event.EventActivityProxy;
import com.sap.sailing.gwt.home.client.place.event.EventPlace;
import com.sap.sailing.gwt.home.client.place.events.EventsActivityProxy;
import com.sap.sailing.gwt.home.client.place.events.EventsPlace;
import com.sap.sailing.gwt.home.client.place.leaderboard.LeaderboardActivityProxy;
import com.sap.sailing.gwt.home.client.place.leaderboard.LeaderboardPlace;
import com.sap.sailing.gwt.home.client.place.regatta.RegattaActivityProxy;
import com.sap.sailing.gwt.home.client.place.regatta.RegattaPlace;
import com.sap.sailing.gwt.home.client.place.searchresult.SearchResultActivityProxy;
import com.sap.sailing.gwt.home.client.place.searchresult.SearchResultPlace;
import com.sap.sailing.gwt.home.client.place.series.SeriesActivityProxy;
import com.sap.sailing.gwt.home.client.place.series.SeriesPlace;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsActivityProxy;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsPlace;
import com.sap.sailing.gwt.home.client.place.sponsoring.SponsoringActivityProxy;
@@ -46,8 +48,10 @@ public class ApplicationActivityMapper implements ActivityMapper {
return new SponsoringActivityProxy((SponsoringPlace) place, clientFactory);
} else if (place instanceof SolutionsPlace) {
return new SolutionsActivityProxy((SolutionsPlace) place, clientFactory);
} else if (place instanceof LeaderboardPlace) {
return new LeaderboardActivityProxy((LeaderboardPlace) place, clientFactory);
} else if (place instanceof RegattaPlace) {
return new RegattaActivityProxy((RegattaPlace) place, clientFactory);
} else if (place instanceof SeriesPlace) {
return new SeriesActivityProxy((SeriesPlace) place, clientFactory);
} else if (place instanceof SearchResultPlace) {
return new SearchResultActivityProxy((SearchResultPlace) place, clientFactory);
} else {
@@ -4,14 +4,15 @@ 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.event.EventClientFactory;
import com.sap.sailing.gwt.home.client.place.events.EventsClientFactory;
import com.sap.sailing.gwt.home.client.place.leaderboard.LeaderboardClientFactory;
import com.sap.sailing.gwt.home.client.place.regatta.RegattaClientFactory;
import com.sap.sailing.gwt.home.client.place.searchresult.SearchResultClientFactory;
import com.sap.sailing.gwt.home.client.place.series.SeriesClientFactory;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsClientFactory;
import com.sap.sailing.gwt.home.client.place.sponsoring.SponsoringClientFactory;
import com.sap.sailing.gwt.home.client.place.start.StartClientFactory;
public interface ApplicationClientFactory extends AboutUsClientFactory, ContactClientFactory, EventClientFactory,
EventsClientFactory, StartClientFactory, SponsoringClientFactory, SolutionsClientFactory, SearchResultClientFactory,
LeaderboardClientFactory {
RegattaClientFactory, SeriesClientFactory {
HomePlacesNavigator getHomePlacesNavigator();
}
@@ -6,14 +6,15 @@ 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.events.EventsPlace;
import com.sap.sailing.gwt.home.client.place.leaderboard.LeaderboardPlace;
import com.sap.sailing.gwt.home.client.place.regatta.RegattaPlace;
import com.sap.sailing.gwt.home.client.place.searchresult.SearchResultPlace;
import com.sap.sailing.gwt.home.client.place.series.SeriesPlace;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsPlace;
import com.sap.sailing.gwt.home.client.place.sponsoring.SponsoringPlace;
import com.sap.sailing.gwt.home.client.place.start.StartPlace;
@WithTokenizers({ AboutUsPlace.Tokenizer.class, ContactPlace.Tokenizer.class, EventPlace.Tokenizer.class, EventsPlace.Tokenizer.class,
SolutionsPlace.Tokenizer.class, SponsoringPlace.Tokenizer.class, SearchResultPlace.Tokenizer.class, StartPlace.Tokenizer.class,
LeaderboardPlace.Tokenizer.class})
RegattaPlace.Tokenizer.class, SeriesPlace.Tokenizer.class })
public interface ApplicationHistoryMapper extends PlaceHistoryMapper {
}
@@ -6,9 +6,13 @@ 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.EventNavigationTabs;
import com.sap.sailing.gwt.home.client.place.events.EventsPlace;
import com.sap.sailing.gwt.home.client.place.leaderboard.LeaderboardPlace;
import com.sap.sailing.gwt.home.client.place.regatta.RegattaPlace;
import com.sap.sailing.gwt.home.client.place.regatta.RegattaPlace.RegattaNavigationTabs;
import com.sap.sailing.gwt.home.client.place.searchresult.SearchResultPlace;
import com.sap.sailing.gwt.home.client.place.series.SeriesPlace;
import com.sap.sailing.gwt.home.client.place.series.SeriesPlace.SeriesNavigationTabs;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsPlace;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsPlace.SolutionsNavigationTabs;
import com.sap.sailing.gwt.home.client.place.sponsoring.SponsoringPlace;
import com.sap.sailing.gwt.home.client.place.start.StartPlace;
@@ -19,27 +23,27 @@ public class HomePlacesNavigator extends AbstractPlaceNavigator {
}
public PlaceNavigation<StartPlace> getHomeNavigation() {
return createPlaceNavigation(getLocationURL(), new StartPlace(), new StartPlace.Tokenizer());
return createGlobalPlaceNavigation(new StartPlace(), new StartPlace.Tokenizer());
}
public PlaceNavigation<EventsPlace> getEventsNavigation() {
return createPlaceNavigation(getLocationURL(), new EventsPlace(), new EventsPlace.Tokenizer());
return createGlobalPlaceNavigation(new EventsPlace(), new EventsPlace.Tokenizer());
}
public PlaceNavigation<SolutionsPlace> getSolutionsNavigation() {
return createPlaceNavigation(getLocationURL(), new SolutionsPlace(), new SolutionsPlace.Tokenizer());
public PlaceNavigation<SolutionsPlace> getSolutionsNavigation(SolutionsNavigationTabs navigationTab) {
return createLocalPlaceNavigation(new SolutionsPlace(navigationTab), new SolutionsPlace.Tokenizer());
}
public PlaceNavigation<SponsoringPlace> getSponsoringNavigation() {
return createPlaceNavigation(getLocationURL(), new SponsoringPlace(), new SponsoringPlace.Tokenizer());
return createGlobalPlaceNavigation(new SponsoringPlace(), new SponsoringPlace.Tokenizer());
}
public PlaceNavigation<AboutUsPlace> getAboutUsNavigation() {
return createPlaceNavigation(getLocationURL(), new AboutUsPlace(), new AboutUsPlace.Tokenizer());
return createGlobalPlaceNavigation(new AboutUsPlace(), new AboutUsPlace.Tokenizer());
}
public PlaceNavigation<ContactPlace> getContactNavigation() {
return createPlaceNavigation(getLocationURL(), new ContactPlace(), new ContactPlace.Tokenizer());
return createGlobalPlaceNavigation(new ContactPlace(), new ContactPlace.Tokenizer());
}
public PlaceNavigation<EventPlace> getEventNavigation(String eventUuidAsString, String baseUrl, boolean isOnRemoteServer) {
@@ -52,21 +56,19 @@ public class HomePlacesNavigator extends AbstractPlaceNavigator {
return createPlaceNavigation(baseUrl, isOnRemoteServer, eventPlace, new EventPlace.Tokenizer());
}
// void goToOverview();
// void goToRegattas();
// void goToSchedule();
// void goToMedia();
// void goToRegattaRaces(LeaderboardGroupDTO leaderboardGroup, StrippedLeaderboardDTO leaderboard, RaceGroupDTO raceGroup);
// void openRaceViewer(StrippedLeaderboardDTO leaderboard, RaceDTO race);
// void openOverallLeaderboardViewer(LeaderboardGroupDTO leaderboardGroup);
// void openLeaderboardViewer(LeaderboardGroupDTO leaderboardGroup, StrippedLeaderboardDTO leaderboard);
public PlaceNavigation<LeaderboardPlace> getLeaderboardNavigation(String eventUuidAsString, String leaderboardIdAsNameString, String baseUrl, boolean isOnRemoteServer) {
LeaderboardPlace leaderboardPlace = new LeaderboardPlace(eventUuidAsString, leaderboardIdAsNameString, true, true);
return createPlaceNavigation(baseUrl, isOnRemoteServer, leaderboardPlace, new LeaderboardPlace.Tokenizer());
/** this place will be merged into the common regatta view as tab later on */
public PlaceNavigation<RegattaPlace> getRegattaAnalyticsNavigation(String eventUuidAsString, RegattaNavigationTabs navigationTab, String leaderboardIdAsNameString, String baseUrl, boolean isOnRemoteServer) {
RegattaPlace regattaPlace = new RegattaPlace(eventUuidAsString, navigationTab, leaderboardIdAsNameString, true, true);
return createPlaceNavigation(baseUrl, isOnRemoteServer, regattaPlace, new RegattaPlace.Tokenizer());
}
/** this place will be merged into the common series event view as tab later on */
public PlaceNavigation<SeriesPlace> getSeriesAnalyticsNavigation(String eventUuidAsString, SeriesNavigationTabs navigationTab, String leaderboardIdAsNameString, String baseUrl, boolean isOnRemoteServer) {
SeriesPlace seriesPlace = new SeriesPlace(eventUuidAsString, navigationTab, leaderboardIdAsNameString, true, true);
return createPlaceNavigation(baseUrl, isOnRemoteServer, seriesPlace, new SeriesPlace.Tokenizer());
}
public PlaceNavigation<SearchResultPlace> getSearchResultNavigation(String searchQuery) {
return createPlaceNavigation(getLocationURL(), new SearchResultPlace(searchQuery), new SearchResultPlace.Tokenizer());
return createGlobalPlaceNavigation(new SearchResultPlace(searchQuery), new SearchResultPlace.Tokenizer());
}
}
@@ -3,6 +3,7 @@ package com.sap.sailing.gwt.home.client.app;
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.user.client.Window;
public class PlaceNavigation<T extends Place> {
private final T destinationPlace;
@@ -10,18 +11,19 @@ public class PlaceNavigation<T extends Place> {
private final String baseUrl;
private final boolean isDestinationOnRemoteServer;
public PlaceNavigation(String baseUrl, T destinationPlace, PlaceTokenizer<T> tokenizer) {
public PlaceNavigation(T destinationPlace, PlaceTokenizer<T> tokenizer) {
this.destinationPlace = destinationPlace;
this.tokenizer = tokenizer;
this.baseUrl = baseUrl;
this.isDestinationOnRemoteServer = !(isLocationOnLocalhost(baseUrl) || isLocationOnDefaultSapSailingServer(baseUrl));
String locationURL = getLocationURL();
this.isDestinationOnRemoteServer = !(isLocationOnLocalhost(locationURL) || isLocationOnDefaultSapSailingServer(locationURL));
this.baseUrl = isDestinationOnRemoteServer ? AbstractPlaceNavigator.DEFAULT_SAPSAILING_SERVER_URL : locationURL;
}
public PlaceNavigation(String baseUrl, T destinationPlace, PlaceTokenizer<T> tokenizer, boolean isDestinationOnRemoteServer) {
this.destinationPlace = destinationPlace;
this.tokenizer = tokenizer;
this.baseUrl = baseUrl;
this.isDestinationOnRemoteServer = isDestinationOnRemoteServer;
this.baseUrl = isDestinationOnRemoteServer ? baseUrl : getLocationURL();
}
public void gotoPlace() {
@@ -31,23 +33,40 @@ public class PlaceNavigation<T extends Place> {
return buildPlaceUrl();
}
public String getHistoryUrl() {
String placeUrl = buildPlaceUrl();
if(placeUrl.startsWith("#")) {
placeUrl = placeUrl.substring(1, placeUrl.length());
}
return placeUrl;
}
public Place getPlace() {
return destinationPlace;
}
private String buildPlaceUrl() {
String url = baseUrl + "/gwt/Home.html";
if(!GWT.isProdMode() && !isDestinationOnRemoteServer) {
url += "?gwt.codesvr=127.0.0.1:9997";
String url = "";
if(isRemotePlace()) {
url = baseUrl + "/gwt/Home.html";
if(!GWT.isProdMode()) {
url += "?gwt.codesvr=127.0.0.1:9997";
}
url += getPlaceToken();
} else {
url = getPlaceToken();
}
url += "#" + destinationPlace.getClass().getSimpleName() + ":" + tokenizer.getToken(destinationPlace);
return url;
}
public boolean isRemotePlace() {
return isDestinationOnRemoteServer;
}
private String getPlaceToken() {
return "#" + destinationPlace.getClass().getSimpleName() + ":" + tokenizer.getToken(destinationPlace);
}
private boolean isLocationOnDefaultSapSailingServer(String urlToCheck) {
return urlToCheck.contains(HomePlacesNavigator.DEFAULT_SAPSAILING_SERVER);
}
@@ -55,4 +74,8 @@ public class PlaceNavigation<T extends Place> {
private boolean isLocationOnLocalhost(String urlToCheck) {
return urlToCheck.contains("localhost") || urlToCheck.contains("127.0.0.1");
}
private String getLocationURL() {
return Window.Location.getProtocol() + "//" + Window.Location.getHostName() + ":" + Window.Location.getPort();
}
}
@@ -6,22 +6,24 @@ import com.google.gwt.event.shared.SimpleEventBus;
import com.google.gwt.place.shared.PlaceController;
import com.google.web.bindery.event.shared.EventBus;
import com.sap.sailing.gwt.home.client.place.error.TabletAndDesktopErrorView;
import com.sap.sailing.gwt.home.client.place.event.EventPlace.EventNavigationTabs;
import com.sap.sailing.gwt.home.client.place.event.EventView;
import com.sap.sailing.gwt.home.client.place.event.EventWithoutRegattasView;
import com.sap.sailing.gwt.home.client.place.event.TabletAndDesktopEventView;
import com.sap.sailing.gwt.home.client.place.event.TabletAndDesktopEventWithoutRegattasView;
import com.sap.sailing.gwt.home.client.place.event.EventPlace.EventNavigationTabs;
import com.sap.sailing.gwt.home.client.place.events.EventsActivity;
import com.sap.sailing.gwt.home.client.place.events.EventsView;
import com.sap.sailing.gwt.home.client.place.events.TabletAndDesktopEventsView;
import com.sap.sailing.gwt.home.client.place.leaderboard.AnalyticsView;
import com.sap.sailing.gwt.home.client.place.leaderboard.TabletAndDesktopLeaderboardView;
import com.sap.sailing.gwt.home.client.place.regatta.RegattaAnalyticsView;
import com.sap.sailing.gwt.home.client.place.regatta.RegattaPlace.RegattaNavigationTabs;
import com.sap.sailing.gwt.home.client.place.regatta.TabletAndDesktopRegattaView;
import com.sap.sailing.gwt.home.client.place.searchresult.SearchResultView;
import com.sap.sailing.gwt.home.client.place.searchresult.TabletAndDesktopSearchResultView;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsActivity;
import com.sap.sailing.gwt.home.client.place.series.SeriesAnalyticsView;
import com.sap.sailing.gwt.home.client.place.series.SeriesPlace.SeriesNavigationTabs;
import com.sap.sailing.gwt.home.client.place.series.TabletAndDesktopSeriesView;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsPlace.SolutionsNavigationTabs;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsView;
import com.sap.sailing.gwt.home.client.place.solutions.TabletAndDesktopSolutionsView;
import com.sap.sailing.gwt.home.client.place.sponsoring.SponsoringActivity;
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;
@@ -51,11 +53,11 @@ public class SmartphoneApplicationClientFactory extends AbstractApplicationClien
@Override
public EventWithoutRegattasView createEventWithoutRegattasView(EventDTO event) {
return new TabletAndDesktopEventWithoutRegattasView(getSailingService(), event);
return new TabletAndDesktopEventWithoutRegattasView(getSailingService(), event, getHomePlacesNavigator());
}
@Override
public EventsView createEventsView(EventsActivity activity) {
public EventsView createEventsView() {
return new TabletAndDesktopEventsView(getHomePlacesNavigator());
}
@@ -70,18 +72,23 @@ public class SmartphoneApplicationClientFactory extends AbstractApplicationClien
}
@Override
public SponsoringView createSponsoringView(SponsoringActivity activity) {
public SponsoringView createSponsoringView() {
return new TabletAndDesktopSponsoringView();
}
@Override
public SolutionsView createSolutionsView(SolutionsActivity activity) {
return new TabletAndDesktopSolutionsView();
public SolutionsView createSolutionsView(SolutionsNavigationTabs navigationTab) {
return new TabletAndDesktopSolutionsView(navigationTab, getHomePlacesNavigator());
}
@Override
public AnalyticsView createLeaderboardView(EventDTO event, String leaderboardName, Timer timerForClientServerOffset) {
return new TabletAndDesktopLeaderboardView(event, leaderboardName, timerForClientServerOffset, getHomePlacesNavigator());
public RegattaAnalyticsView createRegattaAnalyticsView(EventDTO event, String leaderboardName, RegattaNavigationTabs navigationTab, Timer timerForClientServerOffset) {
return new TabletAndDesktopRegattaView(event, leaderboardName, navigationTab, timerForClientServerOffset, getHomePlacesNavigator());
}
@Override
public SeriesAnalyticsView createSeriesAnalyticsView(EventDTO event, String leaderboardName, SeriesNavigationTabs navigationTab, Timer timerForClientServerOffset) {
return new TabletAndDesktopSeriesView(event, leaderboardName, navigationTab, timerForClientServerOffset, getHomePlacesNavigator());
}
@Override
@@ -6,22 +6,24 @@ import com.google.gwt.event.shared.SimpleEventBus;
import com.google.gwt.place.shared.PlaceController;
import com.google.web.bindery.event.shared.EventBus;
import com.sap.sailing.gwt.home.client.place.error.TabletAndDesktopErrorView;
import com.sap.sailing.gwt.home.client.place.event.EventPlace.EventNavigationTabs;
import com.sap.sailing.gwt.home.client.place.event.EventView;
import com.sap.sailing.gwt.home.client.place.event.EventWithoutRegattasView;
import com.sap.sailing.gwt.home.client.place.event.TabletAndDesktopEventView;
import com.sap.sailing.gwt.home.client.place.event.TabletAndDesktopEventWithoutRegattasView;
import com.sap.sailing.gwt.home.client.place.event.EventPlace.EventNavigationTabs;
import com.sap.sailing.gwt.home.client.place.events.EventsActivity;
import com.sap.sailing.gwt.home.client.place.events.EventsView;
import com.sap.sailing.gwt.home.client.place.events.TabletAndDesktopEventsView;
import com.sap.sailing.gwt.home.client.place.leaderboard.AnalyticsView;
import com.sap.sailing.gwt.home.client.place.leaderboard.TabletAndDesktopLeaderboardView;
import com.sap.sailing.gwt.home.client.place.regatta.RegattaAnalyticsView;
import com.sap.sailing.gwt.home.client.place.regatta.RegattaPlace.RegattaNavigationTabs;
import com.sap.sailing.gwt.home.client.place.regatta.TabletAndDesktopRegattaView;
import com.sap.sailing.gwt.home.client.place.searchresult.SearchResultView;
import com.sap.sailing.gwt.home.client.place.searchresult.TabletAndDesktopSearchResultView;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsActivity;
import com.sap.sailing.gwt.home.client.place.series.SeriesAnalyticsView;
import com.sap.sailing.gwt.home.client.place.series.SeriesPlace.SeriesNavigationTabs;
import com.sap.sailing.gwt.home.client.place.series.TabletAndDesktopSeriesView;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsPlace.SolutionsNavigationTabs;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsView;
import com.sap.sailing.gwt.home.client.place.solutions.TabletAndDesktopSolutionsView;
import com.sap.sailing.gwt.home.client.place.sponsoring.SponsoringActivity;
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;
@@ -56,11 +58,11 @@ public class TabletAndDesktopApplicationClientFactory extends AbstractApplicatio
@Override
public EventWithoutRegattasView createEventWithoutRegattasView(EventDTO event) {
return new TabletAndDesktopEventWithoutRegattasView(getSailingService(), event);
return new TabletAndDesktopEventWithoutRegattasView(getSailingService(), event, getHomePlacesNavigator());
}
@Override
public EventsView createEventsView(EventsActivity activity) {
public EventsView createEventsView() {
return new TabletAndDesktopEventsView(getHomePlacesNavigator());
}
@@ -70,18 +72,23 @@ public class TabletAndDesktopApplicationClientFactory extends AbstractApplicatio
}
@Override
public SponsoringView createSponsoringView(SponsoringActivity activity) {
public SponsoringView createSponsoringView() {
return new TabletAndDesktopSponsoringView();
}
@Override
public SolutionsView createSolutionsView(SolutionsActivity activity) {
return new TabletAndDesktopSolutionsView();
public SolutionsView createSolutionsView(SolutionsNavigationTabs navigationTab) {
return new TabletAndDesktopSolutionsView(navigationTab, getHomePlacesNavigator());
}
@Override
public AnalyticsView createLeaderboardView(EventDTO event, String leaderboardName, Timer timerForClientServerOffset) {
return new TabletAndDesktopLeaderboardView(event, leaderboardName, timerForClientServerOffset, getHomePlacesNavigator());
public RegattaAnalyticsView createRegattaAnalyticsView(EventDTO event, String leaderboardName, RegattaNavigationTabs navigationTab, Timer timerForClientServerOffset) {
return new TabletAndDesktopRegattaView(event, leaderboardName, navigationTab, timerForClientServerOffset, getHomePlacesNavigator());
}
@Override
public SeriesAnalyticsView createSeriesAnalyticsView(EventDTO event, String leaderboardName, SeriesNavigationTabs navigationTab, Timer timerForClientServerOffset) {
return new TabletAndDesktopSeriesView(event, leaderboardName, navigationTab, timerForClientServerOffset, getHomePlacesNavigator());
}
@Override
@@ -56,7 +56,7 @@ public class EventActivity extends AbstractActivity {
clientFactory.getSailingService().getEventById(eventUUID, true, new AsyncCallback<EventDTO>() {
@Override
public void onSuccess(final EventDTO event) {
loadRegattaStructure(panel, clientTimeWhenRequestWasSent, event);
loadRegattaStructureAndCreateEventView(panel, clientTimeWhenRequestWasSent, event);
}
@Override
@@ -66,8 +66,9 @@ public class EventActivity extends AbstractActivity {
});
}
private void loadRegattaStructure(final AcceptsOneWidget panel, final long clientTimeWhenRequestWasSent, final EventDTO event) {
private void loadRegattaStructureAndCreateEventView(final AcceptsOneWidget panel, final long clientTimeWhenRequestWasSent, final EventDTO event) {
this.event = event;
if(event.getLeaderboardGroups().size() > 0) {
clientFactory.getSailingService().getRegattaStructureOfEvent(event.id, new AsyncCallback<List<RaceGroupDTO>>() {
@Override
@@ -115,12 +116,14 @@ public class EventActivity extends AbstractActivity {
private void createEventView(EventDTO event, List<RaceGroupDTO> raceGroups, AcceptsOneWidget panel) {
view = clientFactory.createEventView(event, eventPlace.getNavigationTab(), raceGroups, eventPlace.getLeaderboardIdAsNameString(), timerForClientServerOffset);
panel.setWidget(view.asWidget());
Window.setTitle(eventPlace.getTitle(event.getName()));
}
private void createEventWithoutRegattasView(EventDTO event, AcceptsOneWidget panel) {
// no leaderboard groups defined yet -> show a teaser page
EventWithoutRegattasView view = clientFactory.createEventWithoutRegattasView(event);
panel.setWidget(view.asWidget());
Window.setTitle(eventPlace.getTitle(event.getName()));
}
protected void loadAndUpdateEventRaceStatesLog() {
@@ -2,6 +2,7 @@ package com.sap.sailing.gwt.home.client.place.event;
import com.google.gwt.place.shared.PlaceTokenizer;
import com.sap.sailing.gwt.common.client.AbstractBasePlace;
import com.sap.sailing.gwt.common.client.i18n.TextMessages;
public class EventPlace extends AbstractBasePlace {
private final String eventUuidAsString;
@@ -33,6 +34,10 @@ public class EventPlace extends AbstractBasePlace {
this.leaderboardIdAsNameString = leaderboardIdAsNameString;
}
public String getTitle(String eventName) {
return TextMessages.INSTANCE.sapSailing() + " - " + eventName;
}
public String getEventUuidAsString() {
return eventUuidAsString;
}
@@ -11,7 +11,7 @@ public interface EventPlaceNavigator {
void goToSchedule();
void goToMedia();
void goToRegattaRaces(LeaderboardGroupDTO leaderboardGroup, StrippedLeaderboardDTO leaderboard, RaceGroupDTO raceGroup);
void openRaceViewer(StrippedLeaderboardDTO leaderboard, RaceDTO race);
String getRaceViewerURL(StrippedLeaderboardDTO leaderboard, RaceDTO race);
void openOverallLeaderboardViewer(LeaderboardGroupDTO leaderboardGroup);
void openLeaderboardViewer(LeaderboardGroupDTO leaderboardGroup, StrippedLeaderboardDTO leaderboard);
}
@@ -141,11 +141,9 @@ public class TabletAndDesktopEventView extends Composite implements EventView, E
currentInternalPlace = new EventPlace(event.id.toString(), EventNavigationTabs.Media, null);
}
@Override
public void openRaceViewer(StrippedLeaderboardDTO leaderboard, RaceDTO race) {
public String getRaceViewerURL(StrippedLeaderboardDTO leaderboard, RaceDTO race) {
RegattaAndRaceIdentifier raceIdentifier = race.getRaceIdentifier();
String link = EntryPointLinkFactory.createRaceBoardLink(createRaceBoardLinkParameters(leaderboard.name, raceIdentifier));
Window.open(link, "_blank", "");
return EntryPointLinkFactory.createRaceBoardLink(createRaceBoardLinkParameters(leaderboard.name, raceIdentifier));
}
@Override
@@ -5,6 +5,7 @@ import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.sap.sailing.gwt.home.client.app.HomePlacesNavigator;
import com.sap.sailing.gwt.home.client.place.event.header.EventHeader;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.shared.EventDTO;
@@ -17,8 +18,8 @@ public class TabletAndDesktopEventWithoutRegattasView extends Composite implemen
@UiField(provided=true) EventHeader eventHeader;
public TabletAndDesktopEventWithoutRegattasView(SailingServiceAsync sailingService, EventDTO event) {
eventHeader = new EventHeader(event);
public TabletAndDesktopEventWithoutRegattasView(SailingServiceAsync sailingService, EventDTO event, HomePlacesNavigator placeNavigator) {
eventHeader = new EventHeader(event, placeNavigator);
initWidget(uiBinder.createAndBindUi(this));
}
@@ -10,8 +10,10 @@ 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.Event;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.impl.HyperlinkImpl;
import com.sap.sailing.domain.common.LeaderboardNameConstants;
import com.sap.sailing.gwt.common.client.i18n.TextMessages;
import com.sap.sailing.gwt.home.client.app.HomePlacesNavigator;
@@ -19,7 +21,8 @@ import com.sap.sailing.gwt.home.client.app.PlaceNavigation;
import com.sap.sailing.gwt.home.client.place.event.AbstractEventComposite;
import com.sap.sailing.gwt.home.client.place.event.EventPlace;
import com.sap.sailing.gwt.home.client.place.event.EventPlaceNavigator;
import com.sap.sailing.gwt.home.client.place.leaderboard.LeaderboardPlace;
import com.sap.sailing.gwt.home.client.place.series.SeriesPlace;
import com.sap.sailing.gwt.home.client.place.series.SeriesPlace.SeriesNavigationTabs;
import com.sap.sailing.gwt.home.client.shared.EventDatesFormatterUtil;
import com.sap.sailing.gwt.ui.shared.CourseAreaDTO;
import com.sap.sailing.gwt.ui.shared.EventDTO;
@@ -32,6 +35,8 @@ public class EventHeader extends AbstractEventComposite {
interface EventHeaderUiBinder extends UiBinder<Widget, EventHeader> {
}
private static final HyperlinkImpl HYPERLINK_IMPL = GWT.create(HyperlinkImpl.class);
// @UiField Anchor overviewLink;
@UiField Anchor regattasLink;
// @UiField Anchor scheduleLink;
@@ -72,8 +77,9 @@ public class EventHeader extends AbstractEventComposite {
// private final List<Anchor> links3;
private final HomePlacesNavigator placeNavigator;
private PlaceNavigation<LeaderboardPlace> overallLeaderboardNavigation = null;
private PlaceNavigation<SeriesPlace> seriesAnalyticsNavigation = null;
private PlaceNavigation<EventPlace> regattasNavigation = null;
public EventHeader(EventDTO event, HomePlacesNavigator placeNavigator, EventPlaceNavigator pageNavigator) {
super(event, pageNavigator);
@@ -100,10 +106,10 @@ public class EventHeader extends AbstractEventComposite {
updateUI();
}
public EventHeader(EventDTO event) {
public EventHeader(EventDTO event, HomePlacesNavigator placeNavigator) {
super(event, null);
this.placeNavigator = null;
this.placeNavigator = placeNavigator;
initResources();
isFinishedDiv.getStyle().setDisplay(Display.NONE);
@@ -128,9 +134,9 @@ public class EventHeader extends AbstractEventComposite {
eventHeaderWrapperDiv.setAttribute("data-navigationtype", "compact");
EventDTO event = getEvent();
PlaceNavigation<EventPlace> eventNavigation = placeNavigator.getEventNavigation(event.id.toString(), event.getBaseURL(), event.isOnRemoteServer());
regattasLink.setHref(eventNavigation.getTargetUrl());
regattasLink2.setHref(eventNavigation.getTargetUrl());
PlaceNavigation<EventPlace> regattaDetailsNavigation = placeNavigator.getEventNavigation(event.id.toString(), event.getBaseURL(), event.isOnRemoteServer());
regattasLink.setHref(regattaDetailsNavigation.getTargetUrl());
regattasLink2.setHref(regattaDetailsNavigation.getTargetUrl());
}
private StrippedLeaderboardDTO findLeaderboardWithSameCourseArea(EventDTO event) {
@@ -151,13 +157,15 @@ public class EventHeader extends AbstractEventComposite {
boolean isSeries = event.isFakeSeries();
String eventName = event.getName();
regattasNavigation = placeNavigator.getEventNavigation(event.id.toString(), event.getBaseURL(), event.isOnRemoteServer());
if(isSeries) {
LeaderboardGroupDTO leaderboardGroupDTO = event.getLeaderboardGroups().get(0);
eventName = leaderboardGroupDTO.getDisplayName() != null ? leaderboardGroupDTO.getDisplayName() : leaderboardGroupDTO.getName();
String overallLeaderboardName = leaderboardGroupDTO.getName() + " " + LeaderboardNameConstants.OVERALL;
overallLeaderboardNavigation = placeNavigator.getLeaderboardNavigation(event.id.toString(), overallLeaderboardName, event.getBaseURL(), event.isOnRemoteServer());
seriesLeaderboardAnchor.setHref(overallLeaderboardNavigation.getTargetUrl());
seriesAnalyticsNavigation = placeNavigator.getSeriesAnalyticsNavigation(event.id.toString(), SeriesNavigationTabs.OverallLeaderboard, overallLeaderboardName, event.getBaseURL(), event.isOnRemoteServer());
seriesLeaderboardAnchor.setHref(seriesAnalyticsNavigation.getTargetUrl());
StrippedLeaderboardDTO leaderboardFittingToEvent = findLeaderboardWithSameCourseArea(event);
if(leaderboardFittingToEvent != null) {
@@ -242,10 +250,10 @@ public class EventHeader extends AbstractEventComposite {
}
@UiHandler("seriesLeaderboardAnchor")
void seriesLeaderboardClicked(ClickEvent clickevent) {
void seriesLeaderboardClicked(ClickEvent e) {
EventDTO event = getEvent();
if(event.isFakeSeries() && overallLeaderboardNavigation != null) {
placeNavigator.goToPlace(overallLeaderboardNavigation);
if(event.isFakeSeries()) {
handleClickEvent(e, seriesAnalyticsNavigation);
}
}
@@ -254,10 +262,8 @@ public class EventHeader extends AbstractEventComposite {
// showRegattas();
// }
//
private void showRegattas(ClickEvent clickevent) {
getPageNavigator().goToRegattas();
clickevent.preventDefault();
private void showRegattas(ClickEvent e) {
handleClickEvent(e, regattasNavigation);
// setActiveLink(links1, regattasLink);
// setActiveLink(links2, regattasLink2);
// setActiveLink(links3, regattasLink3);
@@ -306,6 +312,13 @@ public class EventHeader extends AbstractEventComposite {
// setActiveLink(links2, mediaLink2);
// setActiveLink(links3, mediaLink3);
// }
private void handleClickEvent(ClickEvent e, PlaceNavigation<?> placeNavigation) {
if (HYPERLINK_IMPL.handleAsClick((Event) e.getNativeEvent())) {
placeNavigator.goToPlace(placeNavigation);
e.preventDefault();
}
}
@Override
protected void onLoad() {
@@ -1,7 +1,6 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:s="urn:import:com.sap.sailing.gwt.home.client.place.event"
xmlns:p="urn:import:com.sap.sailing.gwt.home.client.place.leaderboard"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
<ui:with field="i18n" type="com.sap.sailing.gwt.common.client.i18n.TextMessages"/>
<ui:with field="res" type="com.sap.sailing.gwt.common.client.SharedResources" />
@@ -1,7 +1,6 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:s="urn:import:com.sap.sailing.gwt.home.client.place.event"
xmlns:p="urn:import:com.sap.sailing.gwt.home.client.place.leaderboard"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
<ui:with field="i18n" type="com.sap.sailing.gwt.common.client.i18n.TextMessages"/>
<ui:with field="res" type="com.sap.sailing.gwt.common.client.SharedResources" />
@@ -1,7 +1,6 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:s="urn:import:com.sap.sailing.gwt.home.client.place.event"
xmlns:p="urn:import:com.sap.sailing.gwt.home.client.place.leaderboard"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
<ui:with field="i18n" type="com.sap.sailing.gwt.common.client.i18n.TextMessages"/>
<ui:with field="res" type="com.sap.sailing.gwt.common.client.SharedResources" />
@@ -13,17 +13,20 @@ 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.Event;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.impl.HyperlinkImpl;
import com.sap.sailing.gwt.common.client.BoatClassImageResolver;
import com.sap.sailing.gwt.common.client.BoatClassImageResources;
import com.sap.sailing.gwt.home.client.app.HomePlacesNavigator;
import com.sap.sailing.gwt.home.client.app.PlaceNavigation;
import com.sap.sailing.gwt.home.client.place.event.EventPlace;
import com.sap.sailing.gwt.home.client.place.event.EventPlaceNavigator;
import com.sap.sailing.gwt.home.client.place.leaderboard.LeaderboardPlace;
import com.sap.sailing.gwt.home.client.place.regatta.RegattaPlace;
import com.sap.sailing.gwt.home.client.place.regatta.RegattaPlace.RegattaNavigationTabs;
import com.sap.sailing.gwt.home.client.shared.LongNamesUtil;
import com.sap.sailing.gwt.ui.shared.EventDTO;
import com.sap.sailing.gwt.ui.shared.LeaderboardGroupDTO;
@@ -38,6 +41,8 @@ public class Regatta extends Composite {
interface RegattaUiBinder extends UiBinder<Widget, Regatta> {
}
private static final HyperlinkImpl HYPERLINK_IMPL = GWT.create(HyperlinkImpl.class);
private final EventDTO event;
private final Timer timerForClientServerOffset;
private RaceGroupDTO raceGroup;
@@ -73,7 +78,7 @@ public class Regatta extends Composite {
@UiField Image boatClassImage;
private PlaceNavigation<LeaderboardPlace> leaderboardNavigation;
private PlaceNavigation<RegattaPlace> leaderboardNavigation;
private PlaceNavigation<EventPlace> regattaNavigation;
private final HomePlacesNavigator placesNavigator;
private final EventPlaceNavigator eventPlaceNavigator;
@@ -104,7 +109,8 @@ public class Regatta extends Composite {
if(isSingleView) {
regattaDetailsLink.setVisible(false);
leaderboardNavigation = placesNavigator.getLeaderboardNavigation(event.id.toString(), leaderboard.name, event.getBaseURL(), event.isOnRemoteServer());
leaderboardNavigation = placesNavigator.getRegattaAnalyticsNavigation(event.id.toString(), RegattaNavigationTabs.Leaderboard,
leaderboard.name, event.getBaseURL(), event.isOnRemoteServer());
leaderboardLink.setHref(leaderboardNavigation.getTargetUrl());
} else {
leaderboardLink.setVisible(false);
@@ -165,13 +171,18 @@ public class Regatta extends Composite {
@UiHandler("regattaDetailsLink")
void regattaDetailsLinkClicked(ClickEvent e) {
placesNavigator.goToPlace(regattaNavigation);
e.preventDefault();
handleClickEvent(e, regattaNavigation);
}
@UiHandler("leaderboardLink")
void leaderboardLinkClicked(ClickEvent e) {
placesNavigator.goToPlace(leaderboardNavigation);
e.preventDefault();
handleClickEvent(e, leaderboardNavigation);
}
private void handleClickEvent(ClickEvent e, PlaceNavigation<?> placeNavigation) {
if (HYPERLINK_IMPL.handleAsClick((Event) e.getNativeEvent())) {
placesNavigator.goToPlace(placeNavigation);
e.preventDefault();
}
}
}
@@ -11,10 +11,13 @@ 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.Event;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.impl.HyperlinkImpl;
import com.sap.sailing.domain.common.DetailType;
import com.sap.sailing.domain.common.RaceIdentifier;
import com.sap.sailing.domain.common.dto.FleetDTO;
@@ -22,10 +25,13 @@ import com.sap.sailing.domain.common.dto.LeaderboardDTO;
import com.sap.sailing.domain.common.dto.RaceColumnDTO;
import com.sap.sailing.gwt.common.client.SharedResources;
import com.sap.sailing.gwt.home.client.app.HomePlacesNavigator;
import com.sap.sailing.gwt.home.client.app.PlaceNavigation;
import com.sap.sailing.gwt.home.client.place.event.header.CompactEventHeader;
import com.sap.sailing.gwt.home.client.place.event.oldcompetitorcharts.OldCompetitorCharts;
import com.sap.sailing.gwt.home.client.place.event.oldleaderboard.OldLeaderboard;
import com.sap.sailing.gwt.home.client.place.event.regattaleaderboard.EventRegattaLeaderboardResources;
import com.sap.sailing.gwt.home.client.place.regatta.RegattaPlace;
import com.sap.sailing.gwt.home.client.place.regatta.RegattaPlace.RegattaNavigationTabs;
import com.sap.sailing.gwt.ui.client.LeaderboardUpdateListener;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.client.StringMessages;
@@ -43,6 +49,8 @@ public class RegattaAnalytics extends Composite implements LeaderboardUpdateList
interface RegattaAnalyticsUiBinder extends UiBinder<Widget, RegattaAnalytics> {
}
private static final HyperlinkImpl HYPERLINK_IMPL = GWT.create(HyperlinkImpl.class);
@UiField OldLeaderboard oldLeaderboardComposite;
@UiField OldCompetitorCharts oldCompetitorChartsComposite;
@UiField(provided=true) CompactEventHeader eventHeader;
@@ -57,12 +65,18 @@ public class RegattaAnalytics extends Composite implements LeaderboardUpdateList
@UiField Anchor leaderboardAnchor;
@UiField Anchor competitorChartsAnchor;
private final PlaceNavigation<RegattaPlace> leaderboardNavigation;
private final PlaceNavigation<RegattaPlace> competitorChartsNavigation;
private RegattaAnalyticsDataManager regattaAnalyticsManager;
private Timer autoRefreshTimer;
private RegattaNavigationTabs navigationTab;
public RegattaAnalytics(EventDTO event, String leaderboardName, Timer timerForClientServerOffset, HomePlacesNavigator placeNavigator) {
eventHeader = new CompactEventHeader(event, leaderboardName, placeNavigator);
public RegattaAnalytics(EventDTO event, String leaderboardName, RegattaNavigationTabs navigationTab, Timer timerForClientServerOffset, HomePlacesNavigator placesNavigator) {
this.navigationTab = navigationTab;
eventHeader = new CompactEventHeader(event, leaderboardName, placesNavigator);
EventRegattaLeaderboardResources.INSTANCE.css().ensureInjected();
RegattaAnalyticsResources.INSTANCE.css().ensureInjected();
@@ -71,13 +85,17 @@ public class RegattaAnalytics extends Composite implements LeaderboardUpdateList
title.setInnerText(leaderboardName);
activeAnchor = leaderboardAnchor;
activeTabPanel = leaderboardTabPanel;
activeAnchor.addStyleName(SharedResources.INSTANCE.mainCss().navbar_buttonactive());
competitorChartsTabPanel.setVisible(false);
leaderboardTabPanel.setVisible(false);
liveRaceDiv.getStyle().setVisibility(Visibility.HIDDEN);
leaderboardNavigation = placesNavigator.getRegattaAnalyticsNavigation(event.id.toString(), RegattaNavigationTabs.Leaderboard, leaderboardName,
event.getBaseURL(), event.isOnRemoteServer());
competitorChartsNavigation = placesNavigator.getRegattaAnalyticsNavigation(event.id.toString(), RegattaNavigationTabs.CompetitorAnalytics, leaderboardName,
event.getBaseURL(), event.isOnRemoteServer());
leaderboardAnchor.setHref(leaderboardNavigation.getTargetUrl());
competitorChartsAnchor.setHref(competitorChartsNavigation.getTargetUrl());
}
public void createRegattaAnalyticsViewer(final SailingServiceAsync sailingService, final AsyncActionsExecutor asyncActionsExecutor,
@@ -101,6 +119,17 @@ public class RegattaAnalytics extends Composite implements LeaderboardUpdateList
oldCompetitorChartsComposite.setChart(regattaAnalyticsManager.getMultiCompetitorChart(), availableDetailsTypes, initialDetailType);
regattaAnalyticsManager.hideCompetitorChart();
switch(navigationTab) {
case Leaderboard:
setActiveTabPanel(leaderboardTabPanel, leaderboardAnchor);
break;
case CompetitorAnalytics:
setActiveTabPanel(competitorChartsTabPanel, competitorChartsAnchor);
DetailType selectedChartDetailType = oldCompetitorChartsComposite.getSelectedChartDetailType();
regattaAnalyticsManager.showCompetitorChart(selectedChartDetailType);
break;
}
}
@Override
@@ -144,6 +173,7 @@ public class RegattaAnalytics extends Composite implements LeaderboardUpdateList
void leaderboardTabClicked(ClickEvent event) {
setActiveTabPanel(leaderboardTabPanel, leaderboardAnchor);
regattaAnalyticsManager.hideCompetitorChart();
handleClickEvent(event, leaderboardNavigation);
}
@UiHandler("competitorChartsAnchor")
@@ -151,6 +181,7 @@ public class RegattaAnalytics extends Composite implements LeaderboardUpdateList
setActiveTabPanel(competitorChartsTabPanel, competitorChartsAnchor);
DetailType selectedChartDetailType = oldCompetitorChartsComposite.getSelectedChartDetailType();
regattaAnalyticsManager.showCompetitorChart(selectedChartDetailType);
handleClickEvent(event, competitorChartsNavigation);
}
private void setActiveTabPanel(HTMLPanel newActivePanel, Anchor newActiveAnchor) {
@@ -164,4 +195,13 @@ public class RegattaAnalytics extends Composite implements LeaderboardUpdateList
activeTabPanel.setVisible(true);
activeAnchor.addStyleName(SharedResources.INSTANCE.mainCss().navbar_buttonactive());
}
private void handleClickEvent(ClickEvent e, PlaceNavigation<?> placeNavigation) {
if (HYPERLINK_IMPL.handleAsClick((Event) e.getNativeEvent())) {
// don't use the placecontroller for navigation here as we want to avoid a page reload
History.newItem(placeNavigation.getHistoryUrl(), false);
e.preventDefault();
}
}
}
@@ -1,7 +1,7 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:s="urn:import:com.sap.sailing.gwt.home.client.place.event"
xmlns:p="urn:import:com.sap.sailing.gwt.home.client.place.leaderboard"
xmlns:p="urn:import:com.sap.sailing.gwt.home.client.place.regatta"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
<ui:with field="i18n" type="com.sap.sailing.gwt.common.client.i18n.TextMessages"/>
<ui:with field="res" type="com.sap.sailing.gwt.common.client.SharedResources" />
@@ -20,8 +20,8 @@
</div>
</div>
<div class="{res.mediaCss.small12} {res.mediaCss.columns} {local_res.css.regattaleaderboard_meta_navigation}">
<g:Anchor ui:field="leaderboardAnchor" href="javascript:;" styleName="{res.mainCss.navbar_button}"><ui:text from="{i18n.leaderboard}" /></g:Anchor>
<g:Anchor ui:field="competitorChartsAnchor" href="javascript:;" styleName="{res.mainCss.navbar_button}"><ui:text from="{i18n.competitorsAnalytics}" /></g:Anchor>
<g:Anchor ui:field="leaderboardAnchor" styleName="{res.mainCss.navbar_button}"><ui:text from="{i18n.leaderboard}" /></g:Anchor>
<g:Anchor ui:field="competitorChartsAnchor" styleName="{res.mainCss.navbar_button}"><ui:text from="{i18n.competitorsAnalytics}" /></g:Anchor>
</div>
</div>
<g:HTMLPanel ui:field="leaderboardTabPanel">
@@ -1,7 +1,6 @@
package com.sap.sailing.gwt.home.client.place.event.regattaraces;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.AnchorElement;
import com.google.gwt.dom.client.DivElement;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.SpanElement;
@@ -10,10 +9,9 @@ import com.google.gwt.dom.client.Style.Visibility;
import com.google.gwt.i18n.shared.DateTimeFormat;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.EventListener;
import com.google.gwt.user.client.ui.UIObject;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.sap.sailing.domain.common.dto.CompetitorDTO;
import com.sap.sailing.domain.common.dto.FleetDTO;
import com.sap.sailing.domain.common.dto.RaceColumnDTO;
@@ -22,12 +20,12 @@ import com.sap.sailing.gwt.home.client.place.event.EventPlaceNavigator;
import com.sap.sailing.gwt.ui.shared.StrippedLeaderboardDTO;
import com.sap.sse.gwt.client.player.Timer;
public class EventRegattaRacesRace extends UIObject {
public class EventRegattaRacesRace extends Composite {
private static EventRegattaRacesRaceUiBinder uiBinder = GWT.create(EventRegattaRacesRaceUiBinder.class);
private enum SimpleRaceStates { NOT_TRACKED, TRACKED, TRACKED_AND_LIVE, TRACKED_BUT_NOT_SCHEDULED };
interface EventRegattaRacesRaceUiBinder extends UiBinder<DivElement, EventRegattaRacesRace> {
interface EventRegattaRacesRaceUiBinder extends UiBinder<Widget, EventRegattaRacesRace> {
}
@UiField DivElement fleetColor;
@@ -41,8 +39,8 @@ public class EventRegattaRacesRace extends UIObject {
@UiField DivElement raceNotScheduledDiv;
@UiField DivElement watchRaceDiv;
@UiField DivElement analyzeRaceDiv;
@UiField AnchorElement watchRaceLink;
@UiField AnchorElement analyzeRaceLink;
@UiField Anchor watchRaceLink;
@UiField Anchor analyzeRaceLink;
@UiField DivElement raceWinnerDiv;
@UiField SpanElement raceWinner;
@@ -64,25 +62,21 @@ public class EventRegattaRacesRace extends UIObject {
private final DateTimeFormat raceTimeFormat = DateTimeFormat.getFormat("EEE, h:mm a");
private final StrippedLeaderboardDTO leaderboard;
private final FleetDTO fleet;
private final RaceColumnDTO raceColumn;
private final RaceDTO race;
private final EventPlaceNavigator pageNavigator;
private final Timer timerForClientServerOffset;
private Element[] allConditionalElements;
public EventRegattaRacesRace(StrippedLeaderboardDTO leaderboard, FleetDTO fleet, RaceColumnDTO raceColumn, Timer timerForClientServerOffset, EventPlaceNavigator pageNavigator) {
this.leaderboard = leaderboard;
this.fleet = fleet;
this.raceColumn = raceColumn;
this.pageNavigator = pageNavigator;
this.timerForClientServerOffset = timerForClientServerOffset;
race = raceColumn.getRace(fleet);
EventRegattaRacesResources.INSTANCE.css().ensureInjected();
setElement(uiBinder.createAndBindUi(this));
initWidget(uiBinder.createAndBindUi(this));
allConditionalElements = new Element[] {raceWinnerDiv, raceLeaderDiv, watchRaceDiv, analyzeRaceDiv, raceNotTrackedDiv, raceNotScheduledDiv,
raceFeaturesDiv, legProgressDiv, raceFlagDiv, windStatusDiv };
@@ -94,35 +88,14 @@ public class EventRegattaRacesRace extends UIObject {
raceName.setInnerText(raceColumn.getName());
raceName2.setInnerText(raceColumn.getName());
registerEvents();
if(race != null && race.trackedRace != null) {
String raceViewerURL = pageNavigator.getRaceViewerURL(leaderboard, race);
analyzeRaceLink.setHref(raceViewerURL);
watchRaceLink.setHref(raceViewerURL);
}
updateUI();
}
private void registerEvents() {
Event.sinkEvents(analyzeRaceLink, Event.ONCLICK);
Event.setEventListener(analyzeRaceLink, new EventListener() {
@Override
public void onBrowserEvent(Event event) {
switch (DOM.eventGetType(event)) {
case Event.ONCLICK:
openRaceViewer();
break;
}
}
});
Event.sinkEvents(watchRaceLink, Event.ONCLICK);
Event.setEventListener(watchRaceLink, new EventListener() {
@Override
public void onBrowserEvent(Event event) {
switch (DOM.eventGetType(event)) {
case Event.ONCLICK:
openRaceViewer();
break;
}
}
});
}
private SimpleRaceStates getSimpleRaceState() {
SimpleRaceStates simpleRaceState = SimpleRaceStates.NOT_TRACKED;
@@ -227,10 +200,4 @@ public class EventRegattaRacesRace extends UIObject {
el.getStyle().setVisibility(Visibility.VISIBLE);
el.getStyle().setDisplay(Display.INLINE_BLOCK);
}
private void openRaceViewer() {
if(race != null && race.trackedRace != null) {
pageNavigator.openRaceViewer(leaderboard, race);
}
}
}
@@ -5,7 +5,7 @@
<ui:with field="i18n" type="com.sap.sailing.gwt.common.client.i18n.TextMessages"/>
<ui:with field="res" type="com.sap.sailing.gwt.common.client.SharedResources" />
<ui:with field="local_res" type="com.sap.sailing.gwt.home.client.place.event.regattaraces.EventRegattaRacesResources" />
<div class="{local_res.css.eventregattarace}">
<g:HTMLPanel styleName="{local_res.css.eventregattarace}">
<div ui:field="fleetColor" class="{local_res.css.eventregattarace_fleetindicator}"></div>
<!-- race name -->
<div class="{local_res.css.eventregattarace_details} {local_res.css.eventregattarace_name}">
@@ -45,11 +45,11 @@
<ui:text from='{i18n.raceNotScheduled}'/>
</div>
<div ui:field="watchRaceDiv" class="{local_res.css.eventregattarace_action}">
<a ui:field="watchRaceLink" class="{res.mainCss.button} {local_res.css.eventregattarace_action_watch}"><ui:text from='{i18n.eventRegattaRaceWatch}'/></a>
<g:Anchor ui:field="watchRaceLink" target="_blank" styleName="{res.mainCss.button} {local_res.css.eventregattarace_action_watch}"><ui:text from='{i18n.eventRegattaRaceWatch}'/></g:Anchor>
</div>
<div ui:field="analyzeRaceDiv" class="{local_res.css.eventregattarace_action}">
<a ui:field="analyzeRaceLink" class="{res.mainCss.button} {local_res.css.eventregattarace_action_analyze}"><ui:text from='{i18n.eventRegattaRaceAnalyse}'/></a>
<g:Anchor ui:field="analyzeRaceLink" target="_blank" styleName="{res.mainCss.button} {local_res.css.eventregattarace_action_analyze}"><ui:text from='{i18n.eventRegattaRaceAnalyse}'/></g:Anchor>
</div>
</div>
</g:HTMLPanel>
</ui:UiBinder>
@@ -11,10 +11,13 @@ 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.Event;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.impl.HyperlinkImpl;
import com.sap.sailing.domain.common.DetailType;
import com.sap.sailing.domain.common.LeaderboardNameConstants;
import com.sap.sailing.domain.common.RaceIdentifier;
@@ -23,11 +26,14 @@ import com.sap.sailing.domain.common.dto.LeaderboardDTO;
import com.sap.sailing.domain.common.dto.RaceColumnDTO;
import com.sap.sailing.gwt.common.client.SharedResources;
import com.sap.sailing.gwt.home.client.app.HomePlacesNavigator;
import com.sap.sailing.gwt.home.client.app.PlaceNavigation;
import com.sap.sailing.gwt.home.client.place.event.header.CompactEventHeader;
import com.sap.sailing.gwt.home.client.place.event.oldcompetitorcharts.OldCompetitorCharts;
import com.sap.sailing.gwt.home.client.place.event.oldleaderboard.OldLeaderboard;
import com.sap.sailing.gwt.home.client.place.event.oldmultileaderboard.OldMultiLeaderboard;
import com.sap.sailing.gwt.home.client.place.event.regattaleaderboard.EventRegattaLeaderboardResources;
import com.sap.sailing.gwt.home.client.place.series.SeriesPlace;
import com.sap.sailing.gwt.home.client.place.series.SeriesPlace.SeriesNavigationTabs;
import com.sap.sailing.gwt.ui.client.LeaderboardUpdateListener;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.client.StringMessages;
@@ -45,6 +51,8 @@ public class EventSeriesAnalytics extends Composite implements LeaderboardUpdate
interface EventSeriesAnalyticsUiBinder extends UiBinder<Widget, EventSeriesAnalytics> {
}
private static final HyperlinkImpl HYPERLINK_IMPL = GWT.create(HyperlinkImpl.class);
@UiField OldLeaderboard oldOverallLeaderboardComposite;
@UiField OldCompetitorCharts oldCompetitorChartsComposite;
@UiField OldMultiLeaderboard oldRegattaLeaderboardsComposite;
@@ -56,19 +64,25 @@ public class EventSeriesAnalytics extends Composite implements LeaderboardUpdate
@UiField HTMLPanel overallLeaderboardTabPanel;
@UiField HTMLPanel regattaLeaderboardsTabPanel;
@UiField HTMLPanel competitorChartsTabPanel;
private HTMLPanel activeTabPanel;
private Widget activeContentWidget;
private Anchor activeAnchor;
@UiField Anchor overallLeaderboardAnchor;
@UiField Anchor regattaLeaderboardsAnchor;
@UiField Anchor competitorChartsAnchor;
private final PlaceNavigation<SeriesPlace> overallLeaderboardNavigation;
private final PlaceNavigation<SeriesPlace> regattaLeaderboardsNavigation;
private final PlaceNavigation<SeriesPlace> competitorChartsNavigation;
private HTMLPanel activeTabPanel;
private Widget activeContentWidget;
private Anchor activeAnchor;
private EventSeriesAnalyticsDataManager eventSeriesAnalyticsManager;
private Timer autoRefreshTimer;
private SeriesNavigationTabs navigationTab;
public EventSeriesAnalytics(EventDTO event, String leaderboardName, Timer timerForClientServerOffset, HomePlacesNavigator placeNavigator) {
eventHeader = new CompactEventHeader(event, leaderboardName, placeNavigator);
public EventSeriesAnalytics(EventDTO event, String leaderboardName, SeriesNavigationTabs navigationTab, Timer timerForClientServerOffset, HomePlacesNavigator placesNavigator) {
this.navigationTab = navigationTab;
eventHeader = new CompactEventHeader(event, leaderboardName, placesNavigator);
EventRegattaLeaderboardResources.INSTANCE.css().ensureInjected();
EventSeriesAnalyticsResources.INSTANCE.css().ensureInjected();
@@ -82,14 +96,21 @@ public class EventSeriesAnalytics extends Composite implements LeaderboardUpdate
}
title.setInnerText(seriesTitle);
activeAnchor = overallLeaderboardAnchor;
activeTabPanel = overallLeaderboardTabPanel;
activeContentWidget = null;
activeAnchor.addStyleName(SharedResources.INSTANCE.mainCss().navbar_buttonactive());
overallLeaderboardTabPanel.setVisible(false);
regattaLeaderboardsTabPanel.setVisible(false);
competitorChartsTabPanel.setVisible(false);
liveRaceDiv.getStyle().setVisibility(Visibility.HIDDEN);
overallLeaderboardNavigation = placesNavigator.getSeriesAnalyticsNavigation(event.id.toString(), SeriesNavigationTabs.OverallLeaderboard, leaderboardName,
event.getBaseURL(), event.isOnRemoteServer());
regattaLeaderboardsNavigation = placesNavigator.getSeriesAnalyticsNavigation(event.id.toString(), SeriesNavigationTabs.RegattaLeaderboards, leaderboardName,
event.getBaseURL(), event.isOnRemoteServer());
competitorChartsNavigation = placesNavigator.getSeriesAnalyticsNavigation(event.id.toString(), SeriesNavigationTabs.CompetitorAnalytics, leaderboardName,
event.getBaseURL(), event.isOnRemoteServer());
overallLeaderboardAnchor.setHref(overallLeaderboardNavigation.getTargetUrl());
regattaLeaderboardsAnchor.setHref(regattaLeaderboardsNavigation.getTargetUrl());
competitorChartsAnchor.setHref(competitorChartsNavigation.getTargetUrl());
}
public void createSeriesAnalyticsViewer(SailingServiceAsync sailingService, AsyncActionsExecutor asyncActionsExecutor,
@@ -117,7 +138,21 @@ public class EventSeriesAnalytics extends Composite implements LeaderboardUpdate
eventSeriesAnalyticsManager.getLeaderboardPanel().addLeaderboardUpdateListener(this);
eventSeriesAnalyticsManager.getMultiLeaderboardPanel().addLeaderboardUpdateListener(this);
switch(navigationTab) {
case OverallLeaderboard:
setActiveTabPanel(overallLeaderboardTabPanel, eventSeriesAnalyticsManager.getLeaderboardPanel(), overallLeaderboardAnchor);
break;
case RegattaLeaderboards:
setActiveTabPanel(regattaLeaderboardsTabPanel, eventSeriesAnalyticsManager.getMultiLeaderboardPanel(), regattaLeaderboardsAnchor);
break;
case CompetitorAnalytics:
setActiveTabPanel(competitorChartsTabPanel, eventSeriesAnalyticsManager.getMultiCompetitorChart(), competitorChartsAnchor);
DetailType selectedChartDetailType = oldCompetitorChartsComposite.getSelectedChartDetailType();
eventSeriesAnalyticsManager.showCompetitorChart(selectedChartDetailType);
break;
}
activeContentWidget = eventSeriesAnalyticsManager.getLeaderboardPanel();
}
@@ -163,11 +198,13 @@ public class EventSeriesAnalytics extends Composite implements LeaderboardUpdate
@UiHandler("overallLeaderboardAnchor")
void overallLeaderboardTabClicked(ClickEvent event) {
setActiveTabPanel(overallLeaderboardTabPanel, eventSeriesAnalyticsManager.getLeaderboardPanel(), overallLeaderboardAnchor);
handleClickEvent(event, overallLeaderboardNavigation);
}
@UiHandler("regattaLeaderboardsAnchor")
void regattaLeaderboardsTabClicked(ClickEvent event) {
setActiveTabPanel(regattaLeaderboardsTabPanel, eventSeriesAnalyticsManager.getMultiLeaderboardPanel(), regattaLeaderboardsAnchor);
handleClickEvent(event, regattaLeaderboardsNavigation);
}
@UiHandler("competitorChartsAnchor")
@@ -175,6 +212,7 @@ public class EventSeriesAnalytics extends Composite implements LeaderboardUpdate
setActiveTabPanel(competitorChartsTabPanel, eventSeriesAnalyticsManager.getMultiCompetitorChart(), competitorChartsAnchor);
DetailType selectedChartDetailType = oldCompetitorChartsComposite.getSelectedChartDetailType();
eventSeriesAnalyticsManager.showCompetitorChart(selectedChartDetailType);
handleClickEvent(event, competitorChartsNavigation);
}
private void setActiveTabPanel(HTMLPanel newActivePanel, Widget newActiveContentWidget, Anchor newActiveAnchor) {
@@ -193,4 +231,12 @@ public class EventSeriesAnalytics extends Composite implements LeaderboardUpdate
activeContentWidget.setVisible(true);
activeAnchor.addStyleName(SharedResources.INSTANCE.mainCss().navbar_buttonactive());
}
private void handleClickEvent(ClickEvent e, PlaceNavigation<?> placeNavigation) {
if (HYPERLINK_IMPL.handleAsClick((Event) e.getNativeEvent())) {
// don't use the placecontroller for navigation here as we want to avoid a page reload
History.newItem(placeNavigation.getHistoryUrl(), false);
e.preventDefault();
}
}
}
@@ -1,7 +1,7 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:s="urn:import:com.sap.sailing.gwt.home.client.place.event"
xmlns:p="urn:import:com.sap.sailing.gwt.home.client.place.leaderboard"
xmlns:p="urn:import:com.sap.sailing.gwt.home.client.place.series"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
<ui:with field="i18n" type="com.sap.sailing.gwt.common.client.i18n.TextMessages"/>
<ui:with field="res" type="com.sap.sailing.gwt.common.client.SharedResources" />
@@ -20,9 +20,9 @@
</div>
</div>
<div class="{res.mediaCss.small12} {res.mediaCss.columns} {local_res.css.regattaleaderboard_meta_navigation}">
<g:Anchor ui:field="overallLeaderboardAnchor" href="javascript:;" styleName="{res.mainCss.navbar_button}"><ui:text from="{i18n.overallLeaderboard}" /></g:Anchor>
<g:Anchor ui:field="regattaLeaderboardsAnchor" href="javascript:;" styleName="{res.mainCss.navbar_button}"><ui:text from="{i18n.regattaLeaderboards}" /></g:Anchor>
<g:Anchor ui:field="competitorChartsAnchor" href="javascript:;" styleName="{res.mainCss.navbar_button}"><ui:text from="{i18n.competitorsAnalytics}" /></g:Anchor>
<g:Anchor ui:field="overallLeaderboardAnchor" styleName="{res.mainCss.navbar_button}"><ui:text from="{i18n.overallLeaderboard}" /></g:Anchor>
<g:Anchor ui:field="regattaLeaderboardsAnchor" styleName="{res.mainCss.navbar_button}"><ui:text from="{i18n.regattaLeaderboards}" /></g:Anchor>
<g:Anchor ui:field="competitorChartsAnchor" styleName="{res.mainCss.navbar_button}"><ui:text from="{i18n.competitorsAnalytics}" /></g:Anchor>
</div>
</div>
<g:HTMLPanel ui:field="overallLeaderboardTabPanel">
@@ -4,6 +4,7 @@ import java.util.List;
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.shared.placeholder.Placeholder;
@@ -13,9 +14,11 @@ import com.sap.sse.gwt.client.mvp.ErrorView;
public class EventsActivity extends AbstractActivity {
private final EventsClientFactory clientFactory;
private final EventsPlace place;
public EventsActivity(EventsPlace place, EventsClientFactory clientFactory) {
this.clientFactory = clientFactory;
this.place = place;
}
@Override
@@ -25,8 +28,9 @@ public class EventsActivity extends AbstractActivity {
clientFactory.getSailingService().getPublicEventsOfAllSailingServers(new AsyncCallback<List<EventBaseDTO>>() {
@Override
public void onSuccess(List<EventBaseDTO> events) {
final EventsView eventsView = clientFactory.createEventsView(EventsActivity.this);
final EventsView eventsView = clientFactory.createEventsView();
panel.setWidget(eventsView.asWidget());
Window.setTitle(place.getTitle());
eventsView.setEvents(events);
}
@@ -3,5 +3,5 @@ package com.sap.sailing.gwt.home.client.place.events;
import com.sap.sailing.gwt.ui.client.SailingClientFactory;
public interface EventsClientFactory extends SailingClientFactory {
EventsView createEventsView(EventsActivity activity);
EventsView createEventsView();
}
@@ -2,8 +2,13 @@ package com.sap.sailing.gwt.home.client.place.events;
import com.google.gwt.place.shared.Place;
import com.google.gwt.place.shared.PlaceTokenizer;
import com.sap.sailing.gwt.common.client.i18n.TextMessages;
public class EventsPlace extends Place {
public String getTitle() {
return TextMessages.INSTANCE.sapSailing() + " - " + TextMessages.INSTANCE.events();
}
public static class Tokenizer implements PlaceTokenizer<EventsPlace> {
@Override
public String getToken(EventsPlace place) {
@@ -1,25 +0,0 @@
package com.sap.sailing.gwt.home.client.place.leaderboard;
import com.google.gwt.core.client.GWT;
import com.sap.sse.gwt.client.mvp.AbstractActivityProxy;
public class LeaderboardActivityProxy extends AbstractActivityProxy {
private final LeaderboardClientFactory clientFactory;
private final LeaderboardPlace place;
public LeaderboardActivityProxy(LeaderboardPlace place, LeaderboardClientFactory clientFactory) {
this.place = place;
this.clientFactory = clientFactory;
}
@Override
protected void startAsync() {
GWT.runAsync(new AbstractRunAsyncCallback() {
@Override
public void onSuccess() {
super.onSuccess(new LeaderboardActivity(place, clientFactory));
}
});
}
}
@@ -1,9 +0,0 @@
package com.sap.sailing.gwt.home.client.place.leaderboard;
import com.sap.sailing.gwt.ui.client.SailingClientFactory;
import com.sap.sailing.gwt.ui.shared.EventDTO;
import com.sap.sse.gwt.client.player.Timer;
public interface LeaderboardClientFactory extends SailingClientFactory {
AnalyticsView createLeaderboardView(EventDTO event, String leaderboardName, Timer timerForClientServerOffset);
}
@@ -1,4 +1,4 @@
package com.sap.sailing.gwt.home.client.place.leaderboard;
package com.sap.sailing.gwt.home.client.place.regatta;
import java.util.ArrayList;
import java.util.Collections;
@@ -33,16 +33,16 @@ import com.sap.sse.gwt.client.player.Timer.PlayStates;
import com.sap.sse.gwt.client.useragent.UserAgentDetails;
import com.sap.sse.gwt.shared.GwtHttpRequestUtils;
public class LeaderboardActivity extends AbstractActivity implements ErrorReporter {
private final LeaderboardClientFactory clientFactory;
private final LeaderboardPlace leaderboardPlace;
public class RegattaActivity extends AbstractActivity implements ErrorReporter {
private final RegattaClientFactory clientFactory;
private final RegattaPlace regattaPlace;
private final Timer timerForClientServerOffset;
private final UserAgentDetails userAgent = new UserAgentDetails(Window.Navigator.getUserAgent());
public LeaderboardActivity(LeaderboardPlace place, LeaderboardClientFactory clientFactory) {
public RegattaActivity(RegattaPlace place, RegattaClientFactory clientFactory) {
this.clientFactory = clientFactory;
this.leaderboardPlace = place;
this.regattaPlace = place;
timerForClientServerOffset = new Timer(PlayModes.Replay);
}
@@ -51,9 +51,9 @@ public class LeaderboardActivity extends AbstractActivity implements ErrorReport
public void start(final AcceptsOneWidget panel, EventBus eventBus) {
panel.setWidget(new Placeholder());
UUID eventUUID = UUID.fromString(leaderboardPlace.getEventUuidAsString());
final String leaderboardName = leaderboardPlace.getLeaderboardIdAsNameString();
final boolean showRaceDetails = leaderboardPlace.getShowRaceDetails();
UUID eventUUID = UUID.fromString(regattaPlace.getEventUuidAsString());
final String leaderboardName = regattaPlace.getLeaderboardIdAsNameString();
final boolean showRaceDetails = regattaPlace.getShowRaceDetails();
clientFactory.getSailingService().getEventById(eventUUID, true, new AsyncCallback<EventDTO>() {
@Override
@@ -63,8 +63,12 @@ public class LeaderboardActivity extends AbstractActivity implements ErrorReport
new AsyncCallback<Util.Pair<String, LeaderboardType>>() {
@Override
public void onSuccess(Util.Pair<String, LeaderboardType> leaderboardNameAndType) {
if (leaderboardNameAndType != null && leaderboardName.equals(leaderboardNameAndType.getA())) {
createAnalyticsViewer(panel, event, leaderboardNameAndType.getA(), leaderboardNameAndType.getB(), showRaceDetails);
if(leaderboardNameAndType != null && leaderboardName.equals(leaderboardNameAndType.getA())) {
if(leaderboardNameAndType.getB().isMetaLeaderboard()) {
createErrorView("Leaderboard is a meta leaderboard.", null, panel);
} else {
createAnalyticsViewer(panel, event, leaderboardNameAndType.getA(), leaderboardNameAndType.getB(), showRaceDetails);
}
} else {
createErrorView(TextMessages.INSTANCE.errorMessageNoSuchLeaderboard(), null, panel);
}
@@ -103,19 +107,13 @@ public class LeaderboardActivity extends AbstractActivity implements ErrorReport
} // interval has been specified
boolean autoExpandLastRaceColumn = GwtHttpRequestUtils.getBooleanParameter(LeaderboardUrlSettings.PARAM_AUTO_EXPAND_LAST_RACE_COLUMN, false);
boolean showOverallLeaderboard = GwtHttpRequestUtils.getBooleanParameter(LeaderboardUrlSettings.PARAM_SHOW_OVERALL_LEADERBOARD, false);
boolean showSeriesLeaderboards = GwtHttpRequestUtils.getBooleanParameter(LeaderboardUrlSettings.PARAM_SHOW_SERIES_LEADERBOARDS, false);
AnalyticsView analyticsView = clientFactory.createLeaderboardView(event, leaderboardName, timerForClientServerOffset);
RegattaAnalyticsView analyticsView = clientFactory.createRegattaAnalyticsView(event, leaderboardName, regattaPlace.getNavigationTab(), timerForClientServerOffset);
Window.setTitle(regattaPlace.getTitle(event.getName(), leaderboardDisplayName));
if (leaderboardType.isMetaLeaderboard()) {
analyticsView.createSeriesAnalyticsViewer(clientFactory.getSailingService(), new AsyncActionsExecutor(),
timer, leaderboardSettings, null, preselectedRace, "leaderboardGroupName", leaderboardName, this,
userAgent, showRaceDetails, autoExpandLastRaceColumn, showSeriesLeaderboards);
} else {
analyticsView.createRegattaAnalyticsViewer(clientFactory.getSailingService(), new AsyncActionsExecutor(),
timer, leaderboardSettings, preselectedRace, "leaderboardGroupName", leaderboardName, this,
userAgent, showRaceDetails, autoExpandLastRaceColumn, showOverallLeaderboard);
}
analyticsView.createRegattaAnalyticsViewer(clientFactory.getSailingService(), new AsyncActionsExecutor(),
timer, leaderboardSettings, preselectedRace, "leaderboardGroupName", leaderboardName, this,
userAgent, showRaceDetails, autoExpandLastRaceColumn, showOverallLeaderboard);
panel.setWidget(analyticsView.asWidget());
}
@@ -0,0 +1,25 @@
package com.sap.sailing.gwt.home.client.place.regatta;
import com.google.gwt.core.client.GWT;
import com.sap.sse.gwt.client.mvp.AbstractActivityProxy;
public class RegattaActivityProxy extends AbstractActivityProxy {
private final RegattaClientFactory clientFactory;
private final RegattaPlace place;
public RegattaActivityProxy(RegattaPlace place, RegattaClientFactory clientFactory) {
this.place = place;
this.clientFactory = clientFactory;
}
@Override
protected void startAsync() {
GWT.runAsync(new AbstractRunAsyncCallback() {
@Override
public void onSuccess() {
super.onSuccess(new RegattaActivity(place, clientFactory));
}
});
}
}
@@ -1,4 +1,4 @@
package com.sap.sailing.gwt.home.client.place.leaderboard;
package com.sap.sailing.gwt.home.client.place.regatta;
import com.google.gwt.user.client.ui.Widget;
import com.sap.sailing.domain.common.RaceIdentifier;
@@ -9,7 +9,7 @@ import com.sap.sse.gwt.client.async.AsyncActionsExecutor;
import com.sap.sse.gwt.client.player.Timer;
import com.sap.sse.gwt.client.useragent.UserAgentDetails;
public interface AnalyticsView {
public interface RegattaAnalyticsView {
Widget asWidget();
void createRegattaAnalyticsViewer(final SailingServiceAsync sailingService, final AsyncActionsExecutor asyncActionsExecutor,
@@ -17,10 +17,4 @@ public interface AnalyticsView {
final String leaderboardGroupName, String leaderboardName, final ErrorReporter errorReporter,
final UserAgentDetails userAgent, boolean showRaceDetails,
boolean autoExpandLastRaceColumn, boolean showOverallLeaderboard);
void createSeriesAnalyticsViewer(SailingServiceAsync sailingService, AsyncActionsExecutor asyncActionsExecutor,
Timer timer, LeaderboardSettings leaderboardSettings, String preselectedLeaderboardName, RaceIdentifier preselectedRace,
String leaderboardGroupName, String metaLeaderboardName, ErrorReporter errorReporter,
UserAgentDetails userAgent, boolean showRaceDetails,
boolean autoExpandLastRaceColumn, boolean showSeriesLeaderboards);
}
@@ -0,0 +1,10 @@
package com.sap.sailing.gwt.home.client.place.regatta;
import com.sap.sailing.gwt.home.client.place.regatta.RegattaPlace.RegattaNavigationTabs;
import com.sap.sailing.gwt.ui.client.SailingClientFactory;
import com.sap.sailing.gwt.ui.shared.EventDTO;
import com.sap.sse.gwt.client.player.Timer;
public interface RegattaClientFactory extends SailingClientFactory {
RegattaAnalyticsView createRegattaAnalyticsView(EventDTO event, String leaderboardName, RegattaNavigationTabs navigationTab, Timer timerForClientServerOffset);
}
@@ -1,40 +1,60 @@
package com.sap.sailing.gwt.home.client.place.leaderboard;
package com.sap.sailing.gwt.home.client.place.regatta;
import com.google.gwt.place.shared.PlaceTokenizer;
import com.sap.sailing.gwt.common.client.AbstractBasePlace;
import com.sap.sailing.gwt.common.client.i18n.TextMessages;
public class LeaderboardPlace extends AbstractBasePlace {
public class RegattaPlace extends AbstractBasePlace {
private final String eventUuidAsString;
private final String leaderboardIdAsNameString;
private final Boolean showRaceDetails;
private final Boolean showSettings;
private final RegattaNavigationTabs navigationTab;
private final static String PARAM_EVENTID = "eventId";
private final static String PARAM_LEADERBOARD_NAME = "leaderboardName";
private final static String PARAM_SHOW_RACE_DETAILS = "showRaceDetails";
private final static String PARAM_SHOW_SETTINGS = "showSettings";
private final static String PARAM_NAVIGATION_TAB = "navigationTab";
public enum RegattaNavigationTabs { Leaderboard, CompetitorAnalytics };
public LeaderboardPlace(String url) {
public RegattaPlace(String url) {
super(url);
eventUuidAsString = getParameter(PARAM_EVENTID);
leaderboardIdAsNameString = getParameter(PARAM_LEADERBOARD_NAME);
showRaceDetails = Boolean.valueOf(getParameter(PARAM_SHOW_RACE_DETAILS));
showSettings = Boolean.valueOf(getParameter(PARAM_SHOW_SETTINGS));
String paramNavTab = getParameter(PARAM_NAVIGATION_TAB);
if(paramNavTab != null) {
navigationTab = RegattaNavigationTabs.valueOf(paramNavTab);
} else {
navigationTab = RegattaNavigationTabs.Leaderboard;
}
}
public LeaderboardPlace(String eventUuidAsString, String leaderboardIdAsNameString, Boolean showRaceDetails, Boolean showSettings) {
super(PARAM_EVENTID, eventUuidAsString, PARAM_LEADERBOARD_NAME, leaderboardIdAsNameString,
public RegattaPlace(String eventUuidAsString, RegattaNavigationTabs navigationTab, String leaderboardIdAsNameString, Boolean showRaceDetails, Boolean showSettings) {
super(PARAM_EVENTID, eventUuidAsString, PARAM_NAVIGATION_TAB, navigationTab.name(), PARAM_LEADERBOARD_NAME, leaderboardIdAsNameString,
PARAM_SHOW_RACE_DETAILS, String.valueOf(showRaceDetails), PARAM_SHOW_SETTINGS, String.valueOf(showSettings));
this.eventUuidAsString = eventUuidAsString;
this.navigationTab = navigationTab;
this.leaderboardIdAsNameString = leaderboardIdAsNameString;
this.showRaceDetails = showRaceDetails;
this.showSettings = showSettings;
}
public String getTitle(String eventName, String leaderboardName) {
return TextMessages.INSTANCE.sapSailing() + " - " + TextMessages.INSTANCE.leaderboard() + ": " + leaderboardName;
}
public String getEventUuidAsString() {
return eventUuidAsString;
}
public RegattaNavigationTabs getNavigationTab() {
return navigationTab;
}
public String getLeaderboardIdAsNameString() {
return leaderboardIdAsNameString;
}
@@ -47,15 +67,15 @@ public class LeaderboardPlace extends AbstractBasePlace {
return showSettings;
}
public static class Tokenizer implements PlaceTokenizer<LeaderboardPlace> {
public static class Tokenizer implements PlaceTokenizer<RegattaPlace> {
@Override
public String getToken(LeaderboardPlace place) {
public String getToken(RegattaPlace place) {
return place.getParametersAsToken();
}
@Override
public LeaderboardPlace getPlace(String url) {
return new LeaderboardPlace(url);
public RegattaPlace getPlace(String url) {
return new RegattaPlace(url);
}
}
}
@@ -0,0 +1,45 @@
package com.sap.sailing.gwt.home.client.place.regatta;
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.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.sap.sailing.domain.common.RaceIdentifier;
import com.sap.sailing.gwt.home.client.app.HomePlacesNavigator;
import com.sap.sailing.gwt.home.client.place.event.regattaanalytics.RegattaAnalytics;
import com.sap.sailing.gwt.home.client.place.regatta.RegattaPlace.RegattaNavigationTabs;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.leaderboard.LeaderboardSettings;
import com.sap.sailing.gwt.ui.shared.EventDTO;
import com.sap.sse.gwt.client.ErrorReporter;
import com.sap.sse.gwt.client.async.AsyncActionsExecutor;
import com.sap.sse.gwt.client.player.Timer;
import com.sap.sse.gwt.client.useragent.UserAgentDetails;
public class TabletAndDesktopRegattaView extends Composite implements RegattaAnalyticsView {
private static TabletAndDesktopRegattaViewUiBinder uiBinder = GWT.create(TabletAndDesktopRegattaViewUiBinder.class);
interface TabletAndDesktopRegattaViewUiBinder extends UiBinder<Widget, TabletAndDesktopRegattaView> {
}
@UiField(provided=true) RegattaAnalytics regattaAnalytics;
public TabletAndDesktopRegattaView(EventDTO event, String leaderboardName, RegattaNavigationTabs navigationTab, Timer timerForClientServerOffset, HomePlacesNavigator placeNavigator) {
regattaAnalytics = new RegattaAnalytics(event, leaderboardName, navigationTab, timerForClientServerOffset, placeNavigator);
initWidget(uiBinder.createAndBindUi(this));
regattaAnalytics.setVisible(false);
}
public void createRegattaAnalyticsViewer(final SailingServiceAsync sailingService, final AsyncActionsExecutor asyncActionsExecutor,
final Timer timer, final LeaderboardSettings leaderboardSettings, final RaceIdentifier preselectedRace,
final String leaderboardGroupName, String leaderboardName, final ErrorReporter errorReporter,
final UserAgentDetails userAgent, boolean showRaceDetails,
boolean autoExpandLastRaceColumn, boolean showOverallLeaderboard) {
regattaAnalytics.createRegattaAnalyticsViewer(sailingService, asyncActionsExecutor, timer, leaderboardSettings, preselectedRace,
leaderboardGroupName, leaderboardName, errorReporter, userAgent, showRaceDetails, autoExpandLastRaceColumn, showOverallLeaderboard);
regattaAnalytics.setVisible(true);
}
}
@@ -0,0 +1,10 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:s="urn:import:com.sap.sailing.gwt.home.client.place.event"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
<ui:with field="i18n" type="com.sap.sailing.gwt.common.client.i18n.TextMessages" />
<ui:with field="res" type="com.sap.sailing.gwt.common.client.SharedResources" />
<g:HTMLPanel>
<s:regattaanalytics.RegattaAnalytics ui:field='regattaAnalytics'/>
</g:HTMLPanel>
</ui:UiBinder>
@@ -42,6 +42,8 @@ public class SearchResultActivity extends AbstractActivity {
view = clientFactory.createSearchResultView();
panel.setWidget(view.asWidget());
Window.setTitle(searchResultPlace.getTitle());
doSearch(searchResultPlace.getSearchText());
}
@@ -2,6 +2,7 @@ package com.sap.sailing.gwt.home.client.place.searchresult;
import com.google.gwt.place.shared.Place;
import com.google.gwt.place.shared.PlaceTokenizer;
import com.sap.sailing.gwt.common.client.i18n.TextMessages;
public class SearchResultPlace extends Place {
private final String searchText;
@@ -11,6 +12,10 @@ public class SearchResultPlace extends Place {
this.searchText = searchText;
}
public String getTitle() {
return TextMessages.INSTANCE.sapSailing() + " - " + TextMessages.INSTANCE.search();
}
public String getSearchText() {
return searchText;
}
@@ -0,0 +1,237 @@
package com.sap.sailing.gwt.home.client.place.series;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
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.domain.common.DetailType;
import com.sap.sailing.domain.common.LeaderboardType;
import com.sap.sailing.domain.common.RaceIdentifier;
import com.sap.sailing.domain.common.RegattaNameAndRaceName;
import com.sap.sailing.gwt.common.client.i18n.TextMessages;
import com.sap.sailing.gwt.home.client.shared.placeholder.Placeholder;
import com.sap.sailing.gwt.ui.leaderboard.LeaderboardSettings;
import com.sap.sailing.gwt.ui.leaderboard.LeaderboardSettings.RaceColumnSelectionStrategies;
import com.sap.sailing.gwt.ui.leaderboard.LeaderboardSettingsFactory;
import com.sap.sailing.gwt.ui.leaderboard.LeaderboardUrlSettings;
import com.sap.sailing.gwt.ui.shared.EventDTO;
import com.sap.sse.common.Util;
import com.sap.sse.gwt.client.ErrorReporter;
import com.sap.sse.gwt.client.async.AsyncActionsExecutor;
import com.sap.sse.gwt.client.async.MarkedAsyncCallback;
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;
import com.sap.sse.gwt.client.player.Timer.PlayStates;
import com.sap.sse.gwt.client.useragent.UserAgentDetails;
import com.sap.sse.gwt.shared.GwtHttpRequestUtils;
public class SeriesActivity extends AbstractActivity implements ErrorReporter {
private final SeriesClientFactory clientFactory;
private final SeriesPlace seriesPlace;
private final Timer timerForClientServerOffset;
private final UserAgentDetails userAgent = new UserAgentDetails(Window.Navigator.getUserAgent());
public SeriesActivity(SeriesPlace place, SeriesClientFactory clientFactory) {
this.clientFactory = clientFactory;
this.seriesPlace = place;
timerForClientServerOffset = new Timer(PlayModes.Replay);
}
@Override
public void start(final AcceptsOneWidget panel, EventBus eventBus) {
panel.setWidget(new Placeholder());
UUID eventUUID = UUID.fromString(seriesPlace.getEventUuidAsString());
final String leaderboardName = seriesPlace.getLeaderboardIdAsNameString();
final boolean showRaceDetails = seriesPlace.getShowRaceDetails();
clientFactory.getSailingService().getEventById(eventUUID, true, new AsyncCallback<EventDTO>() {
@Override
public void onSuccess(final EventDTO event) {
if (leaderboardName != null) {
clientFactory.getSailingService().checkLeaderboardName(leaderboardName, new MarkedAsyncCallback<Util.Pair<String, LeaderboardType>>(
new AsyncCallback<Util.Pair<String, LeaderboardType>>() {
@Override
public void onSuccess(Util.Pair<String, LeaderboardType> leaderboardNameAndType) {
if(leaderboardNameAndType != null && leaderboardName.equals(leaderboardNameAndType.getA())) {
if(!leaderboardNameAndType.getB().isMetaLeaderboard()) {
createErrorView("Leaderboard is a not meta leaderboard.", null, panel);
} else {
createAnalyticsViewer(panel, event, leaderboardNameAndType.getA(), leaderboardNameAndType.getB(), showRaceDetails);
}
} else {
createErrorView(TextMessages.INSTANCE.errorMessageNoSuchLeaderboard(), null, panel);
}
}
@Override
public void onFailure(Throwable caught) {
createErrorView("Error while checking the leaderboard name with service checkLeaderboardName()", caught, panel);
}
}));
} else {
createErrorView(TextMessages.INSTANCE.errorMessageNoSuchLeaderboard(), null, panel);
}
}
@Override
public void onFailure(Throwable caught) {
createErrorView("Error while loading the event with service getEventById()", caught, panel);
}
});
}
private void createAnalyticsViewer(AcceptsOneWidget panel, EventDTO event, String leaderboardName, LeaderboardType leaderboardType, boolean showRaceDetails) {
String leaderboardDisplayName = Window.Location.getParameter("displayName");
if (leaderboardDisplayName == null || leaderboardDisplayName.isEmpty()) {
leaderboardDisplayName = leaderboardName;
}
long delayBetweenAutoAdvancesInMilliseconds = 3000l;
final RaceIdentifier preselectedRace = getPreselectedRace(Window.Location.getParameterMap());
// make a single live request as the default but don't continue to play by default
Timer timer = new Timer(PlayModes.Live, PlayStates.Paused, delayBetweenAutoAdvancesInMilliseconds);
final LeaderboardSettings leaderboardSettings = createLeaderboardSettingsFromURLParameters(Window.Location.getParameterMap());
if (leaderboardSettings.getDelayBetweenAutoAdvancesInMilliseconds() != null) {
timer.setPlayMode(PlayModes.Live); // the leaderboard, viewed via the entry point, goes "live" and "playing" if an auto-refresh
} // interval has been specified
boolean autoExpandLastRaceColumn = GwtHttpRequestUtils.getBooleanParameter(LeaderboardUrlSettings.PARAM_AUTO_EXPAND_LAST_RACE_COLUMN, false);
boolean showSeriesLeaderboards = GwtHttpRequestUtils.getBooleanParameter(LeaderboardUrlSettings.PARAM_SHOW_SERIES_LEADERBOARDS, false);
SeriesAnalyticsView analyticsView = clientFactory.createSeriesAnalyticsView(event, leaderboardName,
seriesPlace.getNavigationTab(), timerForClientServerOffset);
Window.setTitle(seriesPlace.getTitle(event.getName(), leaderboardDisplayName));
analyticsView.createSeriesAnalyticsViewer(clientFactory.getSailingService(), new AsyncActionsExecutor(),
timer, leaderboardSettings, null, preselectedRace, "leaderboardGroupName", leaderboardName, this,
userAgent, showRaceDetails, autoExpandLastRaceColumn, showSeriesLeaderboards);
panel.setWidget(analyticsView.asWidget());
}
/**
* Constructs {@link LeaderboardSettings} from the URL parameters found
*/
private LeaderboardSettings createLeaderboardSettingsFromURLParameters(Map<String, List<String>> parameterMap) {
LeaderboardSettings result;
Long refreshIntervalMillis = parameterMap.containsKey(LeaderboardUrlSettings.PARAM_REFRESH_INTERVAL_MILLIS) ? Long
.valueOf(parameterMap.get(LeaderboardUrlSettings.PARAM_REFRESH_INTERVAL_MILLIS).get(0)) : null;
RaceColumnSelectionStrategies raceColumnSelectionStrategy;
final Integer numberOfLastRacesToShow;
if (parameterMap.containsKey(LeaderboardUrlSettings.PARAM_NAME_LAST_N)) {
raceColumnSelectionStrategy = RaceColumnSelectionStrategies.LAST_N;
numberOfLastRacesToShow = Integer.valueOf(parameterMap.get(LeaderboardUrlSettings.PARAM_NAME_LAST_N).get(0));
} else if (isSmallWidth()) {
raceColumnSelectionStrategy = RaceColumnSelectionStrategies.LAST_N;
int width = Window.getClientWidth();
numberOfLastRacesToShow = (width-275)/40;
} else {
raceColumnSelectionStrategy = RaceColumnSelectionStrategies.EXPLICIT;
numberOfLastRacesToShow = null;
}
if (parameterMap.containsKey(LeaderboardUrlSettings.PARAM_RACE_NAME) || parameterMap.containsKey(LeaderboardUrlSettings.PARAM_RACE_DETAIL) ||
parameterMap.containsKey(LeaderboardUrlSettings.PARAM_LEG_DETAIL) || parameterMap.containsKey(LeaderboardUrlSettings.PARAM_MANEUVER_DETAIL) ||
parameterMap.containsKey(LeaderboardUrlSettings.PARAM_OVERALL_DETAIL) || parameterMap.containsKey(LeaderboardUrlSettings.PARAM_SHOW_ADDED_SCORES) ||
parameterMap.containsKey(LeaderboardUrlSettings.PARAM_SHOW_OVERALL_COLUMN_WITH_NUMBER_OF_RACES_COMPLETED)) {
List<DetailType> maneuverDetails = getDetailTypeListFromParamValue(parameterMap.get(LeaderboardUrlSettings.PARAM_MANEUVER_DETAIL));
List<DetailType> raceDetails = getDetailTypeListFromParamValue(parameterMap.get(LeaderboardUrlSettings.PARAM_RACE_DETAIL));
List<DetailType> overallDetails = getDetailTypeListFromParamValue(parameterMap.get(LeaderboardUrlSettings.PARAM_OVERALL_DETAIL));
List<DetailType> legDetails = getDetailTypeListFromParamValue(parameterMap.get(LeaderboardUrlSettings.PARAM_LEG_DETAIL));
List<String> namesOfRacesToShow = getStringListFromParamValue(parameterMap.get(LeaderboardUrlSettings.PARAM_RACE_NAME));
boolean showAddedScores = parameterMap.containsKey(LeaderboardUrlSettings.PARAM_SHOW_ADDED_SCORES) ?
Boolean.valueOf(parameterMap.get(LeaderboardUrlSettings.PARAM_SHOW_ADDED_SCORES).get(0)) : false;
boolean showOverallColumnWithNumberOfRacesSailedPerCompetitor = parameterMap.containsKey(LeaderboardUrlSettings.PARAM_SHOW_OVERALL_COLUMN_WITH_NUMBER_OF_RACES_COMPLETED) ?
Boolean.valueOf(parameterMap.get(LeaderboardUrlSettings.PARAM_SHOW_OVERALL_COLUMN_WITH_NUMBER_OF_RACES_COMPLETED).get(0)) : false;
boolean autoExpandPreSelectedRace = parameterMap.containsKey(LeaderboardUrlSettings.PARAM_AUTO_EXPAND_PRESELECTED_RACE) ?
Boolean.valueOf(parameterMap.get(LeaderboardUrlSettings.PARAM_AUTO_EXPAND_PRESELECTED_RACE).get(0)) :
(namesOfRacesToShow != null && namesOfRacesToShow.size() == 1);
result = new LeaderboardSettings(maneuverDetails, legDetails, raceDetails, overallDetails,
/* namesOfRaceColumnsToShow */ null,
namesOfRacesToShow, numberOfLastRacesToShow,
autoExpandPreSelectedRace, refreshIntervalMillis, /* sort by column */ (namesOfRacesToShow != null && !namesOfRacesToShow.isEmpty()) ?
namesOfRacesToShow.get(0) : null,
/* ascending */ true, /* updateUponPlayStateChange */ raceDetails.isEmpty() && legDetails.isEmpty(),
raceColumnSelectionStrategy, showAddedScores, showOverallColumnWithNumberOfRacesSailedPerCompetitor);
} else {
final List<DetailType> overallDetails = Collections.singletonList(DetailType.REGATTA_RANK);
result = LeaderboardSettingsFactory.getInstance().createNewDefaultSettings(null, null,
/* overallDetails */ overallDetails, null,
/* autoExpandFirstRace */false, refreshIntervalMillis, numberOfLastRacesToShow,
raceColumnSelectionStrategy);
}
return result;
}
private RaceIdentifier getPreselectedRace(Map<String, List<String>> parameterMap) {
RaceIdentifier result;
if (parameterMap.containsKey(LeaderboardUrlSettings.PARAM_RACE_NAME) && parameterMap.get(LeaderboardUrlSettings.PARAM_RACE_NAME).size() == 1 &&
parameterMap.containsKey(LeaderboardUrlSettings.PARAM_REGATTA_NAME) && parameterMap.get(LeaderboardUrlSettings.PARAM_REGATTA_NAME).size() == 1) {
result = new RegattaNameAndRaceName(parameterMap.get(LeaderboardUrlSettings.PARAM_REGATTA_NAME).get(0), parameterMap.get(LeaderboardUrlSettings.PARAM_RACE_NAME).get(0));
} else {
result = null;
}
return result;
}
private List<DetailType> getDetailTypeListFromParamValue(List<String> list) {
List<DetailType> result = new ArrayList<DetailType>();
if (list != null) {
for (String entry : list) {
try {
result.add(DetailType.valueOf(entry));
} catch (IllegalArgumentException e) {
}
}
}
return result;
}
private List<String> getStringListFromParamValue(List<String> list) {
List<String> result = new ArrayList<String>();
if (list != null) {
result.addAll(list);
}
return result;
}
private void createErrorView(String errorMessage, Throwable errorReason, AcceptsOneWidget panel) {
ErrorView view = clientFactory.createErrorView(errorMessage, errorReason);
panel.setWidget(view.asWidget());
}
public boolean isSmallWidth() {
int width = Window.getClientWidth();
return width <= 720;
}
@Override
public void reportError(String message) {
Window.alert(message);
}
@Override
public void reportError(String message, boolean silentMode) {
if (silentMode) {
Window.setStatus(message);
} else {
reportError(message);
}
}
@Override
public void reportPersistentInformation(String message) {
Window.setStatus(message);
}
}
@@ -0,0 +1,25 @@
package com.sap.sailing.gwt.home.client.place.series;
import com.google.gwt.core.client.GWT;
import com.sap.sse.gwt.client.mvp.AbstractActivityProxy;
public class SeriesActivityProxy extends AbstractActivityProxy {
private final SeriesClientFactory clientFactory;
private final SeriesPlace place;
public SeriesActivityProxy(SeriesPlace place, SeriesClientFactory clientFactory) {
this.place = place;
this.clientFactory = clientFactory;
}
@Override
protected void startAsync() {
GWT.runAsync(new AbstractRunAsyncCallback() {
@Override
public void onSuccess() {
super.onSuccess(new SeriesActivity(place, clientFactory));
}
});
}
}
@@ -0,0 +1,20 @@
package com.sap.sailing.gwt.home.client.place.series;
import com.google.gwt.user.client.ui.Widget;
import com.sap.sailing.domain.common.RaceIdentifier;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.leaderboard.LeaderboardSettings;
import com.sap.sse.gwt.client.ErrorReporter;
import com.sap.sse.gwt.client.async.AsyncActionsExecutor;
import com.sap.sse.gwt.client.player.Timer;
import com.sap.sse.gwt.client.useragent.UserAgentDetails;
public interface SeriesAnalyticsView {
Widget asWidget();
void createSeriesAnalyticsViewer(SailingServiceAsync sailingService, AsyncActionsExecutor asyncActionsExecutor,
Timer timer, LeaderboardSettings leaderboardSettings, String preselectedLeaderboardName, RaceIdentifier preselectedRace,
String leaderboardGroupName, String metaLeaderboardName, ErrorReporter errorReporter,
UserAgentDetails userAgent, boolean showRaceDetails,
boolean autoExpandLastRaceColumn, boolean showSeriesLeaderboards);
}
@@ -0,0 +1,10 @@
package com.sap.sailing.gwt.home.client.place.series;
import com.sap.sailing.gwt.home.client.place.series.SeriesPlace.SeriesNavigationTabs;
import com.sap.sailing.gwt.ui.client.SailingClientFactory;
import com.sap.sailing.gwt.ui.shared.EventDTO;
import com.sap.sse.gwt.client.player.Timer;
public interface SeriesClientFactory extends SailingClientFactory {
SeriesAnalyticsView createSeriesAnalyticsView(EventDTO event, String leaderboardName, SeriesNavigationTabs navigationTab, Timer timerForClientServerOffset);
}
@@ -0,0 +1,81 @@
package com.sap.sailing.gwt.home.client.place.series;
import com.google.gwt.place.shared.PlaceTokenizer;
import com.sap.sailing.gwt.common.client.AbstractBasePlace;
import com.sap.sailing.gwt.common.client.i18n.TextMessages;
public class SeriesPlace extends AbstractBasePlace {
private final String eventUuidAsString;
private final String leaderboardIdAsNameString;
private final Boolean showRaceDetails;
private final Boolean showSettings;
private final SeriesNavigationTabs navigationTab;
private final static String PARAM_EVENTID = "eventId";
private final static String PARAM_LEADERBOARD_NAME = "leaderboardName";
private final static String PARAM_SHOW_RACE_DETAILS = "showRaceDetails";
private final static String PARAM_SHOW_SETTINGS = "showSettings";
private final static String PARAM_NAVIGATION_TAB = "navigationTab";
public enum SeriesNavigationTabs { OverallLeaderboard, RegattaLeaderboards, CompetitorAnalytics };
public SeriesPlace(String url) {
super(url);
eventUuidAsString = getParameter(PARAM_EVENTID);
leaderboardIdAsNameString = getParameter(PARAM_LEADERBOARD_NAME);
showRaceDetails = Boolean.valueOf(getParameter(PARAM_SHOW_RACE_DETAILS));
showSettings = Boolean.valueOf(getParameter(PARAM_SHOW_SETTINGS));
String paramNavTab = getParameter(PARAM_NAVIGATION_TAB);
if(paramNavTab != null) {
navigationTab = SeriesNavigationTabs.valueOf(paramNavTab);
} else {
navigationTab = SeriesNavigationTabs.OverallLeaderboard;
}
}
public SeriesPlace(String eventUuidAsString, SeriesNavigationTabs navigationTab, String leaderboardIdAsNameString, Boolean showRaceDetails, Boolean showSettings) {
super(PARAM_EVENTID, eventUuidAsString, PARAM_NAVIGATION_TAB, navigationTab.name(), PARAM_LEADERBOARD_NAME, leaderboardIdAsNameString,
PARAM_SHOW_RACE_DETAILS, String.valueOf(showRaceDetails), PARAM_SHOW_SETTINGS, String.valueOf(showSettings));
this.eventUuidAsString = eventUuidAsString;
this.navigationTab = navigationTab;
this.leaderboardIdAsNameString = leaderboardIdAsNameString;
this.showRaceDetails = showRaceDetails;
this.showSettings = showSettings;
}
public String getTitle(String eventName, String leaderboardName) {
return TextMessages.INSTANCE.sapSailing() + " - " + TextMessages.INSTANCE.leaderboard() + ": " + leaderboardName;
}
public String getEventUuidAsString() {
return eventUuidAsString;
}
public SeriesNavigationTabs getNavigationTab() {
return navigationTab;
}
public String getLeaderboardIdAsNameString() {
return leaderboardIdAsNameString;
}
public Boolean getShowRaceDetails() {
return showRaceDetails;
}
public Boolean getShowSettings() {
return showSettings;
}
public static class Tokenizer implements PlaceTokenizer<SeriesPlace> {
@Override
public String getToken(SeriesPlace place) {
return place.getParametersAsToken();
}
@Override
public SeriesPlace getPlace(String url) {
return new SeriesPlace(url);
}
}
}
@@ -1,4 +1,4 @@
package com.sap.sailing.gwt.home.client.place.leaderboard;
package com.sap.sailing.gwt.home.client.place.series;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
@@ -7,8 +7,8 @@ import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.sap.sailing.domain.common.RaceIdentifier;
import com.sap.sailing.gwt.home.client.app.HomePlacesNavigator;
import com.sap.sailing.gwt.home.client.place.event.regattaanalytics.RegattaAnalytics;
import com.sap.sailing.gwt.home.client.place.event.seriesanalytics.EventSeriesAnalytics;
import com.sap.sailing.gwt.home.client.place.series.SeriesPlace.SeriesNavigationTabs;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.leaderboard.LeaderboardSettings;
import com.sap.sailing.gwt.ui.shared.EventDTO;
@@ -17,35 +17,22 @@ import com.sap.sse.gwt.client.async.AsyncActionsExecutor;
import com.sap.sse.gwt.client.player.Timer;
import com.sap.sse.gwt.client.useragent.UserAgentDetails;
public class TabletAndDesktopLeaderboardView extends Composite implements AnalyticsView {
private static LeaderboardPageViewUiBinder uiBinder = GWT.create(LeaderboardPageViewUiBinder.class);
public class TabletAndDesktopSeriesView extends Composite implements SeriesAnalyticsView {
private static TabletAndDesktopSeriesViewUiBinder uiBinder = GWT.create(TabletAndDesktopSeriesViewUiBinder.class);
interface LeaderboardPageViewUiBinder extends UiBinder<Widget, TabletAndDesktopLeaderboardView> {
interface TabletAndDesktopSeriesViewUiBinder extends UiBinder<Widget, TabletAndDesktopSeriesView> {
}
@UiField(provided=true) RegattaAnalytics regattaAnalytics;
@UiField(provided=true) EventSeriesAnalytics seriesAnalytics;
public TabletAndDesktopLeaderboardView(EventDTO event, String leaderboardName, Timer timerForClientServerOffset, HomePlacesNavigator placeNavigator) {
regattaAnalytics = new RegattaAnalytics(event, leaderboardName, timerForClientServerOffset, placeNavigator);
seriesAnalytics = new EventSeriesAnalytics(event, leaderboardName, timerForClientServerOffset, placeNavigator);
regattaAnalytics.setVisible(false);
seriesAnalytics.setVisible(false);
public TabletAndDesktopSeriesView(EventDTO event, String leaderboardName, SeriesNavigationTabs navigationTab, Timer timerForClientServerOffset, HomePlacesNavigator placeNavigator) {
seriesAnalytics = new EventSeriesAnalytics(event, leaderboardName, navigationTab, timerForClientServerOffset, placeNavigator);
initWidget(uiBinder.createAndBindUi(this));
seriesAnalytics.setVisible(false);
}
public void createRegattaAnalyticsViewer(final SailingServiceAsync sailingService, final AsyncActionsExecutor asyncActionsExecutor,
final Timer timer, final LeaderboardSettings leaderboardSettings, final RaceIdentifier preselectedRace,
final String leaderboardGroupName, String leaderboardName, final ErrorReporter errorReporter,
final UserAgentDetails userAgent, boolean showRaceDetails,
boolean autoExpandLastRaceColumn, boolean showOverallLeaderboard) {
regattaAnalytics.createRegattaAnalyticsViewer(sailingService, asyncActionsExecutor, timer, leaderboardSettings, preselectedRace,
leaderboardGroupName, leaderboardName, errorReporter, userAgent, showRaceDetails, autoExpandLastRaceColumn, showOverallLeaderboard);
regattaAnalytics.setVisible(true);
}
public void createSeriesAnalyticsViewer(SailingServiceAsync sailingService, AsyncActionsExecutor asyncActionsExecutor,
Timer timer, LeaderboardSettings leaderboardSettings, String preselectedLeaderboardName, RaceIdentifier preselectedRace,
String leaderboardGroupName, String metaLeaderboardName, ErrorReporter errorReporter,
@@ -5,7 +5,6 @@
<ui:with field="i18n" type="com.sap.sailing.gwt.common.client.i18n.TextMessages" />
<ui:with field="res" type="com.sap.sailing.gwt.common.client.SharedResources" />
<g:HTMLPanel>
<s:regattaanalytics.RegattaAnalytics ui:field='regattaAnalytics'/>
<s:seriesanalytics.EventSeriesAnalytics ui:field='seriesAnalytics'/>
</g:HTMLPanel>
</ui:UiBinder>
@@ -2,16 +2,24 @@ package com.sap.sailing.gwt.home.client.place.solutions;
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.common.client.i18n.TextMessages;
public class SolutionsActivity extends AbstractActivity {
private final SolutionsPlace solutionsPlace;
private final SolutionsClientFactory clientFactory;
public SolutionsActivity(SolutionsPlace place, SolutionsClientFactory clientFactory) {
this.solutionsPlace = place;
this.clientFactory = clientFactory;
}
@Override
public void start(AcceptsOneWidget panel, EventBus eventBus) {
panel.setWidget(new TabletAndDesktopSolutionsView());
SolutionsView solutionsView = clientFactory.createSolutionsView(solutionsPlace.getNavigationTab());
panel.setWidget(solutionsView.asWidget());
Window.setTitle(TextMessages.INSTANCE.sapSailing() + " - " + TextMessages.INSTANCE.solutions());
}
}
@@ -1,7 +1,8 @@
package com.sap.sailing.gwt.home.client.place.solutions;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsPlace.SolutionsNavigationTabs;
import com.sap.sailing.gwt.ui.client.SailingClientFactory;
public interface SolutionsClientFactory extends SailingClientFactory {
SolutionsView createSolutionsView(SolutionsActivity activity);
SolutionsView createSolutionsView(SolutionsNavigationTabs navigationTab);
}
@@ -1,18 +1,39 @@
package com.sap.sailing.gwt.home.client.place.solutions;
import com.google.gwt.place.shared.Place;
import com.google.gwt.place.shared.PlaceTokenizer;
import com.sap.sailing.gwt.common.client.AbstractBasePlace;
public class SolutionsPlace extends AbstractBasePlace {
public enum SolutionsNavigationTabs { SailingAnalytics, RaceCommiteeApp, PostRaceAnalytics, TrainingDiary, SailingSimulator };
private final SolutionsNavigationTabs navigationTab;
private final static String PARAM_NAVIGATION_TAB = "navigationTab";
public SolutionsPlace(String url) {
super(url);
String paramNavTab = getParameter(PARAM_NAVIGATION_TAB);
navigationTab = paramNavTab != null ? SolutionsNavigationTabs.valueOf(paramNavTab) : null;
}
public SolutionsPlace(SolutionsNavigationTabs navigationTab) {
super(PARAM_NAVIGATION_TAB, navigationTab.name());
this.navigationTab = navigationTab;
}
public SolutionsNavigationTabs getNavigationTab() {
return navigationTab;
}
public class SolutionsPlace extends Place {
public static class Tokenizer implements PlaceTokenizer<SolutionsPlace> {
@Override
public String getToken(SolutionsPlace place) {
return null;
return place.getParametersAsToken();
}
@Override
public SolutionsPlace getPlace(String token) {
return new SolutionsPlace();
public SolutionsPlace getPlace(String url) {
return new SolutionsPlace(url);
}
}
}
@@ -5,18 +5,22 @@ import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.sap.sailing.gwt.home.client.app.HomePlacesNavigator;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsPlace.SolutionsNavigationTabs;
import com.sap.sailing.gwt.home.client.shared.solutions.Solutions;
public class TabletAndDesktopSolutionsView extends Composite implements SolutionsView {
private static SolutionsPageViewUiBinder uiBinder = GWT.create(SolutionsPageViewUiBinder.class);
@UiField Solutions solutions;
@UiField(provided=true) Solutions solutions;
interface SolutionsPageViewUiBinder extends UiBinder<Widget, TabletAndDesktopSolutionsView> {
}
public TabletAndDesktopSolutionsView() {
public TabletAndDesktopSolutionsView(SolutionsNavigationTabs navigationTab, HomePlacesNavigator placesNavigator) {
super();
solutions = new Solutions(navigationTab, placesNavigator);
initWidget(uiBinder.createAndBindUi(this));
}
}
@@ -3,5 +3,5 @@ package com.sap.sailing.gwt.home.client.place.sponsoring;
import com.sap.sailing.gwt.ui.client.SailingClientFactory;
public interface SponsoringClientFactory extends SailingClientFactory {
SponsoringView createSponsoringView(SponsoringActivity activity);
SponsoringView createSponsoringView();
}
@@ -10,6 +10,7 @@ import com.google.gwt.activity.shared.AbstractActivity;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
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.common.client.DateUtil;
@@ -20,9 +21,11 @@ import com.sap.sse.common.Util.Pair;
public class StartActivity extends AbstractActivity {
private final StartClientFactory clientFactory;
private final StartPlace place;
public StartActivity(StartPlace place, StartClientFactory clientFactory) {
this.clientFactory = clientFactory;
this.place = place;
}
@Override
@@ -33,6 +36,7 @@ public class StartActivity extends AbstractActivity {
public void onSuccess(List<EventBaseDTO> result) {
final StartView view = clientFactory.createStartView();
panel.setWidget(view.asWidget());
Window.setTitle(place.getTitle());
fillStartPageEvents(view, result);
}
@@ -2,8 +2,13 @@ package com.sap.sailing.gwt.home.client.place.start;
import com.google.gwt.place.shared.Place;
import com.google.gwt.place.shared.PlaceTokenizer;
import com.sap.sailing.gwt.common.client.i18n.TextMessages;
public class StartPlace extends Place {
public String getTitle() {
return TextMessages.INSTANCE.sapSailing();
}
public static class Tokenizer implements PlaceTokenizer<StartPlace> {
@Override
public String getToken(StartPlace place) {
@@ -4,7 +4,6 @@ import java.util.Arrays;
import java.util.List;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.AnchorElement;
import com.google.gwt.dom.client.StyleInjector;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.KeyCodes;
@@ -13,30 +12,34 @@ import com.google.gwt.event.dom.client.KeyPressHandler;
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.Event;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.impl.HyperlinkImpl;
import com.sap.sailing.gwt.common.client.i18n.TextMessages;
import com.sap.sailing.gwt.home.client.app.HomePlacesNavigator;
import com.sap.sailing.gwt.home.client.app.PlaceNavigation;
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;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsPlace.SolutionsNavigationTabs;
import com.sap.sailing.gwt.home.client.place.start.StartPlace;
public class Header extends Composite {
@UiField Anchor startPageLink;
@UiField Anchor eventsPageLink;
@UiField Anchor solutionsPageLink;
@UiField AnchorElement homeLink;
// @UiField Anchor sponsoringPageLink;
@UiField TextBox searchText;
@UiField Button searchButton;
private static final HyperlinkImpl HYPERLINK_IMPL = GWT.create(HyperlinkImpl.class);
private final List<Anchor> links;
private final HomePlacesNavigator navigator;
@@ -60,7 +63,7 @@ public class Header extends Composite {
homeNavigation = navigator.getHomeNavigation();
eventsNavigation = navigator.getEventsNavigation();
solutionsNavigation = navigator.getSolutionsNavigation();
solutionsNavigation = navigator.getSolutionsNavigation(SolutionsNavigationTabs.SailingAnalytics);
startPageLink.setHref(homeNavigation.getTargetUrl());
eventsPageLink.setHref(eventsNavigation.getTargetUrl());
@@ -75,46 +78,26 @@ public class Header extends Composite {
}
}
});
// Event.sinkEvents(homeLink, Event.ONCLICK);
// Event.setEventListener(homeLink, new EventListener() {
// @Override
// public void onBrowserEvent(Event event) {
// switch (DOM.eventGetType(event)) {
// case Event.ONCLICK:
// navigator.goToHome();
// break;
// }
// }
// });
}
@UiHandler("startPageLink")
public void goToHome(ClickEvent e) {
navigator.goToPlace(homeNavigation);
e.preventDefault();
setActiveLink(startPageLink);
handleClickEvent(e, homeNavigation, startPageLink);
}
@UiHandler("eventsPageLink")
public void goToEvents(ClickEvent e) {
navigator.goToPlace(eventsNavigation);
e.preventDefault();
setActiveLink(eventsPageLink);
handleClickEvent(e, eventsNavigation, eventsPageLink);
}
@UiHandler("solutionsPageLink")
public void goToSolutions(ClickEvent e) {
navigator.goToPlace(solutionsNavigation);
e.preventDefault();
setActiveLink(solutionsPageLink);
handleClickEvent(e, solutionsNavigation, solutionsPageLink);
}
// @UiHandler("sponsoringPageLink")
// public void goToSponsoring(ClickEvent e) {
// navigator.goToPlace(sponsoringNavigation);
// e.preventDefault();
// setActiveLink(sponsoringPageLink);
// handleClickEvent(e, sponsoringNavigation, sponsoringPageLink);
// }
@UiHandler("searchButton")
@@ -138,4 +121,11 @@ public class Header extends Composite {
}
}
private void handleClickEvent(ClickEvent e, PlaceNavigation<?> placeNavigation, Anchor activeLink) {
if (HYPERLINK_IMPL.handleAsClick((Event) e.getNativeEvent())) {
navigator.goToPlace(placeNavigation);
e.preventDefault();
setActiveLink(activeLink);
}
}
}
@@ -9,7 +9,7 @@
<header class="{local_res.css.siteheader}">
<div class="{res.mainCss.grid}">
<div class="{res.mediaCss.small2} {res.mediaCss.large3} {res.mediaCss.columns}">
<a ui:field="homeLink" href="javascript:;">
<a href="http://sapsponsorships.com">
<g:Image resource="{local_res.logo}" pixelSize="80, 40" altText="SAP Sailing Analytics" styleName="{local_res.css.logo}"/>
</a>
<p class="{local_res.css.logotitle}">Sailing Analytics</p>
@@ -11,6 +11,7 @@ import com.google.gwt.user.client.ui.Widget;
import com.sap.sailing.gwt.home.client.app.HomePlacesNavigator;
import com.sap.sailing.gwt.home.client.app.PlaceNavigation;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsPlace;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsPlace.SolutionsNavigationTabs;
import com.sap.sailing.gwt.home.client.place.sponsoring.SponsoringPlace;
public class MainSponsors extends Composite {
@@ -34,7 +35,7 @@ public class MainSponsors extends Composite {
MainSponsorsResources.INSTANCE.css().ensureInjected();
initWidget(uiBinder.createAndBindUi(this));
solutionsNavigation = navigator.getSolutionsNavigation();
solutionsNavigation = navigator.getSolutionsNavigation(SolutionsNavigationTabs.SailingAnalytics);
sponsoringNavigation = navigator.getSponsoringNavigation();
solutionsPageLink.setHref(solutionsNavigation.getTargetUrl());
@@ -1,17 +1,33 @@
package com.sap.sailing.gwt.home.client.shared.solutions;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.dom.client.DivElement;
import com.google.gwt.dom.client.StyleInjector;
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.Event;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.impl.HyperlinkImpl;
import com.sap.sailing.gwt.home.client.app.HomePlacesNavigator;
import com.sap.sailing.gwt.home.client.app.PlaceNavigation;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsPlace;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsPlace.SolutionsNavigationTabs;
public class Solutions extends Composite {
interface SolutionsUiBinder extends UiBinder<Widget, Solutions> {
}
private static SolutionsUiBinder uiBinder = GWT.create(SolutionsUiBinder.class);
private static final HyperlinkImpl HYPERLINK_IMPL = GWT.create(HyperlinkImpl.class);
@UiField Anchor sailingAnalyticsAnchor;
@UiField Anchor raceAnchor;
@@ -25,41 +41,100 @@ public class Solutions extends Composite {
@UiField DivElement trainingDiaryDiv;
@UiField DivElement simulatorDiv;
interface SolutionsUiBinder extends UiBinder<Widget, Solutions> {
}
private final PlaceNavigation<SolutionsPlace> sailingAnalyticsNavigation;
private final PlaceNavigation<SolutionsPlace> raceCommitteeAppNavigation;
private final PlaceNavigation<SolutionsPlace> postRaceAnalyticsNavigation;
private final PlaceNavigation<SolutionsPlace> trainingDiaryNavigation;
private final PlaceNavigation<SolutionsPlace> sailingSimulatorNavigation;
private static SolutionsUiBinder uiBinder = GWT.create(SolutionsUiBinder.class);
public Solutions() {
private final SolutionsNavigationTabs navigationTab;
public Solutions(SolutionsNavigationTabs navigationTab, HomePlacesNavigator placesNavigator) {
this.navigationTab = navigationTab;
SolutionsResources.INSTANCE.css().ensureInjected();
StyleInjector.injectAtEnd("@media (min-width: 25em) { "+SolutionsResources.INSTANCE.mediumCss().getText()+"}");
StyleInjector.injectAtEnd("@media (min-width: 50em) { "+SolutionsResources.INSTANCE.largeCss().getText()+"}");
initWidget(uiBinder.createAndBindUi(this));
sailingAnalyticsNavigation = placesNavigator.getSolutionsNavigation(SolutionsNavigationTabs.SailingAnalytics);
raceCommitteeAppNavigation = placesNavigator.getSolutionsNavigation(SolutionsNavigationTabs.RaceCommiteeApp);
postRaceAnalyticsNavigation = placesNavigator.getSolutionsNavigation(SolutionsNavigationTabs.PostRaceAnalytics);
trainingDiaryNavigation = placesNavigator.getSolutionsNavigation(SolutionsNavigationTabs.TrainingDiary);
sailingSimulatorNavigation = placesNavigator.getSolutionsNavigation(SolutionsNavigationTabs.SailingSimulator);
sailingAnalyticsAnchor.setHref(sailingAnalyticsNavigation.getTargetUrl());
raceAnchor.setHref(raceCommitteeAppNavigation.getTargetUrl());
postRaceAnchor.setHref(postRaceAnalyticsNavigation.getTargetUrl());
trainingDiaryAnchor.setHref(trainingDiaryNavigation.getTargetUrl());
simulatorAnchor.setHref(sailingSimulatorNavigation.getTargetUrl());
}
@Override
protected void onLoad() {
Scheduler.get().scheduleDeferred(new Command() {
public void execute() {
scrollToView(navigationTab);
}
});
}
@UiHandler("sailingAnalyticsAnchor")
public void scrollToSailingAnalytics(ClickEvent e) {
sailingAnalyticsDiv.scrollIntoView();
scrollToView(SolutionsNavigationTabs.SailingAnalytics);
handleClickEvent(e, sailingAnalyticsNavigation);
}
@UiHandler("raceAnchor")
public void scrollToRace(ClickEvent e) {
raceDiv.scrollIntoView();
scrollToView(SolutionsNavigationTabs.RaceCommiteeApp);
handleClickEvent(e, raceCommitteeAppNavigation);
}
@UiHandler("postRaceAnchor")
public void scrollToPostRace(ClickEvent e) {
postRaceDiv.scrollIntoView();
scrollToView(SolutionsNavigationTabs.PostRaceAnalytics);
handleClickEvent(e, postRaceAnalyticsNavigation);
}
@UiHandler("trainingDiaryAnchor")
public void scrollToTrainingDiary(ClickEvent e) {
trainingDiaryDiv.scrollIntoView();
scrollToView(SolutionsNavigationTabs.TrainingDiary);
handleClickEvent(e, trainingDiaryNavigation);
}
@UiHandler("simulatorAnchor")
public void scrollToSimulator(ClickEvent e) {
simulatorDiv.scrollIntoView();
scrollToView(SolutionsNavigationTabs.SailingSimulator);
handleClickEvent(e, sailingSimulatorNavigation);
}
private void scrollToView(SolutionsNavigationTabs navigationTab) {
switch (navigationTab) {
case SailingAnalytics:
Window.scrollTo(0, 0);
break;
case RaceCommiteeApp:
raceDiv.scrollIntoView();
break;
case PostRaceAnalytics:
postRaceDiv.scrollIntoView();
break;
case TrainingDiary:
trainingDiaryDiv.scrollIntoView();
break;
case SailingSimulator:
simulatorDiv.scrollIntoView();
break;
}
}
private void handleClickEvent(ClickEvent e, PlaceNavigation<?> placeNavigation) {
if (HYPERLINK_IMPL.handleAsClick((Event) e.getNativeEvent())) {
// don't use the placecontroller for navigation here as we want to avoid a page reload
History.newItem(placeNavigation.getHistoryUrl(), false);
e.preventDefault();
}
}
}
@@ -12,11 +12,11 @@
<div class="{local_res.css.solutions_nav}">
<div class="{res.mainCss.grid} {local_res.css.gridalternator}">
<div class="{res.mediaCss.small12} {res.mediaCss.columns}">
<g:Anchor ui:field="sailingAnalyticsAnchor" href="javascript:;" styleName="{local_res.css.solutions_nav_link}"><ui:text from='{i18n.solutionsSAPHeadline}'/></g:Anchor>
<g:Anchor ui:field="raceAnchor" href="javascript:;" styleName="{local_res.css.solutions_nav_link}"><ui:text from='{i18n.solutionsRaceHeadline}'/></g:Anchor>
<g:Anchor ui:field="postRaceAnchor" href="javascript:;" styleName="{local_res.css.solutions_nav_link}"><ui:text from='{i18n.solutionsPostHeadline}'/></g:Anchor>
<g:Anchor ui:field="trainingDiaryAnchor" href="javascript:;" styleName="{local_res.css.solutions_nav_link}"><ui:text from='{i18n.solutionsTrainingHeadline}'/></g:Anchor>
<g:Anchor ui:field="simulatorAnchor" href="javascript:;" styleName="{local_res.css.solutions_nav_link}" ><ui:text from='{i18n.solutionsSimulatorHeadline}'/></g:Anchor>
<g:Anchor ui:field="sailingAnalyticsAnchor" styleName="{local_res.css.solutions_nav_link}"><ui:text from='{i18n.solutionsSAPHeadline}'/></g:Anchor>
<g:Anchor ui:field="raceAnchor" styleName="{local_res.css.solutions_nav_link}"><ui:text from='{i18n.solutionsRaceHeadline}'/></g:Anchor>
<g:Anchor ui:field="postRaceAnchor" styleName="{local_res.css.solutions_nav_link}"><ui:text from='{i18n.solutionsPostHeadline}'/></g:Anchor>
<g:Anchor ui:field="trainingDiaryAnchor" styleName="{local_res.css.solutions_nav_link}"><ui:text from='{i18n.solutionsTrainingHeadline}'/></g:Anchor>
<g:Anchor ui:field="simulatorAnchor" styleName="{local_res.css.solutions_nav_link}" ><ui:text from='{i18n.solutionsSimulatorHeadline}'/></g:Anchor>
</div>
</div>
</div>
@@ -7,6 +7,7 @@
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<inherits name="com.google.gwt.http.HTTP"/>
<stylesheet src="../LeaderboardNewHome.css" />
+4
View File
@@ -10,6 +10,10 @@
<version>1.0.0-SNAPSHOT</version>
</parent>
<properties>
<gwt.version>2.6.1</gwt.version>
</properties>
<artifactId>root</artifactId>
<packaging>pom</packaging>