mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-14 22:43:57 +00:00
Enabled fullscreen viewer for progression tab of a regatta or series
This commit is contained in:
1 parent
e17ec290ef
commit
3f5fe1a0fa
10 files changed
+90
-75
No files matched your search
-9
@@ -3,7 +3,6 @@ package com.sap.sailing.gwt.home.desktop.partials.old;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Element;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
@@ -56,14 +55,6 @@ public abstract class AbstractLeaderboardFullscreenViewer extends FullscreenCont
|
||||
leaderboardPanel.removeAttribute("tabIndex");
|
||||
}
|
||||
|
||||
protected Widget createPanel(Widget... contentWidgets) {
|
||||
FlowPanel panel = new FlowPanel();
|
||||
for (Widget widget : contentWidgets) {
|
||||
panel.add(widget);
|
||||
}
|
||||
return panel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLeaderboardPanel(Widget leaderboardPanel) {
|
||||
showContent(leaderboardPanel);
|
||||
|
||||
+2
-7
@@ -41,14 +41,10 @@ public class OldCompetitorCharts extends Composite {
|
||||
@UiField DivElement competitorSelectionStateUi;
|
||||
|
||||
private final List<DetailType> availableDetailsTypes;
|
||||
private MultiCompetitorLeaderboardChart multiCompetitorChart;
|
||||
private final CompetitorChartsDelegate delegate;
|
||||
private MultiCompetitorLeaderboardChart multiCompetitorChart;
|
||||
|
||||
public OldCompetitorCharts() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public OldCompetitorCharts(CompetitorChartsDelegate delegate) {
|
||||
public OldCompetitorCharts(final CompetitorChartsDelegate delegate) {
|
||||
this.availableDetailsTypes = new ArrayList<DetailType>();
|
||||
this.multiCompetitorChart = null;
|
||||
EventRegattaLeaderboardResources.INSTANCE.css().ensureInjected();
|
||||
@@ -78,7 +74,6 @@ public class OldCompetitorCharts extends Composite {
|
||||
public void onChange(ChangeEvent event) {
|
||||
synchronizeChartTypeSelection(delegate.getChartTypeSelectionControl(), chartTypeSelectionListBox);
|
||||
OldCompetitorCharts.this.updateChartType();
|
||||
multiCompetitorChart.forceMaximumChartSize();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+37
-26
@@ -1,11 +1,13 @@
|
||||
package com.sap.sailing.gwt.home.desktop.partials.old.competitorcharts;
|
||||
|
||||
import com.google.gwt.dom.client.Style.Display;
|
||||
import java.util.Optional;
|
||||
|
||||
import com.google.gwt.dom.client.Style.FontWeight;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.ListBox;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.google.web.bindery.event.shared.HandlerRegistration;
|
||||
import com.sap.sailing.gwt.home.shared.partials.fullscreen.FullscreenContainer;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.client.shared.charts.MultiCompetitorLeaderboardChart;
|
||||
@@ -13,23 +15,34 @@ import com.sap.sse.common.Color;
|
||||
|
||||
public class OldCompetitorChartsDelegateFullscreenViewer extends FullscreenContainer<MultiCompetitorLeaderboardChart>
|
||||
implements CompetitorChartsDelegate {
|
||||
|
||||
|
||||
private final ListBox chartTypeSelection = new ListBox();
|
||||
private HandlerRegistration redrawCallback;
|
||||
|
||||
public OldCompetitorChartsDelegateFullscreenViewer() {
|
||||
showLogo();
|
||||
showBorder();
|
||||
setHeaderWidget(createHeaderPanel());
|
||||
addToolbarInfo(createLabeledChartTypeSelectionControl());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onShow() {
|
||||
getContentWidget().forceMaximumChartSize();
|
||||
getContentWidget().onResize();
|
||||
final Runnable resizeCallback = () -> {
|
||||
getContentWidget().forceMaximumChartSize();
|
||||
getContentWidget().onResize();
|
||||
};
|
||||
this.redrawCallback = getContentWidget().addChartDataUpdatedHandler(resizeCallback);
|
||||
resizeCallback.run();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setCompetitorChart(MultiCompetitorLeaderboardChart competitorChart) {
|
||||
protected void onClose() {
|
||||
Optional.ofNullable(redrawCallback).ifPresent(HandlerRegistration::removeHandler);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCompetitorChart(final MultiCompetitorLeaderboardChart competitorChart) {
|
||||
showContent(competitorChart);
|
||||
}
|
||||
|
||||
@@ -37,27 +50,25 @@ public class OldCompetitorChartsDelegateFullscreenViewer extends FullscreenConta
|
||||
public ListBox getChartTypeSelectionControl() {
|
||||
return chartTypeSelection;
|
||||
}
|
||||
|
||||
|
||||
private Widget createHeaderPanel() {
|
||||
final Widget heading = getBoldLabel(StringMessages.INSTANCE.competitorsAnalytics());
|
||||
heading.getElement().getStyle().setFontSize(18, Unit.PX);
|
||||
heading.getElement().getStyle().setMarginTop(-.2, Unit.EM);
|
||||
return createPanel(heading, getBoldLabel(StringMessages.INSTANCE.chartSelectionHint()));
|
||||
}
|
||||
|
||||
private Widget createLabeledChartTypeSelectionControl() {
|
||||
FlowPanel panel = getWidgetWithMarginTop(new FlowPanel(), -30, Unit.PX);
|
||||
panel.add(getWidgetWitDisplay(new Label(StringMessages.INSTANCE.chooseChartType() + " "), Display.INLINE));
|
||||
panel.add(getWidgetWithColor(chartTypeSelection, Color.BLACK));
|
||||
final Widget panel = createPanel(chartTypeSelection);
|
||||
panel.getElement().getStyle().setLineHeight(32, Unit.PX);
|
||||
chartTypeSelection.getElement().getStyle().setColor(Color.BLACK.getAsHtml());
|
||||
return panel;
|
||||
}
|
||||
|
||||
private <T extends Widget> T getWidgetWithMarginTop(T widget, double value, Unit unit) {
|
||||
widget.getElement().getStyle().setMarginTop(value, unit);
|
||||
return widget;
|
||||
}
|
||||
|
||||
private <T extends Widget> T getWidgetWithColor(T widget, Color color) {
|
||||
widget.getElement().getStyle().setColor(color.getAsHtml());
|
||||
return widget;
|
||||
}
|
||||
|
||||
private <T extends Widget> T getWidgetWitDisplay(T widget, Display display) {
|
||||
widget.getElement().getStyle().setDisplay(display);
|
||||
return widget;
|
||||
|
||||
private Widget getBoldLabel(final String text) {
|
||||
final Label label = new Label(text);
|
||||
label.getElement().getStyle().setFontWeight(FontWeight.BOLD);
|
||||
return label;
|
||||
}
|
||||
|
||||
}
|
||||
+1
-5
@@ -59,13 +59,9 @@ public class OldLeaderboard extends Composite implements BusyStateChangeListener
|
||||
@UiField BusyIndicator busyIndicator;
|
||||
@UiField EventRegattaLeaderboardResources local_res;
|
||||
|
||||
private final OldLeaderboardDelegate delegate;
|
||||
private MultiRaceLeaderboardPanel leaderboardPanel;
|
||||
private Timer autoRefreshTimer;
|
||||
private final OldLeaderboardDelegate delegate;
|
||||
|
||||
public OldLeaderboard() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public OldLeaderboard(final OldLeaderboardDelegate delegate) {
|
||||
this.leaderboardPanel = null;
|
||||
|
||||
+1
-2
@@ -25,7 +25,6 @@ import com.sap.sailing.gwt.home.desktop.places.event.regatta.EventRegattaView;
|
||||
import com.sap.sailing.gwt.home.desktop.places.event.regatta.EventRegattaView.Presenter;
|
||||
import com.sap.sailing.gwt.home.desktop.places.event.regatta.RegattaAnalyticsDataManager;
|
||||
import com.sap.sailing.gwt.home.desktop.places.event.regatta.SharedLeaderboardRegattaTabView;
|
||||
import com.sap.sailing.gwt.home.shared.ExperimentalFeatures;
|
||||
import com.sap.sailing.gwt.home.shared.partials.placeholder.InfoPlaceholder;
|
||||
import com.sap.sailing.gwt.ui.client.CompetitorSelectionChangeListener;
|
||||
import com.sap.sailing.gwt.ui.client.CompetitorSelectionModel;
|
||||
@@ -54,7 +53,7 @@ public class RegattaCompetitorAnalyticsTabView extends SharedLeaderboardRegattaT
|
||||
|
||||
@UiField(provided = true)
|
||||
protected OldCompetitorCharts competitorCharts = new OldCompetitorCharts(
|
||||
ExperimentalFeatures.SHOW_COMPETITOR_ANALYTICS_FULLSCREEN_VIEWER ? new OldCompetitorChartsDelegateFullscreenViewer() : null);
|
||||
new OldCompetitorChartsDelegateFullscreenViewer());
|
||||
|
||||
@Override
|
||||
public Class<RegattaCompetitorAnalyticsPlace> getPlaceClassForActivation() {
|
||||
|
||||
+21
-22
@@ -23,7 +23,6 @@ import com.sap.sailing.gwt.home.desktop.partials.old.competitorcharts.OldCompeti
|
||||
import com.sap.sailing.gwt.home.desktop.places.fakeseries.EventSeriesAnalyticsDataManager;
|
||||
import com.sap.sailing.gwt.home.desktop.places.fakeseries.SeriesView;
|
||||
import com.sap.sailing.gwt.home.desktop.places.fakeseries.SharedLeaderboardEventSeriesTabView;
|
||||
import com.sap.sailing.gwt.home.shared.ExperimentalFeatures;
|
||||
import com.sap.sailing.gwt.ui.client.CompetitorSelectionChangeListener;
|
||||
import com.sap.sailing.gwt.ui.client.CompetitorSelectionModel;
|
||||
import com.sap.sse.common.Util;
|
||||
@@ -40,9 +39,9 @@ public class EventSeriesCompetitorAnalyticsTabView extends SharedLeaderboardEven
|
||||
|
||||
@UiField(provided = true)
|
||||
protected OldCompetitorCharts competitorCharts = new OldCompetitorCharts(
|
||||
ExperimentalFeatures.SHOW_COMPETITOR_ANALYTICS_FULLSCREEN_VIEWER ? new OldCompetitorChartsDelegateFullscreenViewer() : null);
|
||||
new OldCompetitorChartsDelegateFullscreenViewer());
|
||||
|
||||
private final int MAX_COMPETITORS_IN_CHART = 30;
|
||||
private final int MAX_COMPETITORS_IN_CHART = 30;
|
||||
|
||||
public EventSeriesCompetitorAnalyticsTabView() {
|
||||
super();
|
||||
@@ -52,23 +51,23 @@ public class EventSeriesCompetitorAnalyticsTabView extends SharedLeaderboardEven
|
||||
public Class<EventSeriesCompetitorAnalyticsPlace> getPlaceClassForActivation() {
|
||||
return EventSeriesCompetitorAnalyticsPlace.class;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TabView.State getState() {
|
||||
return currentPresenter.getSeriesDTO().isHasAnalytics() ? TabView.State.VISIBLE : TabView.State.INVISIBLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(EventSeriesCompetitorAnalyticsPlace myPlace, AcceptsOneWidget contentArea) {
|
||||
public void start(final EventSeriesCompetitorAnalyticsPlace myPlace, final AcceptsOneWidget contentArea) {
|
||||
contentArea.setWidget(currentPresenter.getErrorAndBusyClientFactory().createBusyView());
|
||||
String leaderboardName = currentPresenter.getSeriesDTO().getLeaderboardId();
|
||||
final String leaderboardName = currentPresenter.getSeriesDTO().getLeaderboardId();
|
||||
if (leaderboardName != null && !leaderboardName.isEmpty()) {
|
||||
EventSeriesAnalyticsDataManager eventSeriesAnalyticsManager = currentPresenter.getCtx().getAnalyticsManager();
|
||||
final EventSeriesAnalyticsDataManager eventSeriesAnalyticsManager = currentPresenter.getCtx().getAnalyticsManager();
|
||||
final Runnable callback = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
initWidget(ourUiBinder.createAndBindUi(EventSeriesCompetitorAnalyticsTabView.this));
|
||||
DetailType initialDetailType = DetailType.OVERALL_RANK;
|
||||
final DetailType initialDetailType = DetailType.OVERALL_RANK;
|
||||
if (eventSeriesAnalyticsManager.getMultiCompetitorChart() == null) {
|
||||
eventSeriesAnalyticsManager.createMultiCompetitorChart(null, null, leaderboardName, initialDetailType);
|
||||
}
|
||||
@@ -82,13 +81,13 @@ public class EventSeriesCompetitorAnalyticsTabView extends SharedLeaderboardEven
|
||||
null, new AsyncCallback<Iterable<DetailType>>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(Iterable<DetailType> result) {
|
||||
public void onSuccess(final Iterable<DetailType> result) {
|
||||
createSharedLeaderboardPanel(leaderboardName, eventSeriesAnalyticsManager,
|
||||
currentPresenter.getUserService(), null, panel -> callback.run(), result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
public void onFailure(final Throwable caught) {
|
||||
showMessageLabelAndGoToHome("Could not load detailType list", contentArea);
|
||||
}
|
||||
});
|
||||
@@ -99,7 +98,7 @@ public class EventSeriesCompetitorAnalyticsTabView extends SharedLeaderboardEven
|
||||
showMessageLabelAndGoToHome("No leaderboard specified, cannot proceed to leaderboardpage", contentArea);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void showMessageLabelAndGoToHome(final String message, final AcceptsOneWidget contentArea) {
|
||||
contentArea.setWidget(new Label(message));
|
||||
new Timer() {
|
||||
@@ -111,7 +110,7 @@ public class EventSeriesCompetitorAnalyticsTabView extends SharedLeaderboardEven
|
||||
}
|
||||
|
||||
private List<DetailType> getAvailableDetailsTypes() {
|
||||
List<DetailType> availableDetailsTypes = new ArrayList<DetailType>();
|
||||
final List<DetailType> availableDetailsTypes = new ArrayList<>();
|
||||
availableDetailsTypes.add(DetailType.OVERALL_RANK);
|
||||
availableDetailsTypes.add(DetailType.REGATTA_NET_POINTS_SUM);
|
||||
return availableDetailsTypes;
|
||||
@@ -127,27 +126,27 @@ public class EventSeriesCompetitorAnalyticsTabView extends SharedLeaderboardEven
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPresenter(SeriesView.Presenter currentPresenter) {
|
||||
public void setPresenter(final SeriesView.Presenter currentPresenter) {
|
||||
this.currentPresenter = currentPresenter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatedLeaderboard(LeaderboardDTO leaderboard) {
|
||||
public void updatedLeaderboard(final LeaderboardDTO leaderboard) {
|
||||
// adjust the competitor selection for the chart in case the leaderboard changed
|
||||
updateCompetitorSelection();
|
||||
}
|
||||
|
||||
private void updateCompetitorSelection() {
|
||||
EventSeriesAnalyticsDataManager eventSeriesAnalyticsManager = currentPresenter.getCtx().getAnalyticsManager();
|
||||
CompetitorSelectionModel competitorSelectionProvider = eventSeriesAnalyticsManager.getCompetitorSelectionProvider();
|
||||
final EventSeriesAnalyticsDataManager eventSeriesAnalyticsManager = currentPresenter.getCtx().getAnalyticsManager();
|
||||
final CompetitorSelectionModel competitorSelectionProvider = eventSeriesAnalyticsManager.getCompetitorSelectionProvider();
|
||||
|
||||
// preselect the top N competitors in case there was no selection before and there too many competitors for a chart
|
||||
int competitorsCount = Util.size(competitorSelectionProvider.getAllCompetitors());
|
||||
int selectedCompetitorsCount = Util.size(competitorSelectionProvider.getSelectedCompetitors());
|
||||
|
||||
final int competitorsCount = Util.size(competitorSelectionProvider.getAllCompetitors());
|
||||
final int selectedCompetitorsCount = Util.size(competitorSelectionProvider.getSelectedCompetitors());
|
||||
|
||||
if(selectedCompetitorsCount == 0 && competitorsCount > MAX_COMPETITORS_IN_CHART) {
|
||||
List<CompetitorDTO> selectedCompetitors = new ArrayList<>();
|
||||
Iterator<CompetitorDTO> allCompetitorsIt = competitorSelectionProvider.getAllCompetitors().iterator();
|
||||
final List<CompetitorDTO> selectedCompetitors = new ArrayList<>();
|
||||
final Iterator<CompetitorDTO> allCompetitorsIt = competitorSelectionProvider.getAllCompetitors().iterator();
|
||||
int counter = 0;
|
||||
while(counter < MAX_COMPETITORS_IN_CHART) {
|
||||
selectedCompetitors.add(allCompetitorsIt.next());
|
||||
@@ -158,6 +157,6 @@ public class EventSeriesCompetitorAnalyticsTabView extends SharedLeaderboardEven
|
||||
}
|
||||
|
||||
@Override
|
||||
public void currentRaceSelected(RaceIdentifier raceIdentifier, RaceColumnDTO raceColumn) {
|
||||
public void currentRaceSelected(final RaceIdentifier raceIdentifier, final RaceColumnDTO raceColumn) {
|
||||
}
|
||||
}
|
||||
+4
@@ -4,6 +4,10 @@
|
||||
<div id="mainContent">
|
||||
<h4 class="articleHeadline">What's New - SAP Sailing Analytics</h4>
|
||||
<div class="innerContent">
|
||||
<h5 class="articleSubheadline">January 2021</h5>
|
||||
<ul class="bulletList">
|
||||
<li>The charts within the progression tab of a regatta or series now support viewing in fullscreen mode.</li>
|
||||
</ul>
|
||||
<h5 class="articleSubheadline">October 2020</h5>
|
||||
<ul class="bulletList">
|
||||
<li>An SAP Qualtrics survey is now part of the /gwt/Home.html page. It presents itself after 60s as
|
||||
|
||||
-4
@@ -5,10 +5,6 @@ package com.sap.sailing.gwt.home.shared;
|
||||
*/
|
||||
public interface ExperimentalFeatures {
|
||||
|
||||
/**
|
||||
* Provide button to show the competitor analytics in fullscreen view (work in progress)
|
||||
*/
|
||||
public static final boolean SHOW_COMPETITOR_ANALYTICS_FULLSCREEN_VIEWER = false;
|
||||
/**
|
||||
* Provide buttons for user management login via social services like facebook or google.
|
||||
*/
|
||||
|
||||
+8
@@ -1,5 +1,7 @@
|
||||
package com.sap.sailing.gwt.home.shared.partials.fullscreen;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.AnchorElement;
|
||||
import com.google.gwt.dom.client.Style.Display;
|
||||
@@ -96,6 +98,12 @@ public class FullscreenContainer<T extends Widget> {
|
||||
contentUi.addStyleName(style.contentBorder());
|
||||
}
|
||||
|
||||
protected Widget createPanel(final Widget... contentWidgets) {
|
||||
final FlowPanel panel = new FlowPanel();
|
||||
Stream.of(contentWidgets).forEach(panel::add);
|
||||
return panel;
|
||||
}
|
||||
|
||||
@UiHandler("closeActionUi")
|
||||
void onCloseActionClicked(ClickEvent event) {
|
||||
popup.hide();
|
||||
|
||||
+16
@@ -31,6 +31,7 @@ import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.RequiresResize;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.google.web.bindery.event.shared.HandlerRegistration;
|
||||
import com.sap.sailing.domain.common.DetailType;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.gwt.ui.actions.GetLeaderboardDataEntriesAction;
|
||||
@@ -75,6 +76,8 @@ public abstract class AbstractCompetitorLeaderboardChart<SettingsType extends Ge
|
||||
private final List<String> raceColumnNamesWithData;
|
||||
protected final String leaderboardName;
|
||||
protected final StringMessages stringMessages;
|
||||
|
||||
private final List<Runnable> chartDataUpdateCallbacks = new ArrayList<>();
|
||||
|
||||
public AbstractCompetitorLeaderboardChart(Component<?> parent, ComponentContext<?> context,
|
||||
SailingServiceAsync sailingService,
|
||||
@@ -106,6 +109,18 @@ public abstract class AbstractCompetitorLeaderboardChart<SettingsType extends Ge
|
||||
|
||||
return chart;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a {@link Runnable callback} to get notified when the chart data has been updated successfully.
|
||||
*
|
||||
* @param callback {@link Runnable} to call on chart data update
|
||||
* @return {@link HandlerRegistration} to remove the callback
|
||||
*/
|
||||
public HandlerRegistration addChartDataUpdatedHandler(final Runnable callback) {
|
||||
this.chartDataUpdateCallbacks.add(callback);
|
||||
return () -> this.chartDataUpdateCallbacks.remove(callback);
|
||||
}
|
||||
|
||||
|
||||
protected boolean isCompetitorVisible(CompetitorDTO competitor) {
|
||||
return Util.isEmpty(competitorSelectionProvider.getSelectedCompetitors()) || competitorSelectionProvider.isSelected(competitor);
|
||||
@@ -257,6 +272,7 @@ public abstract class AbstractCompetitorLeaderboardChart<SettingsType extends Ge
|
||||
// positions (nativeAdjustCheckboxPosition)
|
||||
// in the BaseChart class would not be called
|
||||
chart.redraw();
|
||||
chartDataUpdateCallbacks.forEach(Runnable::run);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user