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

bug4374

Conflicts:
	java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/places/event/EventActivityProxy.java
	java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/places/fakeseries/SeriesActivityProxy.java
This commit is contained in:
Kai Boernert committed 2017-11-22 15:18:11 +01:00
commit 0f8e978acf
57 files changed
+719 -409

No files matched your search

@@ -5,6 +5,7 @@ import com.sap.sailing.domain.common.dto.LeaderboardRowDTO;
import com.sap.sailing.domain.common.dto.RaceColumnDTO;
import com.sap.sailing.gwt.settings.client.leaderboard.MultiRaceLeaderboardSettings;
import com.sap.sailing.gwt.ui.client.CompetitorSelectionModel;
import com.sap.sailing.gwt.ui.client.FlagImageResolverImpl;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.client.shared.controls.AbstractSortableColumnWithMinMax;
@@ -22,7 +23,8 @@ public class LeaderboardPanelMock extends MultiRaceLeaderboardPanel {
super(null, null, sailingService, new AsyncActionsExecutor(), new MultiRaceLeaderboardSettings(),
new CompetitorSelectionModel(
/* hasMultiSelection */true),
leaderboardName, errorReporter, stringMessages, /* showRaceDetails */ true,new ClassicLeaderboardStyle());
leaderboardName, errorReporter, stringMessages, /* showRaceDetails */ true, new ClassicLeaderboardStyle(),
FlagImageResolverImpl.get());
}
@Override
@@ -14,6 +14,7 @@ import com.sap.sailing.gwt.settings.client.leaderboard.MultiRaceLeaderboardSetti
import com.sap.sailing.gwt.settings.client.leaderboard.RaceColumnSelectionStrategies;
import com.sap.sailing.gwt.ui.client.CompetitorSelectionModel;
import com.sap.sailing.gwt.ui.client.CompetitorSelectionProvider;
import com.sap.sailing.gwt.ui.client.FlagImageResolverImpl;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.leaderboard.LeaderboardEntryPoint;
import com.sap.sailing.gwt.ui.leaderboard.MultiRaceLeaderboardPanel;
@@ -61,9 +62,11 @@ public class IdleOverallLeaderBoardNode extends FiresPlaceNode {
String overallLeaderboardName = result.get(0);
CompetitorSelectionProvider provider = new CompetitorSelectionModel(true);
MultiRaceLeaderboardPanel leaderboardPanel = new MultiRaceLeaderboardPanel(null,null,cf.getSailingService(),
new AsyncActionsExecutor(), leaderboardSettings,false, provider,timer,null, overallLeaderboardName, cf.getErrorReporter(),
StringMessages.INSTANCE, false,null,false,null,false,true,false,false,false,new SixtyInchLeaderBoardStyle(true));
MultiRaceLeaderboardPanel leaderboardPanel = new MultiRaceLeaderboardPanel(null, null,
cf.getSailingService(), new AsyncActionsExecutor(), leaderboardSettings, false,
provider, timer, null, overallLeaderboardName, cf.getErrorReporter(),
StringMessages.INSTANCE, false, null, false, null, false, true, false, false, false,
new SixtyInchLeaderBoardStyle(true), FlagImageResolverImpl.get());
IdleOverallLeaderBoardPlace place = new IdleOverallLeaderBoardPlace(leaderboardPanel);
@@ -15,6 +15,7 @@ import com.sap.sailing.gwt.autoplay.client.app.AutoPlayPresenterConfigured;
import com.sap.sailing.gwt.autoplay.client.events.AutoPlayHeaderEvent;
import com.sap.sailing.gwt.settings.client.leaderboard.SingleRaceLeaderboardSettings;
import com.sap.sailing.gwt.ui.client.CompetitorSelectionModel;
import com.sap.sailing.gwt.ui.client.FlagImageResolverImpl;
import com.sap.sailing.gwt.ui.client.LeaderboardUpdateListener;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.client.StringMessages;
@@ -69,7 +70,8 @@ public class RaceEndWithBoatsPresenterImpl extends AutoPlayPresenterConfigured<A
leaderboardPanel = new SingleRaceLeaderboardPanel(null,null,sailingService, new AsyncActionsExecutor(), leaderboardSettings,
true, liveRace, competitorSelectionProvider, timer, null,
getSlideCtx().getContextDefinition().getLeaderboardName(), errorReporter, StringMessages.INSTANCE,
false, null, false, null, false, true, false, false, false,new SixtyInchLeaderBoardStyle(true));
false, null, false, null, false, true, false, false, false, new SixtyInchLeaderBoardStyle(true),
FlagImageResolverImpl.get());
int competitorCount = getPlace().getStatistic().getCompetitors();
@@ -16,6 +16,7 @@ import com.sap.sailing.gwt.autoplay.client.app.AutoPlayClientFactory;
import com.sap.sailing.gwt.autoplay.client.app.AutoPlayPresenterConfigured;
import com.sap.sailing.gwt.autoplay.client.utils.AutoplayHelper;
import com.sap.sailing.gwt.settings.client.leaderboard.SingleRaceLeaderboardSettings;
import com.sap.sailing.gwt.ui.client.FlagImageResolverImpl;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.client.shared.racemap.RaceCompetitorSet;
@@ -157,7 +158,8 @@ public class LiveRaceWithRacemapAndLeaderBoardPresenterImpl
leaderboardPanel = new SingleRaceLeaderboardPanel(null,null,sailingService, new AsyncActionsExecutor(), leaderboardSettings,
true, lifeRace, getPlace().getRaceMapSelectionProvider(), timer, null,
getSlideCtx().getContextDefinition().getLeaderboardName(), errorReporter, StringMessages.INSTANCE,
false, null, false, null, false, true, false, false, false,new SixtyInchLeaderBoardStyle(true));
false, null, false, null, false, true, false, false, false, new SixtyInchLeaderBoardStyle(true),
FlagImageResolverImpl.get());
getPlace().getRaceMap().setQuickRanksDTOProvider(new QuickRanksDTOFromLeaderboardDTOProvider(new RaceCompetitorSet(getPlace().getRaceMapSelectionProvider()), lifeRace));
@@ -15,6 +15,7 @@ import com.sap.sailing.gwt.autoplay.client.app.AutoPlayClientFactory;
import com.sap.sailing.gwt.autoplay.client.app.AutoPlayPresenterConfigured;
import com.sap.sailing.gwt.settings.client.leaderboard.SingleRaceLeaderboardSettings;
import com.sap.sailing.gwt.ui.client.CompetitorSelectionModel;
import com.sap.sailing.gwt.ui.client.FlagImageResolverImpl;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.leaderboard.LeaderboardEntryPoint;
@@ -106,7 +107,8 @@ public class PreLiveRaceLeaderBoardWithImagePresenterImpl
leaderboardPanel = new SingleRaceLeaderboardPanel(null,null,sailingService, new AsyncActionsExecutor(),
leaderboardSettings, true, liveRace, competitorSelectionProvider, timer, null,
getSlideCtx().getContextDefinition().getLeaderboardName(), errorReporter, StringMessages.INSTANCE,
false, null, false, null, false, true, false, false, false,new SixtyInchLeaderBoardStyle(false));
false, null, false, null, false, true, false, false, false, new SixtyInchLeaderBoardStyle(false),
FlagImageResolverImpl.get());
view.setLeaderBoard(leaderboardPanel);
selectionTimer.schedule(AnimationPanel.DELAY + AnimationPanel.ANIMATION_DURATION);
@@ -15,6 +15,7 @@ import com.sap.sailing.gwt.common.client.FullscreenUtil;
import com.sap.sailing.gwt.settings.client.leaderboard.MultiRaceLeaderboardPanelLifecycle;
import com.sap.sailing.gwt.settings.client.leaderboard.MultiRaceLeaderboardSettings;
import com.sap.sailing.gwt.ui.client.CompetitorSelectionProvider;
import com.sap.sailing.gwt.ui.client.FlagImageResolverImpl;
import com.sap.sailing.gwt.ui.client.LeaderboardUpdateListener;
import com.sap.sailing.gwt.ui.client.LeaderboardUpdateProvider;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
@@ -194,7 +195,8 @@ public class MultiRaceLeaderboardWithZoomingPerspective extends AbstractPerspect
leaderboardName, errorReporter, stringMessages,
/* showRaceDetails */false, /* competitorSearchTextBox */ null, /* showRegattaRank */
/* showSelectionCheckbox */false, /* raceTimesInfoProvider */null, false, /* autoExpandLastRaceColumn */
/* adjustTimerDelay */ true, /* autoApplyTopNFilter */ false, /* showCompetitorFilterStatus */ false, /* enableSyncScroller */ false,new ClassicLeaderboardStyle());
/* adjustTimerDelay */ true, /* autoApplyTopNFilter */ false, /* showCompetitorFilterStatus */ false, /* enableSyncScroller */ false,
new ClassicLeaderboardStyle(), FlagImageResolverImpl.get());
return leaderboardPanel;
}
@@ -443,12 +443,12 @@ public class RaceListColumnFactory {
};
}
public static <T extends RaceListRaceDTO> SortableRaceListColumn<T, SimpleCompetitorDTO> getWinnerColumn() {
public static <T extends RaceListRaceDTO> SortableRaceListColumn<T, SimpleCompetitorDTO> getWinnerColumn(FlagImageResolver flagImageResolver) {
Cell<SimpleCompetitorDTO> cell = new AbstractCell<SimpleCompetitorDTO>() {
@Override
public void render(Context context, SimpleCompetitorDTO value, SafeHtmlBuilder sb) {
if (value != null) {
SafeUri flagImageUri = FlagImageResolver.getFlagImageUri(value.getFlagImageURL(),
SafeUri flagImageUri = flagImageResolver.getFlagImageUri(value.getFlagImageURL(),
value.getTwoLetterIsoCountryCode());
String sailIdStyle = CSS.race_item_sailid();
String nameStyle = CSS.race_item_winner();
@@ -16,6 +16,7 @@ import com.sap.sailing.gwt.home.communication.event.minileaderboard.MiniLeaderbo
import com.sap.sailing.gwt.home.shared.app.PlaceNavigation;
import com.sap.sailing.gwt.home.shared.refresh.RefreshableWidget;
import com.sap.sailing.gwt.home.shared.utils.LabelTypeUtil;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.common.client.DateAndTimeFormatterUtil;
@@ -35,9 +36,11 @@ public class StandingsList extends Widget implements RefreshableWidget<GetMiniLe
@UiField DivElement scoreInformationUi;
private final boolean finished;
private final FlagImageResolver flagImageResolver;
public StandingsList(boolean finished, PlaceNavigation<?> headerNavigation) {
public StandingsList(boolean finished, PlaceNavigation<?> headerNavigation, FlagImageResolver flagImageResolver) {
this.finished = finished;
this.flagImageResolver = flagImageResolver;
StandingsResources.INSTANCE.css().ensureInjected();
setElement(uiBinder.createAndBindUi(this));
setVisible(false);
@@ -70,7 +73,7 @@ public class StandingsList extends Widget implements RefreshableWidget<GetMiniLe
boolean showRaceCounts = data.hasDifferentRaceCounts();
for (MiniLeaderboardItemDTO item : data.getItems()) {
itemContainerUi.appendChild(new StandingsListCompetitor(item, showRaceCounts).getElement());
itemContainerUi.appendChild(new StandingsListCompetitor(item, showRaceCounts, flagImageResolver).getElement());
}
}
@@ -28,7 +28,7 @@ public class StandingsListCompetitor extends UIObject {
@UiField ImageElement flagUi;
@UiField DivElement pointsUi;
public StandingsListCompetitor(MiniLeaderboardItemDTO item, boolean showRaceCounts) {
public StandingsListCompetitor(MiniLeaderboardItemDTO item, boolean showRaceCounts, FlagImageResolver flagImageResolver) {
setElement(uiBinder.createAndBindUi(this));
SimpleCompetitorDTO competitor = item.getCompetitor();
@@ -40,7 +40,7 @@ public class StandingsListCompetitor extends UIObject {
pointsString += " (" + i18n.racesCount(item.getRaceCount()) + ")";
}
pointsUi.setInnerText(pointsString);
SafeUri imageUri = FlagImageResolver.getFlagImageUri(competitor.getFlagImageURL(), competitor.getTwoLetterIsoCountryCode());
SafeUri imageUri = flagImageResolver.getFlagImageUri(competitor.getFlagImageURL(), competitor.getTwoLetterIsoCountryCode());
flagUi.setSrc(imageUri.asString());
}
@@ -1,6 +1,11 @@
package com.sap.sailing.gwt.home.desktop.places.event;
import java.util.function.Consumer;
import java.util.function.Function;
import com.google.gwt.activity.shared.Activity;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.sap.sailing.domain.common.dto.EventType;
import com.sap.sailing.gwt.home.communication.eventview.EventViewDTO;
import com.sap.sailing.gwt.home.desktop.HighChartInjector;
@@ -18,6 +23,7 @@ import com.sap.sailing.gwt.home.mobile.places.event.minileaderboard.MiniLeaderbo
import com.sap.sailing.gwt.home.shared.places.event.AbstractEventActivityProxy;
import com.sap.sailing.gwt.home.shared.places.event.AbstractEventPlace;
import com.sap.sailing.gwt.home.shared.places.event.EventContext;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
public class EventActivityProxy extends AbstractEventActivityProxy<EventClientFactory> implements WithHeader {
@@ -40,8 +46,8 @@ public class EventActivityProxy extends AbstractEventActivityProxy<EventClientFa
@Override
public void run() {
if (place instanceof AbstractEventRegattaPlace) {
onSuccess(new EventRegattaActivity((AbstractEventRegattaPlace) place, event, clientFactory,
homePlacesNavigator, getNavigationPathDisplay()));
withFlagImageResolver(flagImageResolver -> new EventRegattaActivity((AbstractEventRegattaPlace) place, event, clientFactory,
homePlacesNavigator, getNavigationPathDisplay(), flagImageResolver));
}
if (place instanceof AbstractMultiregattaEventPlace) {
onSuccess(new EventMultiregattaActivity((AbstractMultiregattaEventPlace) place, event,
@@ -50,6 +56,20 @@ public class EventActivityProxy extends AbstractEventActivityProxy<EventClientFa
}
});
}
private void withFlagImageResolver(final Function<FlagImageResolver, Activity> activityFactory) {
final Consumer<Activity> onSuccess = super::onSuccess;
final Consumer<Throwable> onFailure = super::onFailure;
FlagImageResolver.get(new AsyncCallback<FlagImageResolver>() {
@Override
public void onSuccess(FlagImageResolver result) {
onSuccess.accept(activityFactory.apply(result));
}
@Override
public void onFailure(Throwable caught) {
onFailure.accept(caught);
}
});
}
});
}
@@ -23,6 +23,7 @@ import com.sap.sailing.gwt.home.shared.app.NavigationPathDisplay;
import com.sap.sailing.gwt.home.shared.app.NavigationPathDisplay.NavigationItem;
import com.sap.sailing.gwt.home.shared.app.PlaceNavigation;
import com.sap.sailing.gwt.home.shared.places.event.EventContext;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.leaderboard.LeaderboardEntryPoint;
import com.sap.sse.gwt.client.async.AsyncActionsExecutor;
@@ -39,19 +40,20 @@ import com.sap.sse.security.ui.client.UserService;
* The concrete {@link AbstractEventRegattaPlace} subclass, this instance is bound to.
*/
public class EventRegattaActivity extends AbstractEventActivity<AbstractEventRegattaPlace> implements EventRegattaView.Presenter {
private EventRegattaView currentView = new TabletAndDesktopRegattaEventView();
private EventRegattaView currentView;
private final AsyncActionsExecutor asyncActionsExecutor = new AsyncActionsExecutor();
private final long delayBetweenAutoAdvancesInMilliseconds = LeaderboardEntryPoint.DEFAULT_REFRESH_INTERVAL_MILLIS;
public EventRegattaActivity(AbstractEventRegattaPlace place, EventViewDTO eventDTO, EventClientFactory clientFactory,
DesktopPlacesNavigator homePlacesNavigator, NavigationPathDisplay navigationPathDisplay) {
DesktopPlacesNavigator homePlacesNavigator, NavigationPathDisplay navigationPathDisplay, FlagImageResolver flagImageResolver) {
super(place, eventDTO, clientFactory, homePlacesNavigator);
currentView = new TabletAndDesktopRegattaEventView(flagImageResolver);
if (this.ctx.getRegattaAnalyticsManager() == null) {
ctx.withRegattaAnalyticsManager(new RegattaAnalyticsDataManager(
clientFactory.getSailingService(),
asyncActionsExecutor,
new Timer(PlayModes.Live, PlayStates.Paused, delayBetweenAutoAdvancesInMilliseconds),
clientFactory.getErrorReporter()));
clientFactory.getErrorReporter(), flagImageResolver));
}
initNavigationPath(navigationPathDisplay);
@@ -5,6 +5,7 @@ import com.sap.sailing.gwt.settings.client.leaderboard.MultiCompetitorLeaderboar
import com.sap.sailing.gwt.settings.client.leaderboard.MultiRaceLeaderboardSettings;
import com.sap.sailing.gwt.ui.client.CompetitorSelectionModel;
import com.sap.sailing.gwt.ui.client.DebugIdHelper;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.client.shared.charts.MultiCompetitorLeaderboardChart;
@@ -32,9 +33,12 @@ public class RegattaAnalyticsDataManager {
private final ErrorReporter errorReporter;
private final SailingServiceAsync sailingService;
private final Timer timer;
private final FlagImageResolver flagImageResolver;
public RegattaAnalyticsDataManager(final SailingServiceAsync sailingService,
AsyncActionsExecutor asyncActionsExecutor, Timer timer, ErrorReporter errorReporter) {
AsyncActionsExecutor asyncActionsExecutor, Timer timer, ErrorReporter errorReporter,
FlagImageResolver flagImageResolver) {
this.flagImageResolver = flagImageResolver;
this.competitorSelectionProvider = new CompetitorSelectionModel(/* hasMultiSelection */true);
this.sailingService = sailingService;
this.asyncActionsExecutor = asyncActionsExecutor;
@@ -56,7 +60,8 @@ public class RegattaAnalyticsDataManager {
competitorSelectionProvider, timer, leaderboardGroupName, leaderboardName, errorReporter,
StringMessages.INSTANCE, showRaceDetails, /* competitorSearchTextBox */ null,
/* showSelectionCheckbox */ true, /* raceTimesInfoProvider */ null, autoExpandLastRaceColumn,
/* adjustTimerDelay */ true, /* autoApplyTopNFilter */ false, /* showCompetitorFilterStatus */ false, /* enableSyncScroller */ true,new ClassicLeaderboardStyle());
/* adjustTimerDelay */ true, /* autoApplyTopNFilter */ false, /* showCompetitorFilterStatus */ false, /* enableSyncScroller */ true,
new ClassicLeaderboardStyle(), flagImageResolver);
}
return leaderboardPanel;
}
@@ -21,9 +21,12 @@ import com.sap.sailing.gwt.common.client.controls.tabbar.TabPanelPlaceSelectionE
import com.sap.sailing.gwt.common.client.controls.tabbar.TabView;
import com.sap.sailing.gwt.home.desktop.partials.eventheader.EventHeader;
import com.sap.sailing.gwt.home.desktop.partials.sailorinfo.SailorInfo;
import com.sap.sailing.gwt.home.desktop.places.event.regatta.overviewtab.RegattaOverviewTabView;
import com.sap.sailing.gwt.home.desktop.places.event.regatta.racestab.RegattaRacesTabView;
import com.sap.sailing.gwt.home.shared.app.ApplicationHistoryMapper;
import com.sap.sailing.gwt.home.shared.app.PlaceNavigation;
import com.sap.sailing.gwt.home.shared.places.fakeseries.SeriesDefaultPlace;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sse.gwt.client.LinkUtil;
@@ -40,10 +43,15 @@ public class TabletAndDesktopRegattaEventView extends Composite implements Event
@UiField(provided = true) TabPanel<AbstractEventRegattaPlace, EventRegattaView.Presenter, RegattaTabView<AbstractEventRegattaPlace>> tabPanelUi;
@UiField(provided = true) EventHeader eventHeader;
@UiField(provided = true) RegattaRacesTabView racesTabUi;
@UiField(provided = true) RegattaOverviewTabView regattaOverviewTabUi;
private Presenter currentPresenter;
public TabletAndDesktopRegattaEventView() {
private final FlagImageResolver flagImageResolver;
public TabletAndDesktopRegattaEventView(FlagImageResolver flagImageResolver) {
this.flagImageResolver = flagImageResolver;
}
@Override
@@ -51,6 +59,8 @@ public class TabletAndDesktopRegattaEventView extends Composite implements Event
this.currentPresenter = currentPresenter;
tabPanelUi = new TabPanel<>(currentPresenter, historyMapper);
eventHeader = new EventHeader(currentPresenter);
racesTabUi = new RegattaRacesTabView(flagImageResolver);
regattaOverviewTabUi = new RegattaOverviewTabView(flagImageResolver);
initWidget(uiBinder.createAndBindUi(this));
if(currentPresenter.getEventDTO().getType() == EventType.SERIES) {
@@ -10,10 +10,10 @@
<dp:eventheader.EventHeader ui:field="eventHeader" />
</c:header>
<c:tabcontent title="{i18n.overview}">
<e:overviewtab.RegattaOverviewTabView />
<e:overviewtab.RegattaOverviewTabView ui:field="regattaOverviewTabUi" />
</c:tabcontent>
<c:tabcontent title="{i18n.races}">
<e:racestab.RegattaRacesTabView />
<e:racestab.RegattaRacesTabView ui:field="racesTabUi" />
</c:tabcontent>
<c:tabcontent title="{i18n.leaderboard}">
<e:leaderboardtab.RegattaLeaderboardTabView />
@@ -31,6 +31,7 @@ import com.sap.sailing.gwt.home.shared.partials.statistics.EventStatisticsBox;
import com.sap.sailing.gwt.home.shared.refresh.RefreshManager;
import com.sap.sailing.gwt.home.shared.refresh.RefreshManagerWithErrorAndBusy;
import com.sap.sailing.gwt.home.shared.refresh.RefreshableWidget;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
import com.sap.sailing.gwt.ui.client.StringMessages;
/**
@@ -51,8 +52,10 @@ public class RegattaOverviewTabView extends Composite implements RegattaTabView<
@UiField(provided = true) StandingsList standingsUi;
@UiField(provided = true) EventStatisticsBox statisticsBoxUi;
@UiField RaceOfficeSection raceOfficeSectionUi;
private final FlagImageResolver flagImageResolver;
public RegattaOverviewTabView() {
public RegattaOverviewTabView(FlagImageResolver flagImageResolver) {
this.flagImageResolver = flagImageResolver;
}
@Override
@@ -71,7 +74,9 @@ public class RegattaOverviewTabView extends Composite implements RegattaTabView<
stageUi = new EventOverviewStage(currentPresenter);
statisticsBoxUi = new EventStatisticsBox(false, new DesktopStatisticsBoxView());
final HasRegattaMetadata regattaMetadata = currentPresenter.getRegattaMetadata();
standingsUi = new StandingsList(regattaMetadata != null && regattaMetadata.getState() == RegattaState.FINISHED, currentPresenter.getRegattaLeaderboardNavigation(currentPresenter.getRegattaId()));
standingsUi = new StandingsList(regattaMetadata != null && regattaMetadata.getState() == RegattaState.FINISHED,
currentPresenter.getRegattaLeaderboardNavigation(currentPresenter.getRegattaId()),
flagImageResolver);
initWidget(ourUiBinder.createAndBindUi(this));
if (!currentPresenter.showRegattaMetadata()) {
@@ -53,6 +53,7 @@ import com.sap.sailing.gwt.home.shared.refresh.ActionProvider.AbstractActionProv
import com.sap.sailing.gwt.home.shared.refresh.RefreshManager;
import com.sap.sailing.gwt.home.shared.refresh.RefreshManagerWithErrorAndBusy;
import com.sap.sailing.gwt.home.shared.refresh.RefreshableWidget;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sse.gwt.dispatch.shared.commands.DTO;
import com.sap.sse.gwt.dispatch.shared.commands.ResultWithTTL;
@@ -94,6 +95,12 @@ public class RegattaRacesTabView extends Composite implements RegattaTabView<Reg
private RegattaRacesTabViewFilterPresenter filterPresenter;
private Navigation currentlySelectedTab = Navigation.SORT_LIST_FORMAT;
private RefreshManager refreshManager;
private final FlagImageResolver flagImageResolver;
public RegattaRacesTabView(FlagImageResolver flagImageResolver) {
this.flagImageResolver = flagImageResolver;
}
@Override
public void setPresenter(Presenter currentPresenter) {
@@ -199,7 +206,7 @@ public class RegattaRacesTabView extends Composite implements RegattaTabView<Reg
private final SortableRaceListColumn<RaceListRaceDTO, ?> windSourcesCountColumn = RaceListColumnFactory.getWindSourcesCountColumn();
private final SortableRaceListColumn<RaceListRaceDTO, ?> videoCountColumn = RaceListColumnFactory.getVideoCountColumn();
private final SortableRaceListColumn<RaceListRaceDTO, ?> audioCountColumn = RaceListColumnFactory.getAudioCountColumn();
private final SortableRaceListColumn<RaceListRaceDTO, ?> winnerColumn = RaceListColumnFactory.getWinnerColumn();
private final SortableRaceListColumn<RaceListRaceDTO, ?> winnerColumn = RaceListColumnFactory.getWinnerColumn(flagImageResolver);
private boolean hasWind;
private boolean hasVideos;
private boolean hasAudios;
@@ -11,6 +11,7 @@ import com.sap.sailing.gwt.settings.client.leaderboard.MultiRaceLeaderboardSetti
import com.sap.sailing.gwt.ui.client.CompetitorSelectionChangeListener;
import com.sap.sailing.gwt.ui.client.CompetitorSelectionModel;
import com.sap.sailing.gwt.ui.client.DebugIdHelper;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.client.shared.charts.MultiCompetitorLeaderboardChart;
@@ -43,10 +44,13 @@ public class EventSeriesAnalyticsDataManager {
private final ErrorReporter errorReporter;
private final SailingServiceAsync sailingService;
private final Timer timer;
private final int MAX_COMPETITORS_IN_CHART = 30;
private final int MAX_COMPETITORS_IN_CHART = 30;
private final FlagImageResolver flagImageResolver;
public EventSeriesAnalyticsDataManager(final SailingServiceAsync sailingService,
AsyncActionsExecutor asyncActionsExecutor, Timer timer, ErrorReporter errorReporter) {
AsyncActionsExecutor asyncActionsExecutor, Timer timer, ErrorReporter errorReporter,
FlagImageResolver flagImageResolver) {
this.flagImageResolver = flagImageResolver;
this.competitorSelectionProvider = new CompetitorSelectionModel(/* hasMultiSelection */true);
this.sailingService = sailingService;
this.asyncActionsExecutor = asyncActionsExecutor;
@@ -67,7 +71,8 @@ public class EventSeriesAnalyticsDataManager {
StringMessages.INSTANCE, showRaceDetails, /* competitorSearchTextBox */ null,
/* showSelectionCheckbox */ true,
/* raceTimesInfoProvider */null, autoExpandLastRaceColumn, /* adjustTimerDelay */ true, /* autoApplyTopNFilter */ false,
/* showCompetitorFilterStatus */ false, /* enableSyncScroller */ false, new ClassicLeaderboardStyle());
/* showCompetitorFilterStatus */ false, /* enableSyncScroller */ false, new ClassicLeaderboardStyle(),
flagImageResolver);
}
return overallLeaderboardPanel;
}
@@ -93,7 +98,7 @@ public class EventSeriesAnalyticsDataManager {
multiLeaderboardPanel = new MultiLeaderboardProxyPanel(parent, context, sailingService, metaLeaderboardName,
asyncActionsExecutor, timer, true /* isEmbedded */,
preselectedLeaderboardName, errorReporter, StringMessages.INSTANCE,
showRaceDetails, autoExpandLastRaceColumn, leaderboardSettings);
showRaceDetails, autoExpandLastRaceColumn, leaderboardSettings, flagImageResolver);
}
return multiLeaderboardPanel;
}
@@ -23,6 +23,7 @@ import com.sap.sailing.gwt.home.shared.places.fakeseries.AbstractSeriesPlace;
import com.sap.sailing.gwt.home.shared.places.fakeseries.SeriesContext;
import com.sap.sailing.gwt.home.shared.places.fakeseries.SeriesDefaultPlace;
import com.sap.sailing.gwt.home.shared.places.start.StartPlace;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.client.refresh.ErrorAndBusyClientFactory;
import com.sap.sailing.gwt.ui.leaderboard.LeaderboardEntryPoint;
@@ -49,7 +50,7 @@ public class SeriesActivity extends AbstractActivity implements SeriesView.Prese
private final EventSeriesViewDTO series;
public SeriesActivity(AbstractSeriesTabPlace place, EventSeriesViewDTO series, SeriesClientFactory clientFactory,
DesktopPlacesNavigator homePlacesNavigator, NavigationPathDisplay navigationPathDisplay) {
DesktopPlacesNavigator homePlacesNavigator, NavigationPathDisplay navigationPathDisplay, FlagImageResolver flagImageResolver) {
this.currentPlace = place;
this.series = series;
this.ctx = new SeriesContext(place.getCtx());
@@ -61,7 +62,7 @@ public class SeriesActivity extends AbstractActivity implements SeriesView.Prese
clientFactory.getSailingService(), //
asyncActionsExecutor, //
new Timer(PlayModes.Live, PlayStates.Paused, delayBetweenAutoAdvancesInMilliseconds), //
clientFactory.getErrorReporter()));
clientFactory.getErrorReporter(), flagImageResolver));
}
@@ -1,8 +1,12 @@
package com.sap.sailing.gwt.home.desktop.places.fakeseries;
import java.util.UUID;
import java.util.function.Consumer;
import java.util.function.Function;
import com.google.gwt.activity.shared.Activity;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.sap.sailing.gwt.home.client.place.event.legacy.SeriesClientFactory;
import com.sap.sailing.gwt.home.communication.fakeseries.EventSeriesViewDTO;
import com.sap.sailing.gwt.home.communication.fakeseries.GetEventSeriesViewAction;
@@ -18,6 +22,7 @@ import com.sap.sailing.gwt.home.shared.app.ProvidesNavigationPath;
import com.sap.sailing.gwt.home.shared.places.fakeseries.AbstractSeriesPlace;
import com.sap.sailing.gwt.home.shared.places.fakeseries.SeriesContext;
import com.sap.sailing.gwt.home.shared.places.fakeseries.SeriesDefaultPlace;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
import com.sap.sse.gwt.client.mvp.AbstractActivityProxy;
public class SeriesActivityProxy extends AbstractActivityProxy implements ProvidesNavigationPath, WithHeader {
@@ -65,8 +70,22 @@ public class SeriesActivityProxy extends AbstractActivityProxy implements Provid
@Override
public void run() {
onSuccess(new SeriesActivity((AbstractSeriesTabPlace) place, series, clientFactory,
homePlacesNavigator, navigationPathDisplay));
withFlagImageResolver(flagImageResolver -> new SeriesActivity((AbstractSeriesTabPlace) place, series, clientFactory,
homePlacesNavigator, navigationPathDisplay, flagImageResolver));
}
});
}
private void withFlagImageResolver(final Function<FlagImageResolver, Activity> activityFactory) {
final Consumer<Activity> onSuccess = super::onSuccess;
final Consumer<Throwable> onFailure = super::onFailure;
FlagImageResolver.get(new AsyncCallback<FlagImageResolver>() {
@Override
public void onSuccess(FlagImageResolver result) {
onSuccess.accept(activityFactory.apply(result));
}
@Override
public void onFailure(Throwable caught) {
onFailure.accept(caught);
}
});
}
@@ -12,8 +12,10 @@ import com.sap.sailing.gwt.common.client.SharedResources;
import com.sap.sailing.gwt.common.client.controls.tabbar.TabPanel;
import com.sap.sailing.gwt.common.client.controls.tabbar.TabPanelPlaceSelectionEvent;
import com.sap.sailing.gwt.common.client.controls.tabbar.TabView;
import com.sap.sailing.gwt.home.desktop.places.user.profile.preferencestab.UserProfilePreferencesTabView;
import com.sap.sailing.gwt.home.shared.app.ApplicationHistoryMapper;
import com.sap.sailing.gwt.home.shared.places.user.profile.AbstractUserProfilePlace;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sse.security.ui.authentication.app.AuthenticationContext;
import com.sap.sse.security.ui.userprofile.desktop.userheader.UserHeader;
@@ -35,8 +37,14 @@ public class TabletAndDesktopUserProfileView extends Composite implements UserPr
@UiField(provided = true)
UserHeader headerUi;
@UiField(provided = true)
UserProfilePreferencesTabView preferencesTabUi;
public TabletAndDesktopUserProfileView() {
private final FlagImageResolver flagImageResolver;
public TabletAndDesktopUserProfileView(FlagImageResolver flagImageResolver) {
this.flagImageResolver = flagImageResolver;
}
@Override
@@ -46,6 +54,8 @@ public class TabletAndDesktopUserProfileView extends Composite implements UserPr
headerUi = new UserHeader(SharedResources.INSTANCE);
preferencesTabUi = new UserProfilePreferencesTabView(flagImageResolver);
initWidget(uiBinder.createAndBindUi(this));
}
@@ -16,6 +16,7 @@ import com.sap.sailing.gwt.home.shared.app.PlaceNavigation;
import com.sap.sailing.gwt.home.shared.places.fakeseries.AbstractSeriesPlace;
import com.sap.sailing.gwt.home.shared.places.start.StartPlace;
import com.sap.sailing.gwt.home.shared.places.user.profile.AbstractUserProfilePlace;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
import com.sap.sse.security.ui.authentication.AuthenticationContextEvent;
import com.sap.sse.security.ui.authentication.AuthenticationPlaces;
import com.sap.sse.security.ui.authentication.AuthenticationRequestEvent;
@@ -31,13 +32,14 @@ public class UserProfileActivity extends AbstractActivity implements UserProfile
private final StringMessages i18n_sec = StringMessages.INSTANCE;
private UserProfileView<AbstractUserProfilePlace, UserProfileView.Presenter> currentView = new TabletAndDesktopUserProfileView();
private UserProfileView<AbstractUserProfilePlace, UserProfileView.Presenter> currentView;
public UserProfileActivity(AbstractUserProfilePlace place, UserProfileClientFactory clientFactory,
DesktopPlacesNavigator homePlacesNavigator, NavigationPathDisplay navigationPathDisplay) {
DesktopPlacesNavigator homePlacesNavigator, NavigationPathDisplay navigationPathDisplay, FlagImageResolver flagImageResolver) {
this.currentPlace = place;
this.clientFactory = clientFactory;
this.homePlacesNavigator = homePlacesNavigator;
currentView = new TabletAndDesktopUserProfileView(flagImageResolver);
initNavigationPath(navigationPathDisplay);
}
@@ -1,6 +1,11 @@
package com.sap.sailing.gwt.home.desktop.places.user.profile;
import java.util.function.Consumer;
import java.util.function.Function;
import com.google.gwt.activity.shared.Activity;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.sap.sailing.gwt.home.desktop.app.DesktopPlacesNavigator;
import com.sap.sailing.gwt.home.desktop.app.WithHeader;
import com.sap.sailing.gwt.home.shared.app.NavigationPathDisplay;
@@ -8,6 +13,7 @@ import com.sap.sailing.gwt.home.shared.app.ProvidesNavigationPath;
import com.sap.sailing.gwt.home.shared.places.user.profile.AbstractUserProfilePlace;
import com.sap.sailing.gwt.home.shared.places.user.profile.UserProfileDefaultPlace;
import com.sap.sailing.gwt.home.shared.places.user.profile.UserProfileDetailsPlace;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
import com.sap.sse.gwt.client.mvp.AbstractActivityProxy;
public class UserProfileActivityProxy extends AbstractActivityProxy implements ProvidesNavigationPath, WithHeader {
@@ -37,8 +43,22 @@ public class UserProfileActivityProxy extends AbstractActivityProxy implements P
if(place instanceof UserProfileDefaultPlace) {
place = new UserProfileDetailsPlace();
}
super.onSuccess(new UserProfileActivity(place, clientFactory,
homePlacesNavigator, navigationPathDisplay));
withFlagImageResolver(flagImageResolver -> new UserProfileActivity(place, clientFactory,
homePlacesNavigator, navigationPathDisplay, flagImageResolver));
}
private void withFlagImageResolver(final Function<FlagImageResolver, Activity> activityFactory) {
final Consumer<Activity> onSuccess = super::onSuccess;
final Consumer<Throwable> onFailure = super::onFailure;
FlagImageResolver.get(new AsyncCallback<FlagImageResolver>() {
@Override
public void onSuccess(FlagImageResolver result) {
onSuccess.accept(activityFactory.apply(result));
}
@Override
public void onFailure(Throwable caught) {
onFailure.accept(caught);
}
});
}
});
}
@@ -6,12 +6,18 @@ import com.sap.sailing.gwt.common.client.controls.tabbar.TabView;
import com.sap.sailing.gwt.home.desktop.places.user.profile.UserProfileTabView;
import com.sap.sailing.gwt.home.desktop.places.user.profile.UserProfileView;
import com.sap.sailing.gwt.home.shared.places.user.profile.preferences.UserProfilePreferencesPlace;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
import com.sap.sse.security.ui.authentication.app.AuthenticationContext;
public class UserProfilePreferencesTabView extends Composite implements UserProfileTabView<UserProfilePreferencesPlace> {
private UserProfilePreferencesView.Presenter currentPresenter;
private UserProfilePreferencesView view;
private final FlagImageResolver flagImageResolver;
public UserProfilePreferencesTabView(FlagImageResolver flagImageResolver) {
this.flagImageResolver = flagImageResolver;
}
@Override
public Class<UserProfilePreferencesPlace> getPlaceClassForActivation() {
@@ -44,7 +50,7 @@ public class UserProfilePreferencesTabView extends Composite implements UserProf
@Override
public void setPresenter(UserProfileView.Presenter currentPresenter) {
view = new UserProfilePreferencesViewImpl();
view = new UserProfilePreferencesViewImpl(flagImageResolver);
this.currentPresenter = new UserProfilePreferencesPresenter(view, currentPresenter);
}
}
@@ -7,6 +7,7 @@ import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.sap.sailing.gwt.home.shared.places.user.profile.preferences.UserPreferences;
import com.sap.sailing.gwt.home.shared.usermanagement.decorator.AuthorizedContentDecoratorDesktop;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
import com.sap.sse.security.ui.authentication.app.NeedsAuthenticationContext;
public class UserProfilePreferencesViewImpl extends Composite implements UserProfilePreferencesView {
@@ -18,11 +19,17 @@ public class UserProfilePreferencesViewImpl extends Composite implements UserPro
@UiField(provided = true) AuthorizedContentDecoratorDesktop decoratorUi;
@UiField(provided = true) UserPreferences userPreferencesUi;
private final FlagImageResolver flagImageResolver;
public UserProfilePreferencesViewImpl(FlagImageResolver flagImageResolver) {
this.flagImageResolver = flagImageResolver;
}
@Override
public void setPresenter(Presenter presenter) {
decoratorUi = new AuthorizedContentDecoratorDesktop(presenter);
userPreferencesUi = new UserPreferences(presenter.getUserPreferencesPresenter());
userPreferencesUi = new UserPreferences(presenter.getUserPreferencesPresenter(), flagImageResolver);
initWidget(uiBinder.createAndBindUi(this));
}
@@ -20,6 +20,7 @@ import com.sap.sailing.gwt.home.mobile.partials.sectionHeader.SectionHeaderConte
import com.sap.sailing.gwt.home.mobile.partials.toggleButton.BigButton;
import com.sap.sailing.gwt.home.shared.app.PlaceNavigation;
import com.sap.sailing.gwt.home.shared.refresh.RefreshableWidget;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.common.client.DateAndTimeFormatterUtil;
@@ -38,9 +39,12 @@ public class MinileaderboardBox extends Composite implements RefreshableWidget<G
private PlaceNavigation<?> placeNavigation = null;
private boolean isOverall;
private final FlagImageResolver flagImageResolver;
public MinileaderboardBox(boolean isOverall) {
public MinileaderboardBox(boolean isOverall, FlagImageResolver flagImageResolver) {
this.isOverall = isOverall;
this.flagImageResolver = flagImageResolver;
initWidget(uiBinder.createAndBindUi(this));
}
@@ -78,7 +82,7 @@ public class MinileaderboardBox extends Composite implements RefreshableWidget<G
}
boolean showRaceCounts = data.hasDifferentRaceCounts();
for (MiniLeaderboardItemDTO item : data.getItems()) {
itemContainerUi.addContent(new MinileaderboardBoxItem(item, showRaceCounts));
itemContainerUi.addContent(new MinileaderboardBoxItem(item, showRaceCounts, flagImageResolver));
}
if (showRaceCounts) {
itemContainerUi.addContent(new MinileaderboardBoxItemLegend());
@@ -25,7 +25,7 @@ public class MinileaderboardBoxItem extends Widget {
@UiField Element competitorCountryNameUi;
@UiField ImageElement competitorFlagUi;
public MinileaderboardBoxItem(MiniLeaderboardItemDTO entry, boolean showRaceCount) {
public MinileaderboardBoxItem(MiniLeaderboardItemDTO entry, boolean showRaceCount, FlagImageResolver flagImageResolver) {
setElement(uiBinder.createAndBindUi(this));
competitorNameUi.setInnerText(entry.getCompetitor().getName());
competitorCountryNameUi.setInnerText(String.valueOf(entry.getCompetitor().getSailID()));
@@ -38,7 +38,7 @@ public class MinileaderboardBoxItem extends Widget {
SimpleCompetitorDTO competitor = entry.getCompetitor();
String flagImageURL = competitor.getFlagImageURL();
String twoLetterIsoCountryCode = competitor.getTwoLetterIsoCountryCode();
SafeUri imageUri = FlagImageResolver.getFlagImageUri(flagImageURL, twoLetterIsoCountryCode);
SafeUri imageUri = flagImageResolver.getFlagImageUri(flagImageURL, twoLetterIsoCountryCode);
competitorFlagUi.setSrc(imageUri.asString());
}
}
@@ -1,6 +1,11 @@
package com.sap.sailing.gwt.home.mobile.places.event;
import java.util.function.Consumer;
import java.util.function.Function;
import com.google.gwt.activity.shared.Activity;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.sap.sailing.gwt.home.communication.eventview.EventViewDTO;
import com.sap.sailing.gwt.home.desktop.places.event.multiregatta.mediatab.MultiregattaMediaPlace;
import com.sap.sailing.gwt.home.desktop.places.event.multiregatta.overviewtab.MultiregattaOverviewPlace;
@@ -19,6 +24,7 @@ import com.sap.sailing.gwt.home.mobile.places.event.overview.regatta.RegattaActi
import com.sap.sailing.gwt.home.mobile.places.event.races.RacesActivity;
import com.sap.sailing.gwt.home.shared.places.event.AbstractEventActivityProxy;
import com.sap.sailing.gwt.home.shared.places.event.AbstractEventPlace;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
public class EventActivityProxy extends AbstractEventActivityProxy<MobileApplicationClientFactory> {
@@ -35,17 +41,32 @@ public class EventActivityProxy extends AbstractEventActivityProxy<MobileApplica
if (place instanceof MultiregattaOverviewPlace || place instanceof MultiregattaRegattasPlace) {
super.onSuccess(new MultiRegattaActivity(place, event, getNavigationPathDisplay(), clientFactory));
} else if (place instanceof RegattaOverviewPlace) {
super.onSuccess(new RegattaActivity((RegattaOverviewPlace) place, event, getNavigationPathDisplay(), clientFactory));
withFlagImageResolver(flagImageResolver -> new RegattaActivity((RegattaOverviewPlace) place, event, getNavigationPathDisplay(), clientFactory, flagImageResolver));
} else if (place instanceof RegattaRacesPlace) {
super.onSuccess(new RacesActivity((RegattaRacesPlace) place, event, getNavigationPathDisplay(), clientFactory));
} else if (place instanceof MiniLeaderboardPlace) {
super.onSuccess(new MiniLeaderboardActivity((MiniLeaderboardPlace) place, event, getNavigationPathDisplay(), clientFactory));
withFlagImageResolver(flagImageResolver -> new MiniLeaderboardActivity((MiniLeaderboardPlace) place, event, getNavigationPathDisplay(), clientFactory, flagImageResolver));
} else if (place instanceof LatestNewsPlace) {
super.onSuccess(new LatestNewsActivity((LatestNewsPlace) place, event, getNavigationPathDisplay(), clientFactory));
} else if (place instanceof RegattaMediaPlace || place instanceof MultiregattaMediaPlace) {
super.onSuccess(new MediaActivity(place, event, getNavigationPathDisplay(), clientFactory));
}
}
private void withFlagImageResolver(final Function<FlagImageResolver, Activity> activityFactory) {
final Consumer<Activity> onSuccess = super::onSuccess;
final Consumer<Throwable> onFailure = super::onFailure;
FlagImageResolver.get(new AsyncCallback<FlagImageResolver>() {
@Override
public void onSuccess(FlagImageResolver result) {
onSuccess.accept(activityFactory.apply(result));
}
@Override
public void onFailure(Throwable caught) {
onFailure.accept(caught);
}
});
}
});
}
}
@@ -9,12 +9,16 @@ import com.sap.sailing.gwt.home.mobile.places.event.EventViewBase;
import com.sap.sailing.gwt.home.mobile.places.event.minileaderboard.MiniLeaderboardView.Presenter;
import com.sap.sailing.gwt.home.shared.app.NavigationPathDisplay;
import com.sap.sailing.gwt.home.shared.app.NavigationPathDisplay.NavigationItem;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
import com.sap.sailing.gwt.ui.client.StringMessages;
public class MiniLeaderboardActivity extends AbstractEventActivity<MiniLeaderboardPlace> implements Presenter {
public MiniLeaderboardActivity(MiniLeaderboardPlace place, EventViewDTO eventDTO, NavigationPathDisplay navigationPathDisplay, MobileApplicationClientFactory clientFactory) {
private final FlagImageResolver flagImageResolver;
public MiniLeaderboardActivity(MiniLeaderboardPlace place, EventViewDTO eventDTO, NavigationPathDisplay navigationPathDisplay, MobileApplicationClientFactory clientFactory, FlagImageResolver flagImageResolver) {
super(place, eventDTO, clientFactory);
this.flagImageResolver = flagImageResolver;
initNavigationPath(navigationPathDisplay);
}
@@ -27,7 +31,7 @@ public class MiniLeaderboardActivity extends AbstractEventActivity<MiniLeaderboa
@Override
protected EventViewBase initView() {
final MiniLeaderboardView view = new MiniLeaderboardViewImpl(this);
final MiniLeaderboardView view = new MiniLeaderboardViewImpl(this, flagImageResolver);
initQuickfinder(view, true);
return view;
}
@@ -4,6 +4,7 @@ import com.sap.sailing.gwt.home.communication.event.minileaderboard.GetMiniLeade
import com.sap.sailing.gwt.home.communication.event.minileaderboard.GetMiniLeaderbordAction;
import com.sap.sailing.gwt.home.mobile.partials.minileaderboard.MinileaderboardBox;
import com.sap.sailing.gwt.home.mobile.places.event.AbstractEventView;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
import com.sap.sailing.gwt.ui.client.StringMessages;
public class MiniLeaderboardViewImpl extends AbstractEventView<MiniLeaderboardView.Presenter> implements MiniLeaderboardView {
@@ -12,9 +13,9 @@ public class MiniLeaderboardViewImpl extends AbstractEventView<MiniLeaderboardVi
private final MinileaderboardBox minileaderboard;
public MiniLeaderboardViewImpl(MiniLeaderboardView.Presenter presenter) {
public MiniLeaderboardViewImpl(MiniLeaderboardView.Presenter presenter, FlagImageResolver flagImageResolver) {
super(presenter, presenter.isMultiRegattaEvent(), true, presenter.getRegatta() != null);
setViewContent(minileaderboard = new MinileaderboardBox(false));
setViewContent(minileaderboard = new MinileaderboardBox(false, flagImageResolver));
if(presenter.getRegatta() != null) {
refreshManager.add(minileaderboard, new GetMiniLeaderbordAction(getEventId(), getRegattaId()));
} else {
@@ -10,11 +10,15 @@ import com.sap.sailing.gwt.home.mobile.places.event.EventViewBase;
import com.sap.sailing.gwt.home.mobile.places.event.overview.AbstractEventOverview;
import com.sap.sailing.gwt.home.shared.app.NavigationPathDisplay;
import com.sap.sailing.gwt.home.shared.app.NavigationPathDisplay.NavigationItem;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
public class RegattaActivity extends AbstractEventActivity<RegattaOverviewPlace> implements EventViewBase.Presenter {
public RegattaActivity(RegattaOverviewPlace place, EventViewDTO eventDTO, NavigationPathDisplay navigationPathDisplay, MobileApplicationClientFactory clientFactory) {
private final FlagImageResolver flagImageResolver;
public RegattaActivity(RegattaOverviewPlace place, EventViewDTO eventDTO, NavigationPathDisplay navigationPathDisplay, MobileApplicationClientFactory clientFactory, FlagImageResolver flagImageResolver) {
super(place, eventDTO, clientFactory);
this.flagImageResolver = flagImageResolver;
initNavigationPath(navigationPathDisplay);
}
@@ -25,7 +29,7 @@ public class RegattaActivity extends AbstractEventActivity<RegattaOverviewPlace>
@Override
protected EventViewBase initView() {
final AbstractEventOverview view = new RegattaOverviewImpl(this);
final AbstractEventOverview view = new RegattaOverviewImpl(this, flagImageResolver);
initSeriesNavigation(view);
initQuickfinder(view, true);
if (!isMultiRegattaEvent()) {
@@ -19,6 +19,7 @@ import com.sap.sailing.gwt.home.mobile.partials.quickfinder.Quickfinder;
import com.sap.sailing.gwt.home.mobile.places.QuickfinderPresenter;
import com.sap.sailing.gwt.home.mobile.places.event.EventViewBase;
import com.sap.sailing.gwt.home.mobile.places.event.overview.AbstractEventOverview;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
import com.sap.sailing.gwt.ui.client.StringMessages;
public class RegattaOverviewImpl extends AbstractEventOverview {
@@ -28,8 +29,11 @@ public class RegattaOverviewImpl extends AbstractEventOverview {
private EventSteps eventStepsUi;
private RegattaLiveRaces liveRacesUi;
public RegattaOverviewImpl(EventViewBase.Presenter presenter) {
private final FlagImageResolver flagImageResolver;
public RegattaOverviewImpl(EventViewBase.Presenter presenter, FlagImageResolver flagImageResolver) {
super(presenter, presenter.isMultiRegattaEvent(), presenter.isMultiRegattaEvent());
this.flagImageResolver = flagImageResolver;
FlowPanel container = new FlowPanel();
if (presenter.getRegatta() != null) {
this.setupProgress(container);
@@ -62,7 +66,7 @@ public class RegattaOverviewImpl extends AbstractEventOverview {
}
private void setupMiniLeaderboard(Panel container) {
MinileaderboardBox miniLeaderboard = new MinileaderboardBox(false);
MinileaderboardBox miniLeaderboard = new MinileaderboardBox(false, flagImageResolver);
miniLeaderboard.setAction(MSG.showAll(), currentPresenter.getRegattaMiniLeaderboardNavigation(getRegattaId()));
if (currentPresenter.getRegatta() != null) {
refreshManager.add(miniLeaderboard, new GetMiniLeaderbordAction(getEventId(), getRegattaId(), 3));
@@ -18,17 +18,20 @@ import com.sap.sailing.gwt.home.shared.app.NavigationPathDisplay.NavigationItem;
import com.sap.sailing.gwt.home.shared.app.PlaceNavigation;
import com.sap.sailing.gwt.home.shared.places.fakeseries.AbstractSeriesPlace;
import com.sap.sailing.gwt.home.shared.places.fakeseries.SeriesContext;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
public class SeriesActivity extends AbstractActivity implements SeriesView.Presenter {
private final MobileApplicationClientFactory clientFactory;
private final AbstractSeriesPlace place;
private EventSeriesViewDTO series;
private final NavigationPathDisplay navigationPathDisplay;
private final FlagImageResolver flagImageResolver;
public SeriesActivity(AbstractSeriesPlace place, NavigationPathDisplay navigationPathDisplay, MobileApplicationClientFactory clientFactory) {
public SeriesActivity(AbstractSeriesPlace place, NavigationPathDisplay navigationPathDisplay, MobileApplicationClientFactory clientFactory, FlagImageResolver flagImageResolver) {
this.navigationPathDisplay = navigationPathDisplay;
this.clientFactory = clientFactory;
this.place = place;
this.flagImageResolver = flagImageResolver;
}
@Override
@@ -46,7 +49,7 @@ public class SeriesActivity extends AbstractActivity implements SeriesView.Prese
}
private void initUi(final AcceptsOneWidget panel, EventBus eventBus, EventSeriesViewDTO series) {
final SeriesView view = new SeriesViewImpl(this);
final SeriesView view = new SeriesViewImpl(this, flagImageResolver);
view.setQuickFinderValues(series.getDisplayName(), series.getEventsDescending());
panel.setWidget(view.asWidget());
@@ -1,10 +1,16 @@
package com.sap.sailing.gwt.home.mobile.places.series;
import java.util.function.Consumer;
import java.util.function.Function;
import com.google.gwt.activity.shared.Activity;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.sap.sailing.gwt.home.mobile.app.MobileApplicationClientFactory;
import com.sap.sailing.gwt.home.shared.app.NavigationPathDisplay;
import com.sap.sailing.gwt.home.shared.app.ProvidesNavigationPath;
import com.sap.sailing.gwt.home.shared.places.fakeseries.AbstractSeriesPlace;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
import com.sap.sse.gwt.client.mvp.AbstractActivityProxy;
public class SeriesActivityProxy extends AbstractActivityProxy implements ProvidesNavigationPath {
@@ -28,7 +34,21 @@ public class SeriesActivityProxy extends AbstractActivityProxy implements Provid
GWT.runAsync(new AbstractRunAsyncCallback() {
@Override
public void onSuccess() {
super.onSuccess(new SeriesActivity(currentPlace, navigationPathDisplay, clientFactory));
withFlagImageResolver(flagImageResolver -> new SeriesActivity(currentPlace, navigationPathDisplay, clientFactory, flagImageResolver));
}
private void withFlagImageResolver(final Function<FlagImageResolver, Activity> activityFactory) {
final Consumer<Activity> onSuccess = super::onSuccess;
final Consumer<Throwable> onFailure = super::onFailure;
FlagImageResolver.get(new AsyncCallback<FlagImageResolver>() {
@Override
public void onSuccess(FlagImageResolver result) {
onSuccess.accept(activityFactory.apply(result));
}
@Override
public void onFailure(Throwable caught) {
onFailure.accept(caught);
}
});
}
});
}
@@ -22,6 +22,7 @@ import com.sap.sailing.gwt.home.mobile.places.QuickfinderPresenter;
import com.sap.sailing.gwt.home.shared.partials.statistics.EventStatisticsBox;
import com.sap.sailing.gwt.home.shared.refresh.LifecycleRefreshManager;
import com.sap.sailing.gwt.home.shared.refresh.RefreshManager;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
import com.sap.sailing.gwt.ui.client.StringMessages;
public class SeriesViewImpl extends Composite implements SeriesView {
@@ -40,13 +41,13 @@ public class SeriesViewImpl extends Composite implements SeriesView {
private final Presenter currentPresenter;
private final RefreshManager refreshManager;
public SeriesViewImpl(SeriesView.Presenter presenter) {
public SeriesViewImpl(SeriesView.Presenter presenter, FlagImageResolver flagImageResolver) {
this.currentPresenter = presenter;
this.refreshManager = new LifecycleRefreshManager(this, currentPresenter.getDispatch());
EventSeriesViewDTO series = currentPresenter.getSeriesDTO();
eventHeaderUi = new SeriesHeader(series);
this.setupStatisticsBox(series);
leaderboardUi = new MinileaderboardBox(true);
leaderboardUi = new MinileaderboardBox(true, flagImageResolver);
initWidget(uiBinder.createAndBindUi(this));
this.setupListContent(series);
this.setupEventListContent(series);
@@ -17,6 +17,7 @@ import com.sap.sailing.gwt.home.shared.app.PlaceNavigation;
import com.sap.sailing.gwt.home.shared.app.NavigationPathDisplay.NavigationItem;
import com.sap.sailing.gwt.home.shared.places.fakeseries.SeriesContext;
import com.sap.sailing.gwt.home.shared.places.fakeseries.SeriesDefaultPlace;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
import com.sap.sailing.gwt.ui.client.StringMessages;
public class SeriesMiniOverallLeaderboardActivity extends AbstractActivity implements SeriesMiniOverallLeaderboardView.Presenter {
@@ -24,11 +25,13 @@ public class SeriesMiniOverallLeaderboardActivity extends AbstractActivity imple
private final SeriesMiniOverallLeaderboardPlace place;
private EventSeriesViewDTO series;
private final NavigationPathDisplay navigationPathDisplay;
private final FlagImageResolver flagImageResolver;
public SeriesMiniOverallLeaderboardActivity(SeriesMiniOverallLeaderboardPlace place, NavigationPathDisplay navigationPathDisplay, MobileApplicationClientFactory clientFactory) {
public SeriesMiniOverallLeaderboardActivity(SeriesMiniOverallLeaderboardPlace place, NavigationPathDisplay navigationPathDisplay, MobileApplicationClientFactory clientFactory, FlagImageResolver flagImageResolver) {
this.navigationPathDisplay = navigationPathDisplay;
this.clientFactory = clientFactory;
this.place = place;
this.flagImageResolver = flagImageResolver;
}
@Override
@@ -47,7 +50,7 @@ public class SeriesMiniOverallLeaderboardActivity extends AbstractActivity imple
}
private void initUi(AcceptsOneWidget panel, EventBus eventBus, EventSeriesViewDTO series) {
final SeriesMiniOverallLeaderboardView view = new SeriesMiniOverallLeaderboardViewImpl(this);
final SeriesMiniOverallLeaderboardView view = new SeriesMiniOverallLeaderboardViewImpl(this, flagImageResolver);
view.setQuickFinderValues(series.getDisplayName(), series.getEventsDescending());
panel.setWidget(view.asWidget());
@@ -1,9 +1,15 @@
package com.sap.sailing.gwt.home.mobile.places.series.minileaderboard;
import java.util.function.Consumer;
import java.util.function.Function;
import com.google.gwt.activity.shared.Activity;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.sap.sailing.gwt.home.mobile.app.MobileApplicationClientFactory;
import com.sap.sailing.gwt.home.shared.app.NavigationPathDisplay;
import com.sap.sailing.gwt.home.shared.app.ProvidesNavigationPath;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
import com.sap.sse.gwt.client.mvp.AbstractActivityProxy;
public class SeriesMiniOverallLeaderboardActivityProxy extends AbstractActivityProxy implements ProvidesNavigationPath {
@@ -27,8 +33,23 @@ public class SeriesMiniOverallLeaderboardActivityProxy extends AbstractActivityP
GWT.runAsync(new AbstractRunAsyncCallback() {
@Override
public void onSuccess() {
super.onSuccess(new SeriesMiniOverallLeaderboardActivity(currentPlace, navigationPathDisplay, clientFactory));
withFlagImageResolver(flagImageResolver -> new SeriesMiniOverallLeaderboardActivity(currentPlace, navigationPathDisplay, clientFactory, flagImageResolver));
}
private void withFlagImageResolver(final Function<FlagImageResolver, Activity> activityFactory) {
final Consumer<Activity> onSuccess = super::onSuccess;
final Consumer<Throwable> onFailure = super::onFailure;
FlagImageResolver.get(new AsyncCallback<FlagImageResolver>() {
@Override
public void onSuccess(FlagImageResolver result) {
onSuccess.accept(activityFactory.apply(result));
}
@Override
public void onFailure(Throwable caught) {
onFailure.accept(caught);
}
});
}
});
}
}
@@ -17,6 +17,7 @@ import com.sap.sailing.gwt.home.mobile.places.QuickfinderPresenter;
import com.sap.sailing.gwt.home.shared.places.fakeseries.SeriesContext;
import com.sap.sailing.gwt.home.shared.refresh.LifecycleRefreshManager;
import com.sap.sailing.gwt.home.shared.refresh.RefreshManager;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
import com.sap.sailing.gwt.ui.client.StringMessages;
public class SeriesMiniOverallLeaderboardViewImpl extends Composite implements SeriesMiniOverallLeaderboardView {
@@ -33,9 +34,9 @@ public class SeriesMiniOverallLeaderboardViewImpl extends Composite implements S
@UiField(provided = true)
MinileaderboardBox minileaderboardUi;
public SeriesMiniOverallLeaderboardViewImpl(Presenter presenter) {
public SeriesMiniOverallLeaderboardViewImpl(Presenter presenter, FlagImageResolver flagImageResolver) {
this.currentPresenter = presenter;
minileaderboardUi = new MinileaderboardBox(true);
minileaderboardUi = new MinileaderboardBox(true, flagImageResolver);
eventHeaderUi = new SeriesHeader(presenter.getSeriesDTO(), presenter.getSeriesNavigation());
initWidget(uiBinder.createAndBindUi(this));
RefreshManager refreshManager = new LifecycleRefreshManager(this, currentPresenter.getDispatch());
@@ -1,6 +1,11 @@
package com.sap.sailing.gwt.home.mobile.places.user.profile;
import java.util.function.Consumer;
import java.util.function.Function;
import com.google.gwt.activity.shared.Activity;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.sap.sailing.gwt.home.mobile.app.MobileApplicationClientFactory;
import com.sap.sailing.gwt.home.mobile.places.user.profile.details.UserProfileDetailsActivity;
import com.sap.sailing.gwt.home.mobile.places.user.profile.preferences.UserProfilePreferencesActivity;
@@ -8,6 +13,7 @@ import com.sap.sailing.gwt.home.mobile.places.user.profile.settings.UserProfileS
import com.sap.sailing.gwt.home.shared.places.user.profile.AbstractUserProfilePlace;
import com.sap.sailing.gwt.home.shared.places.user.profile.preferences.UserProfilePreferencesPlace;
import com.sap.sailing.gwt.home.shared.places.user.profile.settings.UserProfileSettingsPlace;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
import com.sap.sse.gwt.client.mvp.AbstractActivityProxy;
public class UserProfileActivityProxy extends AbstractActivityProxy {
@@ -27,13 +33,27 @@ public class UserProfileActivityProxy extends AbstractActivityProxy {
public void onSuccess() {
if (currentPlace instanceof UserProfilePreferencesPlace) {
UserProfilePreferencesPlace userProfilePrefsPlace = (UserProfilePreferencesPlace) currentPlace;
super.onSuccess(new UserProfilePreferencesActivity(userProfilePrefsPlace, clientFactory));
withFlagImageResolver(flagImageResolver -> new UserProfilePreferencesActivity(userProfilePrefsPlace, clientFactory, flagImageResolver));
} else if(currentPlace instanceof UserProfileSettingsPlace) {
super.onSuccess(new UserProfileSettingsActivity((UserProfileSettingsPlace) currentPlace, clientFactory));
} else {
super.onSuccess(new UserProfileDetailsActivity(currentPlace, clientFactory));
}
}
private void withFlagImageResolver(final Function<FlagImageResolver, Activity> activityFactory) {
final Consumer<Activity> onSuccess = super::onSuccess;
final Consumer<Throwable> onFailure = super::onFailure;
FlagImageResolver.get(new AsyncCallback<FlagImageResolver>() {
@Override
public void onSuccess(FlagImageResolver result) {
onSuccess.accept(activityFactory.apply(result));
}
@Override
public void onFailure(Throwable caught) {
onFailure.accept(caught);
}
});
}
});
}
}
@@ -7,6 +7,7 @@ import com.sap.sailing.gwt.home.mobile.places.user.profile.AbstractUserProfileAc
import com.sap.sailing.gwt.home.shared.places.user.profile.preferences.UserPreferencesPresenter;
import com.sap.sailing.gwt.home.shared.places.user.profile.preferences.UserPreferencesView;
import com.sap.sailing.gwt.home.shared.places.user.profile.preferences.UserPreferencesView.Presenter;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
import com.sap.sailing.gwt.home.shared.places.user.profile.preferences.UserProfilePreferencesPlace;
import com.sap.sse.security.ui.authentication.AuthenticationContextEvent;
@@ -16,10 +17,10 @@ public class UserProfilePreferencesActivity extends AbstractUserProfileActivity
private final UserProfilePreferencesView currentView;
public UserProfilePreferencesActivity(UserProfilePreferencesPlace place,
MobileApplicationClientFactory clientFactory) {
MobileApplicationClientFactory clientFactory, FlagImageResolver flagImageResolver) {
super(clientFactory);
this.userPreferencesPresenter = new UserPreferencesPresenter<MobileApplicationClientFactory>(clientFactory);
this.currentView = new UserProfilePreferencesViewImpl(this);
this.currentView = new UserProfilePreferencesViewImpl(this, flagImageResolver);
}
@Override
@@ -3,14 +3,15 @@ package com.sap.sailing.gwt.home.mobile.places.user.profile.preferences;
import com.sap.sailing.gwt.home.mobile.places.user.profile.AbstractUserProfileView;
import com.sap.sailing.gwt.home.shared.places.user.profile.preferences.UserPreferences;
import com.sap.sailing.gwt.home.shared.places.user.profile.preferences.UserPreferencesView;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
public class UserProfilePreferencesViewImpl extends AbstractUserProfileView implements UserProfilePreferencesView {
private final UserPreferencesView userPreferencesView;
public UserProfilePreferencesViewImpl(UserProfilePreferencesView.Presenter presenter) {
public UserProfilePreferencesViewImpl(UserProfilePreferencesView.Presenter presenter, FlagImageResolver flagImageResolver) {
super(presenter);
this.userPreferencesView = new UserPreferences(presenter.getUserPreferencesPresenter());
this.userPreferencesView = new UserPreferences(presenter.getUserPreferencesPresenter(), flagImageResolver);
this.userPreferencesView.setEdgeToEdge(true);
this.setViewContent(userPreferencesView);
}
@@ -21,6 +21,7 @@ import com.sap.sailing.gwt.home.shared.partials.filter.AbstractAsyncSuggestBoxFi
import com.sap.sailing.gwt.home.shared.partials.filter.AbstractFilterWidget;
import com.sap.sailing.gwt.home.shared.partials.filter.AbstractSuggestBoxFilter;
import com.sap.sailing.gwt.home.shared.partials.multiselection.SuggestedMultiSelectionDataProvider.SuggestionItemsCallback;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
import com.sap.sailing.gwt.ui.client.StringMessages;
public final class SuggestedMultiSelection<T> extends Composite implements SuggestedMultiSelectionDataProvider.Display<T> {
@@ -157,11 +158,12 @@ public final class SuggestedMultiSelection<T> extends Composite implements Sugge
}
public static SuggestedMultiSelection<SimpleCompetitorWithIdDTO> forCompetitors(
final SuggestedMultiSelectionDataProvider<SimpleCompetitorWithIdDTO, ?> dataProvider, String headerTitle) {
final SuggestedMultiSelectionDataProvider<SimpleCompetitorWithIdDTO, ?> dataProvider, String headerTitle,
FlagImageResolver flagImageResolver) {
return new SuggestedMultiSelection<>(dataProvider, new WidgetProvider<SimpleCompetitorWithIdDTO>() {
@Override
public IsWidget getItemDescriptionWidget(SimpleCompetitorWithIdDTO item) {
return new SuggestedMultiSelectionCompetitorItemDescription(item);
return new SuggestedMultiSelectionCompetitorItemDescription(item, flagImageResolver);
}
@Override
@@ -21,9 +21,9 @@ class SuggestedMultiSelectionCompetitorItemDescription extends Widget {
@UiField SpanElement sailIdUi;
@UiField SpanElement nameUi;
SuggestedMultiSelectionCompetitorItemDescription(SimpleCompetitorDTO competitor) {
SuggestedMultiSelectionCompetitorItemDescription(SimpleCompetitorDTO competitor, FlagImageResolver flagImageResolver) {
setElement(uiBinder.createAndBindUi(this));
flagImageUi.getStyle().setBackgroundImage("url('" + FlagImageResolver.getFlagImageUri(
flagImageUi.getStyle().setBackgroundImage("url('" + flagImageResolver.getFlagImageUri(
competitor.getFlagImageURL(), competitor.getTwoLetterIsoCountryCode()).asString() + "')");
sailIdUi.setInnerText(competitor.getSailID());
nameUi.setInnerText(competitor.getName());
@@ -17,6 +17,7 @@ import com.sap.sailing.gwt.home.shared.partials.multiselection.SuggestedMultiSel
import com.sap.sailing.gwt.home.shared.partials.multiselection.SuggestedMultiSelection.NotificationCallback;
import com.sap.sailing.gwt.home.shared.partials.multiselection.SuggestedMultiSelectionBoatClassDataProvider;
import com.sap.sailing.gwt.home.shared.partials.multiselection.SuggestedMultiSelectionCompetitorDataProvider;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
import com.sap.sailing.gwt.ui.client.StringMessages;
/**
@@ -39,9 +40,9 @@ public class UserPreferences extends Composite implements UserPreferencesView {
@UiField(provided = true) SuggestedMultiSelection<BoatClassDTO> favoriteBoatClassesSelctionUi;
@UiField DivElement notificationsTextUi;
public UserPreferences(UserPreferencesView.Presenter presenter) {
public UserPreferences(UserPreferencesView.Presenter presenter, FlagImageResolver flagImageResolver) {
favoriteCompetitorsSelctionUi = new CompetitorDisplayImpl(
presenter.getFavoriteCompetitorsDataProvider()).selectionUi;
presenter.getFavoriteCompetitorsDataProvider(), flagImageResolver).selectionUi;
favoriteBoatClassesSelctionUi = new BoatClassDisplayImpl(
presenter.getFavoriteBoatClassesDataProvider()).selectionUi;
initWidget(uiBinder.createAndBindUi(this));
@@ -59,8 +60,8 @@ public class UserPreferences extends Composite implements UserPreferencesView {
private final SuggestedMultiSelection<SimpleCompetitorWithIdDTO> selectionUi;
private final HasEnabled notifyAboutResultsUi;
private CompetitorDisplayImpl(final SuggestedMultiSelectionCompetitorDataProvider dataProvider) {
selectionUi = SuggestedMultiSelection.forCompetitors(dataProvider, StringMessages.INSTANCE.favoriteCompetitors());
private CompetitorDisplayImpl(final SuggestedMultiSelectionCompetitorDataProvider dataProvider, FlagImageResolver flagImageResolver) {
selectionUi = SuggestedMultiSelection.forCompetitors(dataProvider, StringMessages.INSTANCE.favoriteCompetitors(), flagImageResolver);
notifyAboutResultsUi = selectionUi.addNotificationToggle(new NotificationCallback() {
@Override
public void onNotificationToggled(boolean enabled) {
@@ -18,7 +18,7 @@ import com.google.gwt.user.client.ui.ImageResourceRenderer;
import com.google.gwt.user.client.ui.Label;
import com.sap.sailing.domain.common.CompetitorDescriptor;
import com.sap.sailing.domain.common.dto.CompetitorDTO;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
import com.sap.sailing.gwt.ui.client.FlagImageResolverImpl;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.client.shared.controls.ImagesBarCell;
@@ -132,9 +132,9 @@ public class CompetitorDescriptorTableWrapper<S extends RefreshableSelectionMode
final String twoLetterIsoCountryCode = countryCode == null ? null : countryCode.getTwoLetterISOCode();
final ImageResource flagImageResource;
if (twoLetterIsoCountryCode == null || twoLetterIsoCountryCode.isEmpty()) {
flagImageResource = FlagImageResolver.getEmptyFlagImageResource();
flagImageResource = FlagImageResolverImpl.get().getEmptyFlagImageResource();
} else {
flagImageResource = FlagImageResolver.getFlagImageResource(twoLetterIsoCountryCode);
flagImageResource = FlagImageResolverImpl.get().getFlagImageResource(twoLetterIsoCountryCode);
}
if (flagImageResource != null) {
sb.append(renderer.render(flagImageResource));
@@ -22,7 +22,7 @@ import com.google.gwt.view.client.CellPreviewEvent;
import com.sap.sailing.domain.common.dto.CompetitorDTO;
import com.sap.sailing.domain.common.dto.CompetitorWithToolTipDTO;
import com.sap.sailing.gwt.ui.adminconsole.ColorColumn.ColorRetriever;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
import com.sap.sailing.gwt.ui.client.FlagImageResolverImpl;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sse.common.Color;
@@ -107,9 +107,9 @@ public class CompetitorTableWrapper<S extends RefreshableSelectionModel<Competit
} else {
final ImageResource flagImageResource;
if (twoLetterIsoCountryCode==null || twoLetterIsoCountryCode.isEmpty()) {
flagImageResource = FlagImageResolver.getEmptyFlagImageResource();
flagImageResource = FlagImageResolverImpl.get().getEmptyFlagImageResource();
} else {
flagImageResource = FlagImageResolver.getFlagImageResource(twoLetterIsoCountryCode);
flagImageResource = FlagImageResolverImpl.get().getFlagImageResource(twoLetterIsoCountryCode);
}
if (flagImageResource != null) {
sb.append(renderer.render(flagImageResource));
@@ -1,305 +1,30 @@
package com.sap.sailing.gwt.ui.client;
import java.util.HashMap;
import java.util.Map;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.RunAsyncCallback;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.safehtml.shared.SafeUri;
import com.google.gwt.safehtml.shared.UriUtils;
import com.google.gwt.user.client.rpc.AsyncCallback;
public class FlagImageResolver {
private static final String NONE = "none";
private static Map<String, ImageResource> flagImagesMap;
private static FlagImageResources flagImageResources = GWT.create(FlagImageResources.class);
public static String[] flagImageNames = { "ad", "ae", "af", "ag", "ai", "al", "am", "an", "ao", "ar", "as", "at",
"au", "aw", "ax", "az", "ba", "bb", "bd", "be", "bf", "bg", "bh", "bi", "bj", "bm", "bn", "bo", "br", "bs",
"bt", "bv", "bw", "by", "bz", "ca", "catalonia", "cc", "cd", "cf", "cg", "ch", "ci", "ck", "cl", "cm",
"cn", "co", "cr", "cs", "cu", "cv", "cx", "cy", "cz", "de", "dj", "dk", "dm", "do", "dz", "ec", "ee", "eg",
"eh", "england", "er", "es", "et", "europeanunion", "fam", "fi", "fj", "fk", "fm", "fo", "fr", "ga", "gb",
"gd", "ge", "gf", "gh", "gi", "gl", "gm", "gn", "gp", "gq", "gr", "gs", "gt", "gu", "gw", "gy", "hk", "hm",
"hn", "hr", "ht", "hu", "id", "ie", "il", "in", "io", "iq", "ir", "is", "it", "jm", "jo", "jp", "ke", "kg",
"kh", "ki", "km", "kn", "kp", "kr", "kw", "ky", "kz", "la", "lb", "lc", "li", "lk", "lr", "ls", "lt", "lu",
"lv", "ly", "ma", "mc", "md", "me", "mg", "mh", "mk", "ml", "mm", "mn", "mo", "mp", "mq", "mr", "ms", "mt",
"mu", "mv", "mw", "mx", "my", "mz", "na", "nc", "ne", "nf", "ng", "ni", "nl", "no", NONE, "np", "nr", "nu",
"nz", "om", "pa", "pe", "pf", "pg", "ph", "pk", "pl", "pm", "pn", "pr", "ps", "pt", "pw", "py", "qa", "re",
"ro", "rs", "ru", "rw", "sa", "sb", "sc", "scotland", "sd", "se", "sg", "sh", "si", "sj", "sk", "sl", "sm",
"sn", "so", "sr", "st", "sv", "sy", "sz", "tc", "td", "tf", "tg", "th", "tj", "tk", "tl", "tm", "tn", "to",
"tr", "tt", "tv", "tw", "tz", "ua", "ug", "um", "us", "uy", "uz", "va", "vc", "ve", "vg", "vi", "vn", "vu",
"wales", "wf", "ws", "ye", "yt", "za", "zm", "zw" };
static {
flagImagesMap = new HashMap<String, ImageResource>();
flagImagesMap.put("ad", flagImageResources.flagAD());
flagImagesMap.put("ae", flagImageResources.flagAE());
flagImagesMap.put("af", flagImageResources.flagAF());
flagImagesMap.put("ag", flagImageResources.flagAG());
flagImagesMap.put("ai", flagImageResources.flagAI());
flagImagesMap.put("al", flagImageResources.flagAL());
flagImagesMap.put("am", flagImageResources.flagAM());
flagImagesMap.put("an", flagImageResources.flagAN());
flagImagesMap.put("ao", flagImageResources.flagAO());
flagImagesMap.put("ar", flagImageResources.flagAR());
flagImagesMap.put("as", flagImageResources.flagAS());
flagImagesMap.put("at", flagImageResources.flagAT());
flagImagesMap.put("au", flagImageResources.flagAU());
flagImagesMap.put("aw", flagImageResources.flagAW());
flagImagesMap.put("ax", flagImageResources.flagAX());
flagImagesMap.put("az", flagImageResources.flagAZ());
flagImagesMap.put("ba", flagImageResources.flagBA());
flagImagesMap.put("bb", flagImageResources.flagBB());
flagImagesMap.put("bd", flagImageResources.flagBD());
flagImagesMap.put("be", flagImageResources.flagBE());
flagImagesMap.put("bf", flagImageResources.flagBF());
flagImagesMap.put("bg", flagImageResources.flagBG());
flagImagesMap.put("bh", flagImageResources.flagBH());
flagImagesMap.put("bi", flagImageResources.flagBI());
flagImagesMap.put("bj", flagImageResources.flagBJ());
flagImagesMap.put("bm", flagImageResources.flagBM());
flagImagesMap.put("bn", flagImageResources.flagBN());
flagImagesMap.put("bo", flagImageResources.flagBO());
flagImagesMap.put("br", flagImageResources.flagBR());
flagImagesMap.put("bs", flagImageResources.flagBS());
flagImagesMap.put("bt", flagImageResources.flagBT());
flagImagesMap.put("bv", flagImageResources.flagBV());
flagImagesMap.put("bw", flagImageResources.flagBW());
flagImagesMap.put("by", flagImageResources.flagBY());
flagImagesMap.put("bz", flagImageResources.flagBZ());
flagImagesMap.put("ca", flagImageResources.flagCA());
flagImagesMap.put("catalonia", flagImageResources.flagCATALONIA());
flagImagesMap.put("cc", flagImageResources.flagCC());
flagImagesMap.put("cd", flagImageResources.flagCD());
flagImagesMap.put("cf", flagImageResources.flagCF());
flagImagesMap.put("cg", flagImageResources.flagCG());
flagImagesMap.put("ch", flagImageResources.flagCH());
flagImagesMap.put("ci", flagImageResources.flagCI());
flagImagesMap.put("ck", flagImageResources.flagCK());
flagImagesMap.put("cl", flagImageResources.flagCL());
flagImagesMap.put("cm", flagImageResources.flagCM());
flagImagesMap.put("cn", flagImageResources.flagCN());
flagImagesMap.put("co", flagImageResources.flagCO());
flagImagesMap.put("cr", flagImageResources.flagCR());
flagImagesMap.put("cs", flagImageResources.flagCS());
flagImagesMap.put("cu", flagImageResources.flagCU());
flagImagesMap.put("cv", flagImageResources.flagCV());
flagImagesMap.put("cx", flagImageResources.flagCX());
flagImagesMap.put("cy", flagImageResources.flagCY());
flagImagesMap.put("cz", flagImageResources.flagCZ());
flagImagesMap.put("de", flagImageResources.flagDE());
flagImagesMap.put("dj", flagImageResources.flagDJ());
flagImagesMap.put("dk", flagImageResources.flagDK());
flagImagesMap.put("dm", flagImageResources.flagDM());
flagImagesMap.put("do", flagImageResources.flagDO());
flagImagesMap.put("dz", flagImageResources.flagDZ());
flagImagesMap.put("ec", flagImageResources.flagEC());
flagImagesMap.put("ee", flagImageResources.flagEE());
flagImagesMap.put("eg", flagImageResources.flagEG());
flagImagesMap.put("eh", flagImageResources.flagEH());
flagImagesMap.put("england", flagImageResources.flagENGLAND());
flagImagesMap.put("er", flagImageResources.flagER());
flagImagesMap.put("es", flagImageResources.flagES());
flagImagesMap.put("et", flagImageResources.flagET());
flagImagesMap.put("europeanunion", flagImageResources.flagEUROPEANUNION());
flagImagesMap.put("fam", flagImageResources.flagFAM());
flagImagesMap.put("fi", flagImageResources.flagFI());
flagImagesMap.put("fj", flagImageResources.flagFJ());
flagImagesMap.put("fk", flagImageResources.flagFK());
flagImagesMap.put("fm", flagImageResources.flagFM());
flagImagesMap.put("fo", flagImageResources.flagFO());
flagImagesMap.put("fr", flagImageResources.flagFR());
flagImagesMap.put("ga", flagImageResources.flagGA());
flagImagesMap.put("gb", flagImageResources.flagGB());
flagImagesMap.put("gd", flagImageResources.flagGD());
flagImagesMap.put("ge", flagImageResources.flagGE());
flagImagesMap.put("gf", flagImageResources.flagGF());
flagImagesMap.put("gh", flagImageResources.flagGH());
flagImagesMap.put("gi", flagImageResources.flagGI());
flagImagesMap.put("gl", flagImageResources.flagGL());
flagImagesMap.put("gm", flagImageResources.flagGM());
flagImagesMap.put("gn", flagImageResources.flagGN());
flagImagesMap.put("gp", flagImageResources.flagGP());
flagImagesMap.put("gq", flagImageResources.flagGQ());
flagImagesMap.put("gr", flagImageResources.flagGR());
flagImagesMap.put("gs", flagImageResources.flagGS());
flagImagesMap.put("gt", flagImageResources.flagGT());
flagImagesMap.put("gu", flagImageResources.flagGU());
flagImagesMap.put("gw", flagImageResources.flagGW());
flagImagesMap.put("gy", flagImageResources.flagGY());
flagImagesMap.put("hk", flagImageResources.flagHK());
flagImagesMap.put("hm", flagImageResources.flagHM());
flagImagesMap.put("hn", flagImageResources.flagHN());
flagImagesMap.put("hr", flagImageResources.flagHR());
flagImagesMap.put("ht", flagImageResources.flagHT());
flagImagesMap.put("hu", flagImageResources.flagHU());
flagImagesMap.put("id", flagImageResources.flagID());
flagImagesMap.put("ie", flagImageResources.flagIE());
flagImagesMap.put("il", flagImageResources.flagIL());
flagImagesMap.put("in", flagImageResources.flagIN());
flagImagesMap.put("io", flagImageResources.flagIO());
flagImagesMap.put("iq", flagImageResources.flagIQ());
flagImagesMap.put("ir", flagImageResources.flagIR());
flagImagesMap.put("is", flagImageResources.flagIS());
flagImagesMap.put("it", flagImageResources.flagIT());
flagImagesMap.put("jm", flagImageResources.flagJM());
flagImagesMap.put("jo", flagImageResources.flagJO());
flagImagesMap.put("jp", flagImageResources.flagJP());
flagImagesMap.put("ke", flagImageResources.flagKE());
flagImagesMap.put("kg", flagImageResources.flagKG());
flagImagesMap.put("kh", flagImageResources.flagKH());
flagImagesMap.put("ki", flagImageResources.flagKI());
flagImagesMap.put("km", flagImageResources.flagKM());
flagImagesMap.put("kn", flagImageResources.flagKN());
flagImagesMap.put("kp", flagImageResources.flagKP());
flagImagesMap.put("kr", flagImageResources.flagKR());
flagImagesMap.put("kw", flagImageResources.flagKW());
flagImagesMap.put("ky", flagImageResources.flagKY());
flagImagesMap.put("kz", flagImageResources.flagKZ());
flagImagesMap.put("la", flagImageResources.flagLA());
flagImagesMap.put("lb", flagImageResources.flagLB());
flagImagesMap.put("lc", flagImageResources.flagLC());
flagImagesMap.put("li", flagImageResources.flagLI());
flagImagesMap.put("lk", flagImageResources.flagLK());
flagImagesMap.put("lr", flagImageResources.flagLR());
flagImagesMap.put("ls", flagImageResources.flagLS());
flagImagesMap.put("lt", flagImageResources.flagLT());
flagImagesMap.put("lu", flagImageResources.flagLU());
flagImagesMap.put("lv", flagImageResources.flagLV());
flagImagesMap.put("ly", flagImageResources.flagLY());
flagImagesMap.put("ma", flagImageResources.flagMA());
flagImagesMap.put("mc", flagImageResources.flagMC());
flagImagesMap.put("md", flagImageResources.flagMD());
flagImagesMap.put("me", flagImageResources.flagME());
flagImagesMap.put("mg", flagImageResources.flagMG());
flagImagesMap.put("mh", flagImageResources.flagMH());
flagImagesMap.put("mk", flagImageResources.flagMK());
flagImagesMap.put("ml", flagImageResources.flagML());
flagImagesMap.put("mm", flagImageResources.flagMM());
flagImagesMap.put("mn", flagImageResources.flagMN());
flagImagesMap.put("mo", flagImageResources.flagMO());
flagImagesMap.put("mp", flagImageResources.flagMP());
flagImagesMap.put("mq", flagImageResources.flagMQ());
flagImagesMap.put("mr", flagImageResources.flagMR());
flagImagesMap.put("ms", flagImageResources.flagMS());
flagImagesMap.put("mt", flagImageResources.flagMT());
flagImagesMap.put("mu", flagImageResources.flagMU());
flagImagesMap.put("mv", flagImageResources.flagMV());
flagImagesMap.put("mw", flagImageResources.flagMW());
flagImagesMap.put("mx", flagImageResources.flagMX());
flagImagesMap.put("my", flagImageResources.flagMY());
flagImagesMap.put("mz", flagImageResources.flagMZ());
flagImagesMap.put("na", flagImageResources.flagNA());
flagImagesMap.put("nc", flagImageResources.flagNC());
flagImagesMap.put("ne", flagImageResources.flagNE());
flagImagesMap.put("nf", flagImageResources.flagNF());
flagImagesMap.put("ng", flagImageResources.flagNG());
flagImagesMap.put("ni", flagImageResources.flagNI());
flagImagesMap.put("nl", flagImageResources.flagNL());
flagImagesMap.put("no", flagImageResources.flagNO());
flagImagesMap.put(NONE, flagImageResources.flagNONE());
flagImagesMap.put("np", flagImageResources.flagNP());
flagImagesMap.put("nr", flagImageResources.flagNR());
flagImagesMap.put("nu", flagImageResources.flagNU());
flagImagesMap.put("nz", flagImageResources.flagNZ());
flagImagesMap.put("om", flagImageResources.flagOM());
flagImagesMap.put("pa", flagImageResources.flagPA());
flagImagesMap.put("pe", flagImageResources.flagPE());
flagImagesMap.put("pf", flagImageResources.flagPF());
flagImagesMap.put("pg", flagImageResources.flagPG());
flagImagesMap.put("ph", flagImageResources.flagPH());
flagImagesMap.put("pk", flagImageResources.flagPK());
flagImagesMap.put("pl", flagImageResources.flagPL());
flagImagesMap.put("pm", flagImageResources.flagPM());
flagImagesMap.put("pn", flagImageResources.flagPN());
flagImagesMap.put("pr", flagImageResources.flagPR());
flagImagesMap.put("ps", flagImageResources.flagPS());
flagImagesMap.put("pt", flagImageResources.flagPT());
flagImagesMap.put("pw", flagImageResources.flagPW());
flagImagesMap.put("py", flagImageResources.flagPY());
flagImagesMap.put("qa", flagImageResources.flagQA());
flagImagesMap.put("re", flagImageResources.flagRE());
flagImagesMap.put("ro", flagImageResources.flagRO());
flagImagesMap.put("rs", flagImageResources.flagRS());
flagImagesMap.put("ru", flagImageResources.flagRU());
flagImagesMap.put("rw", flagImageResources.flagRW());
flagImagesMap.put("sa", flagImageResources.flagSA());
flagImagesMap.put("sb", flagImageResources.flagSB());
flagImagesMap.put("sc", flagImageResources.flagSC());
flagImagesMap.put("scotland", flagImageResources.flagSCOTLAND());
flagImagesMap.put("sd", flagImageResources.flagSD());
flagImagesMap.put("se", flagImageResources.flagSE());
flagImagesMap.put("sg", flagImageResources.flagSG());
flagImagesMap.put("sh", flagImageResources.flagSH());
flagImagesMap.put("si", flagImageResources.flagSI());
flagImagesMap.put("sj", flagImageResources.flagSJ());
flagImagesMap.put("sk", flagImageResources.flagSK());
flagImagesMap.put("sl", flagImageResources.flagSL());
flagImagesMap.put("sm", flagImageResources.flagSM());
flagImagesMap.put("sn", flagImageResources.flagSN());
flagImagesMap.put("so", flagImageResources.flagSO());
flagImagesMap.put("sr", flagImageResources.flagSR());
flagImagesMap.put("st", flagImageResources.flagST());
flagImagesMap.put("sv", flagImageResources.flagSV());
flagImagesMap.put("sy", flagImageResources.flagSY());
flagImagesMap.put("sz", flagImageResources.flagSZ());
flagImagesMap.put("tc", flagImageResources.flagTC());
flagImagesMap.put("td", flagImageResources.flagTD());
flagImagesMap.put("tf", flagImageResources.flagTF());
flagImagesMap.put("tg", flagImageResources.flagTG());
flagImagesMap.put("th", flagImageResources.flagTH());
flagImagesMap.put("tj", flagImageResources.flagTJ());
flagImagesMap.put("tk", flagImageResources.flagTK());
flagImagesMap.put("tl", flagImageResources.flagTL());
flagImagesMap.put("tm", flagImageResources.flagTM());
flagImagesMap.put("tn", flagImageResources.flagTN());
flagImagesMap.put("to", flagImageResources.flagTO());
flagImagesMap.put("tr", flagImageResources.flagTR());
flagImagesMap.put("tt", flagImageResources.flagTT());
flagImagesMap.put("tv", flagImageResources.flagTV());
flagImagesMap.put("tw", flagImageResources.flagTW());
flagImagesMap.put("tz", flagImageResources.flagTZ());
flagImagesMap.put("ua", flagImageResources.flagUA());
flagImagesMap.put("ug", flagImageResources.flagUG());
flagImagesMap.put("um", flagImageResources.flagUM());
flagImagesMap.put("us", flagImageResources.flagUS());
flagImagesMap.put("uy", flagImageResources.flagUY());
flagImagesMap.put("uz", flagImageResources.flagUZ());
flagImagesMap.put("va", flagImageResources.flagVA());
flagImagesMap.put("vc", flagImageResources.flagVC());
flagImagesMap.put("ve", flagImageResources.flagVE());
flagImagesMap.put("vg", flagImageResources.flagVG());
flagImagesMap.put("vi", flagImageResources.flagVI());
flagImagesMap.put("vn", flagImageResources.flagVN());
flagImagesMap.put("vu", flagImageResources.flagVU());
flagImagesMap.put("wales", flagImageResources.flagWALES());
flagImagesMap.put("wf", flagImageResources.flagWF());
flagImagesMap.put("ws", flagImageResources.flagWS());
flagImagesMap.put("ye", flagImageResources.flagYE());
flagImagesMap.put("yt", flagImageResources.flagYT());
flagImagesMap.put("za", flagImageResources.flagZA());
flagImagesMap.put("zm", flagImageResources.flagZM());
flagImagesMap.put("zw", flagImageResources.flagZW());
}
public static ImageResource getFlagImageResource(String twoLetterIsoCountryCode) {
return flagImagesMap.get(twoLetterIsoCountryCode.toLowerCase());
}
public static ImageResource getEmptyFlagImageResource() {
return flagImagesMap.get(NONE);
}
public interface FlagImageResolver {
public static SafeUri getFlagImageUri(String flagImageUrl, String twoLetterIsoCountryCode) {
if (flagImageUrl == null || flagImageUrl.isEmpty()) {
if (twoLetterIsoCountryCode == null || twoLetterIsoCountryCode.isEmpty() || getFlagImageResource(twoLetterIsoCountryCode) == null) {
return getEmptyFlagImageResource().getSafeUri();
public static void get(AsyncCallback<FlagImageResolver> callback) {
GWT.runAsync(new RunAsyncCallback() {
@Override
public void onSuccess() {
callback.onSuccess(FlagImageResolverImpl.get());
}
return getFlagImageResource(twoLetterIsoCountryCode).getSafeUri();
}
return UriUtils.fromTrustedString(flagImageUrl);
@Override
public void onFailure(Throwable reason) {
callback.onFailure(reason);
}
});
}
ImageResource getFlagImageResource(String twoLetterIsoCountryCode);
SafeUri getFlagImageUri(String flagImageUrl, String twoLetterIsoCountryCode);
ImageResource getEmptyFlagImageResource();
}
@@ -0,0 +1,320 @@
package com.sap.sailing.gwt.ui.client;
import java.util.HashMap;
import java.util.Map;
import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.safehtml.shared.SafeUri;
import com.google.gwt.safehtml.shared.UriUtils;
public class FlagImageResolverImpl implements FlagImageResolver {
private static final String NONE = "none";
private final Map<String, ImageResource> flagImagesMap;
private final FlagImageResources flagImageResources = GWT.create(FlagImageResources.class);
public String[] flagImageNames = { "ad", "ae", "af", "ag", "ai", "al", "am", "an", "ao", "ar", "as", "at",
"au", "aw", "ax", "az", "ba", "bb", "bd", "be", "bf", "bg", "bh", "bi", "bj", "bm", "bn", "bo", "br", "bs",
"bt", "bv", "bw", "by", "bz", "ca", "catalonia", "cc", "cd", "cf", "cg", "ch", "ci", "ck", "cl", "cm",
"cn", "co", "cr", "cs", "cu", "cv", "cx", "cy", "cz", "de", "dj", "dk", "dm", "do", "dz", "ec", "ee", "eg",
"eh", "england", "er", "es", "et", "europeanunion", "fam", "fi", "fj", "fk", "fm", "fo", "fr", "ga", "gb",
"gd", "ge", "gf", "gh", "gi", "gl", "gm", "gn", "gp", "gq", "gr", "gs", "gt", "gu", "gw", "gy", "hk", "hm",
"hn", "hr", "ht", "hu", "id", "ie", "il", "in", "io", "iq", "ir", "is", "it", "jm", "jo", "jp", "ke", "kg",
"kh", "ki", "km", "kn", "kp", "kr", "kw", "ky", "kz", "la", "lb", "lc", "li", "lk", "lr", "ls", "lt", "lu",
"lv", "ly", "ma", "mc", "md", "me", "mg", "mh", "mk", "ml", "mm", "mn", "mo", "mp", "mq", "mr", "ms", "mt",
"mu", "mv", "mw", "mx", "my", "mz", "na", "nc", "ne", "nf", "ng", "ni", "nl", "no", NONE, "np", "nr", "nu",
"nz", "om", "pa", "pe", "pf", "pg", "ph", "pk", "pl", "pm", "pn", "pr", "ps", "pt", "pw", "py", "qa", "re",
"ro", "rs", "ru", "rw", "sa", "sb", "sc", "scotland", "sd", "se", "sg", "sh", "si", "sj", "sk", "sl", "sm",
"sn", "so", "sr", "st", "sv", "sy", "sz", "tc", "td", "tf", "tg", "th", "tj", "tk", "tl", "tm", "tn", "to",
"tr", "tt", "tv", "tw", "tz", "ua", "ug", "um", "us", "uy", "uz", "va", "vc", "ve", "vg", "vi", "vn", "vu",
"wales", "wf", "ws", "ye", "yt", "za", "zm", "zw" };
{
flagImagesMap = new HashMap<String, ImageResource>();
flagImagesMap.put("ad", flagImageResources.flagAD());
flagImagesMap.put("ae", flagImageResources.flagAE());
flagImagesMap.put("af", flagImageResources.flagAF());
flagImagesMap.put("ag", flagImageResources.flagAG());
flagImagesMap.put("ai", flagImageResources.flagAI());
flagImagesMap.put("al", flagImageResources.flagAL());
flagImagesMap.put("am", flagImageResources.flagAM());
flagImagesMap.put("an", flagImageResources.flagAN());
flagImagesMap.put("ao", flagImageResources.flagAO());
flagImagesMap.put("ar", flagImageResources.flagAR());
flagImagesMap.put("as", flagImageResources.flagAS());
flagImagesMap.put("at", flagImageResources.flagAT());
flagImagesMap.put("au", flagImageResources.flagAU());
flagImagesMap.put("aw", flagImageResources.flagAW());
flagImagesMap.put("ax", flagImageResources.flagAX());
flagImagesMap.put("az", flagImageResources.flagAZ());
flagImagesMap.put("ba", flagImageResources.flagBA());
flagImagesMap.put("bb", flagImageResources.flagBB());
flagImagesMap.put("bd", flagImageResources.flagBD());
flagImagesMap.put("be", flagImageResources.flagBE());
flagImagesMap.put("bf", flagImageResources.flagBF());
flagImagesMap.put("bg", flagImageResources.flagBG());
flagImagesMap.put("bh", flagImageResources.flagBH());
flagImagesMap.put("bi", flagImageResources.flagBI());
flagImagesMap.put("bj", flagImageResources.flagBJ());
flagImagesMap.put("bm", flagImageResources.flagBM());
flagImagesMap.put("bn", flagImageResources.flagBN());
flagImagesMap.put("bo", flagImageResources.flagBO());
flagImagesMap.put("br", flagImageResources.flagBR());
flagImagesMap.put("bs", flagImageResources.flagBS());
flagImagesMap.put("bt", flagImageResources.flagBT());
flagImagesMap.put("bv", flagImageResources.flagBV());
flagImagesMap.put("bw", flagImageResources.flagBW());
flagImagesMap.put("by", flagImageResources.flagBY());
flagImagesMap.put("bz", flagImageResources.flagBZ());
flagImagesMap.put("ca", flagImageResources.flagCA());
flagImagesMap.put("catalonia", flagImageResources.flagCATALONIA());
flagImagesMap.put("cc", flagImageResources.flagCC());
flagImagesMap.put("cd", flagImageResources.flagCD());
flagImagesMap.put("cf", flagImageResources.flagCF());
flagImagesMap.put("cg", flagImageResources.flagCG());
flagImagesMap.put("ch", flagImageResources.flagCH());
flagImagesMap.put("ci", flagImageResources.flagCI());
flagImagesMap.put("ck", flagImageResources.flagCK());
flagImagesMap.put("cl", flagImageResources.flagCL());
flagImagesMap.put("cm", flagImageResources.flagCM());
flagImagesMap.put("cn", flagImageResources.flagCN());
flagImagesMap.put("co", flagImageResources.flagCO());
flagImagesMap.put("cr", flagImageResources.flagCR());
flagImagesMap.put("cs", flagImageResources.flagCS());
flagImagesMap.put("cu", flagImageResources.flagCU());
flagImagesMap.put("cv", flagImageResources.flagCV());
flagImagesMap.put("cx", flagImageResources.flagCX());
flagImagesMap.put("cy", flagImageResources.flagCY());
flagImagesMap.put("cz", flagImageResources.flagCZ());
flagImagesMap.put("de", flagImageResources.flagDE());
flagImagesMap.put("dj", flagImageResources.flagDJ());
flagImagesMap.put("dk", flagImageResources.flagDK());
flagImagesMap.put("dm", flagImageResources.flagDM());
flagImagesMap.put("do", flagImageResources.flagDO());
flagImagesMap.put("dz", flagImageResources.flagDZ());
flagImagesMap.put("ec", flagImageResources.flagEC());
flagImagesMap.put("ee", flagImageResources.flagEE());
flagImagesMap.put("eg", flagImageResources.flagEG());
flagImagesMap.put("eh", flagImageResources.flagEH());
flagImagesMap.put("england", flagImageResources.flagENGLAND());
flagImagesMap.put("er", flagImageResources.flagER());
flagImagesMap.put("es", flagImageResources.flagES());
flagImagesMap.put("et", flagImageResources.flagET());
flagImagesMap.put("europeanunion", flagImageResources.flagEUROPEANUNION());
flagImagesMap.put("fam", flagImageResources.flagFAM());
flagImagesMap.put("fi", flagImageResources.flagFI());
flagImagesMap.put("fj", flagImageResources.flagFJ());
flagImagesMap.put("fk", flagImageResources.flagFK());
flagImagesMap.put("fm", flagImageResources.flagFM());
flagImagesMap.put("fo", flagImageResources.flagFO());
flagImagesMap.put("fr", flagImageResources.flagFR());
flagImagesMap.put("ga", flagImageResources.flagGA());
flagImagesMap.put("gb", flagImageResources.flagGB());
flagImagesMap.put("gd", flagImageResources.flagGD());
flagImagesMap.put("ge", flagImageResources.flagGE());
flagImagesMap.put("gf", flagImageResources.flagGF());
flagImagesMap.put("gh", flagImageResources.flagGH());
flagImagesMap.put("gi", flagImageResources.flagGI());
flagImagesMap.put("gl", flagImageResources.flagGL());
flagImagesMap.put("gm", flagImageResources.flagGM());
flagImagesMap.put("gn", flagImageResources.flagGN());
flagImagesMap.put("gp", flagImageResources.flagGP());
flagImagesMap.put("gq", flagImageResources.flagGQ());
flagImagesMap.put("gr", flagImageResources.flagGR());
flagImagesMap.put("gs", flagImageResources.flagGS());
flagImagesMap.put("gt", flagImageResources.flagGT());
flagImagesMap.put("gu", flagImageResources.flagGU());
flagImagesMap.put("gw", flagImageResources.flagGW());
flagImagesMap.put("gy", flagImageResources.flagGY());
flagImagesMap.put("hk", flagImageResources.flagHK());
flagImagesMap.put("hm", flagImageResources.flagHM());
flagImagesMap.put("hn", flagImageResources.flagHN());
flagImagesMap.put("hr", flagImageResources.flagHR());
flagImagesMap.put("ht", flagImageResources.flagHT());
flagImagesMap.put("hu", flagImageResources.flagHU());
flagImagesMap.put("id", flagImageResources.flagID());
flagImagesMap.put("ie", flagImageResources.flagIE());
flagImagesMap.put("il", flagImageResources.flagIL());
flagImagesMap.put("in", flagImageResources.flagIN());
flagImagesMap.put("io", flagImageResources.flagIO());
flagImagesMap.put("iq", flagImageResources.flagIQ());
flagImagesMap.put("ir", flagImageResources.flagIR());
flagImagesMap.put("is", flagImageResources.flagIS());
flagImagesMap.put("it", flagImageResources.flagIT());
flagImagesMap.put("jm", flagImageResources.flagJM());
flagImagesMap.put("jo", flagImageResources.flagJO());
flagImagesMap.put("jp", flagImageResources.flagJP());
flagImagesMap.put("ke", flagImageResources.flagKE());
flagImagesMap.put("kg", flagImageResources.flagKG());
flagImagesMap.put("kh", flagImageResources.flagKH());
flagImagesMap.put("ki", flagImageResources.flagKI());
flagImagesMap.put("km", flagImageResources.flagKM());
flagImagesMap.put("kn", flagImageResources.flagKN());
flagImagesMap.put("kp", flagImageResources.flagKP());
flagImagesMap.put("kr", flagImageResources.flagKR());
flagImagesMap.put("kw", flagImageResources.flagKW());
flagImagesMap.put("ky", flagImageResources.flagKY());
flagImagesMap.put("kz", flagImageResources.flagKZ());
flagImagesMap.put("la", flagImageResources.flagLA());
flagImagesMap.put("lb", flagImageResources.flagLB());
flagImagesMap.put("lc", flagImageResources.flagLC());
flagImagesMap.put("li", flagImageResources.flagLI());
flagImagesMap.put("lk", flagImageResources.flagLK());
flagImagesMap.put("lr", flagImageResources.flagLR());
flagImagesMap.put("ls", flagImageResources.flagLS());
flagImagesMap.put("lt", flagImageResources.flagLT());
flagImagesMap.put("lu", flagImageResources.flagLU());
flagImagesMap.put("lv", flagImageResources.flagLV());
flagImagesMap.put("ly", flagImageResources.flagLY());
flagImagesMap.put("ma", flagImageResources.flagMA());
flagImagesMap.put("mc", flagImageResources.flagMC());
flagImagesMap.put("md", flagImageResources.flagMD());
flagImagesMap.put("me", flagImageResources.flagME());
flagImagesMap.put("mg", flagImageResources.flagMG());
flagImagesMap.put("mh", flagImageResources.flagMH());
flagImagesMap.put("mk", flagImageResources.flagMK());
flagImagesMap.put("ml", flagImageResources.flagML());
flagImagesMap.put("mm", flagImageResources.flagMM());
flagImagesMap.put("mn", flagImageResources.flagMN());
flagImagesMap.put("mo", flagImageResources.flagMO());
flagImagesMap.put("mp", flagImageResources.flagMP());
flagImagesMap.put("mq", flagImageResources.flagMQ());
flagImagesMap.put("mr", flagImageResources.flagMR());
flagImagesMap.put("ms", flagImageResources.flagMS());
flagImagesMap.put("mt", flagImageResources.flagMT());
flagImagesMap.put("mu", flagImageResources.flagMU());
flagImagesMap.put("mv", flagImageResources.flagMV());
flagImagesMap.put("mw", flagImageResources.flagMW());
flagImagesMap.put("mx", flagImageResources.flagMX());
flagImagesMap.put("my", flagImageResources.flagMY());
flagImagesMap.put("mz", flagImageResources.flagMZ());
flagImagesMap.put("na", flagImageResources.flagNA());
flagImagesMap.put("nc", flagImageResources.flagNC());
flagImagesMap.put("ne", flagImageResources.flagNE());
flagImagesMap.put("nf", flagImageResources.flagNF());
flagImagesMap.put("ng", flagImageResources.flagNG());
flagImagesMap.put("ni", flagImageResources.flagNI());
flagImagesMap.put("nl", flagImageResources.flagNL());
flagImagesMap.put("no", flagImageResources.flagNO());
flagImagesMap.put(NONE, flagImageResources.flagNONE());
flagImagesMap.put("np", flagImageResources.flagNP());
flagImagesMap.put("nr", flagImageResources.flagNR());
flagImagesMap.put("nu", flagImageResources.flagNU());
flagImagesMap.put("nz", flagImageResources.flagNZ());
flagImagesMap.put("om", flagImageResources.flagOM());
flagImagesMap.put("pa", flagImageResources.flagPA());
flagImagesMap.put("pe", flagImageResources.flagPE());
flagImagesMap.put("pf", flagImageResources.flagPF());
flagImagesMap.put("pg", flagImageResources.flagPG());
flagImagesMap.put("ph", flagImageResources.flagPH());
flagImagesMap.put("pk", flagImageResources.flagPK());
flagImagesMap.put("pl", flagImageResources.flagPL());
flagImagesMap.put("pm", flagImageResources.flagPM());
flagImagesMap.put("pn", flagImageResources.flagPN());
flagImagesMap.put("pr", flagImageResources.flagPR());
flagImagesMap.put("ps", flagImageResources.flagPS());
flagImagesMap.put("pt", flagImageResources.flagPT());
flagImagesMap.put("pw", flagImageResources.flagPW());
flagImagesMap.put("py", flagImageResources.flagPY());
flagImagesMap.put("qa", flagImageResources.flagQA());
flagImagesMap.put("re", flagImageResources.flagRE());
flagImagesMap.put("ro", flagImageResources.flagRO());
flagImagesMap.put("rs", flagImageResources.flagRS());
flagImagesMap.put("ru", flagImageResources.flagRU());
flagImagesMap.put("rw", flagImageResources.flagRW());
flagImagesMap.put("sa", flagImageResources.flagSA());
flagImagesMap.put("sb", flagImageResources.flagSB());
flagImagesMap.put("sc", flagImageResources.flagSC());
flagImagesMap.put("scotland", flagImageResources.flagSCOTLAND());
flagImagesMap.put("sd", flagImageResources.flagSD());
flagImagesMap.put("se", flagImageResources.flagSE());
flagImagesMap.put("sg", flagImageResources.flagSG());
flagImagesMap.put("sh", flagImageResources.flagSH());
flagImagesMap.put("si", flagImageResources.flagSI());
flagImagesMap.put("sj", flagImageResources.flagSJ());
flagImagesMap.put("sk", flagImageResources.flagSK());
flagImagesMap.put("sl", flagImageResources.flagSL());
flagImagesMap.put("sm", flagImageResources.flagSM());
flagImagesMap.put("sn", flagImageResources.flagSN());
flagImagesMap.put("so", flagImageResources.flagSO());
flagImagesMap.put("sr", flagImageResources.flagSR());
flagImagesMap.put("st", flagImageResources.flagST());
flagImagesMap.put("sv", flagImageResources.flagSV());
flagImagesMap.put("sy", flagImageResources.flagSY());
flagImagesMap.put("sz", flagImageResources.flagSZ());
flagImagesMap.put("tc", flagImageResources.flagTC());
flagImagesMap.put("td", flagImageResources.flagTD());
flagImagesMap.put("tf", flagImageResources.flagTF());
flagImagesMap.put("tg", flagImageResources.flagTG());
flagImagesMap.put("th", flagImageResources.flagTH());
flagImagesMap.put("tj", flagImageResources.flagTJ());
flagImagesMap.put("tk", flagImageResources.flagTK());
flagImagesMap.put("tl", flagImageResources.flagTL());
flagImagesMap.put("tm", flagImageResources.flagTM());
flagImagesMap.put("tn", flagImageResources.flagTN());
flagImagesMap.put("to", flagImageResources.flagTO());
flagImagesMap.put("tr", flagImageResources.flagTR());
flagImagesMap.put("tt", flagImageResources.flagTT());
flagImagesMap.put("tv", flagImageResources.flagTV());
flagImagesMap.put("tw", flagImageResources.flagTW());
flagImagesMap.put("tz", flagImageResources.flagTZ());
flagImagesMap.put("ua", flagImageResources.flagUA());
flagImagesMap.put("ug", flagImageResources.flagUG());
flagImagesMap.put("um", flagImageResources.flagUM());
flagImagesMap.put("us", flagImageResources.flagUS());
flagImagesMap.put("uy", flagImageResources.flagUY());
flagImagesMap.put("uz", flagImageResources.flagUZ());
flagImagesMap.put("va", flagImageResources.flagVA());
flagImagesMap.put("vc", flagImageResources.flagVC());
flagImagesMap.put("ve", flagImageResources.flagVE());
flagImagesMap.put("vg", flagImageResources.flagVG());
flagImagesMap.put("vi", flagImageResources.flagVI());
flagImagesMap.put("vn", flagImageResources.flagVN());
flagImagesMap.put("vu", flagImageResources.flagVU());
flagImagesMap.put("wales", flagImageResources.flagWALES());
flagImagesMap.put("wf", flagImageResources.flagWF());
flagImagesMap.put("ws", flagImageResources.flagWS());
flagImagesMap.put("ye", flagImageResources.flagYE());
flagImagesMap.put("yt", flagImageResources.flagYT());
flagImagesMap.put("za", flagImageResources.flagZA());
flagImagesMap.put("zm", flagImageResources.flagZM());
flagImagesMap.put("zw", flagImageResources.flagZW());
}
private static FlagImageResolver INSTANCE;
private FlagImageResolverImpl() {
}
public static FlagImageResolver get() {
if (INSTANCE == null) {
INSTANCE = new FlagImageResolverImpl();
}
return INSTANCE;
}
@Override
public ImageResource getFlagImageResource(String twoLetterIsoCountryCode) {
return flagImagesMap.get(twoLetterIsoCountryCode.toLowerCase());
}
@Override
public ImageResource getEmptyFlagImageResource() {
return flagImagesMap.get(NONE);
}
@Override
public SafeUri getFlagImageUri(String flagImageUrl, String twoLetterIsoCountryCode) {
if (flagImageUrl == null || flagImageUrl.isEmpty()) {
if (twoLetterIsoCountryCode == null || twoLetterIsoCountryCode.isEmpty() || getFlagImageResource(twoLetterIsoCountryCode) == null) {
return getEmptyFlagImageResource().getSafeUri();
}
return getFlagImageResource(twoLetterIsoCountryCode).getSafeUri();
}
return UriUtils.fromTrustedString(flagImageUrl);
}
}
@@ -403,18 +403,21 @@ public abstract class LeaderboardPanel<LS extends LeaderboardSettings> extends A
private FlowPanel informationPanel;
private FlagImageResolver flagImageResolver;
public LeaderboardPanel(Component<?> parent, ComponentContext<?> context, SailingServiceAsync sailingService,
AsyncActionsExecutor asyncActionsExecutor, LS settings,
CompetitorSelectionProvider competitorSelectionProvider, String leaderboardName,
ErrorReporter errorReporter, final StringMessages stringMessages, boolean showRaceDetails,LeaderBoardStyle style) {
ErrorReporter errorReporter, final StringMessages stringMessages, boolean showRaceDetails,LeaderBoardStyle style,
FlagImageResolver flagImageResolver) {
this(parent, context, sailingService, asyncActionsExecutor, settings, false,
competitorSelectionProvider, null, leaderboardName, errorReporter, stringMessages, showRaceDetails,style);
competitorSelectionProvider, null, leaderboardName, errorReporter, stringMessages, showRaceDetails,style, flagImageResolver);
}
public LeaderboardPanel(Component<?> parent, ComponentContext<?> context, SailingServiceAsync sailingService,
AsyncActionsExecutor asyncActionsExecutor, LS settings, boolean isEmbedded, CompetitorSelectionProvider competitorSelectionProvider,
String leaderboardGroupName, String leaderboardName, ErrorReporter errorReporter,
final StringMessages stringMessages, boolean showRaceDetails,LeaderBoardStyle style) {
final StringMessages stringMessages, boolean showRaceDetails,LeaderBoardStyle style, FlagImageResolver flagImageResolver) {
this(parent, context, sailingService, asyncActionsExecutor, settings, isEmbedded,
competitorSelectionProvider,
new Timer(
@@ -425,7 +428,7 @@ public abstract class LeaderboardPanel<LS extends LeaderboardSettings> extends A
/* competitorSearchTextBox */ null, /* showSelectionCheckbox */ true,
/* optionalRaceTimesInfoProvider */ null, /* autoExpandLastRaceColumn */ false,
/* adjustTimerDelay */ true, /* autoApplyTopNFilter */ false, /* showCompetitorFilterStatus */ false,
/* enableSyncScroller */ false,style);
/* enableSyncScroller */ false, style, flagImageResolver);
}
public LeaderboardPanel(Component<?> parent, ComponentContext<?> context, SailingServiceAsync sailingService,
@@ -434,7 +437,7 @@ public abstract class LeaderboardPanel<LS extends LeaderboardSettings> extends A
final StringMessages stringMessages, boolean showRaceDetails, CompetitorFilterPanel competitorSearchTextBox,
boolean showSelectionCheckbox, RaceTimesInfoProvider optionalRaceTimesInfoProvider,
boolean autoExpandLastRaceColumn, boolean adjustTimerDelay, boolean autoApplyTopNFilter,
boolean showCompetitorFilterStatus, boolean enableSyncScroller,LeaderBoardStyle style) {
boolean showCompetitorFilterStatus, boolean enableSyncScroller, LeaderBoardStyle style, FlagImageResolver flagImageResolver) {
super(parent, context);
this.style = style;
this.showSelectionCheckbox = showSelectionCheckbox;
@@ -453,6 +456,7 @@ public abstract class LeaderboardPanel<LS extends LeaderboardSettings> extends A
this.showCompetitorFilterStatus = showCompetitorFilterStatus;
this.enableSyncedScroller = enableSyncScroller;
this.autoExpandLastRaceColumn = autoExpandLastRaceColumn;
this.flagImageResolver = flagImageResolver;
this.timer = timer;RACE_COLUMN_HEADER_STYLE = style.getTableresources().cellTableStyle().cellTableRaceColumnHeader();
LEG_COLUMN_HEADER_STYLE = style.getTableresources().cellTableStyle().cellTableLegColumnHeader();
LEG_DETAIL_COLUMN_HEADER_STYLE = style.getTableresources().cellTableStyle().cellTableLegDetailColumnHeader();
@@ -902,9 +906,9 @@ public abstract class LeaderboardPanel<LS extends LeaderboardSettings> extends A
if (isShowCompetitorNationality || flagImageURL == null || flagImageURL.isEmpty()) {
final ImageResource nationalityFlagImageResource;
if (twoLetterIsoCountryCode == null || twoLetterIsoCountryCode.isEmpty()) {
nationalityFlagImageResource = FlagImageResolver.getEmptyFlagImageResource();
nationalityFlagImageResource = flagImageResolver.getEmptyFlagImageResource();
} else {
nationalityFlagImageResource = FlagImageResolver.getFlagImageResource(twoLetterIsoCountryCode);
nationalityFlagImageResource = flagImageResolver.getFlagImageResource(twoLetterIsoCountryCode);
}
if (nationalityFlagImageResource != null) {
style.renderNationalityFlag(nationalityFlagImageResource,sb);
@@ -10,6 +10,7 @@ import com.sap.sailing.gwt.settings.client.leaderboard.MetaLeaderboardPerspectiv
import com.sap.sailing.gwt.settings.client.leaderboard.MultiRaceLeaderboardSettings;
import com.sap.sailing.gwt.settings.client.leaderboard.MultipleMultiLeaderboardPanelLifecycle;
import com.sap.sailing.gwt.ui.client.CompetitorSelectionModel;
import com.sap.sailing.gwt.ui.client.FlagImageResolverImpl;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.client.shared.charts.MultiCompetitorLeaderboardChart;
@@ -66,7 +67,8 @@ public class MetaLeaderboardViewer extends AbstractLeaderboardViewer<MetaLeaderb
/* showSelectionCheckbox */ true, /* raceTimesInfoProvider */null,
settings.getPerspectiveOwnSettings().isAutoExpandLastRaceColumn(), /* adjustTimerDelay */ true,
/* autoApplyTopNFilter */ false,
/* showCompetitorFilterStatus */ false, /* enableSyncScroller */ false, new ClassicLeaderboardStyle()));
/* showCompetitorFilterStatus */ false, /* enableSyncScroller */ false, new ClassicLeaderboardStyle(),
FlagImageResolverImpl.get()));
final LeaderboardPerspectiveOwnSettings perspectiveSettings = settings.getPerspectiveOwnSettings();
final boolean showCharts = perspectiveSettings.isShowCharts();
@@ -93,7 +95,7 @@ public class MetaLeaderboardViewer extends AbstractLeaderboardViewer<MetaLeaderb
asyncActionsExecutor, timer, false /* isEmbedded */,
preselectedLeaderboardName, errorReporter, stringMessages,
perspectiveSettings.isShowRaceDetails(), perspectiveSettings.isAutoExpandLastRaceColumn(),
leaderboardSettings);
leaderboardSettings, FlagImageResolverImpl.get());
multiLeaderboardPanel.setVisible(perspectiveSettings.isShowSeriesLeaderboards());
mainPanel.add(getLeaderboardPanel());
mainPanel.add(multiCompetitorChart);
@@ -22,6 +22,7 @@ import com.sap.sailing.gwt.settings.client.leaderboard.LeaderboardSettingsFactor
import com.sap.sailing.gwt.settings.client.leaderboard.MultiRaceLeaderboardSettings;
import com.sap.sailing.gwt.settings.client.leaderboard.MultipleMultiLeaderboardPanelLifecycle;
import com.sap.sailing.gwt.ui.client.CompetitorSelectionModel;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
import com.sap.sailing.gwt.ui.client.LeaderboardUpdateListener;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.client.StringMessages;
@@ -66,6 +67,7 @@ public class MultiLeaderboardProxyPanel extends AbstractLazyComponent<MultiRaceL
private final Set<SelectedLeaderboardChangeListener<MultiRaceLeaderboardPanel>> selectedLeaderboardChangeListeners;
private HashMap<String, MultiRaceLeaderboardSettings> contextStore;
private MultiRaceLeaderboardSettings loadedSettings;
private final FlagImageResolver flagImageResolver;
public MultiLeaderboardProxyPanel(Component<?> parent, ComponentContext<?> context,
SailingServiceAsync sailingService, String metaLeaderboardName,
@@ -73,7 +75,7 @@ public class MultiLeaderboardProxyPanel extends AbstractLazyComponent<MultiRaceL
Timer timer, boolean isEmbedded, String preselectedLeaderboardName,
ErrorReporter errorReporter, StringMessages stringMessages,
boolean showRaceDetails, boolean autoExpandLastRaceColumn,
MultiRaceLeaderboardSettings settings) {
MultiRaceLeaderboardSettings settings, FlagImageResolver flagImageResolver) {
super(parent, context);
loadedSettings = settings;
@@ -87,6 +89,7 @@ public class MultiLeaderboardProxyPanel extends AbstractLazyComponent<MultiRaceL
this.timer = timer;
this.isEmbedded = isEmbedded;
this.selectedLeaderboardName = preselectedLeaderboardName;
this.flagImageResolver = flagImageResolver;
selectedLeaderboardFlowPanel = null;
selectedLeaderboardPanel = null;
@@ -238,7 +241,8 @@ public class MultiLeaderboardProxyPanel extends AbstractLazyComponent<MultiRaceL
null, newSelectedLeaderboardName, errorReporter, stringMessages,
showRaceDetails, /* competitorSearchTextBox */ null, /* showSelectionCheckbox */ true, /* raceTimesInfoProvider */null,
false, /* adjustTimerDelay */ true, /* autoApplyTopNFilter */ false,
/* showCompetitorFilterStatus */ false, /* enableSyncScroller */ false, new ClassicLeaderboardStyle());
/* showCompetitorFilterStatus */ false, /* enableSyncScroller */ false, new ClassicLeaderboardStyle(),
flagImageResolver);
selectedLeaderboardFlowPanel.add(newSelectedLeaderboardPanel);
for (LeaderboardUpdateListener listener : leaderboardUpdateListeners) {
newSelectedLeaderboardPanel.addLeaderboardUpdateListener(listener);
@@ -2,6 +2,7 @@ package com.sap.sailing.gwt.ui.leaderboard;
import com.sap.sailing.gwt.settings.client.leaderboard.MultiRaceLeaderboardSettings;
import com.sap.sailing.gwt.ui.client.CompetitorSelectionProvider;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
import com.sap.sailing.gwt.ui.client.RaceTimesInfoProvider;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.client.StringMessages;
@@ -23,12 +24,12 @@ public class MultiMultiRaceLeaderboardPanel extends MultiRaceLeaderboardPanel {
boolean showRaceDetails, CompetitorFilterPanel competitorSearchTextBox,
boolean showSelectionCheckbox, RaceTimesInfoProvider optionalRaceTimesInfoProvider,
boolean autoExpandLastRaceColumn, boolean adjustTimerDelay, boolean autoApplyTopNFilter,
boolean showCompetitorFilterStatus, boolean enableSyncScroller, LeaderBoardStyle style) {
boolean showCompetitorFilterStatus, boolean enableSyncScroller, LeaderBoardStyle style, FlagImageResolver flagImageResolver) {
super(parent, context, sailingService, asyncActionsExecutor, settings, isEmbedded,
competitorSelectionProvider, timer, leaderboardGroupName, leaderboardName, errorReporter,
stringMessages, showRaceDetails, competitorSearchTextBox, showSelectionCheckbox,
optionalRaceTimesInfoProvider, autoExpandLastRaceColumn, adjustTimerDelay, autoApplyTopNFilter,
showCompetitorFilterStatus, enableSyncScroller,style);
showCompetitorFilterStatus, enableSyncScroller,style, flagImageResolver);
}
@@ -15,6 +15,7 @@ import com.sap.sailing.gwt.settings.client.leaderboard.LeaderboardSettings;
import com.sap.sailing.gwt.settings.client.leaderboard.MultiRaceLeaderboardSettings;
import com.sap.sailing.gwt.settings.client.leaderboard.MultiRaceLeaderboardSettingsDialogComponent;
import com.sap.sailing.gwt.ui.client.CompetitorSelectionProvider;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
import com.sap.sailing.gwt.ui.client.RaceTimesInfoProvider;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.client.StringMessages;
@@ -43,9 +44,9 @@ public class MultiRaceLeaderboardPanel extends LeaderboardPanel<MultiRaceLeaderb
MultiRaceLeaderboardSettings settings, boolean isEmbedded,
CompetitorSelectionProvider competitorSelectionProvider, String leaderboardGroupName,
String leaderboardName, ErrorReporter errorReporter, StringMessages stringMessages, boolean showRaceDetails,
LeaderBoardStyle style) {
LeaderBoardStyle style, FlagImageResolver flagImageResolver) {
super(parent, context, sailingService, asyncActionsExecutor, settings, isEmbedded, competitorSelectionProvider,
leaderboardGroupName, leaderboardName, errorReporter, stringMessages, showRaceDetails, style);
leaderboardGroupName, leaderboardName, errorReporter, stringMessages, showRaceDetails, style, flagImageResolver);
initialize(settings);
}
@@ -57,11 +58,11 @@ public class MultiRaceLeaderboardPanel extends LeaderboardPanel<MultiRaceLeaderb
CompetitorFilterPanel competitorSearchTextBox, boolean showSelectionCheckbox,
RaceTimesInfoProvider optionalRaceTimesInfoProvider, boolean autoExpandLastRaceColumn,
boolean adjustTimerDelay, boolean autoApplyTopNFilter, boolean showCompetitorFilterStatus,
boolean enableSyncScroller, LeaderBoardStyle style) {
boolean enableSyncScroller, LeaderBoardStyle style, FlagImageResolver flagImageResolver) {
super(parent, context, sailingService, asyncActionsExecutor, settings, isEmbedded, competitorSelectionProvider,
timer, leaderboardGroupName, leaderboardName, errorReporter, stringMessages, showRaceDetails,
competitorSearchTextBox, showSelectionCheckbox, optionalRaceTimesInfoProvider, autoExpandLastRaceColumn,
adjustTimerDelay, autoApplyTopNFilter, showCompetitorFilterStatus, enableSyncScroller, style);
adjustTimerDelay, autoApplyTopNFilter, showCompetitorFilterStatus, enableSyncScroller, style, flagImageResolver);
initialize(settings);
}
@@ -69,9 +70,9 @@ public class MultiRaceLeaderboardPanel extends LeaderboardPanel<MultiRaceLeaderb
SailingServiceAsync sailingService, AsyncActionsExecutor asyncActionsExecutor,
MultiRaceLeaderboardSettings settings, CompetitorSelectionProvider competitorSelectionProvider,
String leaderboardName, ErrorReporter errorReporter, StringMessages stringMessages,
boolean showRaceDetails, LeaderBoardStyle style) {
boolean showRaceDetails, LeaderBoardStyle style, FlagImageResolver flagImageResolver) {
super(parent, context, sailingService, asyncActionsExecutor, settings, competitorSelectionProvider,
leaderboardName, errorReporter, stringMessages, showRaceDetails,style);
leaderboardName, errorReporter, stringMessages, showRaceDetails,style, flagImageResolver);
initialize(settings);
}
@@ -11,6 +11,7 @@ import com.sap.sailing.gwt.settings.client.leaderboard.LeaderboardPerspectiveLif
import com.sap.sailing.gwt.settings.client.leaderboard.LeaderboardPerspectiveOwnSettings;
import com.sap.sailing.gwt.settings.client.leaderboard.OverallLeaderboardPanelLifecycle;
import com.sap.sailing.gwt.ui.client.CompetitorSelectionModel;
import com.sap.sailing.gwt.ui.client.FlagImageResolverImpl;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.client.shared.charts.MultiCompetitorLeaderboardChart;
@@ -63,7 +64,7 @@ public class MultiRaceLeaderboardViewer extends AbstractLeaderboardViewer<Leader
/* competitorSearchTextBox */ null, /* showSelectionCheckbox */ true, /* raceTimesInfoProvider */ null,
settings.getPerspectiveOwnSettings().isAutoExpandLastRaceColumn(), /* adjustTimerDelay */ true,
/* autoApplyTopNFilter */ false, /* showCompetitorFilterStatus */ false,
/* enableSyncScroller */ false, new ClassicLeaderboardStyle()));
/* enableSyncScroller */ false, new ClassicLeaderboardStyle(), FlagImageResolverImpl.get()));
final LeaderboardPerspectiveOwnSettings perspectiveSettings = settings.getPerspectiveOwnSettings();
final boolean showCharts = perspectiveSettings.isShowCharts();
@@ -105,7 +106,7 @@ public class MultiRaceLeaderboardViewer extends AbstractLeaderboardViewer<Leader
leaderboardGroupName, overallLeaderboardName, errorReporter, stringMessages,
false, /* competitorSearchTextBox */ null, /* showSelectionCheckbox */ true, /* raceTimesInfoProvider */null,
false, /* adjustTimerDelay */ true, /* autoApplyTopNFilter */ false,
/* showCompetitorFilterStatus */ false, /* enableSyncScroller */ false);
/* showCompetitorFilterStatus */ false, /* enableSyncScroller */ false, FlagImageResolverImpl.get());
mainPanel.add(overallLeaderboardPanel);
addChildComponent(overallLeaderboardPanel);
addComponentToNavigationMenu(overallLeaderboardPanel, true, stringMessages.seriesLeaderboard(),
@@ -3,6 +3,7 @@ package com.sap.sailing.gwt.ui.leaderboard;
import com.sap.sailing.gwt.settings.client.leaderboard.MultiRaceLeaderboardSettings;
import com.sap.sailing.gwt.settings.client.leaderboard.OverallLeaderboardPanelLifecycle;
import com.sap.sailing.gwt.ui.client.CompetitorSelectionProvider;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
import com.sap.sailing.gwt.ui.client.RaceTimesInfoProvider;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.client.StringMessages;
@@ -21,12 +22,12 @@ public class OverallLeaderboardPanel extends MultiRaceLeaderboardPanel {
boolean showRaceDetails, CompetitorFilterPanel competitorSearchTextBox,
boolean showSelectionCheckbox, RaceTimesInfoProvider optionalRaceTimesInfoProvider,
boolean autoExpandLastRaceColumn, boolean adjustTimerDelay, boolean autoApplyTopNFilter,
boolean showCompetitorFilterStatus, boolean enableSyncScroller) {
boolean showCompetitorFilterStatus, boolean enableSyncScroller, FlagImageResolver flagImageResolver) {
super(parent, context, sailingService, asyncActionsExecutor, settings, isEmbedded,
competitorSelectionProvider, timer, leaderboardGroupName, leaderboardName, errorReporter,
stringMessages, showRaceDetails, competitorSearchTextBox, showSelectionCheckbox,
optionalRaceTimesInfoProvider, autoExpandLastRaceColumn, adjustTimerDelay, autoApplyTopNFilter,
showCompetitorFilterStatus, enableSyncScroller,new ClassicLeaderboardStyle());
showCompetitorFilterStatus, enableSyncScroller,new ClassicLeaderboardStyle(), flagImageResolver);
}
@Override
@@ -21,6 +21,7 @@ import com.sap.sailing.gwt.settings.client.leaderboard.LeaderboardSettings;
import com.sap.sailing.gwt.settings.client.leaderboard.SingleRaceLeaderboardSettings;
import com.sap.sailing.gwt.settings.client.leaderboard.SingleRaceLeaderboardSettingsDialogComponent;
import com.sap.sailing.gwt.ui.client.CompetitorSelectionProvider;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
import com.sap.sailing.gwt.ui.client.RaceTimesInfoProvider;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.client.StringMessages;
@@ -64,11 +65,11 @@ public class SingleRaceLeaderboardPanel extends LeaderboardPanel<SingleRaceLeade
CompetitorFilterPanel competitorSearchTextBox, boolean showSelectionCheckbox,
RaceTimesInfoProvider optionalRaceTimesInfoProvider, boolean autoExpandLastRaceColumn,
boolean adjustTimerDelay, boolean autoApplyTopNFilter, boolean showCompetitorFilterStatus,
boolean enableSyncScroller,LeaderBoardStyle style) {
boolean enableSyncScroller,LeaderBoardStyle style, FlagImageResolver flagImageResolver) {
super(parent, context, sailingService, asyncActionsExecutor, settings, isEmbedded, competitorSelectionProvider,
timer, leaderboardGroupName, leaderboardName, errorReporter, stringMessages, showRaceDetails,
competitorSearchTextBox, showSelectionCheckbox, optionalRaceTimesInfoProvider, autoExpandLastRaceColumn,
adjustTimerDelay, autoApplyTopNFilter, showCompetitorFilterStatus, enableSyncScroller,style);
adjustTimerDelay, autoApplyTopNFilter, showCompetitorFilterStatus, enableSyncScroller,style, flagImageResolver);
assert preSelectedRace != null;
this.preSelectedRace = preSelectedRace;
this.showRaceRankColumn = settings.isShowRaceRankColumn();
@@ -56,7 +56,7 @@ import com.sap.sailing.gwt.settings.client.leaderboard.MultiRaceLeaderboardSetti
import com.sap.sailing.gwt.ui.adminconsole.AdminConsoleTableResources;
import com.sap.sailing.gwt.ui.client.Collator;
import com.sap.sailing.gwt.ui.client.CompetitorSelectionModel;
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
import com.sap.sailing.gwt.ui.client.FlagImageResolverImpl;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.leaderboard.ClassicLeaderboardStyle;
@@ -152,9 +152,9 @@ public class EditableLeaderboardPanel extends MultiRaceLeaderboardPanel {
final String twoLetterIsoCountryCode = object.getTwoLetterIsoCountryCode();
final ImageResource flagImageResource;
if (twoLetterIsoCountryCode==null || twoLetterIsoCountryCode.isEmpty()) {
flagImageResource = FlagImageResolver.getEmptyFlagImageResource();
flagImageResource = FlagImageResolverImpl.get().getEmptyFlagImageResource();
} else {
flagImageResource = FlagImageResolver.getFlagImageResource(twoLetterIsoCountryCode);
flagImageResource = FlagImageResolverImpl.get().getFlagImageResource(twoLetterIsoCountryCode);
}
if (flagImageResource != null) {
sb.append(renderer.render(flagImageResource));
@@ -580,7 +580,8 @@ public class EditableLeaderboardPanel extends MultiRaceLeaderboardPanel {
final StringMessages stringMessages, UserAgentDetails userAgent) {
super(null, null, sailingService, asyncActionsExecutor, new MultiRaceLeaderboardSettings(),
new CompetitorSelectionModel(/* hasMultiSelection */true),
leaderboardName, errorReporter, stringMessages, /* showRaceDetails */ true,new ClassicLeaderboardStyle());
leaderboardName, errorReporter, stringMessages, /* showRaceDetails */ true, new ClassicLeaderboardStyle(),
FlagImageResolverImpl.get());
suppressedCompetitorsShown = new ListDataProvider<CompetitorDTO>(new ArrayList<CompetitorDTO>());
suppressedCompetitorsTable = createSuppressedCompetitorsTable();
ImageResource importIcon = resources.importIcon();
@@ -46,6 +46,7 @@ import com.sap.sailing.gwt.ui.client.CompetitorColorProviderImpl;
import com.sap.sailing.gwt.ui.client.CompetitorSelectionModel;
import com.sap.sailing.gwt.ui.client.CompetitorSelectionProvider;
import com.sap.sailing.gwt.ui.client.EntryPointLinkFactory;
import com.sap.sailing.gwt.ui.client.FlagImageResolverImpl;
import com.sap.sailing.gwt.ui.client.LeaderboardUpdateListener;
import com.sap.sailing.gwt.ui.client.MediaServiceAsync;
import com.sap.sailing.gwt.ui.client.RaceTimePanel;
@@ -450,7 +451,8 @@ public class RaceBoardPanel
/* showRaceDetails */ true, competitorSearchTextBox,
/* showSelectionCheckbox */ true, raceTimesInfoProvider, /* autoExpandLastRaceColumn */ false,
/* don't adjust the timer's delay from the leaderboard; control it solely from the RaceTimesInfoProvider */ false,
/* autoApplyTopNFilter */ false, /* showCompetitorFilterStatus */ false, /* enableSyncScroller */ false, new ClassicLeaderboardStyle());
/* autoApplyTopNFilter */ false, /* showCompetitorFilterStatus */ false, /* enableSyncScroller */ false,
new ClassicLeaderboardStyle(), FlagImageResolverImpl.get());
}
private void setComponentVisible(SideBySideComponentViewer componentViewer, Component<?> component, boolean visible) {