mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-01 08:40:52 +00:00
Event overview stage - Added dynamic to content to countdown stage view
This commit is contained in:
1 parent
8132785c88
commit
a1024e2889
10 files changed
+183
-30
No files matched your search
+2
-1
@@ -46,6 +46,7 @@ public class MultiregattaOverviewTabView extends Composite implements Multiregat
|
||||
@Override
|
||||
public void start(MultiregattaOverviewPlace myPlace, AcceptsOneWidget contentArea) {
|
||||
racesListLive = new RacesListLive(currentPresenter, true);
|
||||
stage = new EventOverviewStage(currentPresenter);
|
||||
|
||||
initWidget(ourUiBinder.createAndBindUi(this));
|
||||
|
||||
@@ -68,7 +69,7 @@ public class MultiregattaOverviewTabView extends Composite implements Multiregat
|
||||
private static MyBinder ourUiBinder = GWT.create(MyBinder.class);
|
||||
|
||||
@UiField(provided = true) RacesListLive racesListLive;
|
||||
@UiField EventOverviewStage stage;
|
||||
@UiField(provided = true) EventOverviewStage stage;
|
||||
|
||||
@Override
|
||||
public MultiregattaOverviewPlace placeToFire() {
|
||||
|
||||
+6
-2
@@ -3,6 +3,7 @@ package com.sap.sailing.gwt.home.client.place.event.overview;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.SimplePanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.gwt.home.client.place.event.EventView;
|
||||
import com.sap.sailing.gwt.home.client.place.event.partials.countdown.Countdown;
|
||||
import com.sap.sailing.gwt.home.client.place.event.partials.livestream.Livestream;
|
||||
import com.sap.sailing.gwt.home.client.place.event.regatta.tabs.reload.RefreshableWidget;
|
||||
@@ -15,8 +16,11 @@ public class EventOverviewStage extends Composite implements RefreshableWidget<E
|
||||
private final SimplePanel content = new SimplePanel();
|
||||
|
||||
private Widget lastContent;
|
||||
|
||||
private final EventView.Presenter presenter;
|
||||
|
||||
public EventOverviewStage() {
|
||||
public EventOverviewStage(EventView.Presenter presenter) {
|
||||
this.presenter = presenter;
|
||||
initWidget(content);
|
||||
}
|
||||
|
||||
@@ -30,7 +34,7 @@ public class EventOverviewStage extends Composite implements RefreshableWidget<E
|
||||
}
|
||||
if (data instanceof EventOverviewTickerStageDTO) {
|
||||
if (!(lastContent instanceof Countdown)) {
|
||||
lastContent = new Countdown();
|
||||
lastContent = new Countdown(presenter);
|
||||
}
|
||||
((Countdown) lastContent).setData((EventOverviewTickerStageDTO) data);
|
||||
}
|
||||
|
||||
+88
-3
@@ -1,31 +1,116 @@
|
||||
package com.sap.sailing.gwt.home.client.place.event.partials.countdown;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.DivElement;
|
||||
import com.google.gwt.dom.client.HeadingElement;
|
||||
import com.google.gwt.dom.client.Style.Display;
|
||||
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.SimplePanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.gwt.common.client.LinkUtil;
|
||||
import com.sap.sailing.gwt.common.client.SharedResources;
|
||||
import com.sap.sailing.gwt.common.client.SharedResources.MainCss;
|
||||
import com.sap.sailing.gwt.common.client.i18n.TextMessages;
|
||||
import com.sap.sailing.gwt.home.client.app.PlaceNavigation;
|
||||
import com.sap.sailing.gwt.home.client.place.event.EventView;
|
||||
import com.sap.sailing.gwt.home.client.place.event.EventView.Presenter;
|
||||
import com.sap.sailing.gwt.home.client.place.event.partials.countdown.CountdownResources.LocalCss;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.event.EventOverviewRaceTickerStageDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.event.EventOverviewRegattaTickerStageDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.event.EventOverviewTickerStageDTO;
|
||||
|
||||
public class Countdown extends Composite {
|
||||
|
||||
private static final StringMessages I18N = StringMessages.INSTANCE;
|
||||
private static final TextMessages I18N_UBI = TextMessages.INSTANCE;
|
||||
private static final LocalCss CSS = CountdownResources.INSTANCE.css();
|
||||
private static final MainCss MAIN_CSS = SharedResources.INSTANCE.mainCss();
|
||||
|
||||
private static CountdownUiBinder uiBinder = GWT.create(CountdownUiBinder.class);
|
||||
|
||||
interface CountdownUiBinder extends UiBinder<Widget, Countdown> {
|
||||
}
|
||||
|
||||
private static final LocalCss CSS = CountdownResources.INSTANCE.css();
|
||||
|
||||
@UiField SimplePanel tickerContainer;
|
||||
@UiField HeadingElement countdownTitle;
|
||||
@UiField DivElement countdownInfo;
|
||||
@UiField HeadingElement infoTitle;
|
||||
@UiField(provided = true) NavigationAnchor navigationButton;
|
||||
|
||||
public Countdown() {
|
||||
public Countdown(EventView.Presenter presenter) {
|
||||
CSS.ensureInjected();
|
||||
this.navigationButton = new NavigationAnchor(presenter);
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
}
|
||||
|
||||
public void setData(EventOverviewTickerStageDTO data) {
|
||||
navigationButton.removeStyleName(MAIN_CSS.buttonred());
|
||||
navigationButton.removeStyleName(MAIN_CSS.buttonprimary());
|
||||
if (data instanceof EventOverviewRaceTickerStageDTO) {
|
||||
this.updateUi(I18N.nextRaceStartingIn(), data.getTickerInfo());
|
||||
this.navigationButton.linkToRaceViewer((EventOverviewRaceTickerStageDTO) data);
|
||||
} else if (data instanceof EventOverviewRegattaTickerStageDTO) {
|
||||
this.updateUi(I18N.startingIn(data.getTickerInfo()), data.getTickerInfo());
|
||||
this.navigationButton.linkToRegatta((EventOverviewRegattaTickerStageDTO) data);
|
||||
} else {
|
||||
this.updateUi(I18N.startingIn(data.getTickerInfo()), null);
|
||||
}
|
||||
this.tickerContainer.setWidget(new CountdownTicker(data.getStartTime()));
|
||||
}
|
||||
|
||||
private void updateUi(String title, String info) {
|
||||
this.countdownTitle.setInnerText(title);
|
||||
this.infoTitle.setInnerText(info);
|
||||
this.countdownInfo.getStyle().setDisplay(info != null ? Display.BLOCK : Display.NONE);
|
||||
}
|
||||
|
||||
@UiHandler("navigationButton")
|
||||
void handleNavigationButtonClick(ClickEvent event) {
|
||||
this.navigationButton.onClick(event);
|
||||
}
|
||||
|
||||
private class NavigationAnchor extends Anchor {
|
||||
|
||||
private final EventView.Presenter presenter;
|
||||
private PlaceNavigation<?> currentPlaceNavigation;
|
||||
|
||||
private NavigationAnchor(Presenter presenter) {
|
||||
this.presenter = presenter;
|
||||
}
|
||||
|
||||
private void linkToRaceViewer(EventOverviewRaceTickerStageDTO data) {
|
||||
String url = presenter.getRaceViewerURL(data.getRegattaAndRaceIdentifier());
|
||||
this.update(MAIN_CSS.buttonprimary(), MAIN_CSS.buttonred(), I18N_UBI.watchNow(), null, url);
|
||||
}
|
||||
|
||||
private void linkToRegatta(EventOverviewRegattaTickerStageDTO data) {
|
||||
PlaceNavigation<?> nav = presenter.getRegattaNavigation(data.getRegattaIdentifier().getRegattaName());
|
||||
this.update(MAIN_CSS.buttonred(), MAIN_CSS.buttonprimary(), I18N_UBI.regattaDetails(), nav,
|
||||
nav.getTargetUrl());
|
||||
}
|
||||
|
||||
private void update(String removeStyle, String addStyle, String text, PlaceNavigation<?> navigation, String url) {
|
||||
this.removeStyleName(removeStyle);
|
||||
this.addStyleName(addStyle);
|
||||
this.setText(text);
|
||||
this.currentPlaceNavigation = navigation;
|
||||
this.setHref(url);
|
||||
}
|
||||
|
||||
private void onClick(ClickEvent event) {
|
||||
if (LinkUtil.handleLinkClick(event.getNativeEvent().<Event> cast())) {
|
||||
if (currentPlaceNavigation != null) {
|
||||
event.preventDefault();
|
||||
currentPlaceNavigation.goToPlace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
-12
@@ -3,31 +3,26 @@
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui"
|
||||
xmlns:s="urn:import:com.sap.sailing.gwt.home.client.shared">
|
||||
<ui:with field="i18n" type="com.sap.sailing.gwt.ui.client.StringMessages" />
|
||||
<ui:with field="i18n_ubi" 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.partials.countdown.CountdownResources" />
|
||||
<g:HTMLPanel addStyleNames="{local_res.css.countdown}">
|
||||
<div class="{local_res.css.countdown_image}"></div>
|
||||
<div class="{local_res.css.countdown_content}">
|
||||
<h3 class="{local_res.css.countdown_content_title}">
|
||||
TODO Next Race starting in<!-- <ui:text from='{i18n.nextRace}' /> -->
|
||||
</h3>
|
||||
<h3 class="{local_res.css.countdown_content_title}" ui:field="countdownTitle"></h3>
|
||||
<g:SimplePanel ui:field="tickerContainer"/>
|
||||
</div>
|
||||
<div class="{res.mediaCss.grid}">
|
||||
<div class="{local_res.css.countdown_info}">
|
||||
<div class="{local_res.css.countdown_info}" ui:field="countdownInfo">
|
||||
<div class="{res.mediaCss.small7} {res.mediaCss.large8} {res.mediaCss.columns} {local_res.css.countdown_info_text}">
|
||||
<h3 class="{local_res.css.countdown_info_text_title}">
|
||||
TODO This is the next races title
|
||||
</h3>
|
||||
<h3 class="{local_res.css.countdown_info_text_title}" ui:field="infoTitle"></h3>
|
||||
<div data-labeltype="next" class="{local_res.css.countdown_info_lable} {res.mainCss.label}">
|
||||
TODONext<!-- <ui:text from='{i18n.playModeNext}' /> -->
|
||||
<ui:text from='{i18n.next}' />
|
||||
</div>
|
||||
</div>
|
||||
<div class="{res.mediaCss.small5} {res.mediaCss.large4} {res.mediaCss.columns} {local_res.css.countdown_info_button}">
|
||||
<a href="#" class="{res.mainCss.button} {res.mainCss.buttonsmall} {res.mainCss.buttonred} {res.mainCss.buttonstrong} {res.mainCss.buttonarrowrightwhite}">
|
||||
<ui:text from='{i18n_ubi.watchNow}' />
|
||||
</a>
|
||||
<g:Anchor target="_blank" ui:field="navigationButton"
|
||||
addStyleNames="{res.mainCss.button} {res.mainCss.buttonsmall} {res.mainCss.buttonstrong} {res.mainCss.buttonarrowrightwhite}">
|
||||
</g:Anchor>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+2
-4
@@ -1,9 +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:g="urn:import:com.google.gwt.user.client.ui" >
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" xmlns:g="urn:import:com.google.gwt.user.client.ui" >
|
||||
<ui:with field="local_res" type="com.sap.sailing.gwt.home.client.place.event.partials.countdown.CountdownResources" />
|
||||
<g:HTMLPanel ui:field="countdown"
|
||||
addStyleNames="{local_res.css.countdown_content_panewrapper}">
|
||||
<g:HTMLPanel ui:field="countdown" addStyleNames="{local_res.css.countdown_content_panewrapper}">
|
||||
<div ui:field="majorContainer" class="{local_res.css.countdown_content_pane} {local_res.css.countdown_content_panefirst}">
|
||||
<div ui:field="majorValue" class="{local_res.css.countdown_content_pane_count}"></div>
|
||||
<div ui:field="majorUnit" class="{local_res.css.countdown_content_pane_unit}"></div>
|
||||
|
||||
+2
-1
@@ -37,6 +37,7 @@ public class RegattaOverviewTabView extends Composite implements RegattaTabView<
|
||||
@Override
|
||||
public void start(RegattaOverviewPlace myPlace, AcceptsOneWidget contentArea) {
|
||||
racesListLive = new RacesListLive(currentPresenter, false);
|
||||
stage = new EventOverviewStage(currentPresenter);
|
||||
|
||||
initWidget(ourUiBinder.createAndBindUi(this));
|
||||
|
||||
@@ -64,7 +65,7 @@ public class RegattaOverviewTabView extends Composite implements RegattaTabView<
|
||||
|
||||
@UiField(provided = true)
|
||||
RacesListLive racesListLive;
|
||||
@UiField EventOverviewStage stage;
|
||||
@UiField(provided = true) EventOverviewStage stage;
|
||||
|
||||
@Override
|
||||
public RegattaOverviewPlace placeToFire() {
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.sap.sailing.gwt.ui.shared.dispatch.event;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
|
||||
|
||||
public class EventOverviewRaceTickerStageDTO extends EventOverviewTickerStageDTO {
|
||||
|
||||
private RegattaAndRaceIdentifier regattaAndRaceIdentifier;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private EventOverviewRaceTickerStageDTO() {
|
||||
}
|
||||
|
||||
public EventOverviewRaceTickerStageDTO(RegattaAndRaceIdentifier identifier, String tickerInfo, Date startTime) {
|
||||
super(startTime, tickerInfo);
|
||||
this.regattaAndRaceIdentifier = identifier;
|
||||
}
|
||||
|
||||
public RegattaAndRaceIdentifier getRegattaAndRaceIdentifier() {
|
||||
return regattaAndRaceIdentifier;
|
||||
}
|
||||
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.sap.sailing.gwt.ui.shared.dispatch.event;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.sap.sailing.domain.common.RegattaName;
|
||||
|
||||
public class EventOverviewRegattaTickerStageDTO extends EventOverviewTickerStageDTO {
|
||||
|
||||
private RegattaName regattaIdentifier;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private EventOverviewRegattaTickerStageDTO() {
|
||||
}
|
||||
|
||||
public EventOverviewRegattaTickerStageDTO(RegattaName identifier, String tickerInfo, Date startTime) {
|
||||
super(startTime, tickerInfo);
|
||||
this.regattaIdentifier = identifier;
|
||||
}
|
||||
|
||||
public RegattaName getRegattaIdentifier() {
|
||||
return regattaIdentifier;
|
||||
}
|
||||
|
||||
}
|
||||
+16
-1
@@ -4,8 +4,23 @@ import java.util.Date;
|
||||
|
||||
public class EventOverviewTickerStageDTO implements EventOverviewStageDTO {
|
||||
|
||||
private Date startTime;
|
||||
private String tickerInfo;
|
||||
|
||||
protected EventOverviewTickerStageDTO() {
|
||||
}
|
||||
|
||||
public EventOverviewTickerStageDTO(Date startTime, String tickerInfo) {
|
||||
this.startTime = startTime;
|
||||
this.tickerInfo = tickerInfo;
|
||||
}
|
||||
|
||||
public Date getStartTime() {
|
||||
return new Date(new Date().getTime() + 62500);
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public String getTickerInfo() {
|
||||
return tickerInfo;
|
||||
}
|
||||
|
||||
}
|
||||
+12
-6
@@ -1,10 +1,13 @@
|
||||
package com.sap.sailing.gwt.ui.shared.dispatch.event;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.google.gwt.core.shared.GwtIncompatible;
|
||||
import com.sap.sailing.domain.base.Event;
|
||||
import com.sap.sailing.domain.base.Regatta;
|
||||
import com.sap.sailing.domain.common.RegattaName;
|
||||
import com.sap.sailing.domain.common.RegattaNameAndRaceName;
|
||||
import com.sap.sailing.domain.leaderboard.Leaderboard;
|
||||
import com.sap.sailing.domain.leaderboard.LeaderboardGroup;
|
||||
import com.sap.sailing.domain.leaderboard.RegattaLeaderboard;
|
||||
@@ -33,8 +36,8 @@ public class GetEventOverviewStageAction implements Action<ResultWithTTL<EventOv
|
||||
|
||||
EventState state = HomeServiceUtil.calculateEventState(event);
|
||||
if(state == EventState.UPCOMING || state == EventState.PLANNED) {
|
||||
// TODO Type Event
|
||||
return new ResultWithTTL<EventOverviewStageDTO>(5000, new EventOverviewTickerStageDTO());
|
||||
return new ResultWithTTL<EventOverviewStageDTO>(5000, new EventOverviewTickerStageDTO(event.getStartDate()
|
||||
.asDate(), event.getName()));
|
||||
}
|
||||
|
||||
if(state == EventState.RUNNING) {
|
||||
@@ -56,8 +59,9 @@ public class GetEventOverviewStageAction implements Action<ResultWithTTL<EventOv
|
||||
}
|
||||
}
|
||||
if(!HomeServiceUtil.isSingleRegatta(event) && nextRegatta != null) {
|
||||
// TODO Type regatta
|
||||
return new ResultWithTTL<EventOverviewStageDTO>(5000, new EventOverviewTickerStageDTO());
|
||||
return new ResultWithTTL<EventOverviewStageDTO>(5000, new EventOverviewRegattaTickerStageDTO(
|
||||
new RegattaName(nextRegatta.getName()), nextRegatta.getName(), nextRegatta.getStartDate()
|
||||
.asDate()));
|
||||
} else {
|
||||
// TODO find next race or live race
|
||||
// for (LeaderboardGroup lg : event.getLeaderboardGroups()) {
|
||||
@@ -69,8 +73,10 @@ public class GetEventOverviewStageAction implements Action<ResultWithTTL<EventOv
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// TODO Type race
|
||||
return new ResultWithTTL<EventOverviewStageDTO>(5000, new EventOverviewTickerStageDTO());
|
||||
// TODO Proper Implementation (Type race)
|
||||
EventOverviewTickerStageDTO ticker = new EventOverviewRaceTickerStageDTO(new RegattaNameAndRaceName(
|
||||
"Regatta XY", "Race 1"), "Race 1 - Gold Fleet", new Date(new Date().getTime() + 5000));
|
||||
return new ResultWithTTL<EventOverviewStageDTO>(5000, ticker);
|
||||
}
|
||||
// TODO clever fallback for live event/regatta?
|
||||
// }
|
||||
|
||||
Reference in new issue
Block a user