Merge branch 'design2015' of ssh://sapsailing.com/home/trac/git into design2015

# By Steffen Schaefer
# Via Steffen Schaefer
* 'design2015' of ssh://sapsailing.com/home/trac/git:
  Animation fix
  Implemented redirects for cases where the given regatta ID is invalid
  Added TODOs
  Added TODOs for place redirect improvements
  Implemented redirect for EventSeriesRegattaLeaderboardPlace
  Implemented redirects for places that are invalid for specific events
  Improved redirect for new Places from old ones
  Event/Series analytics and leaderboard tabs can now be hidden
  Fixed data-labeltype in css
  Fixed field naming
  EventsOverview improvements
  Initial implementation of regatta leaderboards for fakeseries

Conflicts:
	java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/client/place/event2/EventActivityProxy.java
This commit is contained in:
Papick Garcia Taboada committed 2015-03-17 10:12:34 +01:00
commit 8fc87cfd66
23 files changed
+418 -139

No files matched your search

@@ -14,9 +14,11 @@ import com.sap.sailing.gwt.home.client.place.event2.AbstractEventPlace;
import com.sap.sailing.gwt.home.client.place.event2.EventActivityProxy;
import com.sap.sailing.gwt.home.client.place.event2.EventContext;
import com.sap.sailing.gwt.home.client.place.event2.EventDefaultPlace;
import com.sap.sailing.gwt.home.client.place.event2.multiregatta.tabs.MultiregattaMediaPlace;
import com.sap.sailing.gwt.home.client.place.event2.multiregatta.tabs.MultiregattaRegattasPlace;
import com.sap.sailing.gwt.home.client.place.event2.regatta.tabs.RegattaCompetitorAnalyticsPlace;
import com.sap.sailing.gwt.home.client.place.event2.regatta.tabs.RegattaLeaderboardPlace;
import com.sap.sailing.gwt.home.client.place.event2.regatta.tabs.RegattaMediaPlace;
import com.sap.sailing.gwt.home.client.place.event2.regatta.tabs.RegattaRacesPlace;
import com.sap.sailing.gwt.home.client.place.events.EventsActivityProxy;
import com.sap.sailing.gwt.home.client.place.events.EventsPlace;
@@ -25,6 +27,7 @@ import com.sap.sailing.gwt.home.client.place.fakeseries.SeriesContext;
import com.sap.sailing.gwt.home.client.place.fakeseries.SeriesDefaultPlace;
import com.sap.sailing.gwt.home.client.place.fakeseries.tabs.EventSeriesCompetitorAnalyticsPlace;
import com.sap.sailing.gwt.home.client.place.fakeseries.tabs.EventSeriesLeaderboardPlace;
import com.sap.sailing.gwt.home.client.place.fakeseries.tabs.EventSeriesRegattaLeaderboardPlace;
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;
@@ -96,6 +99,9 @@ public class ApplicationActivityMapper implements ActivityMapper {
EventContext eventContext = new EventContext().withId(eventId);
String regattaId = place.getLeaderboardIdAsNameString();
boolean hasRegattaId = (regattaId != null && !regattaId.isEmpty());
// TODO evaluate additional parameters
if(hasRegattaId) {
switch (place.getNavigationTab()) {
case CompetitorAnalytics:
@@ -122,17 +128,21 @@ public class ApplicationActivityMapper implements ActivityMapper {
switch (place.getNavigationTab()) {
// TODO some places aren't implemented yet
case Media:
return new RegattaMediaPlace(eventContext);
case Overview:
// Overview not implemented yet -> using regatta list
case Regatta:
return new RegattaRacesPlace(eventContext);
}
} else {
switch (place.getNavigationTab()) {
// TODO some places aren't implemented yet
case Media:
// Media not implemented yet -> using regatta list
return new MultiregattaMediaPlace(eventContext);
case Overview:
// Overview not implemented yet -> using regatta list
// Overview not implemented yet -> using race list
case Schedule:
// Schedule not implemented yet -> using race list
case Regattas:
return new MultiregattaRegattasPlace(eventContext);
}
@@ -151,8 +161,7 @@ public class ApplicationActivityMapper implements ActivityMapper {
case OverallLeaderboard:
return new EventSeriesLeaderboardPlace(context);
case RegattaLeaderboards:
// TODO regatta Leaderboards aren't ported over yet
return new EventSeriesLeaderboardPlace(context);
return new EventSeriesRegattaLeaderboardPlace(context);
case CompetitorAnalytics:
return new EventSeriesCompetitorAnalyticsPlace(context);
}
@@ -16,6 +16,7 @@ import com.sap.sailing.gwt.home.client.place.events.EventsPlace;
import com.sap.sailing.gwt.home.client.place.fakeseries.SeriesDefaultPlace;
import com.sap.sailing.gwt.home.client.place.fakeseries.tabs.EventSeriesCompetitorAnalyticsPlace;
import com.sap.sailing.gwt.home.client.place.fakeseries.tabs.EventSeriesLeaderboardPlace;
import com.sap.sailing.gwt.home.client.place.fakeseries.tabs.EventSeriesRegattaLeaderboardPlace;
import com.sap.sailing.gwt.home.client.place.fakeseries.tabs.SeriesEventsPlace;
import com.sap.sailing.gwt.home.client.place.fakeseries.tabs.SeriesMediaPlace;
import com.sap.sailing.gwt.home.client.place.regatta.RegattaPlace;
@@ -47,6 +48,7 @@ import com.sap.sailing.gwt.home.client.place.whatsnew.WhatsNewPlace;
SeriesEventsPlace.Tokenizer.class,
EventSeriesCompetitorAnalyticsPlace.Tokenizer.class,
EventSeriesLeaderboardPlace.Tokenizer.class,
EventSeriesRegattaLeaderboardPlace.Tokenizer.class,
SeriesMediaPlace.Tokenizer.class
})
@@ -93,6 +93,7 @@ public class HomePlacesNavigator extends AbstractPlaceNavigator {
return createPlaceNavigation(baseUrl, isOnRemoteServer, regattaPlace, new RegattaLeaderboardPlace.Tokenizer());
}
// TODO replace with the new places / remove when the code that calls this is gone
/** 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);
@@ -9,9 +9,11 @@ import com.sap.sailing.gwt.home.client.place.error.ErrorPlace;
import com.sap.sailing.gwt.home.client.place.event.EventClientFactory;
import com.sap.sailing.gwt.home.client.place.event2.multiregatta.AbstractMultiregattaEventPlace;
import com.sap.sailing.gwt.home.client.place.event2.multiregatta.EventMultiregattaActivity;
import com.sap.sailing.gwt.home.client.place.event2.multiregatta.tabs.MultiregattaMediaPlace;
import com.sap.sailing.gwt.home.client.place.event2.multiregatta.tabs.MultiregattaRegattasPlace;
import com.sap.sailing.gwt.home.client.place.event2.regatta.AbstractEventRegattaPlace;
import com.sap.sailing.gwt.home.client.place.event2.regatta.EventRegattaActivity;
import com.sap.sailing.gwt.home.client.place.event2.regatta.tabs.RegattaMediaPlace;
import com.sap.sailing.gwt.home.client.place.event2.regatta.tabs.RegattaRacesPlace;
import com.sap.sailing.gwt.ui.shared.eventview.EventViewDTO;
import com.sap.sailing.gwt.ui.shared.eventview.EventViewDTO.EventType;
@@ -63,6 +65,7 @@ public class EventActivityProxy extends AbstractActivityProxy {
if(place instanceof EventDefaultPlace) {
place = getRealPlace();
}
place = verifyAndAdjustPlace();
afterLoad();
}
@@ -84,12 +87,7 @@ public class EventActivityProxy extends AbstractActivityProxy {
private AbstractEventPlace getRealPlace() {
EventViewDTO event = ctx.getEventDTO();
if(event.getType() == EventType.SERIES_EVENT) {
// TODO Overview isn't implemented yet
// return new RegattaOverviewPlace(new EventContext(ctx.getEventDTO()));
return new RegattaRacesPlace(new EventContext(ctx).withRegattaId(null));
}
if(event.getType() == EventType.SINGLE_REGATTA) {
if(event.getType() == EventType.SERIES_EVENT || event.getType() == EventType.SINGLE_REGATTA) {
// TODO Overview isn't implemented yet
// return new RegattaOverviewPlace(new EventContext(ctx.getEventDTO()));
return new RegattaRacesPlace(new EventContext(ctx).withRegattaId(null));
@@ -98,4 +96,42 @@ public class EventActivityProxy extends AbstractActivityProxy {
// return new MultiregattaOverviewPlace(place.getCtx());
return new MultiregattaRegattasPlace(place.getCtx());
}
/**
* Checks if the place is valid for the given event.
* If not, the place is automatically being adjusted.
*/
private AbstractEventPlace verifyAndAdjustPlace() {
EventContext contextWithoutRegatta = new EventContext(ctx).withRegattaId(null);
// TODO check if regatta ID is valid
if(place instanceof AbstractMultiregattaEventPlace && ctx.getEventDTO().getType() != EventType.MULTI_REGATTA) {
// Events with a type other than multi regatta only have regatta level pages
if(place instanceof MultiregattaRegattasPlace) {
return new RegattaRacesPlace(contextWithoutRegatta);
}
if(place instanceof MultiregattaMediaPlace) {
return new RegattaMediaPlace(contextWithoutRegatta);
}
// TODO Overview isn't implemented yet
// return new RegattaOverviewPlace(ctxToUse);
return new RegattaRacesPlace(contextWithoutRegatta);
}
if(place instanceof AbstractEventRegattaPlace) {
boolean regattaKnown = ctx.getEventDTO().isRegattaIDKnown(ctx.getRegattaId());
if(ctx.getEventDTO().getType() != EventType.MULTI_REGATTA && ctx.getRegattaId() != null && !regattaKnown) {
// Regatta ID unknown but unnecessary ...
ctx.withRegattaId(null);
} else if(ctx.getEventDTO().getType() == EventType.MULTI_REGATTA && !regattaKnown) {
return new MultiregattaRegattasPlace(contextWithoutRegatta);
}
}
if(place instanceof RegattaMediaPlace && ctx.getEventDTO().getType() == EventType.MULTI_REGATTA) {
// The media page for multi regatta events is on event level only but not on regatta level
return new MultiregattaMediaPlace(new EventContext(ctx).withRegattaId(null));
}
// no adjustment necessary
return place;
}
}
@@ -39,7 +39,7 @@ public class RegattaCompetitorAnalyticsTabView extends Composite implements
@Override
public TabView.State getState() {
return TabView.State.VISIBLE;
return currentPresenter.getCtx().getEventDTO().isHasAnalytics() ? TabView.State.VISIBLE : TabView.State.INVISIBLE;
}
@Override
@@ -54,7 +54,7 @@ public class RegattaLeaderboardTabView extends Composite implements RegattaTabVi
@Override
public TabView.State getState() {
return TabView.State.VISIBLE;
return currentPresenter.getCtx().getEventDTO().isHasAnalytics() ? TabView.State.VISIBLE : TabView.State.INVISIBLE;
}
@Override
@@ -1,7 +1,10 @@
package com.sap.sailing.gwt.home.client.place.events;
import com.google.gwt.animation.client.Animation;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Style.Display;
import com.google.gwt.dom.client.Style.Overflow;
import com.google.gwt.dom.client.Style.Unit;
@@ -13,13 +16,30 @@ public class CollapseAnimation extends Animation {
private int effectiveHeight;
public CollapseAnimation(Element elementToAnimate) {
this.elementToAnimate = elementToAnimate;
this(elementToAnimate, true);
}
public CollapseAnimation(Element elementToAnimate, int effectiveHeight) {
this(elementToAnimate);
this(elementToAnimate, false);
this.effectiveHeight = effectiveHeight;
show = false;
}
public CollapseAnimation(Element elementToAnimate, boolean showInitial) {
this.elementToAnimate = elementToAnimate;
this.show = showInitial;
elementToAnimate.getStyle().setOverflow(Overflow.HIDDEN);
if(!showInitial) {
elementToAnimate.getStyle().setDisplay(Display.NONE);
}
}
@Override
protected void onComplete() {
if(!show) {
elementToAnimate.getStyle().setDisplay(Display.NONE);
} else {
elementToAnimate.getStyle().clearHeight();
}
}
@Override
@@ -30,17 +50,17 @@ public class CollapseAnimation extends Animation {
elementToAnimate.getStyle().setHeight(effectiveHeight * progress, Unit.PX);
}
protected void onStart() {
super.onStart();
elementToAnimate.getStyle().setOverflow(Overflow.HIDDEN);
}
public void animate(boolean show) {
if(this.show && effectiveHeight == 0) {
effectiveHeight = elementToAnimate.getOffsetHeight();
if(show && effectiveHeight == 0) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
effectiveHeight = elementToAnimate.getScrollHeight();
}
});
}
elementToAnimate.getStyle().clearDisplay();
this.show = show;
run(500);
}
}
@@ -35,15 +35,10 @@ public class EventsOverviewRecent extends Composite {
boolean oneYearIsExpanded = false;
for (EventListYearDTO yearDTO : years) {
EventsOverviewRecentYear recentEventsOfOneYear = new EventsOverviewRecentYear(yearDTO, navigator);
EventsOverviewRecentYear recentEventsOfOneYear = new EventsOverviewRecentYear(yearDTO, navigator, !oneYearIsExpanded);
year.add(recentEventsOfOneYear);
if (oneYearIsExpanded == true) {
recentEventsOfOneYear.hideContent();
} else {
recentEventsOfOneYear.showContent();
oneYearIsExpanded = true;
}
oneYearIsExpanded = true;
}
}
}
@@ -6,7 +6,6 @@ import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.DivElement;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.SpanElement;
import com.google.gwt.dom.client.Style.Display;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.uibinder.client.UiBinder;
@@ -18,6 +17,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.event2.EventDefaultPlace;
import com.sap.sailing.gwt.home.client.place.events.CollapseAnimation;
import com.sap.sailing.gwt.ui.shared.eventlist.EventListEventDTO;
import com.sap.sailing.gwt.ui.shared.eventlist.EventListYearDTO;
@@ -42,11 +42,14 @@ public class EventsOverviewRecentYear extends Composite {
private boolean isContentVisible;
public EventsOverviewRecentYear(EventListYearDTO yearDTO, HomePlacesNavigator navigator) {
private final CollapseAnimation animation;
public EventsOverviewRecentYear(EventListYearDTO yearDTO, HomePlacesNavigator navigator, boolean showInitial) {
List<EventListEventDTO> events = yearDTO.getEvents();
EventsOverviewRecentResources.INSTANCE.css().ensureInjected();
initWidget(uiBinder.createAndBindUi(this));
this.year.setInnerText(String.valueOf(yearDTO.getYear()));
this.eventsCount.setInnerText(String.valueOf(events.size()));
if(yearDTO.getSailorCount() > 0) {
@@ -72,13 +75,16 @@ public class EventsOverviewRecentYear extends Composite {
RecentEventTeaser recentEvent = new RecentEventTeaser(eventNavigation, eventDTO);
recentEventsTeaserPanel.add(recentEvent);
}
isContentVisible = true;
headerDiv.addDomHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
onHeaderCicked();
}
}, ClickEvent.getType());
isContentVisible = showInitial;
animation = new CollapseAnimation(contentDiv, showInitial);
updateAccordionState();
}
private void onHeaderCicked() {
@@ -86,22 +92,15 @@ public class EventsOverviewRecentYear extends Composite {
updateContentVisibility();
}
public void hideContent() {
isContentVisible = false;
updateContentVisibility();
private void updateContentVisibility() {
animation.animate(isContentVisible);
updateAccordionState();
}
public void showContent() {
isContentVisible = true;
updateContentVisibility();
}
private void updateContentVisibility() {
private void updateAccordionState() {
if(isContentVisible) {
contentDiv.getStyle().clearDisplay();
getElement().removeClassName(EventsOverviewRecentResources.INSTANCE.css().accordioncollapsed());
} else {
contentDiv.getStyle().setDisplay(Display.NONE);
getElement().addClassName(EventsOverviewRecentResources.INSTANCE.css().accordioncollapsed());
}
}
@@ -54,6 +54,7 @@
vertical-align: middle;
text-overflow: ellipsis;
width: 66%;
display: inline-block;
}
@media (min-width: 61em) {
.eventsoverviewupcoming_header_ticker {
@@ -16,7 +16,7 @@
<span>
<h3 class="{local_res.css.eventsoverviewupcoming_header_title}">
<ui:text from="{i18n_ubi.seriesHeaderUpcoming}" /><span ui:field="colon" style="display: none;">:</span></h3>
<span ui:field="ticker" class="{local_res.css.eventsoverviewupcoming_header_ticker}" style="display: inline-block;" />
<span ui:field="ticker" class="{local_res.css.eventsoverviewupcoming_header_ticker}" />
</span>
<!-- IFEND upcomingEvents.events.length < 2 -->
</div>
@@ -1,67 +1,69 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:c="urn:import:com.sap.sailing.gwt.common.client.controls.tabbar"
xmlns:tabs="urn:import:com.sap.sailing.gwt.home.client.place.fakeseries.tabs"
xmlns:h="urn:import:com.sap.sailing.gwt.home.client.place.fakeseries.partials.header">
<ui:with field="i18n" type="com.sap.sailing.gwt.ui.client.StringMessages" />
<ui:with field="tm" type="com.sap.sailing.gwt.common.client.i18n.TextMessages" />
<ui:style>
.header {
position: relative;
width: 100%;
margin: 0;
padding: 0;
}
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:c="urn:import:com.sap.sailing.gwt.common.client.controls.tabbar"
xmlns:tabs="urn:import:com.sap.sailing.gwt.home.client.place.fakeseries.tabs"
xmlns:h="urn:import:com.sap.sailing.gwt.home.client.place.fakeseries.partials.header">
<ui:with field="i18n" type="com.sap.sailing.gwt.ui.client.StringMessages" />
<ui:with field="tm" type="com.sap.sailing.gwt.common.client.i18n.TextMessages" />
<ui:style>
.header {
position: relative;
width: 100%;
margin: 0;
padding: 0;
}
.mainHeader {
width: 66.6666666666667%;
}
.mainHeader {
width: 66.6666666666667%;
}
.sharingHeader {
width: 33.3333333333333%;
float: right;
padding: 0 1rem;
position:
relative;
padding: 1.333333333333333em 0;
text-align: right;
.sharingHeader {
width: 33.3333333333333%;
float: right;
padding: 0 1rem;
position: relative;
padding: 1.333333333333333em 0;
text-align: right;
background-color: maroon;
height: 2rem;
}
background-color: maroon;
height: 2rem;
}
.breadcrumb, .intro {
box-sizing: border-box;
-moz-box-sizing: border-box;
}
.breadcrumb, .intro {
box-sizing: border-box;
-moz-box-sizing: border-box;
}
.breadcrumb {
font-size: 0.866666666666667em;
font-weight: 600;
}
.breadcrumb {
font-size: 0.866666666666667em;
font-weight: 600;
}
.intro {
height: 5em;
}
</ui:style>
<g:HTMLPanel>
<c:TabPanel ui:field="tabPanelUi">
<c:header>
<h:SeriesHeader ui:field="seriesHeader" />
</c:header>
<c:tabcontent title="{i18n.events}">
<tabs:SeriesEventsTabView />
</c:tabcontent>
<c:tabcontent title="{tm.overallLeaderboard}">
<tabs:EventSeriesLeaderboardTabView />
</c:tabcontent>
<c:tabcontent title="{i18n.competitorsAnalytics}">
<tabs:EventSeriesCompetitorAnalyticsTabView />
</c:tabcontent>
<c:tabcontent title="{i18n.media}">
<tabs:SeriesMediaTabView />
</c:tabcontent>
</c:TabPanel>
</g:HTMLPanel>
.intro {
height: 5em;
}
</ui:style>
<g:HTMLPanel>
<c:TabPanel ui:field="tabPanelUi">
<c:header>
<h:SeriesHeader ui:field="seriesHeader" />
</c:header>
<c:tabcontent title="{i18n.events}">
<tabs:SeriesEventsTabView />
</c:tabcontent>
<c:tabcontent title="{tm.overallLeaderboard}">
<tabs:EventSeriesLeaderboardTabView />
</c:tabcontent>
<c:tabcontent title="{tm.regattaLeaderboards}">
<tabs:EventSeriesRegattaLeaderboardTabView />
</c:tabcontent>
<c:tabcontent title="{i18n.competitorsAnalytics}">
<tabs:EventSeriesCompetitorAnalyticsTabView />
</c:tabcontent>
<c:tabcontent title="{i18n.media}">
<tabs:SeriesMediaTabView />
</c:tabcontent>
</c:TabPanel>
</g:HTMLPanel>
</ui:UiBinder>
@@ -37,7 +37,7 @@ public class EventSeriesCompetitorAnalyticsTabView extends Composite implements
@Override
public TabView.State getState() {
return TabView.State.VISIBLE;
return currentPresenter.getCtx().getSeriesDTO().isHasAnalytics() ? TabView.State.VISIBLE : TabView.State.INVISIBLE;
}
@Override
@@ -53,7 +53,7 @@ public class EventSeriesLeaderboardTabView extends Composite implements SeriesTa
@Override
public TabView.State getState() {
return TabView.State.VISIBLE;
return currentPresenter.getCtx().getSeriesDTO().isHasAnalytics() ? TabView.State.VISIBLE : TabView.State.INVISIBLE;
}
@Override
@@ -0,0 +1,22 @@
package com.sap.sailing.gwt.home.client.place.fakeseries.tabs;
import com.sap.sailing.gwt.home.client.place.fakeseries.AbstractSeriesPlace;
import com.sap.sailing.gwt.home.client.place.fakeseries.AbstractSeriesTabPlace;
import com.sap.sailing.gwt.home.client.place.fakeseries.SeriesContext;
public class EventSeriesRegattaLeaderboardPlace extends AbstractSeriesTabPlace {
public EventSeriesRegattaLeaderboardPlace(String id) {
super(id);
}
public EventSeriesRegattaLeaderboardPlace(SeriesContext context) {
super(context);
}
public static class Tokenizer extends AbstractSeriesPlace.Tokenizer<EventSeriesRegattaLeaderboardPlace> {
@Override
protected EventSeriesRegattaLeaderboardPlace getRealPlace(SeriesContext context) {
return new EventSeriesRegattaLeaderboardPlace(context);
}
}
}
@@ -0,0 +1,144 @@
package com.sap.sailing.gwt.home.client.place.fakeseries.tabs;
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.Window;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Label;
import com.sap.sailing.domain.common.RaceIdentifier;
import com.sap.sailing.domain.common.dto.LeaderboardDTO;
import com.sap.sailing.domain.common.dto.RaceColumnDTO;
import com.sap.sailing.gwt.common.client.controls.tabbar.TabView;
import com.sap.sailing.gwt.home.client.place.event.oldmultileaderboard.OldMultiLeaderboard;
import com.sap.sailing.gwt.home.client.place.event.seriesanalytics.EventSeriesAnalyticsDataManager;
import com.sap.sailing.gwt.home.client.place.event2.utils.EventParamUtils;
import com.sap.sailing.gwt.home.client.place.fakeseries.SeriesTabView;
import com.sap.sailing.gwt.home.client.place.fakeseries.SeriesView;
import com.sap.sailing.gwt.home.client.shared.placeholder.Placeholder;
import com.sap.sailing.gwt.ui.client.LeaderboardUpdateListener;
import com.sap.sailing.gwt.ui.leaderboard.LeaderboardSettings;
import com.sap.sailing.gwt.ui.leaderboard.LeaderboardUrlSettings;
import com.sap.sailing.gwt.ui.leaderboard.MultiLeaderboardPanel;
import com.sap.sailing.gwt.ui.shared.fakeseries.EventSeriesViewDTO.EventSeriesState;
import com.sap.sse.gwt.shared.GwtHttpRequestUtils;
public class EventSeriesRegattaLeaderboardTabView extends Composite implements SeriesTabView<EventSeriesRegattaLeaderboardPlace>,
LeaderboardUpdateListener {
private SeriesView.Presenter currentPresenter;
@UiField
protected OldMultiLeaderboard leaderboard;
public EventSeriesRegattaLeaderboardTabView() {
}
@Override
public Class<EventSeriesRegattaLeaderboardPlace> getPlaceClassForActivation() {
return EventSeriesRegattaLeaderboardPlace.class;
}
@Override
public void setPresenter(SeriesView.Presenter currentPresenter) {
this.currentPresenter = currentPresenter;
}
@Override
public TabView.State getState() {
return currentPresenter.getCtx().getSeriesDTO().isHasAnalytics() ? TabView.State.VISIBLE : TabView.State.INVISIBLE;
}
@Override
public void start(final EventSeriesRegattaLeaderboardPlace myPlace, final AcceptsOneWidget contentArea) {
contentArea.setWidget(new Placeholder());
String leaderboardName = myPlace.getCtx().getSeriesDTO().getLeaderboardId();
if (leaderboardName != null && !leaderboardName.isEmpty()) {
EventSeriesAnalyticsDataManager regattaAnalyticsManager = currentPresenter.getCtx()
.getAnalyticsManager();
boolean autoExpandLastRaceColumn = GwtHttpRequestUtils.getBooleanParameter(
LeaderboardUrlSettings.PARAM_AUTO_EXPAND_LAST_RACE_COLUMN, false);
final LeaderboardSettings leaderboardSettings = EventParamUtils
.createLeaderboardSettingsFromURLParameters(Window.Location
.getParameterMap());
final RaceIdentifier preselectedRace = EventParamUtils
.getPreselectedRace(Window.Location.getParameterMap());
MultiLeaderboardPanel leaderboardPanel = regattaAnalyticsManager.createMultiLeaderboardPanel(leaderboardSettings,
null, // TODO: preselectedLeaderboardName
preselectedRace,
"leaderboardGroupName", // TODO: keep using magic string? ask frank!
currentPresenter.getCtx().getSeriesDTO().getLeaderboardId(),
true, // this information came from place, now hard coded. check with frank
autoExpandLastRaceColumn);
initWidget(ourUiBinder.createAndBindUi(this));
leaderboard.setMultiLeaderboard(leaderboardPanel,
currentPresenter.getAutoRefreshTimer());
leaderboardPanel.addLeaderboardUpdateListener(this);
if (currentPresenter.getCtx().getSeriesDTO().getState() != EventSeriesState.RUNNING) {
// TODO: this.leaderboard.hideRefresh();
} else {
// TODO: start autorefresh?
}
regattaAnalyticsManager.hideCompetitorChart();
contentArea.setWidget(this);
} else {
contentArea.setWidget(new Label("No leaderboard specified, cannot proceed to leaderboardpage"));
new com.google.gwt.user.client.Timer() {
@Override
public void run() {
currentPresenter.getHomeNavigation().goToPlace();
}
}.schedule(3000);
}
}
@Override
public void updatedLeaderboard(LeaderboardDTO leaderboard) {
this.leaderboard.updatedMultiLeaderboard(leaderboard, true); // TODO hard coded
}
@Override
public void currentRaceSelected(RaceIdentifier raceIdentifier, RaceColumnDTO raceColumn) {
}
@Override
public void stop() {
}
interface MyBinder extends UiBinder<HTMLPanel, EventSeriesRegattaLeaderboardTabView> {
}
private static MyBinder ourUiBinder = GWT.create(MyBinder.class);
@Override
public EventSeriesRegattaLeaderboardPlace placeToFire() {
return new EventSeriesRegattaLeaderboardPlace(currentPresenter.getCtx());
}
}
@@ -0,0 +1,15 @@
<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:style>
.outerBox {
padding-top: 10px;
}
</ui:style>
<g:HTMLPanel styleName="{style.outerBox}">
<s:oldmultileaderboard.OldMultiLeaderboard ui:field='leaderboard'/>
</g:HTMLPanel>
</ui:UiBinder>
@@ -87,7 +87,7 @@ public class EventTeaser extends Composite {
final StringBuilder thumbnailUrlBuilder = new StringBuilder("url('");
final String thumbnailImageUrl = event.getLogoImageURL();
final String thumbnailImageUrl = event.getThumbnailImageURL();
if (thumbnailImageUrl == null || thumbnailImageUrl.isEmpty()) {
thumbnailUrlBuilder.append(EventTeaserResources.INSTANCE.defaultEventPhotoImage().getSafeUri().asString());
} else {
@@ -5443,6 +5443,10 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
dto.setHasMedia(!o.getPhotoGalleryImageURLs().isEmpty() || !o.getVideoURLs().isEmpty());
dto.getLeaderboardGroups().addAll(o.getLeaderboardGroups());
dto.setState(calculateEventState(o));
// TODO @Frank: is this correct
dto.setHasAnalytics(EventState.RUNNING.compareTo(dto.getState()) <= 0);
if (o.isFakeSeries()) {
dto.setType(EventType.SERIES_EVENT);
@@ -5561,6 +5565,9 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
// TODO implement correctly. We currently do not show media for series.
dto.setHasMedia(false);
boolean oneEventStarted = false;
boolean oneEventLive = false;
boolean allFinished = true;
if (o.getLeaderboardGroups().size() == 1 && o.getLeaderboardGroups().get(0).hasOverallLeaderboard()) {
LeaderboardGroupDTO overallLeaderboardGroupDTO = o.getLeaderboardGroups().get(0);
dto.setDisplayName(overallLeaderboardGroupDTO.getDisplayName() != null ? overallLeaderboardGroupDTO.getDisplayName() : overallLeaderboardGroupDTO.getName());
@@ -5584,9 +5591,6 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
return e1.getStartDate().compareTo(e2.getEndDate());
}
});
boolean oneEventStarted = false;
boolean oneEventLive = false;
boolean allFinished = true;
for(Event eventInSeries: fakeSeriesEvents) {
EventMetadataDTO eventOfSeries = convertToMetadataDTO(eventInSeries);
dto.addEvent(eventOfSeries);
@@ -5595,16 +5599,19 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
oneEventLive |= (eventOfSeries.isStarted() && !eventOfSeries.isFinished());
allFinished &= eventOfSeries.isFinished();
}
if(oneEventLive) {
dto.setState(EventSeriesState.RUNNING);
} else if(!oneEventStarted) {
dto.setState(EventSeriesState.UPCOMING);
} else if(allFinished) {
dto.setState(EventSeriesState.FINISHED);
} else {
dto.setState(EventSeriesState.IN_PROGRESS);
}
}
if(oneEventLive) {
dto.setState(EventSeriesState.RUNNING);
} else if(!oneEventStarted) {
dto.setState(EventSeriesState.UPCOMING);
} else if(allFinished) {
dto.setState(EventSeriesState.FINISHED);
} else {
dto.setState(EventSeriesState.IN_PROGRESS);
}
// TODO @Frank: is this correct
dto.setHasAnalytics(oneEventStarted);
return dto;
}
@@ -5692,6 +5699,6 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
dto.setEndDate(event.getEndDate().asDate());
dto.setState(calculateEventState(event.isPublic(), dto.getStartDate(), dto.getEndDate()));
dto.setVenue(event.getVenue().getName());
dto.setLogoImageURL(SailingServiceUtil.findEventThumbnailImageUrlAsString(event));
dto.setThumbnailImageURL(SailingServiceUtil.findEventThumbnailImageUrlAsString(event));
}
}
@@ -42,6 +42,7 @@ public class EventViewDTO extends EventDTO {
private EventType type;
private EventState state;
private boolean hasMedia;
private boolean hasAnalytics;
public EventViewDTO() {
this(new ArrayList<LeaderboardGroupDTO>());
@@ -139,4 +140,21 @@ public class EventViewDTO extends EventDTO {
public void setHasMedia(boolean hasMedia) {
this.hasMedia = hasMedia;
}
public boolean isHasAnalytics() {
return hasAnalytics;
}
public void setHasAnalytics(boolean hasAnalytics) {
this.hasAnalytics = hasAnalytics;
}
public boolean isRegattaIDKnown(String regattaId) {
for (RegattaMetadataDTO regatta : regattas) {
if(regatta.getId().equals(regattaId)) {
return true;
}
}
return false;
}
}
@@ -16,6 +16,7 @@ public class EventSeriesViewDTO implements IsSerializable {
private boolean onRemoteServer;
private String logoImageURL;
private boolean hasMedia;
private boolean hasAnalytics;
private String leaderboardId;
@@ -33,7 +34,6 @@ public class EventSeriesViewDTO implements IsSerializable {
}
}
// TODO: frank, please implement
public EventSeriesState state;
public EventSeriesViewDTO() {
@@ -110,4 +110,12 @@ public class EventSeriesViewDTO implements IsSerializable {
public void setState(EventSeriesState state) {
this.state = state;
}
public boolean isHasAnalytics() {
return hasAnalytics;
}
public void setHasAnalytics(boolean hasAnalytics) {
this.hasAnalytics = hasAnalytics;
}
}
@@ -12,7 +12,7 @@ public class EventMetadataDTO extends EventReferenceDTO {
private String venueCountry;
private Date startDate;
private Date endDate;
private String logoImageURL;
private String thumbnailImageURL;
public EventState getState() {
return state;
@@ -62,12 +62,12 @@ public class EventMetadataDTO extends EventReferenceDTO {
this.endDate = endDate;
}
public String getLogoImageURL() {
return logoImageURL;
public String getThumbnailImageURL() {
return thumbnailImageURL;
}
public void setLogoImageURL(String logoImageURL) {
this.logoImageURL = logoImageURL;
public void setThumbnailImageURL(String thumbnailImageURL) {
this.thumbnailImageURL = thumbnailImageURL;
}
}
@@ -259,49 +259,49 @@ figcaption {
.label[data-labeltype='finished']:before {
border-right-color: #8ab54e;
}
.label[datalabeltype='progress'] {
.label[data-labeltype='progress'] {
background-color: #f0ab00;
vertical-align: middle;
margin-top: -0.416666666666667em;
}
.label[datalabeltype='progress']:before {
.label[data-labeltype='progress']:before {
border-right-color: #f0ab00;
}
.label[datalabeltype='upcoming'] {
.label[data-labeltype='upcoming'] {
color: #333;
background-color: #eee;
vertical-align: middle;
margin-top: -0.416666666666667em;
}
.label[datalabeltype='upcoming']:before {
.label[data-labeltype='upcoming']:before {
border-right-color: #eee;
}
.label[datalabeltype='new'],
.label[datalabeltype='updated'] {
.label[data-labeltype='new'],
.label[data-labeltype='updated'] {
background-color: #f0ab00;
text-transform: uppercase;
vertical-align: middle;
}
.label[datalabeltype='new']:before,
.label[datalabeltype='updated']:before {
.label[data-labeltype='new']:before,
.label[data-labeltype='updated']:before {
border-right-color: #f0ab00;
}
.label[datalabeltype='ess'] {
.label[data-labeltype='ess'] {
background-color: #a71724;
}
.label[datalabeltype='ess']:before {
.label[data-labeltype='ess']:before {
border-right-color: #a71724;
}
.label[datalabeltype='worldcup'] {
.label[data-labeltype='worldcup'] {
background-color: #c79242;
}
.label[datalabeltype='worldcup']:before {
.label[data-labeltype='worldcup']:before {
border-right-color: #c79242;
}
.label[datalabeltype='bundesliga'] {
.label[data-labeltype='bundesliga'] {
background-color: #005fa7;
}
.label[datalabeltype='bundesliga']:before {
.label[data-labeltype='bundesliga']:before {
border-right-color: #005fa7;
}
.morelink {