Changed Idle leaderboard to show overall

This commit is contained in:
Kai Boernert committed 2017-06-19 17:36:17 +02:00
1 parent 2f4f62c82a
commit f1bba0e406
6 files changed
+122 -81

No files matched your search

@@ -3,12 +3,15 @@ package com.sap.sailing.gwt.autoplay.client.nodes;
import java.util.ArrayList;
import java.util.List;
import com.google.gwt.core.shared.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.sap.sailing.domain.common.DetailType;
import com.sap.sailing.gwt.autoplay.client.app.AutoPlayClientFactory;
import com.sap.sailing.gwt.autoplay.client.events.AutoPlayHeaderEvent;
import com.sap.sailing.gwt.autoplay.client.nodes.base.FiresPlaceNode;
import com.sap.sailing.gwt.autoplay.client.places.screens.idleloop.leaderboardsixty.IdleOverallLeaderBoardPlace;
import com.sap.sailing.gwt.autoplay.client.shared.SixtyInchLeaderBoard;
import com.sap.sailing.gwt.autoplay.client.utils.AutoplayHelper;
import com.sap.sailing.gwt.settings.client.leaderboard.LeaderboardSettings;
import com.sap.sailing.gwt.settings.client.leaderboard.LeaderboardSettings.RaceColumnSelectionStrategies;
import com.sap.sailing.gwt.ui.client.CompetitorSelectionModel;
@@ -16,6 +19,7 @@ import com.sap.sailing.gwt.ui.client.CompetitorSelectionProvider;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.leaderboard.LeaderboardEntryPoint;
import com.sap.sse.gwt.client.async.AsyncActionsExecutor;
import com.sap.sse.gwt.client.async.MarkedAsyncCallback;
import com.sap.sse.gwt.client.player.Timer;
import com.sap.sse.gwt.client.player.Timer.PlayModes;
import com.sap.sse.gwt.client.player.Timer.PlayStates;
@@ -34,12 +38,12 @@ public class IdleOverallLeaderBoardNode extends FiresPlaceNode {
List<DetailType> overallDetails = new ArrayList<>();
overallDetails.add(DetailType.OVERALL_RANK);
overallDetails.add(DetailType.REGATTA_RANK);
List<DetailType> raceDetails = new ArrayList<>();
// raceDetails.add(DetailType.RACE_RANK);
final LeaderboardSettings leaderboardSettings = new LeaderboardSettings(null, null, raceDetails, overallDetails , null, null,
null, false, null, null, /* ascending */ true, /* updateUponPlayStateChange */ true,
final LeaderboardSettings leaderboardSettings = new LeaderboardSettings(null, null, raceDetails, overallDetails,
null, null, null, false, null, null, /* ascending */ true, /* updateUponPlayStateChange */ true,
RaceColumnSelectionStrategies.EXPLICIT, /* showAddedScores */ true,
/* showOverallRacesCompleted */ false, true, false, false, true);
@@ -47,23 +51,46 @@ public class IdleOverallLeaderBoardNode extends FiresPlaceNode {
// perform the first request as "live" but don't by default auto-play
PlayModes.Live, PlayStates.Playing,
/* delayBetweenAutoAdvancesInMilliseconds */ LeaderboardEntryPoint.DEFAULT_REFRESH_INTERVAL_MILLIS);
CompetitorSelectionProvider provider = new CompetitorSelectionModel(true);
SixtyInchLeaderBoard leaderboardPanel = new SixtyInchLeaderBoard(cf.getSailingService(), new AsyncActionsExecutor(), leaderboardSettings,
true, null, provider, timer, null, cf.getAutoPlayCtx().getContextDefinition().getLeaderboardName(), cf.getErrorReporter(),
StringMessages.INSTANCE, null, false, null, false, null, false, true, false, false, false);
IdleOverallLeaderBoardPlace place = new IdleOverallLeaderBoardPlace(leaderboardPanel);
setPlaceToGo(place);
firePlaceChangeAndStartTimer();
getBus().fireEvent(new AutoPlayHeaderEvent(cf.getAutoPlayCtx().getEvent().getName(),
cf.getAutoPlayCtx().getContextDefinition().getLeaderboardName()));
};
cf.getSailingService().getOverallLeaderboardNamesContaining(
cf.getAutoPlayCtx().getContextDefinition().getLeaderboardName(),
new MarkedAsyncCallback<List<String>>(new AsyncCallback<List<String>>() {
@Override
public void onSuccess(List<String> result) {
if (result.size() == 1) {
String overallLeaderboardName = result.get(0);
String selectedLeaderboardsGroup = AutoplayHelper.getSelectedLeaderboardsGroup(
cf.getAutoPlayCtx().getEvent(),
cf.getAutoPlayCtx().getContextDefinition().getLeaderboardName());
CompetitorSelectionProvider provider = new CompetitorSelectionModel(true);
SixtyInchLeaderBoard leaderboardPanel = new SixtyInchLeaderBoard(cf.getSailingService(),
new AsyncActionsExecutor(), leaderboardSettings, true, null, provider, timer,
selectedLeaderboardsGroup, overallLeaderboardName, cf.getErrorReporter(),
StringMessages.INSTANCE, null, false, null, false, null, false, true, false, false,
false);
IdleOverallLeaderBoardPlace place = new IdleOverallLeaderBoardPlace(leaderboardPanel);
setPlaceToGo(place);
firePlaceChangeAndStartTimer();
getBus().fireEvent(new AutoPlayHeaderEvent(cf.getAutoPlayCtx().getEvent().getName(),
cf.getAutoPlayCtx().getContextDefinition().getLeaderboardName()));
} else {
GWT.log("Not found any overleaderboardname");
}
}
@Override
public void onFailure(Throwable caught) {
// DO NOTHING
}
}));
}
@Override
public void onStop() {
if(timer != null){
if (timer != null) {
timer.pause();
}
super.onStop();
@@ -15,7 +15,7 @@ import com.sap.sailing.gwt.ui.leaderboard.SortedCellTable;
import com.sap.sse.gwt.client.panels.ResizableFlowPanel;
public class IdleOverallLeaderBoardViewImpl extends ResizeComposite implements IdleOverallLeaderBoardView {
protected static final int TOOLBAR_SIZE = 182;
protected static final int TOOLBAR_SIZE = 80;
private static LifeRaceWithRacemapViewImplUiBinder uiBinder = GWT.create(LifeRaceWithRacemapViewImplUiBinder.class);
@@ -41,11 +41,11 @@ public class IdleOverallLeaderBoardViewImpl extends ResizeComposite implements I
panel.setWidget(this);
leaderBoardHolder.add(leaderboardPanel);
resizer = new Timer() {
@Override
public void run() {
SortedCellTable<LeaderboardRowDTO> tbl = leaderboardPanel.getLeaderboardTable();
LeaderBoardScaleHelper.scaleContentWidget(AutoPlayMainViewImpl.SAP_HEADER_IN_PX+TOOLBAR_SIZE, tbl);
LeaderBoardScaleHelper.scaleContentWidget(AutoPlayMainViewImpl.SAP_HEADER_IN_PX + TOOLBAR_SIZE, tbl);
}
};
resizer.scheduleRepeating(100);
@@ -7,10 +7,10 @@
.fullscreen {
position: absolute;
display: inline-block;
height: 100%;
top: 0px;
bottom: 80px;
width: 100%;
}
</ui:style>
<rf:ResizableFlowPanel styleName="{res.style.slideBackground}">
<rf:ResizableFlowPanel ui:field="leaderBoardHolder"
@@ -1,53 +1,56 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:rf="urn:import:com.sap.sse.gwt.client.panels">
<ui:with field="res"
type="com.sap.sailing.gwt.autoplay.client.resources.SixtyInchBundle" />
<ui:style>
.left {
position: absolute;
display: inline-block;
width: 35%;
height: 100%;
overflow-y:auto;
}
.right {
position: absolute;
display: inline-block;
right: 0px;
height: 100%;
width: 65%;
}
.image{
top: 5%;
display: block;
margin: auto;
min-width: 50%;
height: 90%;
width: auto;
}
.subline1{
font-size:20px;
font-weight:bold;
text-align: center;
}
.subline2{
font-size:20px;
text-align: center;
}
.subline3{
font-size:20px;
text-align: center;
}
</ui:style>
<rf:ResizableFlowPanel styleName="{res.style.slideBackground}">
<rf:ResizableFlowPanel ui:field="leaderBoardHolder"
styleName="{style.left}" />
<rf:ResizableFlowPanel ui:field="racemap"
styleName="{style.right}">
</rf:ResizableFlowPanel>
</rf:ResizableFlowPanel>
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:rf="urn:import:com.sap.sse.gwt.client.panels">
<ui:with field="res"
type="com.sap.sailing.gwt.autoplay.client.resources.SixtyInchBundle" />
<ui:style>
.left {
top: 0px;
bottom: 80px;
position: absolute;
display: inline-block;
width: 35%;
overflow-y: auto;
}
.right {
position: absolute;
display: inline-block;
right: 0px;
height: 100%;
width: 65%;
}
.image {
top: 5%;
display: block;
margin: auto;
min-width: 50%;
height: 90%;
width: auto;
}
.subline1 {
font-size: 20px;
font-weight: bold;
text-align: center;
}
.subline2 {
font-size: 20px;
text-align: center;
}
.subline3 {
font-size: 20px;
text-align: center;
}
</ui:style>
<rf:ResizableFlowPanel styleName="{res.style.slideBackground}">
<rf:ResizableFlowPanel ui:field="leaderBoardHolder"
styleName="{style.left}" />
<rf:ResizableFlowPanel ui:field="racemap"
styleName="{style.right}">
</rf:ResizableFlowPanel>
</rf:ResizableFlowPanel>
</ui:UiBinder>
@@ -2,6 +2,7 @@ package com.sap.sailing.gwt.autoplay.client.utils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@@ -130,8 +131,13 @@ public class AutoplayHelper {
long startTimeInMs = raceTimes.getStartOfRace().getTime();
long delayToLiveInMs = raceTimes.delayToLiveInMs;
long startIn = startTimeInMs - serverTimeDuringRequest.getTime() - delayToLiveInMs;
if (startIn <= PRE_RACE_DELAY) {
return new Pair<Long, RegattaAndRaceIdentifier>(startIn, raceIdentifier);
List<Pair<RaceColumnDTO, FleetDTO>> liveRaces = currentLeaderboard
.getLiveRaces(serverTimeDuringRequest.getTime());
for (Pair<RaceColumnDTO, FleetDTO> liveRace : liveRaces) {
RegattaAndRaceIdentifier identifier = liveRace.getA().getRaceIdentifier(liveRace.getB());
if (startIn <= PRE_RACE_DELAY && raceIdentifier.equals(identifier)) {
return new Pair<Long, RegattaAndRaceIdentifier>(startIn, raceIdentifier);
}
}
}
}
@@ -280,4 +286,9 @@ public class AutoplayHelper {
raceboardPerspective.onResize();
callback.onSuccess(new RVWrapper(raceboardPerspective, competitorSelectionProvider));
}
public static String getSelectedLeaderboardsGroup(EventDTO event, String leaderboardName) {
// TODO Auto-generated method stub
return null;
}
}
@@ -12,16 +12,16 @@ public class LeaderBoardScaleHelper {
int clientWidth = Window.getClientWidth();
int contentWidth = contentWidget.getOffsetWidth();
double scaleFactorX = clientWidth / (double) contentWidth;
if(scaleFactorX > 1){
scaleFactorX = 1;
}
// if(scaleFactorX > 1){
// scaleFactorX = 1;
// }
int clientHeight = Window.getClientHeight()-headerHeight;
int contentHeight = contentWidget.getOffsetHeight();
double scaleFactorY = clientHeight / (double)contentHeight;
if(scaleFactorY < 1){
scaleFactorY = 1;
}
// if(scaleFactorY < 1){
// scaleFactorY = 1;
// }
scaleContentWidget(contentWidget, scaleFactorX,scaleFactorY);
}