mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-27 06:17:27 +00:00
Implemented placeholder text if there are no finished races yet
This commit is contained in:
1 parent
b2f74e1d02
commit
442201fee6
16 files changed
+74
-45
No files matched your search
+1
-1
@@ -83,7 +83,7 @@ public class MultiregattaOverviewTabView extends Composite implements Multiregat
|
||||
initWidget(ourUiBinder.createAndBindUi(this));
|
||||
RefreshManager refreshManager = new RefreshManager(this, currentPresenter.getDispatch());
|
||||
stage.setupRefresh(refreshManager);
|
||||
refreshManager.add(racesListLive, new GetLiveRacesForEventAction(currentPresenter.getCtx().getEventDTO().getId()));
|
||||
refreshManager.add(racesListLive.getRefreshable(), new GetLiveRacesForEventAction(currentPresenter.getCtx().getEventDTO().getId()));
|
||||
|
||||
if (SHOW_NEW_REGATTA_LIST) {
|
||||
refreshManager.add(regattaFilterList, new GetRegattaListViewAction(currentPresenter.getCtx().getEventDTO().getId()));
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@ public class MultiregattaRegattasTabView extends Composite implements Multiregat
|
||||
|
||||
initWidget(ourUiBinder.createAndBindUi(this));
|
||||
RefreshManager refreshManager = new RefreshManager(this, currentPresenter.getDispatch());
|
||||
refreshManager.add(racesListLiveUi, new GetLiveRacesForEventAction(currentPresenter.getCtx().getEventDTO().getId()));
|
||||
refreshManager.add(racesListLiveUi.getRefreshable(), new GetLiveRacesForEventAction(currentPresenter.getCtx().getEventDTO().getId()));
|
||||
|
||||
if (SHOW_NEW_REGATTA_LIST) {
|
||||
refreshManager.add(regattaFilterList, new GetRegattaListViewAction(currentPresenter.getCtx().getEventDTO().getId()));
|
||||
|
||||
+11
-19
@@ -1,7 +1,6 @@
|
||||
package com.sap.sailing.gwt.home.client.place.event.partials.raceListLive;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
import com.google.gwt.dom.client.Style.Display;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
@@ -13,31 +12,23 @@ import com.sap.sailing.gwt.home.client.place.event.partials.racelist.RaceListDat
|
||||
import com.sap.sailing.gwt.home.client.place.event.partials.racelist.SortableRaceListColumn;
|
||||
import com.sap.sailing.gwt.home.client.place.event.regatta.tabs.reload.RefreshableWidget;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.SortedSetResult;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.CollectionResult;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.event.LiveRaceDTO;
|
||||
|
||||
public class RacesListLive extends Composite implements RefreshableWidget<SortedSetResult<LiveRaceDTO>> {
|
||||
public class RacesListLive extends Composite {
|
||||
|
||||
private final RaceListLiveRaces raceList;
|
||||
private final RaceListContainer<LiveRaceDTO> raceListContainer;
|
||||
|
||||
public RacesListLive(EventView.Presenter presenter, boolean showRegattaDetails) {
|
||||
raceList = new RaceListLiveRaces(presenter, showRegattaDetails);
|
||||
initWidget(new RaceListContainer<LiveRaceDTO>(StringMessages.INSTANCE.liveNow(), raceList));
|
||||
raceListContainer = new RaceListContainer<LiveRaceDTO>(StringMessages.INSTANCE.liveNow(), raceList);
|
||||
initWidget(raceListContainer);
|
||||
getElement().getStyle().setDisplay(Display.NONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(SortedSetResult<LiveRaceDTO> data, long nextUpdate, int updateNo) {
|
||||
this.setListData(data == null ? Collections.<LiveRaceDTO>emptySet() : data.getValues());
|
||||
}
|
||||
|
||||
public void setListData(Collection<LiveRaceDTO> data) {
|
||||
if(data == null || data.isEmpty()) {
|
||||
getElement().getStyle().setDisplay(Display.NONE);
|
||||
} else {
|
||||
getElement().getStyle().clearDisplay();
|
||||
raceList.setListData(data);
|
||||
}
|
||||
public RefreshableWidget<CollectionResult<LiveRaceDTO>> getRefreshable() {
|
||||
return raceListContainer;
|
||||
}
|
||||
|
||||
private class RaceListLiveRaces extends AbstractRaceList<LiveRaceDTO> {
|
||||
@@ -52,8 +43,9 @@ public class RacesListLive extends Composite implements RefreshableWidget<Sorted
|
||||
super(presenter);
|
||||
this.regattaNameColumn.setShowDetails(showRegattaDetails);
|
||||
}
|
||||
|
||||
public void setListData(Collection<LiveRaceDTO> data) {
|
||||
|
||||
@Override
|
||||
protected void setTableData(Collection<LiveRaceDTO> data) {
|
||||
boolean hasFleets = RaceListDataUtil.hasFleets(data);
|
||||
this.fleetCornerColumn.setShowDetails(hasFleets);
|
||||
this.fleetNameColumn.setShowDetails(hasFleets);
|
||||
@@ -62,7 +54,7 @@ public class RacesListLive extends Composite implements RefreshableWidget<Sorted
|
||||
boolean hasWind = RaceListDataUtil.hasWind(data);
|
||||
this.windSpeedColumn.setShowDetails(hasWind);
|
||||
this.windDirectionColumn.setShowDetails(hasWind);
|
||||
setTableData(data);
|
||||
super.setTableData(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+31
-3
@@ -6,14 +6,17 @@ import java.util.Collection;
|
||||
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.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.place.event.partials.raceListLive.RacesListLiveResources;
|
||||
import com.sap.sailing.gwt.home.client.place.event.regatta.tabs.reload.RefreshableWidget;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.CollectionResult;
|
||||
import com.sap.sailing.gwt.ui.shared.race.RaceMetadataDTO;
|
||||
|
||||
public class RaceListContainer<T extends RaceMetadataDTO<?>> extends Composite {
|
||||
public class RaceListContainer<T extends RaceMetadataDTO<?>> extends Composite implements RefreshableWidget<CollectionResult<T>> {
|
||||
|
||||
private static RaceListContainerUiBinder uiBinder = GWT.create(RaceListContainerUiBinder.class);
|
||||
|
||||
@@ -22,22 +25,47 @@ public class RaceListContainer<T extends RaceMetadataDTO<?>> extends Composite {
|
||||
|
||||
@UiField HeadingElement titleUi;
|
||||
@UiField DivElement infoUi;
|
||||
@UiField DivElement noContentPlaceholderUi;
|
||||
@UiField(provided = true) AbstractRaceList<T> raceListUi;
|
||||
private String noContentPlaceholderText;
|
||||
|
||||
public RaceListContainer(String title, AbstractRaceList<T> raceList) {
|
||||
this(title, null, raceList);
|
||||
}
|
||||
|
||||
public RaceListContainer(String title, String noContentPlaceholderText, AbstractRaceList<T> raceList) {
|
||||
this.noContentPlaceholderText = noContentPlaceholderText;
|
||||
RacesListLiveResources.INSTANCE.css().ensureInjected();
|
||||
this.raceListUi = raceList;
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
this.titleUi.setInnerText(title);
|
||||
raceListUi.setVisible(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(CollectionResult<T> data, long nextUpdate, int updateNo) {
|
||||
setRaceListData(data == null ? null : data.getValues());
|
||||
}
|
||||
|
||||
public void setRaceListData(Collection<T> data) {
|
||||
this.raceListUi.setTableData(data);
|
||||
if(data == null || data.isEmpty()) {
|
||||
if(noContentPlaceholderText == null) {
|
||||
getElement().getStyle().setDisplay(Display.NONE);
|
||||
} else {
|
||||
noContentPlaceholderUi.setInnerText(noContentPlaceholderText);
|
||||
noContentPlaceholderUi.getStyle().clearDisplay();
|
||||
raceListUi.setVisible(false);
|
||||
}
|
||||
} else {
|
||||
noContentPlaceholderUi.getStyle().setDisplay(Display.NONE);
|
||||
getElement().getStyle().clearDisplay();
|
||||
raceListUi.setVisible(true);
|
||||
this.raceListUi.setTableData(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void setInfoText(String infoText) {
|
||||
this.infoUi.setInnerText(infoText);
|
||||
this.infoUi.getStyle().clearDisplay();
|
||||
}
|
||||
|
||||
}
|
||||
+2
-1
@@ -7,7 +7,8 @@
|
||||
<ui:with field="local_res" type="com.sap.sailing.gwt.home.client.place.event.partials.raceListLive.RacesListLiveResources" />
|
||||
<g:HTMLPanel addStyleNames="{local_res.css.raceslistlive}">
|
||||
<h3 ui:field="titleUi"></h3>
|
||||
<div style="display:none;" ui:field="infoUi"></div>
|
||||
<div style="display: none;" ui:field="infoUi"></div>
|
||||
<div style="display: none; font-weight: bold; font-style: italic;" ui:field="noContentPlaceholderUi"></div>
|
||||
<r:AbstractRaceList ui:field="raceListUi"/>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
||||
+1
-1
@@ -48,7 +48,7 @@ public class RegattaOverviewTabView extends Composite implements RegattaTabView<
|
||||
RefreshManager refreshManager = new RefreshManager(this, currentPresenter.getDispatch());
|
||||
|
||||
stage.setupRefresh(refreshManager);
|
||||
refreshManager.add(racesListLive, new GetLiveRacesForRegattaAction(currentPresenter.getCtx().getEventDTO()
|
||||
refreshManager.add(racesListLive.getRefreshable(), new GetLiveRacesForRegattaAction(currentPresenter.getCtx().getEventDTO()
|
||||
.getId(), currentPresenter.getCtx().getRegattaId()));
|
||||
|
||||
contentArea.setWidget(this);
|
||||
|
||||
+8
-12
@@ -38,7 +38,6 @@ import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardGroupDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceGroupDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.StrippedLeaderboardDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.SortedSetResult;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.event.GetFinishedRacesAction;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.event.GetLiveRacesForRegattaAction;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.event.GetRegattaWithProgressAction;
|
||||
@@ -91,7 +90,7 @@ public class RegattaRacesTabView extends Composite implements RegattaTabView<Reg
|
||||
@UiField SimplePanel oldContentContainer;
|
||||
|
||||
private RacesListLive liveRacesList;
|
||||
private RaceListFinishedRaces finishedRacesList;
|
||||
private RaceListContainer<RaceListRaceDTO> raceListContainer;
|
||||
|
||||
public RegattaRacesTabView() {
|
||||
listNavigationPanelUi = new ListNavigationPanel<Navigation>(new RegattaRacesTabViewNavigationSelectionCallback());
|
||||
@@ -103,7 +102,8 @@ public class RegattaRacesTabView extends Composite implements RegattaTabView<Reg
|
||||
public void setPresenter(Presenter currentPresenter) {
|
||||
this.currentPresenter = currentPresenter;
|
||||
listFormatContainerUi.add(liveRacesList = new RacesListLive(currentPresenter, false));
|
||||
listFormatContainerUi.add(new RaceListContainer<>(I18N.finishedRaces(), finishedRacesList = new RaceListFinishedRaces(currentPresenter)));
|
||||
raceListContainer = new RaceListContainer<>(I18N.finishedRaces(), I18N.noFinishedRaces(), new RaceListFinishedRaces(currentPresenter));
|
||||
listFormatContainerUi.add(raceListContainer);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -119,14 +119,14 @@ public class RegattaRacesTabView extends Composite implements RegattaTabView<Reg
|
||||
// listNavigationPanelUi.addAction(Navigation.SORT_LIST_FORMAT, true);
|
||||
// listNavigationPanelUi.addAction(Navigation.COMPETITION_FORMAT, false);
|
||||
|
||||
refreshManager.add(liveRacesList, new GetLiveRacesForRegattaAction(myPlace.getCtx().getEventDTO().getId(), myPlace.getRegattaId()));
|
||||
refreshManager.add(liveRacesList.getRefreshable(), new GetLiveRacesForRegattaAction(myPlace.getCtx().getEventDTO().getId(), myPlace.getRegattaId()));
|
||||
refreshManager.add(new RefreshableWidget<RegattaWithProgressDTO>() {
|
||||
@Override
|
||||
public void setData(RegattaWithProgressDTO data, long nextUpdate, int updateNo) {
|
||||
regattaInfoContainerUi.setWidget(new MultiRegattaListItem(data));
|
||||
}
|
||||
}, new GetRegattaWithProgressAction(myPlace.getCtx().getEventDTO().getId(), myPlace.getRegattaId()));
|
||||
refreshManager.add(finishedRacesList, new GetFinishedRacesAction(myPlace.getCtx().getEventDTO().getId(), myPlace.getRegattaId()));
|
||||
refreshManager.add(raceListContainer, new GetFinishedRacesAction(myPlace.getCtx().getEventDTO().getId(), myPlace.getRegattaId()));
|
||||
|
||||
oldContentContainer.removeFromParent();
|
||||
} else {
|
||||
@@ -203,7 +203,7 @@ public class RegattaRacesTabView extends Composite implements RegattaTabView<Reg
|
||||
}
|
||||
}
|
||||
|
||||
private class RaceListFinishedRaces extends AbstractRaceList<RaceListRaceDTO> implements RefreshableWidget<SortedSetResult<RaceListRaceDTO>> {
|
||||
private class RaceListFinishedRaces extends AbstractRaceList<RaceListRaceDTO> {
|
||||
private final SortableRaceListColumn<RaceListRaceDTO, ?> durationColumn = RaceListColumnFactory.getDurationColumn();
|
||||
private final SortableRaceListColumn<RaceListRaceDTO, ?> windSpeedColumn = RaceListColumnFactory.getWindRangeColumn();
|
||||
private final SortableRaceListColumn<RaceListRaceDTO, ?> windSourcesCountColumn = RaceListColumnFactory.getWindSourcesCountColumn();
|
||||
@@ -216,11 +216,7 @@ public class RegattaRacesTabView extends Composite implements RegattaTabView<Reg
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(SortedSetResult<RaceListRaceDTO> data, long nextUpdate, int updateNo) {
|
||||
setListData(data.getValues());
|
||||
}
|
||||
|
||||
public void setListData(Collection<RaceListRaceDTO> data) {
|
||||
protected void setTableData(Collection<RaceListRaceDTO> data) {
|
||||
boolean hasFleets = RaceListDataUtil.hasFleets(data);
|
||||
this.fleetCornerColumn.setShowDetails(hasFleets);
|
||||
this.fleetNameColumn.setShowDetails(hasFleets);
|
||||
@@ -231,7 +227,7 @@ public class RegattaRacesTabView extends Composite implements RegattaTabView<Reg
|
||||
this.windSourcesCountColumn.setShowDetails(RaceListDataUtil.hasWindSources(data));
|
||||
this.videoCountColumn.setShowDetails(RaceListDataUtil.hasVideos(data));
|
||||
this.audioCountColumn.setShowDetails(RaceListDataUtil.hasAudios(data));
|
||||
setTableData(data);
|
||||
super.setTableData(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -114,13 +114,13 @@ public class RefreshManager {
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public <D extends DTO, A extends Action<ResultWithTTL<D>>> void add(RefreshableWidget<D> widget,
|
||||
public <D extends DTO, A extends Action<ResultWithTTL<D>>> void add(RefreshableWidget<? super D> widget,
|
||||
ActionProvider<A> provider) {
|
||||
refreshables.add(new RefreshHolder(widget, provider));
|
||||
reschedule();
|
||||
}
|
||||
|
||||
public <D extends DTO, A extends Action<ResultWithTTL<D>>> void add(RefreshableWidget<D> widget, A action) {
|
||||
public <D extends DTO, A extends Action<ResultWithTTL<D>>> void add(RefreshableWidget<? super D> widget, A action) {
|
||||
add(widget, new DefaultActionProvider<>(action));
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -1347,4 +1347,5 @@ public interface StringMessages extends com.sap.sse.gwt.client.StringMessages, c
|
||||
String numberOfRacesShort();
|
||||
String miniLeeaderboardLegendText();
|
||||
String currentOfTotal(int current, int total);
|
||||
String noFinishedRaces();
|
||||
}
|
||||
+1
@@ -1316,3 +1316,4 @@ points=Points
|
||||
numberOfRacesShort=# Races
|
||||
miniLeeaderboardLegendText=Shows the points along with the number of races per competitor
|
||||
currentOfTotal={0,number}/{1,number}
|
||||
noFinishedRaces=There are no finished races yet
|
||||
+2
-1
@@ -1305,4 +1305,5 @@ allBoatClasses=Alle Bootsklassen
|
||||
points=Punkte
|
||||
numberOfRacesShort=# Rennen
|
||||
miniLeeaderboardLegendText=Es werden die Punkte und die Anzahl Rennen je Team angezeigt
|
||||
currentOfTotal={0,number}/{1,number}
|
||||
currentOfTotal={0,number}/{1,number}
|
||||
noFinishedRaces=Es wurden noch keine Wettfahrten beendet.
|
||||
+2
-1
@@ -1252,4 +1252,5 @@ allBoatClasses=All Boat Classes
|
||||
points=Points
|
||||
numberOfRacesShort=# Races
|
||||
miniLeeaderboardLegendText=Shows points along with the number of races per competitor
|
||||
currentOfTotal={0,number}/{1,number}
|
||||
currentOfTotal={0,number}/{1,number}
|
||||
noFinishedRaces=There are no finished races yet
|
||||
+2
-1
@@ -1301,4 +1301,5 @@ allBoatClasses=All Boat Classes
|
||||
points=Points
|
||||
numberOfRacesShort=# Races
|
||||
miniLeeaderboardLegendText=Shows points along with the number of races per competitor
|
||||
currentOfTotal={0,number}/{1,number}
|
||||
currentOfTotal={0,number}/{1,number}
|
||||
noFinishedRaces=There are no finished races yet
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package com.sap.sailing.gwt.ui.shared.dispatch;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public interface CollectionResult<T extends DTO> extends DTO, Result {
|
||||
Collection<T> getValues();
|
||||
}
|
||||
+1
-1
@@ -3,7 +3,7 @@ package com.sap.sailing.gwt.ui.shared.dispatch;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ListResult<T extends DTO> implements DTO, Result {
|
||||
public class ListResult<T extends DTO> implements CollectionResult<T> {
|
||||
private ArrayList<T> values = new ArrayList<>();
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import java.util.Collection;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
public class SortedSetResult<T extends DTO> implements DTO, Result {
|
||||
public class SortedSetResult<T extends DTO> implements CollectionResult<T> {
|
||||
private TreeSet<T> values = new TreeSet<>();
|
||||
|
||||
public SortedSetResult() {
|
||||
|
||||
Reference in new issue
Block a user