diff --git a/build.gradle b/build.gradle index 68f7b4d4a93..a2c53b7b9f9 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:2.0.0-beta6' + classpath 'com.android.tools.build:gradle:2.1.0-alpha1' } } diff --git a/java/com.sap.sailing.dashboards.gwt/.classpath b/java/com.sap.sailing.dashboards.gwt/.classpath index 3c32839e434..34d9ee0253f 100644 --- a/java/com.sap.sailing.dashboards.gwt/.classpath +++ b/java/com.sap.sailing.dashboards.gwt/.classpath @@ -1,12 +1,12 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/java/com.sap.sailing.dashboards.gwt/META-INF/MANIFEST.MF b/java/com.sap.sailing.dashboards.gwt/META-INF/MANIFEST.MF index 7af263e912b..53b9b480d53 100644 --- a/java/com.sap.sailing.dashboards.gwt/META-INF/MANIFEST.MF +++ b/java/com.sap.sailing.dashboards.gwt/META-INF/MANIFEST.MF @@ -25,10 +25,12 @@ Require-Bundle: com.sap.sailing.domain, com.sap.sse.gwt.adminconsole, org.apache.commons.math;bundle-version="2.1.0" Bundle-ActivationPolicy: lazy -Import-Package: com.sap.sse.util, +Import-Package: com.google.gwt.core.ext.linker, + com.sap.sse.util, javax.servlet;version="3.1.0", javax.servlet.descriptor;version="3.1.0", javax.servlet.http;version="3.1.0", + org.apache.commons.io, org.osgi.framework;version="1.5.0", org.osgi.util.tracker Web-ContextPath: /dashboards diff --git a/java/com.sap.sailing.dashboards.gwt/RibDashboard.css b/java/com.sap.sailing.dashboards.gwt/RibDashboard.css index 12a90199883..f256d2a1b33 100644 --- a/java/com.sap.sailing.dashboards.gwt/RibDashboard.css +++ b/java/com.sap.sailing.dashboards.gwt/RibDashboard.css @@ -1,10 +1,11 @@ + .mgwt-Carousel-Indicator { - width: 12.5pt; - height: 12.5pt; + width: 10px; + height: 10px; background-color: #666666; - border-radius: 0pt; - margin: 5pt; - margin-bottom: 12.5pt; + border-radius: 5px; + margin: 5px; + margin-bottom: 20px; } .mgwt-Carousel-Indicator-active { @@ -25,12 +26,4 @@ position: absolute !important; width: 100% !important; height: 100% !important; -} - -.eventLogo { - position: absolute; - right: 12.5px; - bottom: 10px; - height: 22.5pt; - z-index: 1; -} +} \ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/RibDashboard.html b/java/com.sap.sailing.dashboards.gwt/RibDashboard.html index d1f7fa68c2b..44d3171f5e4 100644 --- a/java/com.sap.sailing.dashboards.gwt/RibDashboard.html +++ b/java/com.sap.sailing.dashboards.gwt/RibDashboard.html @@ -5,7 +5,7 @@ - + diff --git a/java/com.sap.sailing.dashboards.gwt/SailingDashboardsGWT sdm.launch b/java/com.sap.sailing.dashboards.gwt/SailingDashboardsGWT sdm.launch index e6230b9950b..aefd1e3ffb6 100755 --- a/java/com.sap.sailing.dashboards.gwt/SailingDashboardsGWT sdm.launch +++ b/java/com.sap.sailing.dashboards.gwt/SailingDashboardsGWT sdm.launch @@ -1,47 +1,47 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/com.sap.sailing.dashboards.gwt/SailingDashboardsGWT.launch b/java/com.sap.sailing.dashboards.gwt/SailingDashboardsGWT.launch index 20731950d47..463a6cf721f 100755 --- a/java/com.sap.sailing.dashboards.gwt/SailingDashboardsGWT.launch +++ b/java/com.sap.sailing.dashboards.gwt/SailingDashboardsGWT.launch @@ -1,47 +1,47 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/com.sap.sailing.dashboards.gwt/WEB-INF/web.xml b/java/com.sap.sailing.dashboards.gwt/WEB-INF/web.xml index f79f8d5f9e6..ad6c4ff7907 100644 --- a/java/com.sap.sailing.dashboards.gwt/WEB-INF/web.xml +++ b/java/com.sap.sailing.dashboards.gwt/WEB-INF/web.xml @@ -48,4 +48,9 @@ /com.sap.sailing.dashboards.gwt.RibDashboard/remote_logging + + manifest + text/cache-manifest + + diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/RibDashboardEntryPoint.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/RibDashboardEntryPoint.java index d1ca55aa36a..82aabb4338f 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/RibDashboardEntryPoint.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/RibDashboardEntryPoint.java @@ -3,7 +3,6 @@ package com.sap.sailing.dashboards.gwt.client; import com.google.gwt.user.client.ui.RootLayoutPanel; import com.googlecode.mgwt.ui.client.MGWT; import com.googlecode.mgwt.ui.client.MGWTSettings; -import com.googlecode.mgwt.ui.client.MGWTSettings.StatusBarStyle; import com.googlecode.mgwt.ui.client.MGWTSettings.ViewPort; import com.googlecode.mgwt.ui.client.MGWTStyle; import com.sap.sailing.dashboards.gwt.client.dashboardpanel.DashboardPanel; @@ -34,9 +33,6 @@ public class RibDashboardEntryPoint extends AbstractEntryPoint { viewPort.setUserScaleAble(false).setMinimumScale(1.0).setMinimumScale(1.0).setMaximumScale(1.0); MGWTSettings settings = new MGWTSettings(); settings.setViewPort(viewPort); - settings.setFullscreen(true); - settings.setPreventScrolling(true); - settings.setStatusBarStyle(StatusBarStyle.BLACK_TRANSLUCENT); MGWT.applySettings(settings); } diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/actions/GetStartAnalysesAction.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/actions/GetStartAnalysesAction.java index 3b557754a9a..ada80912458 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/actions/GetStartAnalysesAction.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/actions/GetStartAnalysesAction.java @@ -2,6 +2,8 @@ package com.sap.sailing.dashboards.gwt.client.actions; import java.util.ArrayList; import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; import com.google.gwt.core.shared.GwtIncompatible; import com.sap.sailing.dashboards.gwt.server.util.actions.startanalysis.StartAnalysisCreationController; @@ -24,6 +26,8 @@ public class GetStartAnalysesAction implements DashboardAction private String leaderboarName; private String competitorIdAsString; + + private static final Logger logger = Logger.getLogger(GetStartAnalysesAction.class.getName()); @SuppressWarnings("unused") private GetStartAnalysesAction() { @@ -39,10 +43,12 @@ public class GetStartAnalysesAction implements DashboardAction public StartAnalysesDTO execute(DashboardDispatchContext dashboardDispatchContext) throws DispatchException { StartAnalysesDTO result = new StartAnalysesDTO(); List startanalyses = new ArrayList(); - if (competitorIdAsString != null && leaderboarName != null) { + if (leaderboarName != null) { try { - Competitor competitor = dashboardDispatchContext.getRacingEventService().getBaseDomainFactory().getCompetitorStore().getExistingCompetitorByIdAsString( - competitorIdAsString); + Competitor competitor = null; + if(competitorIdAsString != null) { + competitor = dashboardDispatchContext.getRacingEventService().getBaseDomainFactory().getCompetitorStore().getExistingCompetitorByIdAsString(competitorIdAsString); + } Leaderboard leaderboard = dashboardDispatchContext.getRacingEventService().getLeaderboardByName(this.leaderboarName); if (leaderboard != null) { for (RaceColumn column : leaderboard.getRaceColumns()) { @@ -59,7 +65,7 @@ public class GetStartAnalysesAction implements DashboardAction } } catch (NullPointerException e) { - // logger.log(Level.INFO, "", e); + logger.log(Level.INFO, "", e); } } result.setStartAnalyses(startanalyses); diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/actions/GetStartlineAdvantageByGeometryAction.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/actions/GetStartlineAdvantageByGeometryAction.java index a3d7de27f48..d1a4d0629c1 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/actions/GetStartlineAdvantageByGeometryAction.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/actions/GetStartlineAdvantageByGeometryAction.java @@ -1,5 +1,7 @@ package com.sap.sailing.dashboards.gwt.client.actions; +import java.util.UUID; + import com.google.gwt.core.shared.GwtIncompatible; import com.sap.sailing.dashboards.gwt.server.util.actions.startlineadvantage.StartlineAdvantageByGeometryCalculator; import com.sap.sailing.dashboards.gwt.shared.StartlineAdvantageType; @@ -20,6 +22,8 @@ public class GetStartlineAdvantageByGeometryAction extends RequiresLiveRaceAndCa public GetStartlineAdvantageByGeometryAction(String leaderboardName) { super(leaderboardName); } + + private static final String MOVING_AVERAGE_CACHE_KEY = UUID.randomUUID().toString(); @Override @GwtIncompatible @@ -35,14 +39,14 @@ public class GetStartlineAdvantageByGeometryAction extends RequiresLiveRaceAndCa Double average = null; if (startlineAdvantageByGeometry != null) { super.addValueToMovingAverage(startlineAdvantageByGeometry.doubleValue(), dashboardDispatchContext.getMovingAveragesCache()); - average = dashboardDispatchContext.getMovingAveragesCache().getValueForKey(getKeyForMovingAverage()); + average = dashboardDispatchContext.getMovingAveragesCache().getValueForKey(uniqueMovingAverageCacheKey()); } result.average = average; return result; } @Override - protected String getKeyForMovingAverage() { - return super.getLeaderboardName(); + protected String uniqueMovingAverageCacheKey() { + return MOVING_AVERAGE_CACHE_KEY; } } diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/actions/GetStartlineAdvantagesByWindAction.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/actions/GetStartlineAdvantagesByWindAction.java index de3bb83d006..1d8776f81e2 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/actions/GetStartlineAdvantagesByWindAction.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/actions/GetStartlineAdvantagesByWindAction.java @@ -5,16 +5,19 @@ package com.sap.sailing.dashboards.gwt.client.actions; * */ +import java.util.UUID; + import com.google.gwt.core.shared.GwtIncompatible; import com.sap.sailing.dashboards.gwt.server.util.actions.startlineadvantage.StartlineAdvantagesByWindCalculator; import com.sap.sailing.dashboards.gwt.shared.dispatch.DashboardDispatchContext; import com.sap.sailing.dashboards.gwt.shared.dispatch.RequiresLiveRaceAndCachesMovingAverageAction; import com.sap.sailing.dashboards.gwt.shared.dto.StartlineAdvantagesWithMaxAndAverageDTO; +import com.sap.sailing.domain.base.DomainFactory; import com.sap.sailing.domain.tracking.TrackedRace; import com.sap.sse.common.impl.MillisecondsTimePoint; import com.sap.sse.gwt.dispatch.shared.exceptions.DispatchException; -public class GetStartlineAdvantagesByWindAction extends RequiresLiveRaceAndCachesMovingAverageAction { +public class GetStartlineAdvantagesByWindAction extends RequiresLiveRaceAndCachesMovingAverageAction { public GetStartlineAdvantagesByWindAction() {} @@ -22,24 +25,27 @@ public class GetStartlineAdvantagesByWindAction extends RequiresLiveRaceAndCach super(leaderboardName); } + private static final String MOVING_AVERAGE_CACHE_KEY = UUID.randomUUID().toString(); + @Override @GwtIncompatible public StartlineAdvantagesWithMaxAndAverageDTO execute(DashboardDispatchContext dashboardDispatchContext) throws DispatchException { StartlineAdvantagesWithMaxAndAverageDTO result = new StartlineAdvantagesWithMaxAndAverageDTO(); TrackedRace liveRace = super.getLiveRace(dashboardDispatchContext); if (liveRace != null) { - StartlineAdvantagesByWindCalculator startlineAdvantagesByWindCalculator = new StartlineAdvantagesByWindCalculator(dashboardDispatchContext); + final DomainFactory domainFactory = dashboardDispatchContext.getRacingEventService().getBaseDomainFactory(); + StartlineAdvantagesByWindCalculator startlineAdvantagesByWindCalculator = new StartlineAdvantagesByWindCalculator(dashboardDispatchContext, domainFactory); result = startlineAdvantagesByWindCalculator.getStartLineAdvantagesAccrossLineFromTrackedRaceAtTimePoint(liveRace, MillisecondsTimePoint.now()); } if(result != null && result.maximum != null) { super.addValueToMovingAverage(result.maximum, dashboardDispatchContext.getMovingAveragesCache()); - result.average = dashboardDispatchContext.getMovingAveragesCache().getValueForKey(getKeyForMovingAverage()); + result.average = dashboardDispatchContext.getMovingAveragesCache().getValueForKey(uniqueMovingAverageCacheKey()); } return result; } - + @Override - protected String getKeyForMovingAverage() { - return super.getLeaderboardName(); + protected String uniqueMovingAverageCacheKey() { + return MOVING_AVERAGE_CACHE_KEY; } } \ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/dashboardpanel/DashboardPanel.gss b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/dashboardpanel/DashboardPanel.gss index 14b3eef2b2f..e7151291ce6 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/dashboardpanel/DashboardPanel.gss +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/dashboardpanel/DashboardPanel.gss @@ -1,18 +1,5 @@ @require 'theme'; -.bar { - height: 100%; - margin-top: 20pt; - line-height: 15pt; - vertical-align: middle; - font-size: 15pt; - font-family: DASHBOARD_FONT_FAMILY; - width: 100%; - text-align: center; - font-weight: bold; - overflow: visible; -} - .page { position: absolute; border: none; @@ -22,15 +9,12 @@ top: 0; bottom: 30pt; margin: 5pt; + margin-top: 0px; } -.logo { - position: absolute; - width: 48pt; - height: 23.5pt; - margin-top: 17.5pt; +.header { + margin-top:20px; margin-left: 10pt; - z-index: 1; } .collumn { @@ -47,72 +31,52 @@ .collumnthree { left: 66.8%; - right: 0pt; + right: 0px; } .left { - left: 0pt; + left: 0px; right: 50%; } .right { left: 50%; - right: 0pt; + right: 0px; } .startline_advantage_by_wind_container { position: absolute; - background-color: white; - top: 27%; - right: 0pt; - left: 0pt; + top: 160px; + right: 0px; + left: 0px; bottom: 0%; } .startline_advantage_by_geometry_container { position: absolute; - background-color: white; - top: 0%; - right: 0pt; - left: 0pt; - bottom: 73%; - margin-bottom: 10pt; + top: 0px; + right: 0px; + left: 0px; + height: 145px } .windcharthint { position: absolute; - bottom: 0pt; - height: 15pt; - line-height: 15pt; - margin-top: 0pt; + height: DASHBOARD_FONT_SIZE_SMALL; + line-height: DASHBOARD_FONT_SIZE_SMALL; + bottom: 3px; vertical-align: middle; - font-size: 12pt; + font-size: DASHBOARD_FONT_SIZE_MEDIUM; font-family: DASHBOARD_FONT_FAMILY; width: 100%; text-align: center; } -.windloadinghint { +.event_logo { position: absolute; - background-color: white; - opacity: 0.4; - width: 100%; - height: 100%; - vertical-align: middle; - text-align: center; - z-index: 0; -} - -.windloadinghinttext { - position: absolute; - bottom: 0pt; - height: 15pt; - line-height: 15pt; - margin-top: 0pt; - vertical-align: middle; - font-size: 12pt; - font-family: DASHBOARD_FONT_FAMILY; - width: 100%; - text-align: center; - top: 50%; + height: DASHBOARD_SPACE_MEDIUM; + width: auto; + right: 10pt; + bottom: 10pt; + z-index: 1; } diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/dashboardpanel/DashboardPanel.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/dashboardpanel/DashboardPanel.java index bde0b1d2608..56c672e0951 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/dashboardpanel/DashboardPanel.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/dashboardpanel/DashboardPanel.java @@ -1,16 +1,18 @@ package com.sap.sailing.dashboards.gwt.client.dashboardpanel; -import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.UUID; import java.util.logging.Level; import java.util.logging.Logger; import com.google.gwt.core.client.GWT; -import com.google.gwt.dom.client.DivElement; import com.google.gwt.dom.client.Document; +import com.google.gwt.dom.client.Style.Visibility; +import com.google.gwt.safehtml.shared.UriUtils; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.user.client.Window; import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.HTMLPanel; @@ -22,17 +24,19 @@ import com.sap.sailing.dashboards.gwt.client.DashboardClientFactory; import com.sap.sailing.dashboards.gwt.client.actions.GetIDFromRaceThatIsLiveAction; import com.sap.sailing.dashboards.gwt.client.dataretriever.NumberOfWindBotsChangeListener; import com.sap.sailing.dashboards.gwt.client.dataretriever.WindBotDataRetrieverProvider; -import com.sap.sailing.dashboards.gwt.client.eventlogo.EventLogo; +import com.sap.sailing.dashboards.gwt.client.header.DashboardHeader; import com.sap.sailing.dashboards.gwt.client.notifications.orientation.WrongDeviceOrientationNotification; import com.sap.sailing.dashboards.gwt.client.widgets.PollsLiveDataEvery5Seconds; import com.sap.sailing.dashboards.gwt.client.widgets.startanalysis.StartAnalysisWidget; -import com.sap.sailing.dashboards.gwt.client.widgets.startlineadvantage.course.StartLineAdvantageByGeometryWidget; +import com.sap.sailing.dashboards.gwt.client.widgets.startlineadvantage.course.StartlineAdvantageByGeometryWidget; import com.sap.sailing.dashboards.gwt.client.widgets.startlineadvantage.wind.StartlineAdvantagesByWindWidget; import com.sap.sailing.dashboards.gwt.client.widgets.windbot.WindBotWidget; import com.sap.sailing.dashboards.gwt.shared.DashboardURLParameters; import com.sap.sailing.dashboards.gwt.shared.dto.RaceIdDTO; import com.sap.sailing.gwt.ui.client.SailingServiceAsync; import com.sap.sailing.gwt.ui.client.StringMessages; +import com.sap.sailing.gwt.ui.shared.EventDTO; +import com.sap.sse.gwt.client.media.ImageDTO; /** * This class contains all components of the Dashboard and the basic UI Elements of the Dashboard, like top and bottom @@ -49,41 +53,37 @@ public class DashboardPanel extends Composite implements NumberOfWindBotsChangeL @UiField LayoutPanel root; - + @UiField - HTMLPanel header; + DashboardHeader header; @UiField Carousel carousel; - @UiField - HTMLPanel leftwindbotcontainer; - - @UiField - HTMLPanel rightwindbotcontainer; + @UiField(provided = true) + WindBotWidget leftWindBotWidget; + + @UiField(provided = true) + WindBotWidget rightWindBotWidget; @UiField(provided = true) StartlineAdvantagesByWindWidget startlineAdvantagesByWindComponent; - @UiField - public DivElement windloadinghintleft; - - @UiField - public DivElement windloadinghintright; - @UiField public HTMLPanel bottombar; @UiField public HTMLPanel windcharthint; + @UiField + public Image eventLogo; + @UiField(provided = true) public StartAnalysisWidget startanalysisComponent; @UiField(provided = true) - public StartLineAdvantageByGeometryWidget startlineAdvantageByGeometryComponent; + public StartlineAdvantageByGeometryWidget startlineAdvantageByGeometryWidget; - private List windBotComponents; private StringMessages stringConstants; DashboardClientFactory dashboardClientFactory; private static final Logger logger = Logger.getLogger(DashboardPanel.class.getName()); @@ -91,34 +91,53 @@ public class DashboardPanel extends Composite implements NumberOfWindBotsChangeL public DashboardPanel(DashboardClientFactory dashboardClientFactory) { DashboardPanelResources.INSTANCE.style().ensureInjected(); this.dashboardClientFactory = dashboardClientFactory; - windBotComponents = new ArrayList(); + leftWindBotWidget = new WindBotWidget(dashboardClientFactory); + rightWindBotWidget = new WindBotWidget(dashboardClientFactory); startanalysisComponent = new StartAnalysisWidget(this.dashboardClientFactory); startlineAdvantagesByWindComponent = new StartlineAdvantagesByWindWidget(this.dashboardClientFactory); - startlineAdvantageByGeometryComponent = new StartLineAdvantageByGeometryWidget(this.dashboardClientFactory); + startlineAdvantageByGeometryWidget = new StartlineAdvantageByGeometryWidget(this.dashboardClientFactory); stringConstants = StringMessages.INSTANCE; initWidget(uiBinder.createAndBindUi(this)); - initLogos(); windcharthint.getElement().setInnerText(stringConstants.dashboardWindChartHint()); - windloadinghintleft.setInnerHTML(stringConstants.dashboardWindBotLoadingText()+"
"+stringConstants.dashboardWindBotLoadingMessage()); - windloadinghintright.setInnerHTML(stringConstants.dashboardWindBotLoadingText()+"
"+stringConstants.dashboardWindBotLoadingMessage()); - loadAndAddEventLogo(dashboardClientFactory.getSailingService()); + loadEventLogoAndName(dashboardClientFactory.getSailingService()); initAndAddWrongOrientationNotification(); registerForDashboardFiveSecondsTimer(dashboardClientFactory); } - - private void initLogos() { - Image logo = new Image(); - logo.setResource(DashboardPanelResources.INSTANCE.logo_sap()); - logo.getElement().addClassName(DashboardPanelResources.INSTANCE.style().logo()); - Document.get().getBody().appendChild(logo.getElement()); - } - private void loadAndAddEventLogo(SailingServiceAsync sailingServiceAsync){ + private void loadEventLogoAndName(SailingServiceAsync sailingServiceAsync){ String eventId = DashboardURLParameters.EVENT_ID.getValue(); if (eventId != null) { - EventLogo eventLogo = EventLogo.getEventLogoFromEventId(sailingServiceAsync, eventId); - if (eventLogo != null) { - Document.get().getBody().appendChild(eventLogo.getElement()); + try { + final UUID eventUUID = UUID.fromString(eventId); + logger.log(Level.INFO, "Loading EventDTO for id " + eventId); + sailingServiceAsync.getEventById(eventUUID, true, new AsyncCallback() { + @Override + public void onSuccess(final EventDTO event) { + logger.log(Level.INFO, "Received EventDTO"); + if (event != null) { + final ImageDTO logo = event.getLogoImage(); + if (logo != null) { + eventLogo.getElement().setAttribute("src", UriUtils.fromString(logo.getSourceRef()).asString()); + } else { + eventLogo.getElement().getStyle().setVisibility(Visibility.HIDDEN); + } + if (event.getName() != null) { + header.setEventName(event.getName()); + Window.setTitle("Dashboard - "+event.getName()); + } + } else { + logger.log(Level.INFO, "Received EventDTO is null"); + } + } + + @Override + public void onFailure(Throwable caught) { + logger.log(Level.INFO, "Failed to received EventDTO, "+caught.getMessage()); + eventLogo.getElement().getStyle().setVisibility(Visibility.HIDDEN); + } + }); + } catch (IllegalArgumentException e) { + eventLogo.getElement().getStyle().setVisibility(Visibility.HIDDEN); } } } @@ -127,52 +146,6 @@ public class DashboardPanel extends Composite implements NumberOfWindBotsChangeL WrongDeviceOrientationNotification wrongDeviceOrientationNotification = new WrongDeviceOrientationNotification(); Document.get().getBody().appendChild(wrongDeviceOrientationNotification.getElement()); } - - private void initWindBotComponents(List windBotIDs, - WindBotDataRetrieverProvider windBotDataRetrieverProvider) { - int windBotAddedCounterTOConsiderForPanels = 0; - leftwindbotcontainer.clear(); - removeWindBotComponentsAsDataRetrieverListener(windBotDataRetrieverProvider); - windBotComponents.clear(); - for (String windBotID : windBotIDs) { - if (windBotAddedCounterTOConsiderForPanels == 0) { - WindBotWidget leftwindBotComponent = new WindBotWidget(windBotID); - leftwindbotcontainer.add(leftwindBotComponent); - windBotComponents.add(leftwindBotComponent); - windloadinghintleft.getStyle().setOpacity(0.0); - } else if (windBotAddedCounterTOConsiderForPanels == 1) { - WindBotWidget rightwindBotComponent = new WindBotWidget(windBotID); - rightwindbotcontainer.add(rightwindBotComponent); - windBotComponents.add(rightwindBotComponent); - windloadinghintright.getStyle().setOpacity(0.0); - } - windBotAddedCounterTOConsiderForPanels++; - if (windloadinghintleft.getStyle().getOpacity() != "0.0" - || windloadinghintright.getStyle().getOpacity() != "0.0") { - windloadinghintleft.setInnerHTML(stringConstants.dashboardWindBotNotAvailable()); - windloadinghintright.setInnerHTML(stringConstants.dashboardWindBotNotAvailable()); - } - } - addWindBotComponentsAsDataRetrieverListener(windBotDataRetrieverProvider); - } - - private void addWindBotComponentsAsDataRetrieverListener(WindBotDataRetrieverProvider windBotDataRetrieverProvider) { - for (WindBotWidget windBotComponent : windBotComponents) { - logger.log(Level.INFO, "Registering WindBotDataRetrieverListener"); - windBotDataRetrieverProvider.addWindBotDataRetrieverListener(windBotComponent); - } - } - - private void removeWindBotComponentsAsDataRetrieverListener( - WindBotDataRetrieverProvider windBotDataRetrieverProvider) { - for (WindBotWidget windBotComponent : windBotComponents) { - windBotDataRetrieverProvider.removeWindBotDataRetrieverListener(windBotComponent); - } - } - - private void setHeaderText(String raceName) { - this.header.getElement().setInnerText(raceName); - } @Override public void timeChanged(Date newTime, Date oldTime) { @@ -185,7 +158,7 @@ public class DashboardPanel extends Composite implements NumberOfWindBotsChangeL public void onSuccess(RaceIdDTO result) { if (result != null && result.getRaceId() != null) { logger.log(Level.INFO, "Updating UI with live race id"); - setHeaderText(result.getRaceId().getRaceName()); + header.setRaceName(result.getRaceId().getRaceName()); } else { logger.log(Level.INFO, "Received null for live race id"); } @@ -207,19 +180,21 @@ public class DashboardPanel extends Composite implements NumberOfWindBotsChangeL } @Override - public void numberOfWindBotsReceivedChanged(List windBotIDs, - WindBotDataRetrieverProvider windBotDataRetrieverProvider) { - if(windBotIDs != null) { - logger.log(Level.INFO, "Number of available windbots changed to "+windBotIDs.size()); + public void numberOfWindBotsReceivedChanged(List windBotIDs, WindBotDataRetrieverProvider windBotDataRetrieverProvider) { + if (windBotIDs != null) { + logger.log(Level.INFO, "Number of available windbots changed to " + windBotIDs.size()); + for (int i = 0; i < windBotIDs.size(); i++) { + if (i == 0) { + leftWindBotWidget.setWindBotId(windBotIDs.get(i)); + windBotDataRetrieverProvider.addWindBotDataRetrieverListener(leftWindBotWidget); + } + if (i == 1) { + rightWindBotWidget.setWindBotId(windBotIDs.get(i)); + windBotDataRetrieverProvider.addWindBotDataRetrieverListener(rightWindBotWidget); + } + } } else { logger.log(Level.INFO, "Number of available windbots changed. WindBots List is null"); } - initWindBotComponents(windBotIDs, windBotDataRetrieverProvider); - } - - @Override - public void numberOfWindBotsReceivedIsZero() { - windloadinghintleft.setInnerText(stringConstants.dashboardWindBotNotAvailable()); - windloadinghintright.setInnerText(stringConstants.dashboardWindBotNotAvailable()); } } diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/dashboardpanel/DashboardPanel.ui.xml b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/dashboardpanel/DashboardPanel.ui.xml index 9016ead477b..94eb1010e74 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/dashboardpanel/DashboardPanel.ui.xml +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/dashboardpanel/DashboardPanel.ui.xml @@ -1,6 +1,8 @@ - - + + - + -
-
-
+
- -
-
-
+ +
- + - + - +
- - + + +
diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/dashboardpanel/DashboardPanelResources.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/dashboardpanel/DashboardPanelResources.java index e3b7a8dddc4..c7e147925a4 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/dashboardpanel/DashboardPanelResources.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/dashboardpanel/DashboardPanelResources.java @@ -7,34 +7,25 @@ package com.sap.sailing.dashboards.gwt.client.dashboardpanel; import com.google.gwt.core.client.GWT; import com.google.gwt.resources.client.ClientBundle; import com.google.gwt.resources.client.CssResource; -import com.google.gwt.resources.client.ImageResource; public interface DashboardPanelResources extends ClientBundle { public static final DashboardPanelResources INSTANCE = GWT.create(DashboardPanelResources.class); - @Source("com/sap/sailing/dashboards/gwt/client/images/logo_sap.png") - ImageResource logo_sap(); - - @Source("com/sap/sailing/dashboards/gwt/client/images/settings.png") - ImageResource settings(); - @Source({"com/sap/sailing/dashboards/gwt/client/theme/theme.gss", "DashboardPanel.gss"}) DashboardGSS style(); public interface DashboardGSS extends CssResource { - String bar(); String page(); + String header(); String collumn(); String startanalysiscollumn(); String collumnthree(); - String logo(); String right(); String left(); String startline_advantage_by_wind_container(); String startline_advantage_by_geometry_container(); String windcharthint(); - String windloadinghint(); - String windloadinghinttext(); + String event_logo(); } } diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/dataretriever/NumberOfWindBotsChangeListener.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/dataretriever/NumberOfWindBotsChangeListener.java index e85672afaaf..17b803da303 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/dataretriever/NumberOfWindBotsChangeListener.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/dataretriever/NumberOfWindBotsChangeListener.java @@ -4,5 +4,4 @@ import java.util.List; public interface NumberOfWindBotsChangeListener { public void numberOfWindBotsReceivedChanged(List windBotIDs, WindBotDataRetrieverProvider windBotDataRetrieverProvider); - public void numberOfWindBotsReceivedIsZero(); } diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/dataretriever/WindBotDataRetriever.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/dataretriever/WindBotDataRetriever.java index 440951f64b8..f7827b0725e 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/dataretriever/WindBotDataRetriever.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/dataretriever/WindBotDataRetriever.java @@ -76,7 +76,6 @@ public class WindBotDataRetriever implements PollsLiveDataEvery5Seconds, WindBot } notifyWindBotDataRetrieverListeners(result); } else { - notifyListenersAboutNumberOfWindBotsReceivedIsZero(); logger.log(Level.INFO, "WindInfoForRaceDTO is not containing wind from windbots"); } } else { @@ -115,12 +114,6 @@ public class WindBotDataRetriever implements PollsLiveDataEvery5Seconds, WindBot } } - private void notifyListenersAboutNumberOfWindBotsReceivedIsZero() { - for (NumberOfWindBotsChangeListener numberOfWindBotsChangeListener : numberOfWindBotsChangeListeners) { - numberOfWindBotsChangeListener.numberOfWindBotsReceivedIsZero(); - } - } - @Override public void addWindBotDataRetrieverListener(WindBotDataRetrieverListener windBotDataRetrieverListener) { windBotDataRetrieverListeners.add(windBotDataRetrieverListener); @@ -156,7 +149,6 @@ public class WindBotDataRetriever implements PollsLiveDataEvery5Seconds, WindBot logger.log(Level.INFO, "Received RegattaAndRaceIdentifier from race that takes wind fixes now"); loadWindBotData(finaloldTime, finalNewTime, raceId); } else { - notifyListenersAboutNumberOfWindBotsReceivedIsZero(); logger.log(Level.INFO, "Can´t load wind data because RegattaAndRaceIdentifier for race which takes wind is null"); } } @@ -164,7 +156,6 @@ public class WindBotDataRetriever implements PollsLiveDataEvery5Seconds, WindBot @Override public void onFailure(Throwable caught) { - notifyListenersAboutNumberOfWindBotsReceivedIsZero(); logger.log(Level.INFO, "Failed to received RegattaAndRaceIdentifier from race that takes wind fixes now"); logger.log(Level.INFO, caught.getMessage()); } diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/eventlogo/EventLogo.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/eventlogo/EventLogo.java deleted file mode 100644 index bf051376afb..00000000000 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/eventlogo/EventLogo.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.sap.sailing.dashboards.gwt.client.eventlogo; - -import java.util.UUID; -import java.util.logging.Level; -import java.util.logging.Logger; - -import com.google.gwt.dom.client.Style.Visibility; -import com.google.gwt.safehtml.shared.UriUtils; -import com.google.gwt.user.client.Window; -import com.google.gwt.user.client.rpc.AsyncCallback; -import com.google.gwt.user.client.ui.Image; -import com.sap.sailing.gwt.ui.client.SailingServiceAsync; -import com.sap.sailing.gwt.ui.shared.EventDTO; -import com.sap.sse.gwt.client.media.ImageDTO; - -public class EventLogo extends Image { - - private static final Logger logger = Logger.getLogger(EventLogo.class.getName()); - - protected EventLogo() { - super(); - this.getElement().addClassName("eventLogo"); - } - - public static EventLogo getEventLogoFromEventId(SailingServiceAsync sailingServiceAsync, String eventId) { - final EventLogo eventLogo = new EventLogo(); - try { - final UUID eventUUID = UUID.fromString(eventId); - logger.log(Level.INFO, "Loading EventDTO for id " + eventId); - sailingServiceAsync.getEventById(eventUUID, true, new AsyncCallback() { - @Override - public void onSuccess(final EventDTO event) { - logger.log(Level.INFO, "Received EventDTO"); - if (event != null) { - final ImageDTO logo = event.getLogoImage(); - if (logo != null) { - eventLogo.getElement().setAttribute("src", UriUtils.fromString(logo.getSourceRef()).asString()); - } else { - eventLogo.getElement().getStyle().setVisibility(Visibility.HIDDEN); - } - if (event.getName() != null) { - Window.setTitle(event.getName() + " Dashboard"); - } - } else { - logger.log(Level.INFO, "Received EventDTO is null"); - } - } - - @Override - public void onFailure(Throwable caught) { - logger.log(Level.INFO, "Failed to received EventDTO, "+caught.getMessage()); - eventLogo.getElement().getStyle().setVisibility(Visibility.HIDDEN); - } - }); - } catch (IllegalArgumentException e) { - eventLogo.getElement().getStyle().setVisibility(Visibility.HIDDEN); - } - return eventLogo; - } -} diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/header/DashboardHeader.gss b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/header/DashboardHeader.gss new file mode 100644 index 00000000000..59f5401a5e7 --- /dev/null +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/header/DashboardHeader.gss @@ -0,0 +1,49 @@ +@require 'theme'; + +.sap_logo { + position: absolute; + height: DASHBOARD_SPACE_MEDIUM; + width: auto; + top: 0px; + left: 0px; + z-index: 1; +} + +.event_race_container { + position: absolute; + height: DASHBOARD_SPACE_MEDIUM; + width: 100%; + top: 0px; + color: LIGHT_TEXT_COLOR; +} + +.event { + width: 100%; + height: DASHBOARD_SPACE_MEDIUM; + top: 0px; + line-height: DASHBOARD_SPACE_MEDIUM; + vertical-align: middle; + font-size: DASHBOARD_FONT_SIZE_MEDIUM; + font-family: DASHBOARD_FONT_FAMILY; + text-align: center; + font-weight: bold; + overflow: visible; +} + +.event_shared_space { + height: DASHBOARD_FONT_SIZE_MEDIUM; + top: DASHBOARD_SPACE_VERY_SMALL; + line-height: DASHBOARD_FONT_SIZE_MEDIUM; +} + +.race { + width: 100%; + height: DASHBOARD_FONT_SIZE_SMALL; + margin-top: 5px; + line-height: DASHBOARD_FONT_SIZE_SMALL; + vertical-align: middle; + font-size: DASHBOARD_FONT_SIZE_SMALL; + font-family: DASHBOARD_FONT_FAMILY; + text-align: center; + overflow: visible; +} diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/header/DashboardHeader.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/header/DashboardHeader.java new file mode 100644 index 00000000000..3f641a2b5b3 --- /dev/null +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/header/DashboardHeader.java @@ -0,0 +1,72 @@ +package com.sap.sailing.dashboards.gwt.client.header; + +import java.util.Iterator; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.dom.client.DivElement; +import com.google.gwt.resources.client.CssResource; +import com.google.gwt.uibinder.client.UiBinder; +import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.user.client.ui.Composite; +import com.google.gwt.user.client.ui.HasWidgets; +import com.google.gwt.user.client.ui.Image; +import com.google.gwt.user.client.ui.Widget; +import com.sap.sailing.gwt.ui.client.StringMessages; + +public class DashboardHeader extends Composite implements HasWidgets { + + private static DashboardHeaderUiBinder uiBinder = GWT.create(DashboardHeaderUiBinder.class); + + interface DashboardHeaderUiBinder extends UiBinder { + } + + interface SettingsButtonWithSelectionIndicationLabelStyle extends CssResource { + } + + @UiField + Image sapLogo; + + @UiField + DivElement event; + + @UiField + DivElement race; + + private DashboardHeaderResources dashboardHeaderResources = DashboardHeaderResources.INSTANCE; + + public DashboardHeader() { + dashboardHeaderResources.gss().ensureInjected(); + initWidget(uiBinder.createAndBindUi(this)); + sapLogo.setResource(DashboardHeaderResources.INSTANCE.sapLogo()); + event.setInnerHTML(StringMessages.INSTANCE.dashboardHeader()); + } + + public void setEventName(String eventName) { + event.setInnerHTML(eventName); + } + + public void setRaceName(String raceName) { + this.event.addClassName(dashboardHeaderResources.gss().event_shared_space()); + race.setInnerHTML(raceName); + } + + @Override + public void add(Widget w) { + throw new UnsupportedOperationException("The method add(Widget w) is not supported."); + } + + @Override + public void clear() { + throw new UnsupportedOperationException("The method clear() is not supported."); + } + + @Override + public Iterator iterator() { + return null; + } + + @Override + public boolean remove(Widget w) { + return false; + } +} diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/header/DashboardHeader.ui.xml b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/header/DashboardHeader.ui.xml new file mode 100644 index 00000000000..cd7a0ab64d9 --- /dev/null +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/header/DashboardHeader.ui.xml @@ -0,0 +1,14 @@ + + + + + + + +
+
+
+
+
+
\ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/header/DashboardHeaderResources.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/header/DashboardHeaderResources.java new file mode 100644 index 00000000000..ff75072020a --- /dev/null +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/header/DashboardHeaderResources.java @@ -0,0 +1,29 @@ +package com.sap.sailing.dashboards.gwt.client.header; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.resources.client.ClientBundle; +import com.google.gwt.resources.client.CssResource; +import com.google.gwt.resources.client.ImageResource; + +/** + * @author Alexander Ries (D062114) + * + */ +public interface DashboardHeaderResources extends ClientBundle { + + public static final DashboardHeaderResources INSTANCE = GWT.create(DashboardHeaderResources.class); + + @Source("com/sap/sailing/dashboards/gwt/client/images/logo_sap.png") + ImageResource sapLogo(); + + @Source({"com/sap/sailing/dashboards/gwt/client/theme/theme.gss", "DashboardHeader.gss"}) + DashboardHeaderGSS gss(); + + public interface DashboardHeaderGSS extends CssResource { + String sap_logo(); + String event_race_container(); + String event(); + String event_shared_space(); + String race(); + } +} diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/linker/DashboardManifestLinker.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/linker/DashboardManifestLinker.java new file mode 100644 index 00000000000..a630e5cbe1b --- /dev/null +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/linker/DashboardManifestLinker.java @@ -0,0 +1,22 @@ +package com.sap.sailing.dashboards.gwt.client.linker; + +import com.google.gwt.core.ext.linker.Shardable; +import com.sap.sse.gwt.client.linker.ManifestLinker; + +/** + * @author Alexander Ries (D062114) + * + */ + +@Shardable +public class DashboardManifestLinker extends ManifestLinker { + + @Override + protected String[] staticCachedFiles() { + return new String[] { "/dashboards/RibDashboard.html", + "/dashboards/RibDashboard.css", + "/dashboards/images/dashboardicon.png", + "/dashboards/js/jquery-1.5.2.min.js", + "/sailing-fontface-1.0.cache.css"}; + } +} diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/linker/cache.manifest.template b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/linker/cache.manifest.template new file mode 100644 index 00000000000..dd838fa13be --- /dev/null +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/linker/cache.manifest.template @@ -0,0 +1,14 @@ +CACHE MANIFEST +# Unique id #$UNIQUEID$ +# Build version $BUILDVERSION$ +# Change this every time for cache to invalidate. +# Do not delete the sections, as safari requires this file structure!!! + +NETWORK: +* + +CACHE: +$STATICAPPFILES$ +$GENAPPFILES$ + +FALLBACK: \ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/notifications/bottom/BottomNotification.gss b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/notifications/bottom/BottomNotification.gss index 627f472867f..656cd57794a 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/notifications/bottom/BottomNotification.gss +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/notifications/bottom/BottomNotification.gss @@ -4,12 +4,12 @@ position: absolute !important; opacity: 0.9; background-color: #F0AB00; - height: 0pt; + height: 0px; width: 100%; - bottom: 0pt; + bottom: 0px; text-align: center; - font-size: 15pt; - line-height: 30pt; + font-size: DASHBOARD_FONT_SIZE_LARGE; + line-height: DASHBOARD_SPACE_MEDIUM; color: black; font-family: DASHBOARD_FONT_FAMILY; z-index: 2; @@ -20,8 +20,8 @@ -moz-transition: all 700ms cubic-bezier(0.480, -0.035, 0.000, 2.650); -o-transition: all 700ms cubic-bezier(0.480, -0.035, 0.000, 2.650); transition: all 700ms cubic-bezier(0.480, -0.035, 0.000, 2.650); - height: 30pt; - line-height: 30pt; + height: DASHBOARD_SPACE_MEDIUM; + line-height: DASHBOARD_SPACE_MEDIUM; } .hidden { @@ -29,6 +29,6 @@ -moz-transition: all 700ms cubic-bezier(0.480, -0.035, 0.000, 1.650); -o-transition: all 700ms cubic-bezier(0.480, -0.035, 0.000, 1.650); transition: all 700ms cubic-bezier(0.480, -0.035, 0.000, 1.650); - height: 0pt; - line-height: 0pt; + height: 0px; + line-height: 0px; } \ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/notifications/orientation/WrongDeviceOrientationNotification.gss b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/notifications/orientation/WrongDeviceOrientationNotification.gss index 948368c90ee..a6b8e377386 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/notifications/orientation/WrongDeviceOrientationNotification.gss +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/notifications/orientation/WrongDeviceOrientationNotification.gss @@ -1,11 +1,31 @@ @require 'theme'; +.notification_background { + position: absolute !important; + top: 0px; + left: 0px; + background-color: DARK_GREY; + z-index: 7; +} + +.notification_background_shown { + width: 100%; + height: 100%; + opacity: 1.0; +} + +.notification_background_hidden { + width: 0px; + height: 0px; + opacity: 0.0; +} + .notification { position: absolute !important; top: 50%; right: 50%; - background-color: white; - z-index: 2; + background-color: WHITE; + z-index: 8; } .shown { diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/notifications/orientation/WrongDeviceOrientationNotification.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/notifications/orientation/WrongDeviceOrientationNotification.java index 6ae4e7f05d4..c4944053911 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/notifications/orientation/WrongDeviceOrientationNotification.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/notifications/orientation/WrongDeviceOrientationNotification.java @@ -3,47 +3,53 @@ package com.sap.sailing.dashboards.gwt.client.notifications.orientation; import com.google.gwt.user.client.ui.AbsolutePanel; import com.google.gwt.user.client.ui.Image; import com.google.gwt.user.client.ui.Label; -import com.google.gwt.user.client.ui.RootLayoutPanel; import com.sap.sailing.dashboards.gwt.client.device.Orientation; import com.sap.sailing.dashboards.gwt.client.device.OrientationListener; import com.sap.sailing.dashboards.gwt.client.device.OrientationType; -import com.sap.sailing.dashboards.gwt.client.visualeffects.BlurEffect; import com.sap.sse.common.Util.Pair; public class WrongDeviceOrientationNotification extends AbsolutePanel implements OrientationListener { private Label rotateDeviceLabel; + private AbsolutePanel notification; public WrongDeviceOrientationNotification() { super(); WrongDeviceOrientationNotificationResources.INSTANCE.gss().ensureInjected(); - this.addStyleName(WrongDeviceOrientationNotificationResources.INSTANCE.gss().notification()); - this.addStyleName(WrongDeviceOrientationNotificationResources.INSTANCE.gss().hidden()); + this.addStyleName(WrongDeviceOrientationNotificationResources.INSTANCE.gss().notification_background()); + this.addStyleName(WrongDeviceOrientationNotificationResources.INSTANCE.gss().notification_background_hidden()); + notification = new AbsolutePanel(); + notification.addStyleName(WrongDeviceOrientationNotificationResources.INSTANCE.gss().notification()); + notification.addStyleName(WrongDeviceOrientationNotificationResources.INSTANCE.gss().hidden()); Image rotateDeviceIcon = new Image(); rotateDeviceIcon.setResource(WrongDeviceOrientationNotificationResources.INSTANCE.rotatedevice()); rotateDeviceIcon.getElement().addClassName(WrongDeviceOrientationNotificationResources.INSTANCE.gss().logo()); - add(rotateDeviceIcon); + notification.add(rotateDeviceIcon); rotateDeviceLabel = new Label(); rotateDeviceLabel.getElement().addClassName(WrongDeviceOrientationNotificationResources.INSTANCE.gss().text()); rotateDeviceLabel.setText("Rotate Device"); - add(rotateDeviceLabel); + notification.add(rotateDeviceLabel); + + this.add(notification); Orientation.getInstance().addListener(this); Orientation.getInstance().triggerDeviceOrientationRead(); } public void show() { - this.removeStyleName(WrongDeviceOrientationNotificationResources.INSTANCE.gss().hidden()); - this.addStyleName(WrongDeviceOrientationNotificationResources.INSTANCE.gss().shown()); - BlurEffect.getInstance().addToView(RootLayoutPanel.get()); + this.removeStyleName(WrongDeviceOrientationNotificationResources.INSTANCE.gss().notification_background_hidden()); + this.addStyleName(WrongDeviceOrientationNotificationResources.INSTANCE.gss().notification_background_shown()); + notification.removeStyleName(WrongDeviceOrientationNotificationResources.INSTANCE.gss().hidden()); + notification.addStyleName(WrongDeviceOrientationNotificationResources.INSTANCE.gss().shown()); } public void hide() { - this.removeStyleName(WrongDeviceOrientationNotificationResources.INSTANCE.gss().shown()); - this.addStyleName(WrongDeviceOrientationNotificationResources.INSTANCE.gss().hidden()); - BlurEffect.getInstance().removeFromView(RootLayoutPanel.get()); + this.removeStyleName(WrongDeviceOrientationNotificationResources.INSTANCE.gss().notification_background_shown()); + this.addStyleName(WrongDeviceOrientationNotificationResources.INSTANCE.gss().notification_background_hidden()); + notification.removeStyleName(WrongDeviceOrientationNotificationResources.INSTANCE.gss().shown()); + notification.addStyleName(WrongDeviceOrientationNotificationResources.INSTANCE.gss().hidden()); } @Override diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/notifications/orientation/WrongDeviceOrientationNotificationResources.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/notifications/orientation/WrongDeviceOrientationNotificationResources.java index 43b88ebcfed..b341950f9ab 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/notifications/orientation/WrongDeviceOrientationNotificationResources.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/notifications/orientation/WrongDeviceOrientationNotificationResources.java @@ -20,6 +20,9 @@ public interface WrongDeviceOrientationNotificationResources extends ClientBundl WrongDeviceNotificationGSS gss(); public interface WrongDeviceNotificationGSS extends CssResource { + public String notification_background(); + public String notification_background_shown(); + public String notification_background_hidden(); public String notification(); public String shown(); public String hidden(); diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/CompetitorSelectionPopup.css b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/CompetitorSelectionPopup.css deleted file mode 100644 index 665596c0f8d..00000000000 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/CompetitorSelectionPopup.css +++ /dev/null @@ -1,85 +0,0 @@ -@CHARSET "UTF-8"; - -.competitorselectionbackground { - position: absolute; - background-color: rgba(0, 0, 0, 0.6); - width: 100%; - height: 100%; - z-index: 1; -} - -.competitorselectionpopup { - position: absolute; - left: 50%; - top: 50%; - width: 200pt; - height: 200pt; - margin-top: -600pt; - margin-left: -100pt; - background-color: rgba(255, 255, 255, 1); - border-radius: 0px; - z-index: 2; -} - -.header { - position: absolute; - color: black; - font-size: 12pt; - background-color: white; - height: 30pt; - line-height: 30pt; - vertical-align: middle; - text-align: center; - font-weight: bold; - text-shadow: 0 1px 1px rgba(255, 255, 255, 0.7); - width: 100%; - z-index: 3; -} - -.scrollpanel { - position: absolute; - top: 30pt; - width: 100%; - bottom: 6pt; - overflow: hidden; - z-index: 2; -} - -.button { - position: absolute; - background-color: #2AB3E8; - box-shadow: none; - outline: none; - border-width: 0; - font-size: 12pt; - font-color: white; - color: white; - height: 0pt; - width: 100%; - top: 100%; - left: 0pt; -} - -.button:active { - background-color: #4192D9; -} - -.buttonshow { - transition: all ease-in-out 200ms; - height: 30pt; -} - -.popuphide { - transition: all ease-in-out 500ms; - height: 0pt; -} - -.popupshow { - transition: margin-top ease-in-out 500ms; - margin-top: -100pt; -} - -.popuphide { - transition: margin-top ease-in-out 500ms; - margin-top: -600pt; -} diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/CompetitorSelectionPopup.gss b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/CompetitorSelectionPopup.gss new file mode 100644 index 00000000000..7ddd775d473 --- /dev/null +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/CompetitorSelectionPopup.gss @@ -0,0 +1,91 @@ +@require 'theme'; + +.competitorselectionbackground { + position: absolute; + background-color: rgba(0, 0, 0, 0.4); + width: 100%; + height: 100%; + z-index: 4; +} + +.competitorselectionpopup { + position: absolute; + left: 50%; + top: 50%; + width: 250px; + height: 300px; + margin-top: -150px; + margin-left: -125px; + background-color: WHITE; + border-radius: 5px; + overflow: hidden; + z-index: 7; +} + +.header { + position: absolute; + color: BLACK; + font-size: DASHBOARD_FONT_SIZE_MEDIUM; + background-color: WHITE; + height: DASHBOARD_SPACE_MEDIUM; + line-height: DASHBOARD_SPACE_MEDIUM; + vertical-align: middle; + text-align: center; + font-weight: bold; + text-shadow: 0 1px 1px rgba(255, 255, 255, 0.7); + width: 100%; + z-index: 3; +} + +.scrollpanel { + position: absolute; + top: DASHBOARD_SPACE_MEDIUM; + width: 100%; + bottom: 42px; + overflow: hidden; + z-index: 2; +} + +.buttonSeparator { + position: absolute; + height: DASHBOARD_SPACE_MEDIUM; + width: 1px; + left: 49%; + bottom: 0px; + background-color: WHITE; +} + +.button { + position: absolute; + bottom: 0px; + background-color: BUTTON_BACKGROUND; + box-shadow: none; + outline: none; + border-width: 0; + font-size: DASHBOARD_FONT_SIZE_MEDIUM; + line-height: DASHBOARD_SPACE_MEDIUM; + text-align: center; + color: WHITE; + height: DASHBOARD_SPACE_MEDIUM; + width: 50%; +} + +.button:active { + background-color: BUTTON_BACKGROUND_ACTIVE; +} + +.cancelButton { + left:0px; +} + +.okButton { + right: 0px; +} + +.popupshow { +/* margin-top: -150pt; */ +} + +.popuphide { +/* margin-top: -600pt; */ +} diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/CompetitorSelectionPopup.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/CompetitorSelectionPopup.java index a41d2825551..743eb998187 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/CompetitorSelectionPopup.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/CompetitorSelectionPopup.java @@ -5,48 +5,42 @@ import java.util.Iterator; import java.util.List; import com.google.gwt.core.client.GWT; -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.resources.client.CssResource; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.uibinder.client.UiHandler; -import com.google.gwt.user.client.ui.Button; +import com.google.gwt.user.client.Event; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.HTMLPanel; import com.google.gwt.user.client.ui.HasWidgets; import com.google.gwt.user.client.ui.RootLayoutPanel; -import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.Widget; +import com.sap.sailing.dashboards.gwt.client.popups.competitorselection.table.CompetitorTable; +import com.sap.sailing.dashboards.gwt.client.popups.competitorselection.table.CompetitorTableRowSelectionListener; +import com.sap.sailing.dashboards.gwt.client.widgets.ActionPanel; import com.sap.sailing.domain.common.dto.CompetitorDTO; public class CompetitorSelectionPopup extends Composite implements HasWidgets, CompetitorTableRowSelectionListener { - interface CompetitorSelectionPopupStyle extends CssResource { - String popupshow(); - String popuphide(); - String buttonshow(); - } + @UiField(provided = true) + ActionPanel competitorselectionbackground; @UiField - CompetitorSelectionPopupStyle style; + HTMLPanel competitorselectionpopup; - @UiField - HTMLPanel competitorselectionbackground; - - @UiField - VerticalPanel competitorselectionpopup; - @UiField HTMLPanel header; @UiField(provided = true) CompetitorTable competitortable; - @UiField - Button button; + @UiField(provided = true) + ActionPanel cancelButton; + + @UiField(provided = true) + ActionPanel okButton; private CompetitorDTO currentCompetitorSelected; private boolean isVisible; + private CompetitorSelectionPopupResources competitorSelectionPopupResources = CompetitorSelectionPopupResources.INSTANCE; private List competitorSelectionPopupListener; @@ -56,28 +50,34 @@ public class CompetitorSelectionPopup extends Composite implements HasWidgets, C } public CompetitorSelectionPopup() { + competitorSelectionPopupResources.gss().ensureInjected(); competitorSelectionPopupListener = new ArrayList(); competitortable = new CompetitorTable(this); isVisible = false; + competitorselectionbackground = new ActionPanel(Event.TOUCHEVENTS, Event.ONCLICK); + cancelButton = new ActionPanel(Event.TOUCHEVENTS, Event.ONCLICK); + okButton = new ActionPanel(Event.TOUCHEVENTS, Event.ONCLICK); + addActionListenerToActionPanels(); initWidget(uiBinder.createAndBindUi(this)); + cancelButton.getElement().setInnerText("CANCEL"); + okButton.getElement().setInnerText("OK"); } public void show(List competitorList) { competitortable.setTableContent(competitorList); RootLayoutPanel.get().add(this); - this.button.setText("OK"); - competitorselectionpopup.addStyleName(style.popupshow()); - competitorselectionpopup.removeStyleName(style.popuphide()); + competitorselectionpopup.addStyleName(competitorSelectionPopupResources.gss().popupshow()); + competitorselectionpopup.removeStyleName(competitorSelectionPopupResources.gss().popuphide()); isVisible = true; } public void hide() { - competitorselectionpopup.addStyleName(style.popuphide()); - competitorselectionpopup.removeStyleName(style.popupshow()); + competitorselectionpopup.addStyleName(competitorSelectionPopupResources.gss().popuphide()); + competitorselectionpopup.removeStyleName(competitorSelectionPopupResources.gss().popupshow()); RootLayoutPanel.get().remove(this); isVisible = false; } - + public void addListener(CompetitorSelectionListener o) { if (o != null && !competitorSelectionPopupListener.contains(o)) { this.competitorSelectionPopupListener.add(o); @@ -94,25 +94,42 @@ public class CompetitorSelectionPopup extends Composite implements HasWidgets, C } hide(); } - - public boolean isShown(){ + + public boolean isShown() { return isVisible; } - @UiHandler("button") - void handleClick(ClickEvent e) { - hide(); - if (currentCompetitorSelected != null) { - notifyListenerAboutOKButtonClickedWithSelectedCompetitorName(currentCompetitorSelected); - } - } - - @Override - public void didSelectedRowWithCompetitorName(CompetitorDTO competitor) { - button.getElement().addClassName(style.buttonshow()); - currentCompetitorSelected = competitor; + private void addActionListenerToActionPanels() { + competitorselectionbackground.addActionPanelListener(new ActionPanel.ActionPanelListener() { + + @Override + public void eventTriggered() { + hide(); + } + }); + cancelButton.addActionPanelListener(new ActionPanel.ActionPanelListener() { + + @Override + public void eventTriggered() { + hide(); + } + }); + okButton.addActionPanelListener(new ActionPanel.ActionPanelListener() { + + @Override + public void eventTriggered() { + hide(); + if (currentCompetitorSelected != null) { + notifyListenerAboutOKButtonClickedWithSelectedCompetitorName(currentCompetitorSelected); + } + } + }); } + @Override + public void didSelectedRowWithCompetitorName(CompetitorDTO competitor) { + currentCompetitorSelected = competitor; + } @Override public void add(Widget w) { diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/CompetitorSelectionPopup.ui.xml b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/CompetitorSelectionPopup.ui.xml index 9c762ce1e0e..8980164e04d 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/CompetitorSelectionPopup.ui.xml +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/CompetitorSelectionPopup.ui.xml @@ -1,25 +1,25 @@ + xmlns:table="urn:import:com.sap.sailing.dashboards.gwt.client.popups.competitorselection.table" + xmlns:mgwts="urn:import:com.googlecode.mgwt.ui.client.widget.panel.scroll" + xmlns:action="urn:import:com.sap.sailing.dashboards.gwt.client.widgets"> - - - - Select your Team - - - - - - - + + + + + + Select your Team + + + + + + +
+ +
\ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/CompetitorSelectionPopupResources.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/CompetitorSelectionPopupResources.java new file mode 100644 index 00000000000..79330d81dd2 --- /dev/null +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/CompetitorSelectionPopupResources.java @@ -0,0 +1,30 @@ +package com.sap.sailing.dashboards.gwt.client.popups.competitorselection; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.resources.client.ClientBundle; +import com.google.gwt.resources.client.CssResource; + +/** + * @author Alexander Ries (D062114) + * + */ +public interface CompetitorSelectionPopupResources extends ClientBundle { + + public static final CompetitorSelectionPopupResources INSTANCE = GWT.create(CompetitorSelectionPopupResources.class); + + @Source({"com/sap/sailing/dashboards/gwt/client/theme/theme.gss", "CompetitorSelectionPopup.gss"}) + CompetitorSelectionPopupGss gss(); + + public interface CompetitorSelectionPopupGss extends CssResource { + String competitorselectionbackground(); + String competitorselectionpopup(); + String header(); + String scrollpanel(); + String buttonSeparator(); + String button(); + String cancelButton(); + String okButton(); + String popuphide(); + String popupshow(); + } +} \ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/SettingsButtonWithSelectionIndicationLabel.css b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/SettingsButtonWithSelectionIndicationLabel.css deleted file mode 100644 index 3231255779b..00000000000 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/SettingsButtonWithSelectionIndicationLabel.css +++ /dev/null @@ -1,27 +0,0 @@ -@CHARSET "UTF-8"; - -.settings_button { - position: absolute !important; - height: 23.5pt; - width: 23.5pt; - right: 10pt; - top: 17.5pt; - z-index: 2; -} - -.settings_button_image { - height: 23.5pt; - width: 23.5pt; -} - -.settings_indication_label { - position: absolute; - width: 200pt; - height: 23.5pt; - margin-top: 17.5pt; - right: 43.5pt; - font-size: 12pt; - font-color: black; - text-align: right; - line-height: 23.5pt; -} \ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/SettingsButtonWithSelectionIndicationLabel.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/SettingsButtonWithSelectionIndicationLabel.java deleted file mode 100644 index 05a92598d1c..00000000000 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/SettingsButtonWithSelectionIndicationLabel.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.sap.sailing.dashboards.gwt.client.popups.competitorselection; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.resources.client.CssResource; -import com.google.gwt.uibinder.client.UiBinder; -import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.FocusPanel; -import com.google.gwt.user.client.ui.Image; -import com.google.gwt.user.client.ui.Label; -import com.google.gwt.user.client.ui.Widget; -import com.sap.sailing.dashboards.gwt.client.dashboardpanel.DashboardPanelResources; - -public class SettingsButtonWithSelectionIndicationLabel extends Composite { - - private static SettingsButtonWithSelectionIndicationLabelUiBinder uiBinder = GWT - .create(SettingsButtonWithSelectionIndicationLabelUiBinder.class); - - interface SettingsButtonWithSelectionIndicationLabelUiBinder extends - UiBinder { - } - - interface SettingsButtonWithSelectionIndicationLabelStyle extends CssResource { - } - - @UiField - SettingsButtonWithSelectionIndicationLabelStyle style; - - @UiField - FocusPanel settingsButton; - - @UiField - Image settingsButtonImage; - - @UiField - Label settingsIndicationLabel; - - public SettingsButtonWithSelectionIndicationLabel() { - initWidget(uiBinder.createAndBindUi(this)); - settingsButtonImage.setResource(DashboardPanelResources.INSTANCE.settings()); - } - - public void addClickHandlerToSettingsButton(ClickHandler clickHandler){ - settingsButton.addClickHandler(clickHandler); - } - - public void setSelectionIndicationTextOnLabel(String selectionIndicationText) { - settingsIndicationLabel.setText(selectionIndicationText); - } -} diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/SettingsButtonWithSelectionIndicationLabel.ui.xml b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/SettingsButtonWithSelectionIndicationLabel.ui.xml deleted file mode 100644 index 865b2a2a998..00000000000 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/SettingsButtonWithSelectionIndicationLabel.ui.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/CompetitorTable.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/table/CompetitorTable.java similarity index 99% rename from java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/CompetitorTable.java rename to java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/table/CompetitorTable.java index 7190699bafb..56ae2e648c1 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/CompetitorTable.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/table/CompetitorTable.java @@ -1,4 +1,4 @@ -package com.sap.sailing.dashboards.gwt.client.popups.competitorselection; +package com.sap.sailing.dashboards.gwt.client.popups.competitorselection.table; import java.util.List; diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/CompetitorTableRowSelectionListener.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/table/CompetitorTableRowSelectionListener.java similarity index 94% rename from java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/CompetitorTableRowSelectionListener.java rename to java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/table/CompetitorTableRowSelectionListener.java index 32bae21b54c..3087d8745b4 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/CompetitorTableRowSelectionListener.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/table/CompetitorTableRowSelectionListener.java @@ -1,4 +1,4 @@ -package com.sap.sailing.dashboards.gwt.client.popups.competitorselection; +package com.sap.sailing.dashboards.gwt.client.popups.competitorselection.table; import com.sap.sailing.domain.common.dto.CompetitorDTO; diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/CompetitorTableStyle.css b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/table/CompetitorTableStyle.css similarity index 53% rename from java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/CompetitorTableStyle.css rename to java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/table/CompetitorTableStyle.css index dbad0efc14d..62fa6469b9f 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/CompetitorTableStyle.css +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/table/CompetitorTableStyle.css @@ -1,4 +1,3 @@ -@CHARSET "UTF-8"; .cellTableHeader { height: 0pt; @@ -10,25 +9,25 @@ .cellTableCell { padding: 10px; overflow: hidden; - font-size: 12pt; + font-size: 14px; color: black; - background-color: #d3d3d3; - border-width: 4px 8px 4px 8px; + background-color: #E0E0E0; + border-width: 0px 8px 8px 8px; border-color: white; } .cellTableSelectedRow { - background: grey !important; - backrgound-color: #d3d3d3 !important; + background: #848484 !important; + backrgound-color: #848484 !important; color: white !important; - border-width: 3pt 6pt 3pt 6pt; + border-width: 0px 8px 8px 8px; border-color: white; } .cellTableSelectedRowCell { - background: grey !important; - backrgound-color: #d3d3d3 !important; + background: #848484 !important; + backrgound-color: #848484 !important; color: white !important; - border-width: 3pt 6pt 3pt 6pt; + border-width: 0px 8px 8px 8px; border-color: white; } \ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/CompetitorTableStyleResource.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/table/CompetitorTableStyleResource.java similarity index 95% rename from java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/CompetitorTableStyleResource.java rename to java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/table/CompetitorTableStyleResource.java index e9cb0af6c7b..d1a5fe46776 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/CompetitorTableStyleResource.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/table/CompetitorTableStyleResource.java @@ -1,11 +1,10 @@ -package com.sap.sailing.dashboards.gwt.client.popups.competitorselection; +package com.sap.sailing.dashboards.gwt.client.popups.competitorselection.table; import com.google.gwt.user.cellview.client.CellTable; public interface CompetitorTableStyleResource extends CellTable.Resources { @Source({CellTable.Style.DEFAULT_CSS, "CompetitorTableStyle.css"}) - TableStyle cellTableStyle(); interface TableStyle extends CellTable.Style { diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/util/SettingsButtonWithSelectionIndicationLabel.gss b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/util/SettingsButtonWithSelectionIndicationLabel.gss new file mode 100644 index 00000000000..f7c5fdf100a --- /dev/null +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/util/SettingsButtonWithSelectionIndicationLabel.gss @@ -0,0 +1,35 @@ +@require 'theme'; + +.settings_button { + position: absolute !important; + height: DASHBOARD_SPACE_MEDIUM; + right: 0px; + top: 0px; + width: 300px; + z-index: 5; +} + +.settings_button_image { + position: absolute; + height: 20px; + width: 20px; + top: 7.5px; + right: DASHBOARD_SPACE_VERY_SMALL; +} + +.settings_indication_label { + position: absolute; + width: 300px; + height: DASHBOARD_SPACE_MEDIUM; + top: 0px; + right: DASHBOARD_SPACE_MEDIUM; + font-size: DASHBOARD_FONT_SIZE_MEDIUM; + color: black; + text-align: right; + line-height: DASHBOARD_SPACE_MEDIUM; + z-index: 3; +} + +.settings_indication_label_disabled { + color: DARK_GREY; +} \ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/util/SettingsButtonWithSelectionIndicationLabel.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/util/SettingsButtonWithSelectionIndicationLabel.java new file mode 100644 index 00000000000..04b6001a7ea --- /dev/null +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/util/SettingsButtonWithSelectionIndicationLabel.java @@ -0,0 +1,85 @@ +package com.sap.sailing.dashboards.gwt.client.popups.competitorselection.util; + +import java.util.Iterator; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.resources.client.CssResource; +import com.google.gwt.uibinder.client.UiBinder; +import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.user.client.Event; +import com.google.gwt.user.client.ui.Composite; +import com.google.gwt.user.client.ui.HTMLPanel; +import com.google.gwt.user.client.ui.HasWidgets; +import com.google.gwt.user.client.ui.Image; +import com.google.gwt.user.client.ui.Widget; +import com.sap.sailing.dashboards.gwt.client.widgets.ActionPanel; +import com.sap.sailing.dashboards.gwt.client.widgets.ActionPanel.ActionPanelListener; + +public class SettingsButtonWithSelectionIndicationLabel extends Composite implements HasWidgets { + + private static SettingsButtonWithSelectionIndicationLabelUiBinder uiBinder = GWT + .create(SettingsButtonWithSelectionIndicationLabelUiBinder.class); + + interface SettingsButtonWithSelectionIndicationLabelUiBinder extends + UiBinder { + } + + interface SettingsButtonWithSelectionIndicationLabelStyle extends CssResource { + } + + @UiField(provided = true) + ActionPanel settingsButton; + + @UiField + Image settingsButtonImage; + + @UiField + HTMLPanel settingsIndicationLabel; + + public SettingsButtonWithSelectionIndicationLabel() { + SettingsButtonWithSelectionIndicationLabelResources.INSTANCE.gss().ensureInjected(); + settingsButton = new ActionPanel(Event.TOUCHEVENTS, Event.ONCLICK); + initWidget(uiBinder.createAndBindUi(this)); + settingsButtonImage.setResource(SettingsButtonWithSelectionIndicationLabelResources.INSTANCE.settings()); + } + + public void addActionListener(ActionPanelListener actionPanelListener) { + settingsButton.addActionPanelListener(actionPanelListener); + } + + public void setSelectionIndicationTextOnLabel(String selectionIndicationText) { + settingsIndicationLabel.getElement().setInnerHTML("" + selectionIndicationText); + } + + public void disable() { + settingsButton.disable(); + settingsButtonImage.setResource(SettingsButtonWithSelectionIndicationLabelResources.INSTANCE.settingsDisabled()); + settingsIndicationLabel.getElement().addClassName(SettingsButtonWithSelectionIndicationLabelResources.INSTANCE.gss().settings_indication_label_disabled()); + } + + public void enable() { + settingsButton.enable(); + settingsButtonImage.setResource(SettingsButtonWithSelectionIndicationLabelResources.INSTANCE.settings()); + settingsIndicationLabel.getElement().removeClassName(SettingsButtonWithSelectionIndicationLabelResources.INSTANCE.gss().settings_indication_label_disabled()); + } + + @Override + public void add(Widget w) { + throw new UnsupportedOperationException("The method add(Widget w) is not supported."); + } + + @Override + public void clear() { + throw new UnsupportedOperationException("The method clear() is not supported."); + } + + @Override + public Iterator iterator() { + return null; + } + + @Override + public boolean remove(Widget w) { + return false; + } +} diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/util/SettingsButtonWithSelectionIndicationLabel.ui.xml b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/util/SettingsButtonWithSelectionIndicationLabel.ui.xml new file mode 100644 index 00000000000..a3b023bd9b8 --- /dev/null +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/util/SettingsButtonWithSelectionIndicationLabel.ui.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/util/SettingsButtonWithSelectionIndicationLabelResources.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/util/SettingsButtonWithSelectionIndicationLabelResources.java new file mode 100644 index 00000000000..11e7703e8a6 --- /dev/null +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/popups/competitorselection/util/SettingsButtonWithSelectionIndicationLabelResources.java @@ -0,0 +1,31 @@ +package com.sap.sailing.dashboards.gwt.client.popups.competitorselection.util; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.resources.client.ClientBundle; +import com.google.gwt.resources.client.CssResource; +import com.google.gwt.resources.client.ImageResource; + +/** + * @author Alexander Ries (D062114) + * + */ +public interface SettingsButtonWithSelectionIndicationLabelResources extends ClientBundle { + + public static final SettingsButtonWithSelectionIndicationLabelResources INSTANCE = GWT.create(SettingsButtonWithSelectionIndicationLabelResources.class); + + @Source("com/sap/sailing/dashboards/gwt/client/images/settings.png") + ImageResource settings(); + + @Source("com/sap/sailing/dashboards/gwt/client/images/settings_disabled.png") + ImageResource settingsDisabled(); + + @Source({"com/sap/sailing/dashboards/gwt/client/theme/theme.gss", "SettingsButtonWithSelectionIndicationLabel.gss"}) + StartlineAdvantagesOnLineChartGSS gss(); + + public interface StartlineAdvantagesOnLineChartGSS extends CssResource { + String settings_button(); + String settings_button_image(); + String settings_indication_label(); + String settings_indication_label_disabled(); + } +} diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/theme/Colors.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/theme/Colors.java index e74d80c2ed6..649f9a65987 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/theme/Colors.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/theme/Colors.java @@ -6,11 +6,14 @@ package com.sap.sailing.dashboards.gwt.client.theme; */ public class Colors { public static final String WHITE = "#FFFFFF"; - public static final String LIGHT_GREY = "#FFFFFF"; - public static final String DARK_GREY = "#FFFFFF"; - public static final String LIGHT_TEXT_COLOR = "#FFFFFF"; - public static final String DARK_TEXT_COLOR = "#FFFFFF"; - public static final String DARK_BLUE = "#FFFFFF"; - public static final String LIGHT_BLUE = "#FFFFFF"; - public static final String YELLOW = "#FFFFFF"; + public static final String BLACK = "#000000"; + public static final String LIGHT_GREY = "#F3F2F4"; + public static final String DARK_GREY = "#E0E0E0"; + public static final String LIGHT_TEXT_COLOR = "#848484"; + public static final String DARK_TEXT_COLOR = "#000000"; + public static final String BUTTON_BACKGROUND = "#008FFF"; + public static final String BUTTON_BACKGROUND_ACTIVE = "#4192D9"; + public static final String DARK_BLUE = "#008FFF"; + public static final String LIGHT_BLUE = "#6ADBFF"; + public static final String YELLOW = "#F0AB00"; } \ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/theme/Sizes.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/theme/Sizes.java index a539e9021a4..9a43a5c9824 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/theme/Sizes.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/theme/Sizes.java @@ -1,13 +1,21 @@ package com.sap.sailing.dashboards.gwt.client.theme; + /** * @author Alexander Ries (D062114) * */ public class Sizes { - public static final String DASHBOARD_FONT_SIZE_VERY_SMALL = "12px"; - public static final String DASHBOARD_FONT_SIZE_SMALL = "12px"; - public static final String DASHBOARD_FONT_SIZE_MEDIUM = "12px"; - public static final String DASHBOARD_FONT_SIZE_BIG = "12px"; - public static final String DASHBOARD_FONT_SIZE_VERY_BIG = "12px"; + public static final String DASHBOARD_FONT_SIZE_VERY_SMALL = "10px"; + public static final String DASHBOARD_FONT_SIZE_SMALL = "13px"; + public static final String DASHBOARD_FONT_SIZE_MEDIUM = "14px"; + public static final String DASHBOARD_FONT_SIZE_LARGE = "16px"; + public static final String DASHBOARD_FONT_SIZE_VERY_LARGE = "33px"; + public static final String DASHBOARD_SPACE_VERY_SMALL = "10px"; + public static final String DASHBOARD_SPACE_SMALL = "30px"; + public static final String DASHBOARD_SPACE_MEDIUM = "35px"; + public static final String DASHBOARD_SPACE_LARGE = "50px"; + public static final String DASHBOARD_SPACE_VERY_LARGE = "70px"; + public static final String DASHBOARD_LINE_HEIGHT = "20px"; + public static final String DASHBOARD_BORDER_RADIUS = "5px"; } diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/theme/theme.gss b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/theme/theme.gss index 168c9ab59aa..66eb9d3e990 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/theme/theme.gss +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/theme/theme.gss @@ -2,6 +2,33 @@ /*Colors*/ @def WHITE eval("com.sap.sailing.dashboards.gwt.client.theme.Colors.WHITE"); +@def BLACK eval("com.sap.sailing.dashboards.gwt.client.theme.Colors.BLACK"); +@def LIGHT_GREY eval("com.sap.sailing.dashboards.gwt.client.theme.Colors.LIGHT_GREY"); +@def DARK_GREY eval("com.sap.sailing.dashboards.gwt.client.theme.Colors.DARK_GREY"); +@def LIGHT_TEXT_COLOR eval("com.sap.sailing.dashboards.gwt.client.theme.Colors.LIGHT_TEXT_COLOR"); +@def DARK_TEXT_COLOR eval("com.sap.sailing.dashboards.gwt.client.theme.Colors.DARK_TEXT_COLOR"); +@def DARK_BLUE eval("com.sap.sailing.dashboards.gwt.client.theme.Colors.DARK_BLUE"); +@def BUTTON_BACKGROUND eval("com.sap.sailing.dashboards.gwt.client.theme.Colors.BUTTON_BACKGROUND"); +@def BUTTON_BACKGROUND_ACTIVE eval("com.sap.sailing.dashboards.gwt.client.theme.Colors.BUTTON_BACKGROUND_ACTIVE"); +@def LIGHT_BLUE eval("com.sap.sailing.dashboards.gwt.client.theme.Colors.LIGHT_GREY"); +@def YELLOW eval("com.sap.sailing.dashboards.gwt.client.theme.Colors.YELLOW"); /*Fonts*/ @def DASHBOARD_FONT_FAMILY eval("com.sap.sailing.dashboards.gwt.client.theme.Fonts.DASHBOARD_FONT_FAMILY"); + +/*Sizes*/ +@def DASHBOARD_FONT_SIZE_VERY_SMALL eval("com.sap.sailing.dashboards.gwt.client.theme.Sizes.DASHBOARD_FONT_SIZE_VERY_SMALL"); +@def DASHBOARD_FONT_SIZE_SMALL eval("com.sap.sailing.dashboards.gwt.client.theme.Sizes.DASHBOARD_FONT_SIZE_SMALL"); +@def DASHBOARD_FONT_SIZE_MEDIUM eval("com.sap.sailing.dashboards.gwt.client.theme.Sizes.DASHBOARD_FONT_SIZE_MEDIUM"); +@def DASHBOARD_FONT_SIZE_LARGE eval("com.sap.sailing.dashboards.gwt.client.theme.Sizes.DASHBOARD_FONT_SIZE_LARGE"); +@def DASHBOARD_FONT_SIZE_VERY_LARGE eval("com.sap.sailing.dashboards.gwt.client.theme.Sizes.DASHBOARD_FONT_SIZE_VERY_LARGE"); + +@def DASHBOARD_SPACE_VERY_SMALL eval("com.sap.sailing.dashboards.gwt.client.theme.Sizes.DASHBOARD_SPACE_VERY_SMALL"); +@def DASHBOARD_SPACE_SMALL eval("com.sap.sailing.dashboards.gwt.client.theme.Sizes.DASHBOARD_SPACE_SMALL"); +@def DASHBOARD_SPACE_MEDIUM eval("com.sap.sailing.dashboards.gwt.client.theme.Sizes.DASHBOARD_SPACE_MEDIUM"); +@def DASHBOARD_SPACE_LARGE eval("com.sap.sailing.dashboards.gwt.client.theme.Sizes.DASHBOARD_SPACE_LARGE"); +@def DASHBOARD_SPACE_VERY_LARGE eval("com.sap.sailing.dashboards.gwt.client.theme.Sizes.DASHBOARD_SPACE_VERY_LARGE"); + +@def DASHBOARD_LINE_HEIGHT eval("com.sap.sailing.dashboards.gwt.client.theme.Sizes.DASHBOARD_LINE_HEIGHT"); + +@def DASHBOARD_BORDER_RADIUS eval("com.sap.sailing.dashboards.gwt.client.theme.Sizes.DASHBOARD_BORDER_RADIUS"); \ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/visualeffects/BlurEffect.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/visualeffects/BlurEffect.java deleted file mode 100644 index 17dbdb55da4..00000000000 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/visualeffects/BlurEffect.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.sap.sailing.dashboards.gwt.client.visualeffects; - -import com.google.gwt.core.shared.GWT; -import com.google.gwt.user.client.ui.Widget; - - -public class BlurEffect { - - private static BlurEffect INSTANCE = null; - private VisualEffectsResources visualEffectsResources = GWT.create(VisualEffectsResources.class); - - private BlurEffect() { - visualEffectsResources.blurEffectStyle().ensureInjected(); - } - - public static BlurEffect getInstance() { - synchronized (BlurEffect.class) { - if (INSTANCE == null) { - INSTANCE = new BlurEffect(); - } - } - return INSTANCE; - } - - public void addToView(Widget widget){ - widget.removeStyleName(visualEffectsResources.blurEffectStyle().not_blurred()); - widget.addStyleName(visualEffectsResources.blurEffectStyle().blurred()); - } - - public void removeFromView(Widget widget){ - widget.removeStyleName(visualEffectsResources.blurEffectStyle().blurred()); - widget.addStyleName(visualEffectsResources.blurEffectStyle().not_blurred()); - } -} diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/visualeffects/BlurEffect.css b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/visualeffects/DarkeningEffect.css similarity index 83% rename from java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/visualeffects/BlurEffect.css rename to java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/visualeffects/DarkeningEffect.css index 7e1020ab331..8ac04b47d18 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/visualeffects/BlurEffect.css +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/visualeffects/DarkeningEffect.css @@ -1,11 +1,11 @@ @CHARSET "UTF-8"; -.blurred { +.darkened { -webkit-filter: brightness(0.7); filter: brightness(0.7); } -.not_blurred { +.not_darkened { -webkit-filter: brightness(1); filter: brightness(1); } \ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/visualeffects/DarkeningEffect.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/visualeffects/DarkeningEffect.java new file mode 100644 index 00000000000..5e04ce0f60c --- /dev/null +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/visualeffects/DarkeningEffect.java @@ -0,0 +1,34 @@ +package com.sap.sailing.dashboards.gwt.client.visualeffects; + +import com.google.gwt.core.shared.GWT; +import com.google.gwt.user.client.ui.Widget; + + +public class DarkeningEffect { + + private static DarkeningEffect INSTANCE = null; + private VisualEffectsResources visualEffectsResources = GWT.create(VisualEffectsResources.class); + + private DarkeningEffect() { + visualEffectsResources.darkeningEffectStyle().ensureInjected(); + } + + public static DarkeningEffect getInstance() { + synchronized (DarkeningEffect.class) { + if (INSTANCE == null) { + INSTANCE = new DarkeningEffect(); + } + } + return INSTANCE; + } + + public void addToView(Widget widget){ + widget.removeStyleName(visualEffectsResources.darkeningEffectStyle().not_darkened()); + widget.addStyleName(visualEffectsResources.darkeningEffectStyle().darkened()); + } + + public void removeFromView(Widget widget){ + widget.removeStyleName(visualEffectsResources.darkeningEffectStyle().darkened()); + widget.addStyleName(visualEffectsResources.darkeningEffectStyle().not_darkened()); + } +} diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/visualeffects/BlurEffectStyle.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/visualeffects/DarkeningEffectStyle.java similarity index 61% rename from java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/visualeffects/BlurEffectStyle.java rename to java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/visualeffects/DarkeningEffectStyle.java index ec1306d820f..2d3709361d3 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/visualeffects/BlurEffectStyle.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/visualeffects/DarkeningEffectStyle.java @@ -4,10 +4,10 @@ import com.google.gwt.resources.client.CssResource; import com.google.gwt.resources.client.CssResource.Shared; @Shared -public interface BlurEffectStyle extends CssResource{ +public interface DarkeningEffectStyle extends CssResource{ - public String blurred(); + public String darkened(); - public String not_blurred(); + public String not_darkened(); } diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/visualeffects/VisualEffectsResources.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/visualeffects/VisualEffectsResources.java index f87efb9d50c..84c29f0f843 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/visualeffects/VisualEffectsResources.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/visualeffects/VisualEffectsResources.java @@ -4,6 +4,6 @@ import com.google.gwt.resources.client.ClientBundle; public interface VisualEffectsResources extends ClientBundle{ - @Source("BlurEffect.css") - BlurEffectStyle blurEffectStyle(); + @Source("DarkeningEffect.css") + DarkeningEffectStyle darkeningEffectStyle(); } diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/ActionPanel.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/ActionPanel.java new file mode 100644 index 00000000000..7b87a2d7117 --- /dev/null +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/ActionPanel.java @@ -0,0 +1,65 @@ +package com.sap.sailing.dashboards.gwt.client.widgets; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gwt.user.client.Event; +import com.google.gwt.user.client.ui.AbsolutePanel; + +/** + * @author Alexander Ries (D062114) + * + */ +public class ActionPanel extends AbsolutePanel { + + private List listeners; + private List eventsList; + + public ActionPanel(int... events) { + super(); + listeners = new ArrayList(); + eventsList = new ArrayList(); + for (int event : events) { + sinkEvents(event); + eventsList.add(Integer.valueOf(event)); + } + this.getElement().setAttribute("style", "-webkit-tap-highlight-color: rgba(0,0,0,0);"); + } + + public void enable() { + for(Integer eventAsInteger : eventsList) { + sinkEvents(eventAsInteger.intValue()); + } + } + + public void disable() { + for(Integer eventAsInteger : eventsList) { + unsinkEvents(eventAsInteger.intValue()); + } + } + + public void addActionPanelListener(ActionPanelListener actionPanelListener) { + listeners.add(actionPanelListener); + } + + public void removeActionPanelListener(ActionPanelListener actionPanelListener) { + listeners.remove(actionPanelListener); + } + + private void notifyActionPanelListenerAboutTriggeredEvent() { + for (ActionPanelListener actionPanelListener : listeners) { + actionPanelListener.eventTriggered(); + } + } + + @Override + public void onBrowserEvent(Event event) { + if (this.eventsList.contains(event.getTypeInt())) { + notifyActionPanelListenerAboutTriggeredEvent(); + } + } + + public interface ActionPanelListener { + public void eventTriggered(); + } +} diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/header/DashboardWidgetHeaderAndNoDataMessage.gss b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/header/DashboardWidgetHeaderAndNoDataMessage.gss new file mode 100644 index 00000000000..adb86fb010e --- /dev/null +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/header/DashboardWidgetHeaderAndNoDataMessage.gss @@ -0,0 +1,44 @@ +@require 'theme'; + +.dashboard_widget_header { + position: absolute; + width: 100%; + height: DASHBOARD_SPACE_MEDIUM; + top: 0; + line-height: DASHBOARD_SPACE_MEDIUM; + vertical-align: middle; + font-size: DASHBOARD_FONT_SIZE_LARGE; + font-family: DASHBOARD_FONT_FAMILY; + text-align: center; + font-weight: bold; + overflow: visible; + background-color: WHITE; + border-bottom:solid LIGHT_GREY 1px; + z-index: 4; +} + +.dashboard_widget_no_data_message_container { + position: absolute; + top: DASHBOARD_SPACE_MEDIUM; + bottom: 0px; + width: 100%; + font-size: DASHBOARD_FONT_SIZE_MEDIUM; + font-family: DASHBOARD_FONT_FAMILY; + display: flex; + align-items: center; + justify-content: center; + text-align: center; + line-height: DASHBOARD_LINE_HEIGHT; +} + +.dashboard_widget_no_data_message_header { + color: DARK_TEXT_COLOR; + font-weight: bold; + text-align: center; + display: inline-block; +} + +.dashboard_widget_no_data_message { + color: LIGHT_TEXT_COLOR; + font-weight: normal; +} \ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/header/DashboardWidgetHeaderAndNoDataMessage.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/header/DashboardWidgetHeaderAndNoDataMessage.java new file mode 100644 index 00000000000..7fc95e6c677 --- /dev/null +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/header/DashboardWidgetHeaderAndNoDataMessage.java @@ -0,0 +1,83 @@ +package com.sap.sailing.dashboards.gwt.client.widgets.header; + +import java.util.Iterator; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.core.client.Scheduler; +import com.google.gwt.dom.client.DivElement; +import com.google.gwt.dom.client.Style.Unit; +import com.google.gwt.uibinder.client.UiBinder; +import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.user.client.Command; +import com.google.gwt.user.client.ui.Composite; +import com.google.gwt.user.client.ui.HTMLPanel; +import com.google.gwt.user.client.ui.HasWidgets; +import com.google.gwt.user.client.ui.Widget; + +/** + * @author Alexander Ries (D062114) + * + */ +public class DashboardWidgetHeaderAndNoDataMessage extends Composite implements HasWidgets { + + private static DashboardWidgetHeaderAndNoDataMessageUiBinder uiBinder = GWT.create(DashboardWidgetHeaderAndNoDataMessageUiBinder.class); + private static final int EXTRA_WIDTH_MESSAGE = 10; + + interface DashboardWidgetHeaderAndNoDataMessageUiBinder extends + UiBinder { + } + + @UiField + HTMLPanel header; + + @UiField + DivElement noDataMessageHeader; + + @UiField + DivElement noDataMessage; + + public DashboardWidgetHeaderAndNoDataMessage() { + DashboardWidgetHeaderAndNoDataMessageResources.INSTANCE.gss().ensureInjected(); + initWidget(uiBinder.createAndBindUi(this)); + } + + public void setHeaderText(String headerText) { + this.header.getElement().setInnerHTML(headerText); + } + + public void showNoDataMessageWithHeaderAndMessage(final String header, final String message) { + Scheduler.get().scheduleDeferred(new Command() { + public void execute() { + noDataMessageHeader.setInnerText(header); + noDataMessage.setInnerText(message); + noDataMessage.getStyle().setWidth(noDataMessageHeader.getClientWidth() + EXTRA_WIDTH_MESSAGE, Unit.PX); + } + }); + + } + + public void hideNoDataMessage() { + noDataMessageHeader.setInnerHTML(""); + noDataMessage.setInnerHTML(""); + } + + @Override + public void add(Widget w) { + throw new UnsupportedOperationException("The method add(Widget w) is not supported."); + } + + @Override + public void clear() { + throw new UnsupportedOperationException("The method clear() is not supported."); + } + + @Override + public Iterator iterator() { + return null; + } + + @Override + public boolean remove(Widget w) { + return false; + } +} diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/header/DashboardWidgetHeaderAndNoDataMessage.ui.xml b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/header/DashboardWidgetHeaderAndNoDataMessage.ui.xml new file mode 100644 index 00000000000..293102124f9 --- /dev/null +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/header/DashboardWidgetHeaderAndNoDataMessage.ui.xml @@ -0,0 +1,17 @@ + + + + + + + + +
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/header/DashboardWidgetHeaderAndNoDataMessageResources.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/header/DashboardWidgetHeaderAndNoDataMessageResources.java new file mode 100644 index 00000000000..b5032dbfecc --- /dev/null +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/header/DashboardWidgetHeaderAndNoDataMessageResources.java @@ -0,0 +1,24 @@ +package com.sap.sailing.dashboards.gwt.client.widgets.header; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.resources.client.ClientBundle; +import com.google.gwt.resources.client.CssResource; + +/** + * @author Alexander Ries (D062114) + * + */ +public interface DashboardWidgetHeaderAndNoDataMessageResources extends ClientBundle { + + public static final DashboardWidgetHeaderAndNoDataMessageResources INSTANCE = GWT.create(DashboardWidgetHeaderAndNoDataMessageResources.class); + + @Source({"com/sap/sailing/dashboards/gwt/client/theme/theme.gss", "DashboardWidgetHeaderAndNoDataMessage.gss"}) + DashboardWidgetHeaderAndNoDataMessageGSS gss(); + + public interface DashboardWidgetHeaderAndNoDataMessageGSS extends CssResource { + String dashboard_widget_header(); + String dashboard_widget_no_data_message_container(); + String dashboard_widget_no_data_message_header(); + String dashboard_widget_no_data_message(); + } +} \ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/DashboardRaceMapResources.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/DashboardRaceMapResources.java new file mode 100644 index 00000000000..ceaf0392cb6 --- /dev/null +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/DashboardRaceMapResources.java @@ -0,0 +1,18 @@ +package com.sap.sailing.dashboards.gwt.client.widgets.startanalysis; + +import com.google.gwt.resources.client.ImageResource; +import com.sap.sailing.gwt.ui.client.shared.racemap.RaceMapStyle; +import com.sap.sailing.gwt.ui.client.shared.racemap.RaceMapResources; + +/** + * @author Alexander Ries (D062114) + * + */ +public interface DashboardRaceMapResources extends RaceMapResources { + + @Source("com/sap/sailing/dashboards/gwt/client/images/windarrow.png") + ImageResource combinedWindIcon(); + + @Source({"com/sap/sailing/dashboards/gwt/client/theme/theme.gss", "StartAnalysisRaceMap.gss"}) + RaceMapStyle raceMapStyle(); +} diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/StartAnalysisCombinedWindPanel.gss b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/StartAnalysisCombinedWindPanel.gss deleted file mode 100644 index d4843d25e1b..00000000000 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/StartAnalysisCombinedWindPanel.gss +++ /dev/null @@ -1,30 +0,0 @@ -@require 'theme'; - -.combinedWindPanel { - margin-top: 10pt; - margin-left: 10pt; - right: 0pt; - width: 45pt; - height: 45pt; - border-radius: 22.5pt; - background-color: white; -} - -.combinedWindPanelTextLabel { - margin-top: 15pt; - width: 45pt; - height: 25pt; - background-color: white; - line-height: 25pt; - vertical-align: middle; - font-size: 11pt; - font-family: DASHBOARD_FONT_FAMILY; - text-align: center; -} - -.combinedWindPanelCanvas { - width: 35pt; - height: 35pt; - margin-top: 5pt; - margin-left: 5pt; -} \ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/StartAnalysisRaceMap.gss b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/StartAnalysisRaceMap.gss new file mode 100644 index 00000000000..73ed5bf03fd --- /dev/null +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/StartAnalysisRaceMap.gss @@ -0,0 +1,37 @@ +@require 'theme'; + +.raceMapIndicatorPanel { + margin-top: DASHBOARD_SPACE_VERY_SMALL; + margin-left: DASHBOARD_SPACE_VERY_SMALL; + right: 0px; + width: 50px; + height: 50px; + border-radius: 50px; + background-color: white; +} + +.raceMapIndicatorPanelTextLabel { + margin-top: DASHBOARD_SPACE_VERY_SMALL; + width: 50px; + height: DASHBOARD_SPACE_SMALL; + line-height: DASHBOARD_SPACE_SMALL; + vertical-align: middle; + font-size: DASHBOARD_FONT_SIZE_SMALL; + font-weight: bold; + font-family: DASHBOARD_FONT_FAMILY; + text-align: center; + color: white; +} + +.raceMapIndicatorPanelCanvas { + width: 30px !important; + height: 30px !important; + margin-top: 10px; + margin-left: 10px; +} + +.combinedWindPanel {} + +.trueNorthIndicator { + opacity: 0.0; +} \ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/StartAnalysisWidget.gss b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/StartAnalysisWidget.gss index 4e60c3bae9d..f91e0140c02 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/StartAnalysisWidget.gss +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/StartAnalysisWidget.gss @@ -2,64 +2,102 @@ .startanalysis { position: absolute; - overflow: hidden; - background-color: white; + background-color: LIGHT_GREY; left: 0pt; right: 0pt; top: 0pt; bottom: 0pt; + border-radius: DASHBOARD_BORDER_RADIUS; + overflow: hidden; + z-index: 5; } -.panel_header { - height: 100%; - margin-top: 0; - line-height: 30pt; +.current_start_panel { + position: absolute; + height: DASHBOARD_SPACE_MEDIUM; + top: DASHBOARD_SPACE_MEDIUM; + line-height: DASHBOARD_SPACE_MEDIUM; vertical-align: middle; - font-size: 14pt; + font-size: DASHBOARD_FONT_SIZE_MEDIUM; font-family: DASHBOARD_FONT_FAMILY; width: 100%; text-align: center; font-weight: bold; - overflow: visible; - background-color: white; + z-index: 4; } .controll_header_button { position: absolute; - top: 10pt; - height: 17.5pt; - width: 17.5pt; + height: DASHBOARD_SPACE_VERY_LARGE; + width: DASHBOARD_SPACE_VERY_LARGE; + top: 50%; + background-color: WHITE; + z-index: 1; + opacity: 0.0; + border-radius: DASHBOARD_BORDER_RADIUS; +} + +.controll_header_button_visible { + opacity: 0.9; +} + +.controll_header_button:active { + background-color: LIGHT_GREY; +} + +.controll_header_button_image { + position: absolute; + width: 18px; + height: DASHBOARD_SPACE_SMALL; + top: 20px; + left: 27px; } .controll_header_button_left { - left: 10%; + left: 31px; } .controll_header_button_right { - right: 10%; + right: 31px; } .card_container { position: absolute; overflow: visible; - top: 33.5pt; - bottom: 10pt; + top: DASHBOARD_SPACE_MEDIUM; + bottom: 70px; + padding-top: DASHBOARD_SPACE_MEDIUM; + padding-bottom: DASHBOARD_SPACE_SMALL; width: 100%; left: 0%; - background-color: white; -webkit-transition: left 0.7s ease-in-out; /* For Safari 3.1 to 6.0 */ transition: left 0.7s ease-in-out; } .card { position: absolute; - display: inline; - width: 80%; + width: 75%; height: 100%; - /*#4293DB old water color*/ + border-radius: DASHBOARD_BORDER_RADIUS !important; + overflow: hidden !important; + /* + Chrome and Safari are having problems with border radius and animation. + http://stackoverflow.com/questions/14383632/webkit-border-radius-and-overflow-bug-when-using-any-animation-transition + Do not remove these 4 lines + */ + -webkit-backface-visibility: hidden; + -moz-backface-visibility: hidden; + -webkit-transform: translate3d(0, 0, 0); + -moz-transform: translate3d(0, 0, 0) +} + +.card_map_container { + position: absolute; + margin-top: 29px; + /*#4293DB old water color*/ background-color: #004384; - margin-top: 1px; /*Shows otherwise small line at top edge*/ - overflow: hidden; + width: 100%; + height: 100%; } .card_table { @@ -67,54 +105,49 @@ bottom: 0pt; right: 0pt; left: 0pt; - padding-left:10pt; - padding-right:10pt; - padding-bottom: 10pt; - background-color: #004384;; + background-color: WHITE; z-index: 2; } .card_wind_line_data_container { position: absolute; - top: 10pt; - left: 10pt; - width: 45pt; - height: 80pt; + top: 0pt; + left: 0; + width: 100%; + height: 30px; z-index: 1; + background-color: WHITE; + color: LIGHT_TEXT_COLOR; } .card_data { position: absolute; right: 0pt; width: 45pt; - height: 25pt; - line-height: 25pt; + height: DASHBOARD_SPACE_SMALL; + line-height: DASHBOARD_SPACE_SMALL; vertical-align: middle; - font-size: 11pt; + font-size: DASHBOARD_FONT_SIZE_SMALL; font-family: DASHBOARD_FONT_FAMILY; + font-weight: bold; text-align: center; } .card_line_advantage { top: 0pt; - left: 55pt; + left: 10px; width: 215pt; text-align: left; - padding-left: 7pt; - background-color: white; } .card_race_time{ position: absolute; - top: 10pt; - right: 10pt; + right: 10px; width: 200px; text-align: right; - color: white; - line-height: 25pt; - font-size: 11pt; + line-height: DASHBOARD_SPACE_SMALL; + font-size: DASHBOARD_FONT_SIZE_SMALL; font-family: DASHBOARD_FONT_FAMILY; - z-index: 1; } .card_line_data_geo { @@ -141,4 +174,4 @@ width: 50%; height: 100%; z-index: 2; -} \ No newline at end of file +} diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/StartAnalysisWidget.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/StartAnalysisWidget.java index 29a7dc12220..b808797b761 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/StartAnalysisWidget.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/StartAnalysisWidget.java @@ -12,7 +12,6 @@ import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.resources.client.CssResource; -import com.google.gwt.safehtml.shared.SafeHtmlUtils; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.user.client.Cookies; @@ -32,21 +31,24 @@ import com.sap.sailing.dashboards.gwt.client.notifications.bottom.BottomNotifica import com.sap.sailing.dashboards.gwt.client.notifications.bottom.BottomNotificationType; import com.sap.sailing.dashboards.gwt.client.popups.competitorselection.CompetitorSelectionListener; import com.sap.sailing.dashboards.gwt.client.popups.competitorselection.CompetitorSelectionPopup; -import com.sap.sailing.dashboards.gwt.client.popups.competitorselection.SettingsButtonWithSelectionIndicationLabel; +import com.sap.sailing.dashboards.gwt.client.popups.competitorselection.util.SettingsButtonWithSelectionIndicationLabel; +import com.sap.sailing.dashboards.gwt.client.widgets.ActionPanel; import com.sap.sailing.dashboards.gwt.client.widgets.PollsLiveDataEvery5Seconds; +import com.sap.sailing.dashboards.gwt.client.widgets.header.DashboardWidgetHeaderAndNoDataMessage; import com.sap.sailing.dashboards.gwt.client.widgets.startanalysis.card.StartAnalysisCard; import com.sap.sailing.dashboards.gwt.shared.DashboardURLParameters; import com.sap.sailing.dashboards.gwt.shared.dto.LeaderboardCompetitorsDTO; import com.sap.sailing.dashboards.gwt.shared.dto.StartAnalysesDTO; import com.sap.sailing.dashboards.gwt.shared.dto.StartAnalysisDTO; import com.sap.sailing.domain.common.dto.CompetitorDTO; +import com.sap.sailing.gwt.ui.client.StringMessages; +import com.sap.sailing.gwt.ui.client.shared.racemap.RaceMapResources; /** * The class contains an collection of {@link StartAnalysisCard}s that are displayed in horizontal aligned pages. It - * shows only one {@link StartAnalysisCard} at a time and enables the user to switch between - * {@link StartAnalysisCard}s with left and right buttons represented by {@link #left_focus_panel} and - * {@link #right_focus_panel}. When a new {@link StartAnalysisCard} gets added to the component it shows a - * {@link BottomNotification}. + * shows only one {@link StartAnalysisCard} at a time and enables the user to switch between {@link StartAnalysisCard}s + * with left and right buttons represented by {@link #left_focus_panel} and {@link #right_focus_panel}. When a new + * {@link StartAnalysisCard} gets added to the component it shows a {@link BottomNotification}. * * @author Alexander Ries (D062114) * @@ -61,14 +63,26 @@ public class StartAnalysisWidget extends Composite implements HasWidgets, PollsL interface StartlineAnalysis extends CssResource { } - @UiField - HTMLPanel header; + @UiField(provided = true) + DashboardWidgetHeaderAndNoDataMessage dashboardWidgetHeaderAndNoDataMessage; + + @UiField(provided = true) + SettingsButtonWithSelectionIndicationLabel selectedCompetitorWithSettingsButton; @UiField - Image rightButton; + HTMLPanel currentStartPanel; @UiField - Image leftButton; + HTMLPanel rightButton; + + @UiField + HTMLPanel leftButton; + + @UiField + Image rightButtonImage; + + @UiField + Image leftButtonImage; @UiField FocusPanel left_focus_panel; @@ -97,49 +111,71 @@ public class StartAnalysisWidget extends Composite implements HasWidgets, PollsL * Amount of {@link StartAnalysisCard}s in {@link #startanalysis_card_container}. * */ private int numberOfStartAnalysisCards = 0; - private boolean displaysCards; private List starts; private List pageChangeListener; private BottomNotification bottomNotification; - private CompetitorSelectionPopup competitorSelectionPopup; - private SettingsButtonWithSelectionIndicationLabel settingsButtonWithSelectionIndicationLabel; - private DashboardClientFactory dashboardClientFactory; - private static final String SELECTED_COMPETITOR_ID_COOKIE_KEY = "selectedCompetitorId"; + private final String cookieKeyForSelectedCompetitorInLeaderboard; + + private static final String SELECTED_COMPETITOR_IN_LEADERBOARD_COOKIE_KEY_FIRST_PART = "competitorId"; private static final int SELECTED_COMPETITOR_ID_COOKIE_KEY_EXPIRE_TIME_IN_MILLIS = 60 * 1000 * 60 * 5; - private static final int SCROLL_OFFSET_STARTANALYSIS_CARDS = 83; + private static final int SCROLL_OFFSET_STARTANALYSIS_CARDS = 80; + private static final double MARGIN_LEFT_STARTANALYSIS_CARD = 12.5; private static final Logger logger = Logger.getLogger(StartAnalysisWidget.class.getName()); + private static final RaceMapResources raceMapResources = GWT.create(DashboardRaceMapResources.class); + /** * Component that contains handles, displays and loads startanalysis cards. * */ public StartAnalysisWidget(DashboardClientFactory dashboardClientFactory) { StartAnalysisWidgetResources.INSTANCE.gss().ensureInjected(); - StartAnalysisWidgetResources.INSTANCE.combinedWindPanelStyle().ensureInjected(); + dashboardWidgetHeaderAndNoDataMessage = new DashboardWidgetHeaderAndNoDataMessage(); + selectedCompetitorWithSettingsButton = new SettingsButtonWithSelectionIndicationLabel(); + selectedCompetitorWithSettingsButton.disable(); + selectedCompetitorWithSettingsButton.setSelectionIndicationTextOnLabel(StringMessages.INSTANCE.dashboardSelectCompetitor()); + addClickListenerToSettingsButtonAndLabel(); + raceMapResources.raceMapStyle().ensureInjected(); this.dashboardClientFactory = dashboardClientFactory; pageChangeListener = new ArrayList(); starts = new ArrayList(); + cookieKeyForSelectedCompetitorInLeaderboard = computeCookieKeyForSelectedCompetitorInLeaderboard(); initWidget(uiBinder.createAndBindUi(this)); + dashboardWidgetHeaderAndNoDataMessage.setHeaderText(StringMessages.INSTANCE.dashboardStartAnalysesHeader()); initCompetitorSelectionPopupAndAddCompetitorSelectionListener(); initLeftRightButtons(); initAndAddBottomNotification(); - getCachedSelectedCompetitorOrAskForWithPopup(); - initAndAddSettingsButtonWithSelectionIndicationLabel(); registerForDashboardFiveSecondsTimer(dashboardClientFactory); } + private String computeCookieKeyForSelectedCompetitorInLeaderboard() { + String result = SELECTED_COMPETITOR_IN_LEADERBOARD_COOKIE_KEY_FIRST_PART+DashboardURLParameters.LEADERBOARD_NAME.getValue(); + return result; + } + + private String getCachedSelectedCompetitorId() { + String result = null; + String selectedCompetitorId = Cookies.getCookie(cookieKeyForSelectedCompetitorInLeaderboard); + if (selectedCompetitorId == null || "undefined".equals(selectedCompetitorId)) { + result = null; + } else { + result = selectedCompetitorId; + } + return result; + } + private void initLeftRightButtons() { - leftButton.setResource(StartAnalysisWidgetResources.INSTANCE.leftdisabled()); + leftButtonImage.setResource(StartAnalysisWidgetResources.INSTANCE.leftdisabled()); left_focus_panel.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { clickedArrowButton(false); } }); - rightButton.setResource(StartAnalysisWidgetResources.INSTANCE.rightdisabled()); + rightButtonImage.setResource(StartAnalysisWidgetResources.INSTANCE.rightdisabled()); right_focus_panel.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { @@ -148,33 +184,43 @@ public class StartAnalysisWidget extends Composite implements HasWidgets, PollsL }); } - private void loadStartAnalysisDTOsForCompetitorID(String competitorIdAsString){ + private void loadStartAnalysisDTOsForCompetitorID(String competitorIdAsString) { logger.log(Level.INFO, "Loading startanalysis for competitor id " + competitorIdAsString); - dashboardClientFactory.getDispatch().execute(new GetStartAnalysesAction(DashboardURLParameters.LEADERBOARD_NAME.getValue(), competitorIdAsString), new AsyncCallback() { + dashboardClientFactory.getDispatch().execute( + new GetStartAnalysesAction(DashboardURLParameters.LEADERBOARD_NAME.getValue(), competitorIdAsString), + new AsyncCallback() { - @Override - public void onFailure(Throwable caught) { - logger.log(Level.INFO, "Failed to received startanalysis list, "+caught.getMessage()); - } + @Override + public void onFailure(Throwable caught) { + logger.log(Level.INFO, "Failed to received startanalysis list, "+caught.getMessage()); + dashboardWidgetHeaderAndNoDataMessage.showNoDataMessageWithHeaderAndMessage(StringMessages.INSTANCE.dashboardNoStartAnalysesAvailableHeader(), StringMessages.INSTANCE.dashboardNoStartAnalysesAvailableMessage()); + selectedCompetitorWithSettingsButton.disable(); + } - @Override - public void onSuccess(StartAnalysesDTO result) { - logger.log(Level.INFO, "Received startanalysis list"); - if (result != null && !result.getStartAnalyses().isEmpty()) { - if (displayedStartAnalysisCompetitorDifferentToRequestedOne()) { - removeAllStartAnalysisCards(); - } - if (result.getStartAnalyses().size() != starts.size()) { - showNotificationForNewStartAnalysis(); - } - logger.log(Level.INFO, "Updating UI with startanalysis list"); - addNewStartAnalysisCards(result.getStartAnalyses()); - settingsButtonWithSelectionIndicationLabel.setSelectionIndicationTextOnLabel(result.getStartAnalyses().get(0).competitor.getName()); - } else { - logger.log(Level.INFO, "Received startanalysis list is null or empty"); - } - } - }); + @Override + public void onSuccess(StartAnalysesDTO result) { + logger.log(Level.INFO, "Received startanalysis list"); + if (result != null && !result.getStartAnalyses().isEmpty() && result.getStartAnalyses().size() > 0) { + dashboardWidgetHeaderAndNoDataMessage.hideNoDataMessage(); + if (displayedStartAnalysisForDifferentCompetitorToRequestedOne()) { + removeAllStartAnalysisCards(); + } + if (result.getStartAnalyses().size() != starts.size()) { + showNotificationForNewStartAnalysis(); + } + logger.log(Level.INFO, "Updating UI with startanalysis list"); + addNewStartAnalysisCards(result.getStartAnalyses()); + showControllHeaderButtons(); + if (result.getStartAnalyses().get(0).competitor != null) { + selectedCompetitorWithSettingsButton.setSelectionIndicationTextOnLabel(result.getStartAnalyses().get(0).competitor.getName()); + } + selectedCompetitorWithSettingsButton.enable(); + } else { + logger.log(Level.INFO, "Received startanalysis list is null or empty"); + dashboardWidgetHeaderAndNoDataMessage.showNoDataMessageWithHeaderAndMessage(StringMessages.INSTANCE.dashboardNoStartAnalysesAvailableHeader(), StringMessages.INSTANCE.dashboardNoStartAnalysesAvailableMessage()); + } + } + }); } private void initAndAddBottomNotification() { @@ -196,12 +242,10 @@ public class StartAnalysisWidget extends Composite implements HasWidgets, PollsL @Override public void didClickOKWithSelectedCompetitor(CompetitorDTO competitor) { if (competitor != null) { - Cookies.removeCookie(SELECTED_COMPETITOR_ID_COOKIE_KEY); - Cookies.setCookie(SELECTED_COMPETITOR_ID_COOKIE_KEY, competitor.getIdAsString(), new Date( - new Date().getTime() + SELECTED_COMPETITOR_ID_COOKIE_KEY_EXPIRE_TIME_IN_MILLIS)); - if (settingsButtonWithSelectionIndicationLabel != null) { - settingsButtonWithSelectionIndicationLabel.setSelectionIndicationTextOnLabel(competitor - .getName()); + Cookies.removeCookie(cookieKeyForSelectedCompetitorInLeaderboard); + Cookies.setCookie(cookieKeyForSelectedCompetitorInLeaderboard, competitor.getIdAsString(), new Date(new Date().getTime()+SELECTED_COMPETITOR_ID_COOKIE_KEY_EXPIRE_TIME_IN_MILLIS)); + if (selectedCompetitorWithSettingsButton != null) { + selectedCompetitorWithSettingsButton.setSelectionIndicationTextOnLabel(competitor.getName()); } loadStartAnalysisDTOsForCompetitorID(competitor.getIdAsString()); } @@ -209,21 +253,17 @@ public class StartAnalysisWidget extends Composite implements HasWidgets, PollsL }); } - private void getCachedSelectedCompetitorOrAskForWithPopup() { - String selectedCompetitorIdFromCookie = Cookies.getCookie(SELECTED_COMPETITOR_ID_COOKIE_KEY); - if (selectedCompetitorIdFromCookie == null) { - loadCompetitorsAndShowCompetitorSelectionPopup(); - } - } - private void loadCompetitorsAndShowCompetitorSelectionPopup() { logger.log(Level.INFO, "Requesting Competitors in Leaderboard"); - dashboardClientFactory.getDispatch().execute(new GetCompetitorInLeaderboardAction(DashboardURLParameters.LEADERBOARD_NAME.getValue()), new AsyncCallback() { + dashboardClientFactory.getDispatch().execute( + new GetCompetitorInLeaderboardAction(DashboardURLParameters.LEADERBOARD_NAME.getValue()), + new AsyncCallback() { @Override public void onSuccess(LeaderboardCompetitorsDTO result) { logger.log(Level.INFO, "Received competitors for leaderboard name"); if (result.getCompetitors() != null && result.getCompetitors().size() > 0) { + selectedCompetitorWithSettingsButton.enable(); if (!competitorSelectionPopup.isShown()) { logger.log(Level.INFO, "Showing CompetitorSelectionPopup with competitors"); competitorSelectionPopup.show(result.getCompetitors()); @@ -232,26 +272,33 @@ public class StartAnalysisWidget extends Composite implements HasWidgets, PollsL } } else { logger.log(Level.INFO, "Received competitors are null or empty"); + dashboardWidgetHeaderAndNoDataMessage.showNoDataMessageWithHeaderAndMessage( + StringMessages.INSTANCE.dashboardNoStartAnalysesAvailableHeader(), + StringMessages.INSTANCE.dashboardNoStartAnalysesAvailableMessage()); + selectedCompetitorWithSettingsButton.disable(); } } - + @Override public void onFailure(Throwable caught) { - logger.log(Level.INFO, "Failed to received competitors for leaderboard name, "+caught.getMessage()); + logger.log(Level.INFO, + "Failed to received competitors for leaderboard name, " + caught.getMessage()); + dashboardWidgetHeaderAndNoDataMessage.showNoDataMessageWithHeaderAndMessage( + StringMessages.INSTANCE.dashboardNoStartAnalysesAvailableHeader(), + StringMessages.INSTANCE.dashboardNoStartAnalysesAvailableMessage()); + selectedCompetitorWithSettingsButton.disable(); } }); } - private void initAndAddSettingsButtonWithSelectionIndicationLabel() { - settingsButtonWithSelectionIndicationLabel = new SettingsButtonWithSelectionIndicationLabel(); - settingsButtonWithSelectionIndicationLabel.addClickHandlerToSettingsButton(new ClickHandler() { + private void addClickListenerToSettingsButtonAndLabel() { + selectedCompetitorWithSettingsButton.addActionListener(new ActionPanel.ActionPanelListener() { @Override - public void onClick(ClickEvent event) { + public void eventTriggered() { loadCompetitorsAndShowCompetitorSelectionPopup(); } }); - RootPanel.get().add(settingsButtonWithSelectionIndicationLabel); } /** @@ -268,14 +315,14 @@ public class StartAnalysisWidget extends Composite implements HasWidgets, PollsL startanalysis_card_container.getElement().getStyle().setLeft(currentScrollPosition, Unit.PCT); notifyStartAnalysisPageChangeListener(page); int displayPage = page + 1; - header.getElement().setInnerHTML("Start " + starts.get(displayPage - 1).raceName); + currentStartPanel.getElement().setInnerHTML(starts.get(displayPage - 1).raceName); if (page != numberOfStartAnalysisCards - 1) { - rightButton.setResource(StartAnalysisWidgetResources.INSTANCE.right()); + rightButtonImage.setResource(StartAnalysisWidgetResources.INSTANCE.right()); rightButton.getElement().getStyle().setProperty("disabled", "false"); } if (page == 0) { - leftButton.setResource(StartAnalysisWidgetResources.INSTANCE.leftdisabled()); - leftButton.getElement().getStyle().setProperty("disabled", "true"); + leftButtonImage.setResource(StartAnalysisWidgetResources.INSTANCE.leftdisabled()); + leftButtonImage.getElement().getStyle().setProperty("disabled", "true"); } } } else { @@ -285,13 +332,13 @@ public class StartAnalysisWidget extends Composite implements HasWidgets, PollsL startanalysis_card_container.getElement().getStyle().setLeft(currentScrollPosition, Unit.PCT); notifyStartAnalysisPageChangeListener(page); int displayPage = page + 1; - header.getElement().setInnerHTML("Start " + starts.get(displayPage - 1).raceName); + currentStartPanel.getElement().setInnerHTML(starts.get(displayPage - 1).raceName); if (page >= 0) { - leftButton.setResource(StartAnalysisWidgetResources.INSTANCE.left()); + leftButtonImage.setResource(StartAnalysisWidgetResources.INSTANCE.left()); leftButton.getElement().getStyle().setProperty("disabled", "false"); } if (page == numberOfStartAnalysisCards - 1) { - rightButton.setResource(StartAnalysisWidgetResources.INSTANCE.rightdisabled()); + rightButtonImage.setResource(StartAnalysisWidgetResources.INSTANCE.rightdisabled()); rightButton.getElement().getStyle().setProperty("disabled", "true"); } } @@ -299,17 +346,24 @@ public class StartAnalysisWidget extends Composite implements HasWidgets, PollsL } } + private void showControllHeaderButtons() { + leftButton.getElement().addClassName( + StartAnalysisWidgetResources.INSTANCE.gss().controll_header_button_visible()); + rightButton.getElement().addClassName( + StartAnalysisWidgetResources.INSTANCE.gss().controll_header_button_visible()); + } + private void scrollToLast() { if (numberOfStartAnalysisCards > 1) { currentScrollPosition = currentScrollPosition - (numberOfStartAnalysisCards - page - 1) * SCROLL_OFFSET_STARTANALYSIS_CARDS; page = numberOfStartAnalysisCards - 1; startanalysis_card_container.getElement().getStyle().setLeft(currentScrollPosition, Unit.PCT); - header.getElement().setInnerHTML("Start " + starts.get(page).raceName); + currentStartPanel.getElement().setInnerHTML(starts.get(page).raceName); notifyStartAnalysisPageChangeListener(page); - rightButton.setResource(StartAnalysisWidgetResources.INSTANCE.rightdisabled()); + rightButtonImage.setResource(StartAnalysisWidgetResources.INSTANCE.rightdisabled()); rightButton.getElement().getStyle().setProperty("disabled", "true"); - leftButton.setResource(StartAnalysisWidgetResources.INSTANCE.left()); + leftButtonImage.setResource(StartAnalysisWidgetResources.INSTANCE.left()); leftButton.getElement().getStyle().setProperty("disabled", "false"); } } @@ -318,14 +372,14 @@ public class StartAnalysisWidget extends Composite implements HasWidgets, PollsL logger.log(Level.INFO, "Adding Startanalysis Card"); if (displaysCards == false) { displaysCards = true; - header.getElement().setInnerHTML("Start " + SafeHtmlUtils.fromString(startAnalysisDTO.raceName)); + currentStartPanel.getElement().setInnerHTML(startAnalysisDTO.raceName); } if (numberOfStartAnalysisCards > 0) { - rightButton.setResource(StartAnalysisWidgetResources.INSTANCE.right()); + rightButtonImage.setResource(StartAnalysisWidgetResources.INSTANCE.right()); } final StartAnalysisCard startlineAnalysisCard = new StartAnalysisCard(numberOfStartAnalysisCards - * SCROLL_OFFSET_STARTANALYSIS_CARDS + 10, numberOfStartAnalysisCards, startAnalysisDTO, - dashboardClientFactory.getSailingService()); + * SCROLL_OFFSET_STARTANALYSIS_CARDS + MARGIN_LEFT_STARTANALYSIS_CARD, numberOfStartAnalysisCards, + startAnalysisDTO, dashboardClientFactory.getSailingService(), raceMapResources); startanalysis_card_container.add(startlineAnalysisCard); startlineAnalysisCard.startAnalysisComponentPageChangedToIndexAndStartAnalysis(page, startAnalysisDTO); registerPageChangeListener(startlineAnalysisCard); @@ -352,8 +406,8 @@ public class StartAnalysisWidget extends Composite implements HasWidgets, PollsL public void notifyStartAnalysisPageChangeListener(int newPageIndex) { for (StartAnalysisPageChangeListener sO : pageChangeListener) { - if(starts.get(newPageIndex) != null) - sO.startAnalysisComponentPageChangedToIndexAndStartAnalysis(newPageIndex, starts.get(newPageIndex)); + if (starts.get(newPageIndex) != null) + sO.startAnalysisComponentPageChangedToIndexAndStartAnalysis(newPageIndex, starts.get(newPageIndex)); } } @@ -364,8 +418,8 @@ public class StartAnalysisWidget extends Composite implements HasWidgets, PollsL } } - private String getCompetitorIdAsStringFromDisplayedStartAnalysisDTOs() { - String result = ""; + private String getCompetitorIdAsStringFromFirstDisplayedStartAnalysis() { + String result = null; if (starts != null && starts.size() > 0) { CompetitorDTO competitor = starts.get(0).competitor; if (competitor != null) @@ -374,27 +428,20 @@ public class StartAnalysisWidget extends Composite implements HasWidgets, PollsL return result; } - private boolean displayedStartAnalysisCompetitorDifferentToRequestedOne() { - String competitorIDFromDispalyedStartAnalysisDTOs = getCompetitorIdAsStringFromDisplayedStartAnalysisDTOs(); - if (competitorIDFromDispalyedStartAnalysisDTOs != null - && !(competitorIDFromDispalyedStartAnalysisDTOs.equals(Cookies - .getCookie(SELECTED_COMPETITOR_ID_COOKIE_KEY)))) { + private boolean displayedStartAnalysisForDifferentCompetitorToRequestedOne() { + String competitorIDFromDispalyedStartAnalysisDTOs = getCompetitorIdAsStringFromFirstDisplayedStartAnalysis(); + if ((competitorIDFromDispalyedStartAnalysisDTOs != getCachedSelectedCompetitorId()) || (competitorIDFromDispalyedStartAnalysisDTOs == null && getCachedSelectedCompetitorId() != null)) { return true; } else { return false; } } - + @Override public void timeChanged(Date newTime, Date oldTime) { - String selectedCompetitorId = Cookies.getCookie(SELECTED_COMPETITOR_ID_COOKIE_KEY); - if (selectedCompetitorId != null) { - loadStartAnalysisDTOsForCompetitorID(selectedCompetitorId); - } else { - loadCompetitorsAndShowCompetitorSelectionPopup(); - } + loadStartAnalysisDTOsForCompetitorID(getCachedSelectedCompetitorId()); } - + @Override public void registerForDashboardFiveSecondsTimer(DashboardClientFactory dashboardClientFactory) { if (dashboardClientFactory != null) { diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/StartAnalysisWidget.ui.xml b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/StartAnalysisWidget.ui.xml index 3ede34ebdf6..d2893aa1d9e 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/StartAnalysisWidget.ui.xml +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/StartAnalysisWidget.ui.xml @@ -1,21 +1,27 @@ - - + xmlns:g="urn:import:com.google.gwt.user.client.ui" + xmlns:header="urn:import:com.sap.sailing.dashboards.gwt.client.widgets.header" + xmlns:competitorselection="urn:import:com.sap.sailing.dashboards.gwt.client.popups.competitorselection.util"> + + - - No Starts Available + + + + + + + + + + + - - - + diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/StartAnalysisWidgetResources.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/StartAnalysisWidgetResources.java index 7a0aab98c25..3ca58a41b8a 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/StartAnalysisWidgetResources.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/StartAnalysisWidgetResources.java @@ -4,41 +4,37 @@ import com.google.gwt.core.client.GWT; import com.google.gwt.resources.client.ClientBundle; import com.google.gwt.resources.client.CssResource; import com.google.gwt.resources.client.ImageResource; -import com.sap.sailing.gwt.ui.client.shared.racemap.CombinedWindPanelStyle; public interface StartAnalysisWidgetResources extends ClientBundle { public static final StartAnalysisWidgetResources INSTANCE = GWT.create(StartAnalysisWidgetResources.class); - @Source("com/sap/sailing/dashboards/gwt/client/images/leftarrow.png") + @Source("com/sap/sailing/dashboards/gwt/client/images/left.png") ImageResource left(); - @Source("com/sap/sailing/dashboards/gwt/client/images/rightarrow.png") + @Source("com/sap/sailing/dashboards/gwt/client/images/right.png") ImageResource right(); - @Source("com/sap/sailing/dashboards/gwt/client/images/leftarrow_disabled.png") + @Source("com/sap/sailing/dashboards/gwt/client/images/left_disabled.png") ImageResource leftdisabled(); - @Source("com/sap/sailing/dashboards/gwt/client/images/rightarrow_disabled.png") + @Source("com/sap/sailing/dashboards/gwt/client/images/right_disabled.png") ImageResource rightdisabled(); - - @Source("com/sap/sailing/dashboards/gwt/client/images/windarrow.png") - ImageResource combinedWindIcon(); @Source({"com/sap/sailing/dashboards/gwt/client/theme/theme.gss", "StartAnalysisWidget.gss"}) StartAnalysisGSS gss(); - - @Source({"com/sap/sailing/dashboards/gwt/client/theme/theme.gss", "StartAnalysisCombinedWindPanel.gss"}) - CombinedWindPanelStyle combinedWindPanelStyle(); public interface StartAnalysisGSS extends CssResource { String startanalysis(); - String panel_header(); + String current_start_panel(); String controll_header_button(); + String controll_header_button_visible(); + String controll_header_button_image(); String controll_header_button_left(); String controll_header_button_right(); String card_container(); String card(); + String card_map_container(); String card_table(); String card_wind_line_data_container(); String card_data(); diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/card/StartAnalysisCard.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/card/StartAnalysisCard.java index 8d997ca6d63..23d40016256 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/card/StartAnalysisCard.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/card/StartAnalysisCard.java @@ -20,7 +20,6 @@ import com.google.gwt.user.client.ui.HTMLPanel; import com.google.gwt.user.client.ui.HasWidgets; import com.google.gwt.user.client.ui.Widget; import com.sap.sailing.dashboards.gwt.client.widgets.startanalysis.StartAnalysisPageChangeListener; -import com.sap.sailing.dashboards.gwt.client.widgets.startanalysis.StartAnalysisWidgetResources; import com.sap.sailing.dashboards.gwt.client.widgets.startanalysis.rankingtable.StartAnalysisStartRankTable; import com.sap.sailing.dashboards.gwt.shared.StartlineAdvantageType; import com.sap.sailing.dashboards.gwt.shared.dto.StartAnalysisDTO; @@ -34,6 +33,7 @@ import com.sap.sailing.gwt.ui.client.StringMessages; import com.sap.sailing.gwt.ui.client.shared.racemap.RaceMap; import com.sap.sailing.gwt.ui.client.shared.racemap.RaceMapHelpLinesSettings; import com.sap.sailing.gwt.ui.client.shared.racemap.RaceMapHelpLinesSettings.HelpLineTypes; +import com.sap.sailing.gwt.ui.client.shared.racemap.RaceMapResources; import com.sap.sailing.gwt.ui.client.shared.racemap.RaceMapZoomSettings; import com.sap.sailing.gwt.ui.client.shared.racemap.RaceMapZoomSettings.ZoomTypes; import com.sap.sse.gwt.client.async.AsyncActionsExecutor; @@ -52,6 +52,9 @@ public class StartAnalysisCard extends Composite implements HasWidgets, StartAna @UiField HTMLPanel startanalysis_card; + @UiField + HTMLPanel card_map_container; + @UiField HTMLPanel startanalysis_card_table; @@ -72,12 +75,14 @@ public class StartAnalysisCard extends Composite implements HasWidgets, StartAna private final double WIND_LINE_ADVANTAGE_DIV_WIDTH_IN_PT = 185; private final double GEOMETRIC_LINE_ADVANTAGE_DIV_WIDTH_IN_PT = 210; - private final int TABLE_MARGIN_IN_PT = 10; private final String RACE_TIME_START = "00:00:00"; - public StartAnalysisCard(double leftCSSProperty, int cardId, StartAnalysisDTO startAnalysisDTO, SailingServiceAsync sailingServiceAsync) { + private RaceMapResources raceMapResources; + + public StartAnalysisCard(double leftCSSProperty, int cardId, StartAnalysisDTO startAnalysisDTO, SailingServiceAsync sailingServiceAsync, RaceMapResources raceMapResources) { stringMessages = StringMessages.INSTANCE; this.sailingServiceAsync = sailingServiceAsync; + this.raceMapResources = raceMapResources; colorProvider = new CompetitorColorProviderImpl(); competitorSelectionModel = new CompetitorSelectionModel(/* hasMultiSelection */true, colorProvider); competitorSelectionModel.setCompetitors(startAnalysisDTO.getCompetitorDTOsFromStartAnaylsisCompetitorDTOs(), @@ -96,9 +101,9 @@ public class StartAnalysisCard extends Composite implements HasWidgets, StartAna final String startLineAdvantageType; if (startAnalysisDTO.startAnalysisWindLineInfoDTO.startLineAdvantage.startLineAdvatageType .equals(StartlineAdvantageType.GEOMETRIC)) { - startLineAdvantageType = stringMessages.dashboardStartlineAdvantageByGeometry(); + startLineAdvantageType = stringMessages.dashboardStartlineAdvantageByGeometryHeader(); } else { - startLineAdvantageType = stringMessages.dashboardStartlineAdvantagesByWind(); + startLineAdvantageType = stringMessages.dashboardStartlineAdvantagesByWindHeader(); } startanalysis_card_line_advantage .setInnerHTML(SafeHtmlUtils.fromString(startLineAdvantageType @@ -133,7 +138,7 @@ public class StartAnalysisCard extends Composite implements HasWidgets, StartAna } } - private void addMap(final int cardID, final StartAnalysisDTO startAnalysisDTO) { + private void addMap(final int cardID, final StartAnalysisDTO startAnalysisDTO, RaceMapResources raceMapResources) { com.sap.sse.gwt.client.player.Timer timer = new com.sap.sse.gwt.client.player.Timer(PlayModes.Live, 1000l); timer.pause(); ArrayList zoomTypes = new ArrayList(); @@ -149,13 +154,14 @@ public class StartAnalysisCard extends Composite implements HasWidgets, StartAna asyncActionsExecutor, null, Collections.singletonList(startAnalysisDTO.regattaAndRaceIdentifier), 5000l /* requestInterval */); raceMap = new RaceMap(sailingServiceAsync, asyncActionsExecutor, null, timer, competitorSelectionModel, StringMessages.INSTANCE, false, false, false, false, startAnalysisDTO.regattaAndRaceIdentifier, - StartAnalysisWidgetResources.INSTANCE.combinedWindPanelStyle(), /* showHeaderPanel */ true); + raceMapResources, /* showHeaderPanel */ true); raceMap.getSettings().setZoomSettings(new RaceMapZoomSettings(zoomTypes, false)); raceMap.getSettings().setHelpLinesSettings(getHelpLineSettings()); raceMap.getSettings().setTailLengthInMilliseconds(startAnalysisDTO.tailLenghtInMilliseconds); raceTimesInfoProvider.addRaceTimesInfoProviderListener(raceMap); - raceMap.setSize("100%", getHeightForRaceMapInPixels()+"px"); - startanalysis_card.add(raceMap); + raceMap.setSize("100%", "100%"); + card_map_container.getElement().getStyle().setHeight(getHeightForRaceMapInPixels(), Unit.PX); + card_map_container.add(raceMap); /** * Executes onResize() after the reflow of the DOM. Otherwise it has no effect. * Needs to resize the map because google maps are not shown loaded fully when they are hidden. @@ -169,8 +175,8 @@ public class StartAnalysisCard extends Composite implements HasWidgets, StartAna }); } - private int getHeightForRaceMapInPixels(){ - return this.getElement().getOffsetHeight() - startanalysis_card_table.getElement().getOffsetHeight() + (TABLE_MARGIN_IN_PT*3); + private double getHeightForRaceMapInPixels(){ + return this.getElement().getOffsetHeight() - startanalysis_card_table.getElement().getOffsetHeight() - 30; } private RaceMapHelpLinesSettings getHelpLineSettings() { @@ -184,7 +190,7 @@ public class StartAnalysisCard extends Composite implements HasWidgets, StartAna private void removeMap() { if (raceMap != null && raceMap.isAttached() == true) { - startanalysis_card.remove(raceMap); + card_map_container.remove(raceMap); } } @@ -201,7 +207,7 @@ public class StartAnalysisCard extends Composite implements HasWidgets, StartAna @Override public void execute() { - addMap(newPageIndex, startAnalysisDTO); + addMap(newPageIndex, startAnalysisDTO, raceMapResources); } }); } diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/card/StartAnalysisCard.ui.xml b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/card/StartAnalysisCard.ui.xml index fbb57deff27..5c90d570e6c 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/card/StartAnalysisCard.ui.xml +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/card/StartAnalysisCard.ui.xml @@ -5,11 +5,12 @@ -
+
+
Time: 00:05:00
-
Time: 00:05:00
+ diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/rankingtable/StartAnalysisStartRankTable.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/rankingtable/StartAnalysisStartRankTable.java index 198e638da0c..3295a5d25c4 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/rankingtable/StartAnalysisStartRankTable.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/rankingtable/StartAnalysisStartRankTable.java @@ -7,7 +7,6 @@ import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.i18n.client.NumberFormat; import com.google.gwt.user.cellview.client.CellTable; import com.google.gwt.user.cellview.client.HasKeyboardSelectionPolicy.KeyboardSelectionPolicy; -import com.google.gwt.user.cellview.client.TextColumn; import com.google.gwt.user.client.ui.AbsolutePanel; import com.sap.sailing.dashboards.gwt.shared.dto.StartAnalysisCompetitorDTO; import com.sap.sailing.gwt.ui.client.CompetitorSelectionModel; @@ -48,31 +47,27 @@ public class StartAnalysisStartRankTable extends AbsolutePanel { } }; - StartAnalysisStartRankTableTeamCollumn teamColumn = new StartAnalysisStartRankTableTeamCollumn() { + StartAnalysisStartRankTableTextColumn teamColumn = new StartAnalysisStartRankTableTextColumn() { @Override - public Pair getValue(StartAnalysisCompetitorDTO saCompetitor) { - String competitorColorAsHTML = competitorSelectionModel.getColor(saCompetitor.competitorDTO).getAsHtml(); - if(competitorColorAsHTML == null){ - competitorColorAsHTML = "#121212"; - } - return new Pair(saCompetitor.rankingTableEntryDTO.teamName, competitorColorAsHTML); + public String getValue(StartAnalysisCompetitorDTO saCompetitor) { + return saCompetitor.rankingTableEntryDTO.teamName; } }; - TextColumn speedColumn = new TextColumn() { + StartAnalysisStartRankTableTextColumn speedColumn = new StartAnalysisStartRankTableTextColumn() { @Override public String getValue(StartAnalysisCompetitorDTO saCompetitor) { return "" + NumberFormat.getFormat("#0.0").format(saCompetitor.rankingTableEntryDTO.speedAtStartTime); } }; - TextColumn distanceColumn = new TextColumn() { + StartAnalysisStartRankTableTextColumn distanceColumn = new StartAnalysisStartRankTableTextColumn() { @Override public String getValue(StartAnalysisCompetitorDTO saCompetitor) { return "" + NumberFormat.getFormat("#0.0").format(saCompetitor.rankingTableEntryDTO.distanceToLineAtStartTime); } }; - + table.addColumn(rankColumn, stringConstants.dashboardRankAtFirstMark()); table.setColumnWidth(rankColumn, 18.0, Unit.PCT); table.addColumn(teamColumn, stringConstants.dashboardTeam()); diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/rankingtable/StartAnalysisStartRankTableRankAtFirstMarkCell.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/rankingtable/StartAnalysisStartRankTableRankAtFirstMarkCell.java index 3169789147f..9b9f3cdbf7f 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/rankingtable/StartAnalysisStartRankTableRankAtFirstMarkCell.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/rankingtable/StartAnalysisStartRankTableRankAtFirstMarkCell.java @@ -3,6 +3,7 @@ package com.sap.sailing.dashboards.gwt.client.widgets.startanalysis.rankingtable import com.google.gwt.cell.client.AbstractCell; import com.google.gwt.cell.client.Cell; import com.google.gwt.safehtml.shared.SafeHtmlBuilder; +import com.sap.sailing.dashboards.gwt.client.theme.Fonts; import com.sap.sse.common.Util.Pair; public class StartAnalysisStartRankTableRankAtFirstMarkCell extends AbstractCell> implements Cell> { @@ -12,19 +13,18 @@ public class StartAnalysisStartRankTableRankAtFirstMarkCell extends AbstractCell @Override public void render(com.google.gwt.cell.client.Cell.Context context, Pair value, SafeHtmlBuilder sb) { - String borderColor = "white"; String textColor = "white"; - String width = "20pt"; - String height = "20pt"; + String width = "22px"; + String height = "22px"; + String fontFamily = Fonts.DASHBOARD_FONT_FAMILY; if(value.getB().equals("#FFFFFF")){ borderColor = "black"; textColor = "black"; - width = "19pt"; - height = "19pt"; + width = "22px"; + height = "22px"; } - - sb.appendHtmlConstant("
"); + sb.appendHtmlConstant("
"); if (value != null) { sb.appendHtmlConstant(value.getA()); } diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/rankingtable/StartAnalysisStartRankTableStyle.css b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/rankingtable/StartAnalysisStartRankTableStyle.css index beddf87f241..6fa2b7a3807 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/rankingtable/StartAnalysisStartRankTableStyle.css +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/rankingtable/StartAnalysisStartRankTableStyle.css @@ -1,37 +1,52 @@ @CHARSET "UTF-8"; .cellTableHeader { -padding-left: 10px; -color: black; -font-size: 9pt; -background-image: none; -background-color: white; -height: 30px; -vertical-align: middle; -font-weight: bold; -text-shadow: 0 1px 1px rgba(255,255,255,.7); + padding: 7px; + padding-left: 10px; + color: black; + background-image: none; + background-color: white; + font-family: 'Open Sans' !important; + font-size: 13px; + font-weight: bold; + text-shadow: 0 1px 1px rgba(255, 255, 255, .7); + border-bottom-color: lightgrey !important; + border: none !important; + vertical-align: bottom; } .cellTableCell { -padding: 5px; -overflow: hidden; -font-size: 10pt; -height: 20px; -color: black; -background-color: white; -border:none; + padding-bottom: 8px; + padding-left: 10px; + overflow: hidden; + font-family: 'Open Sans' !important; + font-size: 13px; + color: #848484; + background-color: white; + border: none !important; + margin: 100px !important; + border-spacing: 0px !important; } -.cellTableEvenRow { -background-color: white; -border:none; +.cellTableOddRowCell { + background-color: white; + border: none !important; + padding: 0px; + padding-left: 10px; + padding-bottom: 10px; + margin: 0px !important; + border-spacing: 0px !important; + font-family: 'Open Sans' !important; } -.cellTableOddRow { -background-color: white; -border:none; + +.cellTableEvenRowCell { + background-color: white; + border: none !important; + padding: 0px; + padding-left: 10px; + padding-bottom: 10px; + maring: 0px !important; + border-spacing: 0px !important; + font-family: 'Open Sans' !important; } -cellTableOddRowCell{ -background-color: white; -border:none; -} \ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/rankingtable/StartAnalysisStartRankTableTeamCell.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/rankingtable/StartAnalysisStartRankTableTeamCell.java deleted file mode 100644 index 20baef7dfe9..00000000000 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/rankingtable/StartAnalysisStartRankTableTeamCell.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.sap.sailing.dashboards.gwt.client.widgets.startanalysis.rankingtable; - -import com.google.gwt.cell.client.AbstractCell; -import com.google.gwt.cell.client.Cell; -import com.google.gwt.safehtml.shared.SafeHtmlBuilder; -import com.sap.sse.common.Util.Pair; - -public class StartAnalysisStartRankTableTeamCell extends AbstractCell> implements Cell> { - - public StartAnalysisStartRankTableTeamCell() { - } - - @Override - public void render(com.google.gwt.cell.client.Cell.Context context, Pair value, SafeHtmlBuilder sb) { - - sb.appendHtmlConstant("
"); - if (value != null) { - sb.appendHtmlConstant(value.getA()); - sb.appendHtmlConstant("
"); - } - sb.appendHtmlConstant("
"); - } -} diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/rankingtable/StartAnalysisStartRankTableTeamCollumn.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/rankingtable/StartAnalysisStartRankTableTeamCollumn.java deleted file mode 100644 index 9ad2d1c776f..00000000000 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/rankingtable/StartAnalysisStartRankTableTeamCollumn.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.sap.sailing.dashboards.gwt.client.widgets.startanalysis.rankingtable; - -import com.google.gwt.user.cellview.client.Column; -import com.sap.sse.common.Util.Pair; - -public abstract class StartAnalysisStartRankTableTeamCollumn extends Column> { - - public StartAnalysisStartRankTableTeamCollumn() { - super(new StartAnalysisStartRankTableTeamCell()); - } - - @Override - public Pair getValue(T object) { - return null; - } -} \ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/rankingtable/StartAnalysisStartRankTableTextCell.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/rankingtable/StartAnalysisStartRankTableTextCell.java new file mode 100644 index 00000000000..67644eb9686 --- /dev/null +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/rankingtable/StartAnalysisStartRankTableTextCell.java @@ -0,0 +1,22 @@ +package com.sap.sailing.dashboards.gwt.client.widgets.startanalysis.rankingtable; + +import com.google.gwt.cell.client.AbstractCell; +import com.google.gwt.cell.client.Cell; +import com.google.gwt.safehtml.shared.SafeHtmlBuilder; +import com.sap.sailing.dashboards.gwt.client.theme.Fonts; + +public class StartAnalysisStartRankTableTextCell extends AbstractCell implements Cell { + + public StartAnalysisStartRankTableTextCell() { + } + + @Override + public void render(com.google.gwt.cell.client.Cell.Context context, String value, SafeHtmlBuilder sb) { + String fontFamily = Fonts.DASHBOARD_FONT_FAMILY; + sb.appendHtmlConstant("
"); + if (value != null) { + sb.appendHtmlConstant(value); + } + sb.appendHtmlConstant("
"); + } +} diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/rankingtable/StartAnalysisStartRankTableTextColumn.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/rankingtable/StartAnalysisStartRankTableTextColumn.java new file mode 100644 index 00000000000..d585946773a --- /dev/null +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startanalysis/rankingtable/StartAnalysisStartRankTableTextColumn.java @@ -0,0 +1,21 @@ +package com.sap.sailing.dashboards.gwt.client.widgets.startanalysis.rankingtable; + +import com.google.gwt.user.cellview.client.Column; + +/** + * @author Alexander Ries (D062114) + * + */ + +public abstract class StartAnalysisStartRankTableTextColumn extends Column { + + public StartAnalysisStartRankTableTextColumn() { + super(new StartAnalysisStartRankTableTextCell()); + } + + @Override + public String getValue(T object) { + return null; + } +} + diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/course/StartLineAdvantageByGeometryWidget.gss b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/course/StartLineAdvantageByGeometryWidget.gss deleted file mode 100644 index 77918068ae3..00000000000 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/course/StartLineAdvantageByGeometryWidget.gss +++ /dev/null @@ -1,31 +0,0 @@ -@require 'theme'; - -.startLineAdvantageComponent_liveAveragePanel { - bottom: 5pt; - margin-top: 4pt; -} - -.startLineAdvantageComponent_header { - font-size: 14pt; -} - -.startLineAdvantageComponent_livePanel { - top: 35%; - bottom: 20%; -} - -.startLineAdvantageComponent_averagePanel { - top: 35%; - bottom: 20%; -} - -.startLineAdvantageComponent_middleLine { - top: 35%; - bottom: 20%; -} - -.startLineAdvantageComponent_wrapper { - position: absolute; - width: 100%; - height: 100%; -} \ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/course/StartLineAdvantageByGeometryWidget.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/course/StartLineAdvantageByGeometryWidget.java deleted file mode 100644 index e930a70fa76..00000000000 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/course/StartLineAdvantageByGeometryWidget.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.sap.sailing.dashboards.gwt.client.widgets.startlineadvantage.course; - -import java.util.Date; -import java.util.logging.Level; -import java.util.logging.Logger; - -import com.google.gwt.i18n.client.NumberFormat; -import com.google.gwt.user.client.rpc.AsyncCallback; -import com.sap.sailing.dashboards.gwt.client.DashboardClientFactory; -import com.sap.sailing.dashboards.gwt.client.actions.GetStartlineAdvantageByGeometryAction; -import com.sap.sailing.dashboards.gwt.client.widgets.PollsLiveDataEvery5Seconds; -import com.sap.sailing.dashboards.gwt.client.widgets.startlineadvantage.util.LiveAverageComponent; -import com.sap.sailing.dashboards.gwt.shared.DashboardURLParameters; -import com.sap.sailing.dashboards.gwt.shared.dto.StartLineAdvantageDTO; -import com.sap.sailing.gwt.ui.client.StringMessages; - -/** - * The purpose of the class is to display the live and average start line advantage either by wind or by geometry. There - * is only one advantage display at once, so the user can switch between these following two - * {@link StartLineAdvantageComponentState}s {@link StartLineAdvantageComponentStateShowsAdvantageByWind} and - * {@link StartLineAdvantageComponentStateShowsAdvantageByGeometry} by tabing somewhere at the widget. The class extends - * from {@link LiveAverageComponent} to get necessary Ui Elements but customizes these with own CSS. - * - * @author Alexander Ries (D062114) - * - */ -public class StartLineAdvantageByGeometryWidget extends LiveAverageComponent implements PollsLiveDataEvery5Seconds { - - private DashboardClientFactory dashboardClientFactory; - - private static StringMessages stringConstants = StringMessages.INSTANCE; - private static final Logger logger = Logger.getLogger(StartLineAdvantageByGeometryWidget.class.getName()); - - public StartLineAdvantageByGeometryWidget(DashboardClientFactory dashboardClientFactory) { - super(stringConstants.dashboardStartlineAdvantageByGeometry(), "m"); - this.dashboardClientFactory = dashboardClientFactory; - StartLineAdvantageByGeometryWidgetRessources.INSTANCE.gss().ensureInjected(); - this.header.setInnerText(stringConstants.dashboardStartlineAdvantageByGeometry()); - this.header.addClassName(StartLineAdvantageByGeometryWidgetRessources.INSTANCE.gss().startLineAdvantageComponent_header()); - liveAveragePanel.getElement().addClassName(StartLineAdvantageByGeometryWidgetRessources.INSTANCE.gss().startLineAdvantageComponent_liveAveragePanel()); - livePanel.getElement().addClassName(StartLineAdvantageByGeometryWidgetRessources.INSTANCE.gss().startLineAdvantageComponent_livePanel()); - middleLine.getElement().addClassName(StartLineAdvantageByGeometryWidgetRessources.INSTANCE.gss().startLineAdvantageComponent_middleLine()); - averagePanel.getElement().addClassName(StartLineAdvantageByGeometryWidgetRessources.INSTANCE.gss().startLineAdvantageComponent_averagePanel()); - this.liveLabel.setInnerHTML(stringConstants.dashboardLiveWind()); - this.averageLabel.setInnerHTML(stringConstants.dashboardAverageWind()+"
"+stringConstants.dashboardAverageWindMinutes(15)); - registerForDashboardFiveSecondsTimer(dashboardClientFactory); - } - - @Override - public void timeChanged(Date newTime, Date oldTime) { - String leaderboardNameParameterValue = DashboardURLParameters.LEADERBOARD_NAME.getValue(); - if (leaderboardNameParameterValue != null) { - dashboardClientFactory.getDispatch().execute( - new GetStartlineAdvantageByGeometryAction(leaderboardNameParameterValue), - new AsyncCallback() { - - @Override - public void onFailure(Throwable caught) { - logger.log(Level.INFO, "Failed to received startline advantage by geometry"); - } - - @Override - public void onSuccess(StartLineAdvantageDTO result) { - if (result.startLineAdvantage != null) { - logger.log(Level.INFO, "Updating UI with RibDashboardRaceInfoDTO.startLineAdvantageDTO"); - setLiveValue(NumberFormat.getFormat("#0.0").format(result.startLineAdvantage.doubleValue())); - setAverageValue(NumberFormat.getFormat("#0.0").format(result.average.doubleValue())); - } else { - logger.log(Level.INFO, "RibDashboardRaceInfoDTO.startLineAdvantageDTO is 0"); - } - } - }); - } - } - - @Override - public void registerForDashboardFiveSecondsTimer(DashboardClientFactory dashboardClientFactory) { - if (dashboardClientFactory != null) { - dashboardClientFactory.getDashboardFiveSecondsTimer().addTimeListener(this); - } - } -} diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/course/StartlineAdvantageByGeometryWidget.gss b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/course/StartlineAdvantageByGeometryWidget.gss new file mode 100644 index 00000000000..b8fccaeba4b --- /dev/null +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/course/StartlineAdvantageByGeometryWidget.gss @@ -0,0 +1,17 @@ +@require 'theme'; + +.start_line_advantage_by_geometry_widget { + position: absolute; + height: 100%; + width: 100%; + background-color: LIGHT_GREY; + border-radius: DASHBOARD_BORDER_RADIUS; + overflow: hidden; +} + +.advantage_maximum_live_average { + position: absolute; + width: 100%; + top: DASHBOARD_SPACE_MEDIUM; + height: auto; +} \ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/course/StartlineAdvantageByGeometryWidget.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/course/StartlineAdvantageByGeometryWidget.java new file mode 100644 index 00000000000..c9b027fee99 --- /dev/null +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/course/StartlineAdvantageByGeometryWidget.java @@ -0,0 +1,148 @@ +package com.sap.sailing.dashboards.gwt.client.widgets.startlineadvantage.course; + +import java.util.Date; +import java.util.Iterator; +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.i18n.client.NumberFormat; +import com.google.gwt.uibinder.client.UiBinder; +import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.user.client.rpc.AsyncCallback; +import com.google.gwt.user.client.ui.Composite; +import com.google.gwt.user.client.ui.HTMLPanel; +import com.google.gwt.user.client.ui.HasWidgets; +import com.google.gwt.user.client.ui.Widget; +import com.sap.sailing.dashboards.gwt.client.DashboardClientFactory; +import com.sap.sailing.dashboards.gwt.client.actions.GetStartlineAdvantageByGeometryAction; +import com.sap.sailing.dashboards.gwt.client.widgets.PollsLiveDataEvery5Seconds; +import com.sap.sailing.dashboards.gwt.client.widgets.header.DashboardWidgetHeaderAndNoDataMessage; +import com.sap.sailing.dashboards.gwt.client.widgets.startlineadvantage.util.LiveAverageComponent; +import com.sap.sailing.dashboards.gwt.client.widgets.startlineadvantage.wind.StartlineAdvantagesByWindWidget; +import com.sap.sailing.dashboards.gwt.shared.DashboardURLParameters; +import com.sap.sailing.dashboards.gwt.shared.dto.StartLineAdvantageDTO; +import com.sap.sailing.gwt.ui.client.StringMessages; + +/** + * @author Alexander Ries (D062114) + * + */ +public class StartlineAdvantageByGeometryWidget extends Composite implements HasWidgets, PollsLiveDataEvery5Seconds { + + private static StartlineAdvantageByGeometryWidgetUiBinder uiBinder = GWT + .create(StartlineAdvantageByGeometryWidgetUiBinder.class); + + interface StartlineAdvantageByGeometryWidgetUiBinder extends UiBinder { + } + + @UiField(provided = true) + DashboardWidgetHeaderAndNoDataMessage dashboardWidgetHeaderAndNoDataMessage; + + @UiField(provided = true) + LiveAverageComponent advantageMaximumLiveAverage; + + @UiField + HTMLPanel contentContainer; + + private DashboardClientFactory dashboardClientFactory; + private GetStartlineAdvantageByGeometryAction getStartlineAdvantageByGeometryAction; + private static final Logger logger = Logger.getLogger(StartlineAdvantagesByWindWidget.class.getName()); + + public StartlineAdvantageByGeometryWidget(DashboardClientFactory dashboardClientFactory) { + StartlineAdvantageByGeometryWidgetRessources.INSTANCE.gss().ensureInjected(); + String leaderboardNameParameterValue = DashboardURLParameters.LEADERBOARD_NAME.getValue(); + if (leaderboardNameParameterValue != null) { + this.getStartlineAdvantageByGeometryAction = new GetStartlineAdvantageByGeometryAction(leaderboardNameParameterValue); + } + this.dashboardClientFactory = dashboardClientFactory; + dashboardWidgetHeaderAndNoDataMessage = new DashboardWidgetHeaderAndNoDataMessage(); + advantageMaximumLiveAverage = new LiveAverageComponent(StringMessages.INSTANCE.metersUnit()); + advantageMaximumLiveAverage.liveLabel.setInnerHTML(StringMessages.INSTANCE.dashboardLiveWind()); + advantageMaximumLiveAverage.averageLabel.setInnerHTML("

" + StringMessages.INSTANCE.dashboardAverageWind() + + "

" + StringMessages.INSTANCE.dashboardAverageWindMinutes(15) + "

"); + initWidget(uiBinder.createAndBindUi(this)); + hideDataDisplayContainer(); + dashboardWidgetHeaderAndNoDataMessage.setHeaderText(StringMessages.INSTANCE + .dashboardStartlineAdvantageByGeometryHeader()); + dashboardWidgetHeaderAndNoDataMessage.showNoDataMessageWithHeaderAndMessage( + StringMessages.INSTANCE.dashboardNoStartlineAdvantagesByGeometryAvailableHeader(), + StringMessages.INSTANCE.dashboardNoStartlineAdvantagesByGeometryAvailableMessage()); + registerForDashboardFiveSecondsTimer(dashboardClientFactory); + } + + private void showDataDisplayContainer() { + contentContainer.getElement().getStyle().setOpacity(1.0); + } + + private void hideDataDisplayContainer() { + contentContainer.getElement().getStyle().setOpacity(0.0); + } + + @Override + public void timeChanged(Date newTime, Date oldTime) { + if (getStartlineAdvantageByGeometryAction != null) { + dashboardClientFactory.getDispatch().execute(getStartlineAdvantageByGeometryAction, + new AsyncCallback() { + + @Override + public void onFailure(Throwable caught) { + logger.log(Level.INFO, "Failed to received startline advantage by geometry"); + hideDataDisplayContainer(); + dashboardWidgetHeaderAndNoDataMessage.showNoDataMessageWithHeaderAndMessage( + StringMessages.INSTANCE.dashboardNoStartlineAdvantagesByGeometryAvailableHeader(), + StringMessages.INSTANCE.dashboardNoStartlineAdvantagesByGeometryAvailableMessage()); + } + + @Override + public void onSuccess(StartLineAdvantageDTO result) { + if (result.startLineAdvantage != null) { + logger.log(Level.INFO, + "Updating UI with RibDashboardRaceInfoDTO.startLineAdvantageDTO"); + advantageMaximumLiveAverage.setLiveValue(NumberFormat.getFormat("#0.0").format( + result.startLineAdvantage.doubleValue())); + advantageMaximumLiveAverage.setAverageValue(NumberFormat.getFormat("#0.0").format( + result.average.doubleValue())); + showDataDisplayContainer(); + dashboardWidgetHeaderAndNoDataMessage.hideNoDataMessage(); + } else { + logger.log(Level.INFO, "RibDashboardRaceInfoDTO.startLineAdvantageDTO is 0"); + hideDataDisplayContainer(); + dashboardWidgetHeaderAndNoDataMessage.showNoDataMessageWithHeaderAndMessage( + StringMessages.INSTANCE + .dashboardNoStartlineAdvantagesByGeometryAvailableHeader(), + StringMessages.INSTANCE + .dashboardNoStartlineAdvantagesByGeometryAvailableMessage()); + } + } + }); + } + } + + @Override + public void registerForDashboardFiveSecondsTimer(DashboardClientFactory dashboardClientFactory) { + if (dashboardClientFactory != null) { + dashboardClientFactory.getDashboardFiveSecondsTimer().addTimeListener(this); + } + } + + @Override + public void add(Widget w) { + throw new UnsupportedOperationException("The method add(Widget w) is not supported."); + } + + @Override + public void clear() { + throw new UnsupportedOperationException("The method clear() is not supported."); + } + + @Override + public Iterator iterator() { + return null; + } + + @Override + public boolean remove(Widget w) { + return false; + } +} \ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/course/StartlineAdvantageByGeometryWidget.ui.xml b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/course/StartlineAdvantageByGeometryWidget.ui.xml new file mode 100644 index 00000000000..ae191af9880 --- /dev/null +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/course/StartlineAdvantageByGeometryWidget.ui.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/course/StartLineAdvantageByGeometryWidgetRessources.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/course/StartlineAdvantageByGeometryWidgetRessources.java similarity index 51% rename from java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/course/StartLineAdvantageByGeometryWidgetRessources.java rename to java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/course/StartlineAdvantageByGeometryWidgetRessources.java index ccbc0fe1578..f45bb80527e 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/course/StartLineAdvantageByGeometryWidgetRessources.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/course/StartlineAdvantageByGeometryWidgetRessources.java @@ -5,25 +5,16 @@ import com.google.gwt.resources.client.ClientBundle; import com.google.gwt.resources.client.CssResource; import com.google.gwt.resources.client.CssResource.Shared; -public interface StartLineAdvantageByGeometryWidgetRessources extends ClientBundle { +public interface StartlineAdvantageByGeometryWidgetRessources extends ClientBundle { - public static final StartLineAdvantageByGeometryWidgetRessources INSTANCE = GWT.create(StartLineAdvantageByGeometryWidgetRessources.class); + public static final StartlineAdvantageByGeometryWidgetRessources INSTANCE = GWT.create(StartlineAdvantageByGeometryWidgetRessources.class); - @Source({"com/sap/sailing/dashboards/gwt/client/theme/theme.gss", "StartLineAdvantageByGeometryWidget.gss"}) + @Source({"com/sap/sailing/dashboards/gwt/client/theme/theme.gss", "StartlineAdvantageByGeometryWidget.gss"}) StartLineAdvantageByGeometryGss gss(); @Shared public interface StartLineAdvantageByGeometryGss extends CssResource { - public String startLineAdvantageComponent_liveAveragePanel(); - - public String startLineAdvantageComponent_header(); - - public String startLineAdvantageComponent_livePanel(); - - public String startLineAdvantageComponent_averagePanel(); - - public String startLineAdvantageComponent_middleLine(); - - public String startLineAdvantageComponent_wrapper(); + String start_line_advantage_by_geometry_widget(); + String advantage_maximum_live_average(); } } diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/util/LiveAverageComponent.gss b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/util/LiveAverageComponent.gss index cdeb1373791..4a26d8200e3 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/util/LiveAverageComponent.gss +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/util/LiveAverageComponent.gss @@ -5,33 +5,14 @@ left: 0px; right: 0px; top: 0px; - bottom: 0px; -} - -.header_container { - position: absolute; - left: 0px; - right: 0px; - top: 0px; - height: 35%; -} - -.header { - height: 100%; - margin-top: 5pt; - line-height: 15pt; - vertical-align: middle; - font-size: 13pt; - font-family: DASHBOARD_FONT_FAMILY; - width: 100%; - text-align: center; - overflow: visible; - font-weight: bold; + height: 110px; + background-color: WHITE; + z-index: 2; } .live_container { position: absolute; - top: 35%; + top: DASHBOARD_SPACE_VERY_SMALL; bottom: 30%; right: 52%; left: 0%; @@ -39,7 +20,7 @@ .average_container { position: absolute; - top: 35%; + top: DASHBOARD_SPACE_VERY_SMALL; bottom: 30%; right: 0%; left: 52%; @@ -47,7 +28,7 @@ .middle_line { position: absolute; - top: 35%; + top: 13px; height: 30pt; width: 1px; left: 50%; @@ -57,12 +38,13 @@ .panel_value_number { font-family: DASHBOARD_FONT_FAMILY; - font-size: 26pt; + font-size: DASHBOARD_FONT_SIZE_VERY_LARGE; + height: DASHBOARD_FONT_SIZE_VERY_LARGE; } .panel_value_unit { font-family: DASHBOARD_FONT_FAMILY; - font-size: 15pt; + font-size: DASHBOARD_FONT_SIZE_MEDIUM; } .panel_value_unit_degrees { @@ -74,7 +56,6 @@ .value_panel { margin: 0px; width: 100%; - height: 90%; text-align: center; font-family: DASHBOARD_FONT_FAMILY; font-weight: bolder; @@ -85,23 +66,27 @@ width: 100%; height: 100%; text-align: center; - font-size: 11pt; - color: grey; + font-size: DASHBOARD_FONT_SIZE_MEDIUM; + color: LIGHT_TEXT_COLOR; font-family: DASHBOARD_FONT_FAMILY; } .live_label_container { position: absolute; - bottom: 0px; + top: 56px; left: 0px; right: 50%; - height: 35%; + height: 14px; + padding-left: DASHBOARD_SPACE_VERY_SMALL; + padding-right: DASHBOARD_SPACE_VERY_SMALL; } .average_label_container { position: absolute; - bottom: 0px; - right: 0px; + top: 56px; left: 50%; - height: 35%; + right: 0px; + height: 14px; + padding-left: DASHBOARD_SPACE_VERY_SMALL; + padding-right: DASHBOARD_SPACE_VERY_SMALL; } \ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/util/LiveAverageComponent.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/util/LiveAverageComponent.java index dd976dc9f0a..5ec96b8befc 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/util/LiveAverageComponent.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/util/LiveAverageComponent.java @@ -11,7 +11,6 @@ import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.HTMLPanel; import com.google.gwt.user.client.ui.HasWidgets; import com.google.gwt.user.client.ui.Widget; -import com.sap.sailing.dashboards.gwt.client.widgets.startlineadvantage.course.StartLineAdvantageByGeometryWidget; import com.sap.sailing.dashboards.gwt.client.widgets.windbot.WindBotWidget; import com.sap.sailing.dashboards.gwt.client.widgets.windbot.charts.VerticalWindChartClickListener; import com.sap.sailing.gwt.ui.client.StringMessages; @@ -34,9 +33,6 @@ public class LiveAverageComponent extends Composite implements HasWidgets, Verti @UiField public HTMLPanel liveAveragePanel; - @UiField - public DivElement header; - @UiField SpanElement liveNumber; @@ -78,12 +74,11 @@ public class LiveAverageComponent extends Composite implements HasWidgets, Verti * sets a special size * * */ - public LiveAverageComponent(String header, String unit) { + public LiveAverageComponent(String unit) { LiveAverageComponentResources.INSTANCE.gss().ensureInjected(); stringConstants = StringMessages.INSTANCE; initWidget(uiBinder.createAndBindUi(this)); liveAveragePanel.getElement().getStyle().setProperty("backgroundColor", "white"); - this.header.setInnerText(header); this.liveUnit.setInnerText(unit); this.averageUnit.setInnerText(unit); // Lifts the degrees unit string "°". Otherwise it would be too small. diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/util/LiveAverageComponent.ui.xml b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/util/LiveAverageComponent.ui.xml index 907458fd311..4780e7128cb 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/util/LiveAverageComponent.ui.xml +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/util/LiveAverageComponent.ui.xml @@ -2,40 +2,29 @@ - - + + - - -
-
- -
- - -
+
+ + +
- - - -
- - -
+
+ + +
- -
+
- -
+
-
-
\ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/util/LiveAverageComponentResources.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/util/LiveAverageComponentResources.java index 2809a676b98..16f81f74f6b 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/util/LiveAverageComponentResources.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/util/LiveAverageComponentResources.java @@ -17,8 +17,6 @@ public interface LiveAverageComponentResources extends ClientBundle { interface LiveAverageComponentGss extends CssResource { String live_average_component(); - String header(); - String header_container(); String live_container(); String average_container(); String middle_line(); diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/wind/StartlineAdvantagesByWindWidget.gss b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/wind/StartlineAdvantagesByWindWidget.gss index 3d15fb8ff12..0a0fe674631 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/wind/StartlineAdvantagesByWindWidget.gss +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/wind/StartlineAdvantagesByWindWidget.gss @@ -1,21 +1,24 @@ @require 'theme'; -.start_line_advantages_by_wind_component{ +.start_line_advantages_by_wind_component { position: absolute; height: 100%; width: 100%; + background-color: LIGHT_GREY; + border-radius: DASHBOARD_BORDER_RADIUS; + overflow: hidden; } -.advantage_maximum_live_average{ +.advantage_maximum_live_average { position: absolute; - height: 30%; width: 100%; - top: 4pt; + top: DASHBOARD_SPACE_MEDIUM; + height: auto; } -.advantages_on_line_chart_container{ - position: absolute; - height: 70%; - top: 30%; +.advantages_on_line_chart_container { + position: absolute; + top: 145px; width: 100%; + bottom: 0px; } \ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/wind/StartlineAdvantagesByWindWidget.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/wind/StartlineAdvantagesByWindWidget.java index c54b0cc2482..2c9eb3aea66 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/wind/StartlineAdvantagesByWindWidget.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/wind/StartlineAdvantagesByWindWidget.java @@ -6,18 +6,19 @@ import java.util.logging.Level; import java.util.logging.Logger; import com.google.gwt.core.client.GWT; -import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.i18n.client.NumberFormat; import com.google.gwt.resources.client.CssResource; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.Composite; +import com.google.gwt.user.client.ui.HTMLPanel; import com.google.gwt.user.client.ui.HasWidgets; import com.google.gwt.user.client.ui.Widget; import com.sap.sailing.dashboards.gwt.client.DashboardClientFactory; import com.sap.sailing.dashboards.gwt.client.actions.GetStartlineAdvantagesByWindAction; import com.sap.sailing.dashboards.gwt.client.widgets.PollsLiveDataEvery5Seconds; +import com.sap.sailing.dashboards.gwt.client.widgets.header.DashboardWidgetHeaderAndNoDataMessage; import com.sap.sailing.dashboards.gwt.client.widgets.startlineadvantage.util.LiveAverageComponent; import com.sap.sailing.dashboards.gwt.client.widgets.startlineadvantage.wind.charts.StartlineAdvantagesOnLineChart; import com.sap.sailing.dashboards.gwt.shared.DashboardURLParameters; @@ -40,47 +41,63 @@ public class StartlineAdvantagesByWindWidget extends Composite implements HasWid } + @UiField(provided = true) + DashboardWidgetHeaderAndNoDataMessage dashboardWidgetHeaderAndNoDataMessage; + @UiField(provided = true) LiveAverageComponent advantageMaximumLiveAverage; @UiField(provided = true) StartlineAdvantagesOnLineChart startlineAdvantagesOnLineChart; - public DashboardClientFactory dashboardClientFactory; + @UiField + HTMLPanel dataDisplayContainer; + + private GetStartlineAdvantagesByWindAction getStartlineAdvantagesByWindAction; + private DashboardClientFactory dashboardClientFactory; private static final Logger logger = Logger.getLogger(StartlineAdvantagesByWindWidget.class.getName()); public StartlineAdvantagesByWindWidget(DashboardClientFactory dashboardClientFactory) { StartlineAdvantagesByWindWidgetResources.INSTANCE.gss().ensureInjected(); + String leaderboardNameParameterValue = DashboardURLParameters.LEADERBOARD_NAME.getValue(); + if (leaderboardNameParameterValue != null) { + getStartlineAdvantagesByWindAction = new GetStartlineAdvantagesByWindAction(leaderboardNameParameterValue); + } this.dashboardClientFactory = dashboardClientFactory; + dashboardWidgetHeaderAndNoDataMessage = new DashboardWidgetHeaderAndNoDataMessage(); + advantageMaximumLiveAverage = new LiveAverageComponent(StringMessages.INSTANCE.metersUnit()); startlineAdvantagesOnLineChart = new StartlineAdvantagesOnLineChart(); - advantageMaximumLiveAverage = new LiveAverageComponent(StringMessages.INSTANCE.dashboardStartlineAdvantagesByWind(), "m"); - advantageMaximumLiveAverage.header.getStyle().setFontSize(14, Unit.PT); advantageMaximumLiveAverage.liveLabel.setInnerHTML("advantage max."); advantageMaximumLiveAverage.averageLabel.setInnerHTML("advantage max. average "+StringMessages.INSTANCE.dashboardAverageWindMinutes(15)); initWidget(uiBinder.createAndBindUi(this)); + hideDataDisplayContainer(); + dashboardWidgetHeaderAndNoDataMessage.setHeaderText(StringMessages.INSTANCE.dashboardStartlineAdvantagesByWindHeader()); + dashboardWidgetHeaderAndNoDataMessage.showNoDataMessageWithHeaderAndMessage(StringMessages.INSTANCE.dashboardNoStartlineAdvantagesByWindAvailableHeader(), StringMessages.INSTANCE.dashboardNoStartlineAdvantagesByWindAvailableMessage()); + dataDisplayContainer.getElement().getStyle().setOpacity(0.0); registerForDashboardFiveSecondsTimer(dashboardClientFactory); } private void loadData() { logger.log(Level.INFO, "Executing GetStartlineAdvantagesAction"); - String leaderboardNameParameterValue = DashboardURLParameters.LEADERBOARD_NAME.getValue(); - if (leaderboardNameParameterValue != null) { - dashboardClientFactory.getDispatch().execute( - new GetStartlineAdvantagesByWindAction(leaderboardNameParameterValue), + if (getStartlineAdvantagesByWindAction != null) { + dashboardClientFactory.getDispatch().execute(getStartlineAdvantagesByWindAction, new AsyncCallback() { @Override public void onSuccess(StartlineAdvantagesWithMaxAndAverageDTO result) { logger.log(Level.INFO, "Received StartlineAdvantagesWithMaxAndAverageDTO"); if (result != null && result.maximum != null && result.average != null) { + dashboardWidgetHeaderAndNoDataMessage.hideNoDataMessage(); logger.log(Level.INFO, "Updating UI with StartlineAdvantagesWithMaxAndAverageDTO"); startlineAdvantagesOnLineChart.setStartlineAdvantagesAndConfidences(result.distanceToRCBoatToStartlineAdvantage, result.distanceToRCBoatToConfidence); advantageMaximumLiveAverage.setLiveValue(NumberFormat.getFormat("#0.0").format( result.maximum.doubleValue())); advantageMaximumLiveAverage.setAverageValue(NumberFormat.getFormat("#0.0").format( result.average.doubleValue())); + showDataDisplayContainer(); } else { logger.log(Level.INFO, "StartlineAdvantagesWithMaxAndAverageDTO is null"); + dashboardWidgetHeaderAndNoDataMessage.showNoDataMessageWithHeaderAndMessage(StringMessages.INSTANCE.dashboardNoStartlineAdvantagesByWindAvailableHeader(), StringMessages.INSTANCE.dashboardNoStartlineAdvantagesByWindAvailableMessage()); } } @@ -88,11 +105,20 @@ public class StartlineAdvantagesByWindWidget extends Composite implements HasWid public void onFailure(Throwable caught) { logger.log(Level.INFO, "Failed to received StartlineAdvantagesWithMaxAndAverageDTO, " + caught.getMessage()); + dashboardWidgetHeaderAndNoDataMessage.showNoDataMessageWithHeaderAndMessage(StringMessages.INSTANCE.dashboardNoStartlineAdvantagesByWindAvailableHeader(), StringMessages.INSTANCE.dashboardNoStartlineAdvantagesByWindAvailableMessage()); } }); } } + private void showDataDisplayContainer(){ + dataDisplayContainer.getElement().getStyle().setOpacity(1.0); + } + + private void hideDataDisplayContainer(){ + dataDisplayContainer.getElement().getStyle().setOpacity(0.0); + } + @Override public void timeChanged(Date newTime, Date oldTime) { loadData(); diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/wind/StartlineAdvantagesByWindWidget.ui.xml b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/wind/StartlineAdvantagesByWindWidget.ui.xml index 4b8cd97fb6b..2a7f23688ce 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/wind/StartlineAdvantagesByWindWidget.ui.xml +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/startlineadvantage/wind/StartlineAdvantagesByWindWidget.ui.xml @@ -2,16 +2,21 @@ + xmlns:chart="urn:import:com.sap.sailing.dashboards.gwt.client.widgets.startlineadvantage.wind.charts" + xmlns:header="urn:import:com.sap.sailing.dashboards.gwt.client.widgets.header"> - + - - - - - + + + + + + + + \ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/WindBotWidget.gss b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/WindBotWidget.gss index 3443715463a..12939789ba7 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/WindBotWidget.gss +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/WindBotWidget.gss @@ -1,23 +1,27 @@ @require 'theme'; -.wind_bot_component{ +.wind_bot_widget{ position: absolute; height: 100%; width: 100%; + background-color: LIGHT_GREY; z-index: 5; + border-radius: DASHBOARD_BORDER_RADIUS; + overflow: hidden; } -.name_panel { - height: 45pt; - line-height: 45pt; +.live_average_header { + position: absolute; + height: 60px; + top: DASHBOARD_SPACE_MEDIUM; + line-height: 60px; vertical-align: middle; - font-size: 14pt; + font-size: DASHBOARD_FONT_SIZE_LARGE; font-family: DASHBOARD_FONT_FAMILY; - width: 100%; text-align: center; font-weight: bold; overflow: visible; - background-color: white; + background-color: WHITE; } .live_average_container { @@ -25,41 +29,34 @@ border: none; border-radius: 0pt; background-color: white; - top: 45pt; - bottom: 65%; + top: 90px; } .left { - left: 0pt; + left: 0px; right: 50%; } .right { left: 50%; - right: 0pt; + right: 0px; } .windchart_container { position: absolute; border: none; - border-radius: 0pt; + border-radius: 0px; background-color: white; - top: 35%; - bottom: 0pt; + top: 190px; + bottom: 0px; + padding-bottom: 10px; } .windchart{ - position: absolute; - left: 0pt; - right: 0pt; - top: 0pt; - bottom: 0pt; -} - -.compass_container{ position: absolute; - height: 45pt; - width: 45pt; - top: 5pt; - right: 5pt; -} \ No newline at end of file + left: 0px; + right: 0px; + top: 0px; + bottom: 0px; + padding-bottom: 10px; +} diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/WindBotWidget.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/WindBotWidget.java index 8e2b66b977e..6d79fe56bc4 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/WindBotWidget.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/WindBotWidget.java @@ -7,15 +7,17 @@ import java.util.logging.Logger; import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.Scheduler.ScheduledCommand; +import com.google.gwt.dom.client.DivElement; import com.google.gwt.i18n.client.NumberFormat; -import com.google.gwt.resources.client.CssResource; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.HTMLPanel; import com.google.gwt.user.client.ui.HasWidgets; import com.google.gwt.user.client.ui.Widget; +import com.sap.sailing.dashboards.gwt.client.DashboardClientFactory; import com.sap.sailing.dashboards.gwt.client.dataretriever.WindBotDataRetrieverListener; +import com.sap.sailing.dashboards.gwt.client.widgets.header.DashboardWidgetHeaderAndNoDataMessage; import com.sap.sailing.dashboards.gwt.client.widgets.startlineadvantage.util.LiveAverageComponent; import com.sap.sailing.dashboards.gwt.client.widgets.windbot.charts.VerticalWindChart; import com.sap.sailing.dashboards.gwt.client.widgets.windbot.compass.LocationPointerCompass; @@ -49,18 +51,18 @@ public class WindBotWidget extends Composite implements HasWidgets, WindBotDataR interface WindBotWidgetUiBinder extends UiBinder { } - - interface WindBotComponentStyle extends CssResource { - } @UiField - public HTMLPanel windBotComponent; - - /** - * The header of the widget displaying the name of the wind bot. - * */ + HTMLPanel contentContainer; + + @UiField(provided = true) + DashboardWidgetHeaderAndNoDataMessage dashboardWidgetHeaderAndNoDataMessage; + @UiField - public HTMLPanel windBotNamePanel; + DivElement totalWindSpeedHeader; + + @UiField + DivElement totalWindDirectionHeader; /** * One of two {@link LiveAverageComponent}s that display in big font the live and the average value of the measured @@ -97,27 +99,45 @@ public class WindBotWidget extends Composite implements HasWidgets, WindBotDataR @UiField public LocationPointerCompass locationPointerCompass; + public DashboardClientFactory dashboardClientFactory; private String windBotId; private StringMessages stringConstants; - private final static String UNIT_WIND_DIRECTION = "°"; - public WindBotWidget(String windBotId) { + public WindBotWidget(DashboardClientFactory dashboardClientFactory) { WindBotWidgetResources.INSTANCE.gss().ensureInjected(); - this.windBotId = windBotId; + this.dashboardClientFactory = dashboardClientFactory; + dashboardWidgetHeaderAndNoDataMessage = new DashboardWidgetHeaderAndNoDataMessage(); stringConstants = StringMessages.INSTANCE; movingAverageSpeed = new MovingAverage(500); movingAverageDirection = new MovingAverage(500); - trueWindSpeedLiveAverageComponent = new LiveAverageComponent(stringConstants.dashboardTrueWindSpeed(), stringConstants.dashboardTrueWindSpeedUnit()); - trueWindDirectionLiveAverageComponent = new LiveAverageComponent(stringConstants.dashboardTrueWindDirection(), UNIT_WIND_DIRECTION); + trueWindSpeedLiveAverageComponent = new LiveAverageComponent(stringConstants.dashboardTrueWindSpeedUnit()); + trueWindDirectionLiveAverageComponent = new LiveAverageComponent(stringConstants.degreesUnit()); trueWindSpeedVerticalWindChart = new VerticalWindChart("#008FFF", "#6ADBFF"); trueWindDirectionVerticalWindChart = new VerticalWindChart("#008FFF", "#6ADBFF"); initWidget(uiBinder.createAndBindUi(this)); - windBotNamePanel.getElement().setInnerText(stringConstants.dashboardWindBot()+" "+ windBotId); + hideContentContainer(); + dashboardWidgetHeaderAndNoDataMessage.setHeaderText(stringConstants.dashboardWindBot()); + dashboardWidgetHeaderAndNoDataMessage.showNoDataMessageWithHeaderAndMessage(stringConstants.dashboardNoWindBotAvailableHeader(), stringConstants.dashboardNoWindBotAvailableMessage()); + totalWindSpeedHeader.setInnerHTML(stringConstants.dashboardTrueWindSpeed()); + totalWindDirectionHeader.setInnerHTML(stringConstants.dashboardTrueWindDirection()); trueWindSpeedVerticalWindChart.addVerticalWindChartClickListener(trueWindSpeedLiveAverageComponent); trueWindDirectionVerticalWindChart.addVerticalWindChartClickListener(trueWindDirectionLiveAverageComponent); } - - public WindTrackInfoDTO getWindTrackInfoDTOFromAndWindBotID(WindInfoForRaceDTO windInfoForRaceDTO, String id) { + + public void setWindBotId(String windBotId) { + this.windBotId = windBotId; + dashboardWidgetHeaderAndNoDataMessage.setHeaderText(stringConstants.dashboardWindBot() + " " + windBotId); + } + + private void showContentContainer(){ + contentContainer.getElement().getStyle().setOpacity(1.0); + } + + private void hideContentContainer(){ + contentContainer.getElement().getStyle().setOpacity(0.0); + } + + private WindTrackInfoDTO getWindTrackInfoDTOFromAndWindBotID(WindInfoForRaceDTO windInfoForRaceDTO, String id) { WindTrackInfoDTO windTrackInfo = null; for (WindSource windSource : windInfoForRaceDTO.windTrackInfoByWindSource.keySet()) { if (windSource.getType().equals(WindSourceType.EXPEDITION) && windSource.getId() != null) { @@ -128,26 +148,6 @@ public class WindBotWidget extends Composite implements HasWidgets, WindBotDataR return windTrackInfo; } - @Override - public void add(Widget w) { - throw new UnsupportedOperationException("The method add(Widget w) is not supported."); - } - - @Override - public void clear() { - throw new UnsupportedOperationException("The method clear() is not supported."); - } - - @Override - public Iterator iterator() { - return null; - } - - @Override - public boolean remove(Widget w) { - return false; - } - /** * Updates the classes {@link LiveAverageComponent}s and {@link VerticalWindChart}s with data AND updates the * {@link #locationPointerCompass} with a new wind bot position !!! @@ -161,6 +161,7 @@ public class WindBotWidget extends Composite implements HasWidgets, WindBotDataR logger.log(Level.INFO, "WindInfoForRaceDTO contains WindTrackInfoDTO for Windbot id " + windBotId); if (windTrackInfoDTO.windFixes != null) { if (windTrackInfoDTO.windFixes.size() > 0) { + dashboardWidgetHeaderAndNoDataMessage.hideNoDataMessage(); logger.log(Level.INFO, "Upating UI with Wind Fixes for WindBot id " + windBotId); SplitScheduler.get().schedule(new ScheduledCommand() { @@ -190,6 +191,7 @@ public class WindBotWidget extends Composite implements HasWidgets, WindBotDataR updateLocationPointerCompass(windTrackInfoDTO); } }); + showContentContainer(); } else { logger.log(Level.INFO, "WindTrackInfoDTO.windFixes is empty"); } @@ -220,8 +222,7 @@ public class WindBotWidget extends Composite implements HasWidgets, WindBotDataR } private void updateLocationPointerCompass(final WindTrackInfoDTO windTrackInfoDTO) { - locationPointerCompass.windBotPositionChanged(windTrackInfoDTO.windFixes - .get(windTrackInfoDTO.windFixes.size() - 1).position); + locationPointerCompass.windBotPositionChanged(windTrackInfoDTO.windFixes.get(windTrackInfoDTO.windFixes.size() - 1).position); } private void updateMovingAverages(List windFixes) { @@ -230,4 +231,24 @@ public class WindBotWidget extends Composite implements HasWidgets, WindBotDataR movingAverageDirection.add(windDTO.trueWindFromDeg); } } + + @Override + public void add(Widget w) { + throw new UnsupportedOperationException("The method add(Widget w) is not supported."); + } + + @Override + public void clear() { + throw new UnsupportedOperationException("The method clear() is not supported."); + } + + @Override + public Iterator iterator() { + return null; + } + + @Override + public boolean remove(Widget w) { + return false; + } } \ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/WindBotWidget.ui.xml b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/WindBotWidget.ui.xml index 7a9d59ee719..be7b9f0b8ec 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/WindBotWidget.ui.xml +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/WindBotWidget.ui.xml @@ -3,12 +3,17 @@ xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:client="urn:import:com.sap.sailing.dashboards.gwt.client" xmlns:util="urn:import:com.sap.sailing.dashboards.gwt.client.widgets.startlineadvantage.util" xmlns:windchart="urn:import:com.sap.sailing.dashboards.gwt.client.widgets.windbot.charts" - xmlns:compass="urn:import:com.sap.sailing.dashboards.gwt.client.widgets.windbot.compass"> + xmlns:compass="urn:import:com.sap.sailing.dashboards.gwt.client.widgets.windbot.compass" + xmlns:header="urn:import:com.sap.sailing.dashboards.gwt.client.widgets.header"> - - + + + + +
+
@@ -27,9 +32,6 @@ - -
\ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/WindBotWidgetResources.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/WindBotWidgetResources.java index c4e600796ba..fe2c852ec8a 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/WindBotWidgetResources.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/WindBotWidgetResources.java @@ -16,13 +16,12 @@ public interface WindBotWidgetResources extends ClientBundle { WindBotComponentGss gss(); public interface WindBotComponentGss extends CssResource { - String wind_bot_component(); - String name_panel(); + String wind_bot_widget(); + String live_average_header(); String live_average_container(); String left(); String right(); String windchart_container(); String windchart(); - String compass_container(); } } \ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/charts/VerticalWindChart.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/charts/VerticalWindChart.java index 01ea5d824aa..6fb1e99d8b3 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/charts/VerticalWindChart.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/charts/VerticalWindChart.java @@ -37,6 +37,9 @@ import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.FocusPanel; import com.google.gwt.user.client.ui.HasWidgets; import com.google.gwt.user.client.ui.Widget; +import com.sap.sailing.dashboards.gwt.client.theme.Colors; +import com.sap.sailing.dashboards.gwt.client.theme.Fonts; +import com.sap.sailing.dashboards.gwt.client.theme.Sizes; import com.sap.sailing.dashboards.gwt.client.util.HighchartsUtil; import com.sap.sailing.dashboards.gwt.shared.WindType; import com.sap.sailing.gwt.ui.client.shared.charts.ChartPointRecalculator; @@ -138,9 +141,8 @@ public class VerticalWindChart extends Composite implements HasWidgets { .setType(Type.DATE_TIME) .setReversed(false) .setLabels( - new XAxisLabels().setStyle(new Style().setFontFamily("Arial").setFontSize("12") - .setColor("grey"))).setLineColor("grey").setTickWidth(0.5).setLineWidth(1) - .setTickWidth(1).setTickColor("grey").setOffset(0).setMinPadding(20).setGridLineColor("white") + new XAxisLabels().setStyle(new Style().setFontFamily(Fonts.DASHBOARD_FONT_FAMILY).setFontSize(Sizes.DASHBOARD_FONT_SIZE_SMALL).setColor(Colors.LIGHT_TEXT_COLOR))).setLineColor(Colors.LIGHT_TEXT_COLOR).setTickWidth(0.5).setLineWidth(1) + .setTickWidth(1).setTickColor(Colors.LIGHT_TEXT_COLOR).setOffset(0).setMinPadding(20).setGridLineColor(Colors.LIGHT_GREY) .setGridLineWidth(0) .setDateTimeLabelFormats(new DateTimeLabelFormats().setMonth("%e. %b").setYear("%b")); } @@ -148,12 +150,12 @@ public class VerticalWindChart extends Composite implements HasWidgets { private void setYAxisOptions() { verticalWindChart .getYAxis() - .setLineColor("grey") + .setLineColor(Colors.LIGHT_TEXT_COLOR) .setTickWidth(1) - .setTickColor("grey") + .setTickColor(Colors.LIGHT_TEXT_COLOR) .setAxisTitleText(null) .setGridLineWidth(0) - .setAlternateGridColor("#d4d4d4") + .setAlternateGridColor(Colors.LIGHT_GREY) .setLineWidth(1) .setEndOnTick(true) .setStartOnTick(true) @@ -163,7 +165,7 @@ public class VerticalWindChart extends Composite implements HasWidgets { .setMaxPadding(0) .setLabels( new YAxisLabels().setStyle( - new Style().setFontFamily("Arial").setFontSize("12").setColor("grey")).setFormatter( + new Style().setFontFamily(Fonts.DASHBOARD_FONT_FAMILY).setFontSize(Sizes.DASHBOARD_FONT_SIZE_SMALL).setColor(Colors.LIGHT_TEXT_COLOR)).setFormatter( new AxisLabelsFormatter() { @Override public String format(AxisLabelsData axisLabelsData) { @@ -276,13 +278,15 @@ public class VerticalWindChart extends Composite implements HasWidgets { * */ @UiHandler("verticalWindChartClickArea") public void verticalWindChartClickAreaClicked(ClickEvent e) { - if (chartIntervallinMinutes == SMALL_DISPLAY_INTERVALL_IN_MINUTES) { - chartIntervallinMinutes = LARGE_DISPLAY_INTERVALL_IN_MINUTES; - } else { - chartIntervallinMinutes = SMALL_DISPLAY_INTERVALL_IN_MINUTES; + if (lastPoint != null) { + if (chartIntervallinMinutes == SMALL_DISPLAY_INTERVALL_IN_MINUTES) { + chartIntervallinMinutes = LARGE_DISPLAY_INTERVALL_IN_MINUTES; + } else { + chartIntervallinMinutes = SMALL_DISPLAY_INTERVALL_IN_MINUTES; + } + adaptVerticalWindChartExtemes(lastPoint.getX().longValue()); + notifyVerticalWindChartClickListeners(chartIntervallinMinutes); } - adaptVerticalWindChartExtemes(lastPoint.getX().longValue()); - notifyVerticalWindChartClickListeners(chartIntervallinMinutes); } @Override diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/compass/LocationPointerCompass.gss b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/compass/LocationPointerCompass.gss index adbcad59e81..c75ec51b3cb 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/compass/LocationPointerCompass.gss +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/compass/LocationPointerCompass.gss @@ -1,5 +1,18 @@ @require 'theme'; +.location_pointer_compass { + position: absolute; + width: 70px; + height: 85px; + background-color: LIGHT_GREY; + top: 0px; + right: 13px; + z-index: 5; + border-bottom-left-radius: DASHBOARD_BORDER_RADIUS; + border-bottom-right-radius: DASHBOARD_BORDER_RADIUS; + overflow:hidden; +} + .compass{ height: 100%; width: 100%; @@ -8,13 +21,13 @@ .needle{ position: absolute; - height: 100%; - width: 100%; - top: 0%; - left: 0%; + top: 10px; + left: 10px; + width: 50px; + height: 50px; } -.angleToLocationLabel{ +.angle_to_location { position: absolute; height: 10pt; width: 100%; @@ -23,22 +36,22 @@ text-align: center; vertical-align: middle; font-family: DASHBOARD_FONT_FAMILY; - font-size: 9pt; + font-size: DASHBOARD_FONT_SIZE_VERY_SMALL; font-weight: bold; color: white; } -.distanceToLocationLabel{ +.distance_to_location { position: absolute; - height: 15pt; + height: DASHBOARD_FONT_SIZE_SMALL; width: 100%; - bottom: -17pt; + top: 65px; text-align: center; vertical-align: middle; font-family: DASHBOARD_FONT_FAMILY; - line-height: 10pt; + line-height: DASHBOARD_FONT_SIZE_SMALL; font-weight: bold; - font-size: 9pt; + font-size: DASHBOARD_FONT_SIZE_SMALL; color: black; z-index: 10; } diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/compass/LocationPointerCompass.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/compass/LocationPointerCompass.java index f92b6b3a1b9..a6a3a21c52f 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/compass/LocationPointerCompass.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/compass/LocationPointerCompass.java @@ -1,38 +1,45 @@ package com.sap.sailing.dashboards.gwt.client.widgets.windbot.compass; +import java.util.Iterator; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.dom.client.DivElement; import com.google.gwt.i18n.client.NumberFormat; -import com.google.gwt.user.client.ui.AbsolutePanel; +import com.google.gwt.uibinder.client.UiBinder; +import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.HasWidgets; import com.google.gwt.user.client.ui.Image; -import com.google.gwt.user.client.ui.Label; +import com.google.gwt.user.client.ui.Widget; import com.sap.sailing.domain.common.Position; /** - * The class is an UI component that should be used to display the direction and the distance from the users device to a - * certain pointed GPS location. The class needs an {@link LocationPointerCompassAngleDistance} instance and registers - * as an listener to it. It furthermore notifies its {@link LocationPointerCompassAngleDistance} instance about wind bot - * GPS location changes. - * * @author Alexander Ries (D062114) * */ -public class LocationPointerCompass extends AbsolutePanel implements HasWidgets, - LocationPointerCompassAngleDistanceListener { +public class LocationPointerCompass extends Composite implements HasWidgets, LocationPointerCompassAngleDistanceListener { - private double angleOffset; + private static LocationPointerCompasssUiBinder uiBinder = GWT.create(LocationPointerCompasssUiBinder.class); + + interface LocationPointerCompasssUiBinder extends UiBinder { + } - private Image compassNeedle; + @UiField + Image compassNeedle; /** * The Label shows the distance the users device is away from the location it points to. * */ - private Label distanceToPointetLocationLabel; + @UiField + DivElement distanceToPointetLocation; /** * The Label shows the direction in degrees from north the users device is away from the location it points to. * */ - private Label angleToPointetLocationLabel; + @UiField + DivElement angleToPointetLocation; + private double angleOffset; /** * The {@link LocationPointerCompassAngleDistance} notifies the class about updates about angle and distance * changes. @@ -41,57 +48,34 @@ public class LocationPointerCompass extends AbsolutePanel implements HasWidgets, public LocationPointerCompass() { LocationPointerCompassRessources.INSTANCE.gss().ensureInjected(); - this.getElement().addClassName(LocationPointerCompassRessources.INSTANCE.gss().compass()); - initCompassNeedle(); - initAngleToPointetLocationLabel(); - initDistanceToPointedLocationLabel(); + initWidget(uiBinder.createAndBindUi(this)); + compassNeedle.setResource(LocationPointerCompassRessources.INSTANCE.compass()); locationPointerCompassAngleDistance = new LocationPointerCompassAngleDistance(); locationPointerCompassAngleDistance.addListener(this); - locationPointerCompassAngleDistance.triggerOrientationRead(); - } - - private void initCompassNeedle() { - compassNeedle = new Image(); - compassNeedle.setResource(LocationPointerCompassRessources.INSTANCE.compass()); - compassNeedle.getElement().addClassName(LocationPointerCompassRessources.INSTANCE.gss().needle()); - LocationPointerCompass.this.add(compassNeedle); - } - - private void initAngleToPointetLocationLabel() { - angleToPointetLocationLabel = new Label(); - angleToPointetLocationLabel.getElement().addClassName(LocationPointerCompassRessources.INSTANCE.gss().angleToLocationLabel()); - this.add(angleToPointetLocationLabel); - } - - private void initDistanceToPointedLocationLabel() { - distanceToPointetLocationLabel = new Label(); - distanceToPointetLocationLabel.getElement().addClassName(LocationPointerCompassRessources.INSTANCE.gss().distanceToLocationLabel()); - distanceToPointetLocationLabel.setText("m"); - this.add(distanceToPointetLocationLabel); } private void updateNeedleAngle(double newDirection) { // Adapt degrees to image angle synchronized (this) { - double newAngle = newDirection-angleOffset; + double newAngle = (newDirection-angleOffset)%360; String winddirectionformatted = NumberFormat.getFormat("#0").format(newAngle); compassNeedle.getElement().getStyle().setProperty("transform", "rotate(" + winddirectionformatted + "deg)"); compassNeedle.getElement().getStyle() .setProperty("webkitTransform", "rotate(" + winddirectionformatted + "deg)"); String winddirectionFormattedForLabel = NumberFormat.getFormat("#0").format((newAngle < 0) ? 360+newAngle : newAngle); - angleToPointetLocationLabel.setText(winddirectionFormattedForLabel+"°"); + angleToPointetLocation.setInnerHTML(winddirectionFormattedForLabel+"°"); } } private void updateDistanceToPointedLocationLabel(double distance, double angle) { String distanceFormatted = NumberFormat.getFormat("#0").format(distance); - distanceToPointetLocationLabel.setText(distanceFormatted + " m"); + distanceToPointetLocation.setInnerHTML(distanceFormatted + " m"); } public void windBotPositionChanged(Position positionDTO) { locationPointerCompassAngleDistance.windBotPositionChanged(positionDTO); } - + @Override public void angleChanged(double angle) { updateNeedleAngle(angle); @@ -107,4 +91,24 @@ public class LocationPointerCompass extends AbsolutePanel implements HasWidgets, public void setAngleOffset(double offset) { angleOffset = offset; } + + @Override + public void add(Widget w) { + throw new UnsupportedOperationException("The method add(Widget w) is not supported."); + } + + @Override + public void clear() { + throw new UnsupportedOperationException("The method clear() is not supported."); + } + + @Override + public Iterator iterator() { + return null; + } + + @Override + public boolean remove(Widget w) { + return false; + } } diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/compass/LocationPointerCompass.ui.xml b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/compass/LocationPointerCompass.ui.xml new file mode 100644 index 00000000000..9b84f404930 --- /dev/null +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/compass/LocationPointerCompass.ui.xml @@ -0,0 +1,12 @@ + + + + + + + +
+
+
+
\ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/compass/LocationPointerCompassAngleDistance.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/compass/LocationPointerCompassAngleDistance.java index 11d2d0020c7..9aa0f802e6f 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/compass/LocationPointerCompassAngleDistance.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/compass/LocationPointerCompassAngleDistance.java @@ -55,18 +55,17 @@ public class LocationPointerCompassAngleDistance implements LocationListener, Co Double phi2 = lat2 * degreesToRadiansFactor; Double lam1 = lng1 * degreesToRadiansFactor; Double lam2 = lng2 * degreesToRadiansFactor; - double angle = Math.atan2(Math.sin(lam2 - lam1) * Math.cos(phi2), Math.cos(phi1) * Math.sin(phi2) - Math.sin(phi1) * Math.cos(phi2) * Math.cos(lam2 - lam1)) * 180 / Math.PI; if (angle < 0) { angle = 360 + angle; } - return angle; + return Math.abs(angle); } private float getDistanceBetweenGPSPoints(double lat1, double lng1, double lat2, double lng2) { - double earthRadius = 6371000; // kilometers + double earthRadius = 6371000; //kilometers double dLat = Math.toRadians(lat2 - lat1); double dLng = Math.toRadians(lng2 - lng1); double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(Math.toRadians(lat1)) diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/compass/LocationPointerCompassRessources.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/compass/LocationPointerCompassRessources.java index b38b91e3b57..2b6ae32897f 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/compass/LocationPointerCompassRessources.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/widgets/windbot/compass/LocationPointerCompassRessources.java @@ -18,9 +18,10 @@ public interface LocationPointerCompassRessources extends ClientBundle { @Shared public interface LocationPointerCompassGSS extends CssResource { + public String location_pointer_compass(); public String compass(); public String needle(); - public String angleToLocationLabel(); - public String distanceToLocationLabel(); + public String angle_to_location(); + public String distance_to_location(); } } diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/server/util/actions/startanalysis/StartAnalysisCreationController.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/server/util/actions/startanalysis/StartAnalysisCreationController.java index c424e122404..cf6dc65b73a 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/server/util/actions/startanalysis/StartAnalysisCreationController.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/server/util/actions/startanalysis/StartAnalysisCreationController.java @@ -14,20 +14,20 @@ public final class StartAnalysisCreationController extends AbstractStartAnalysis private static final Logger logger = Logger.getLogger(StartAnalysisCreationController.class.getName()); - private StartAnalysisCreationController(DashboardDispatchContext ctx) { - - } - public static StartAnalysisDTO checkStartAnalysisForCompetitorInTrackedRace(DashboardDispatchContext dashboardDispatchContext, Competitor competitor, TrackedRace trackedRace) { StartAnalysisDTO result = null; - if (competitor != null && trackedRace != null) { - if (threeCompetitorsPassedSecondWayPoint(trackedRace) && raceProgressedFarEnough(competitor, trackedRace)) { - logger.log(Level.INFO, "Creating startanalysis for race " + trackedRace.getRace().getName() + " and competitor: " + competitor.getName()); - result = StartAnalysisDTOFactory.createStartAnalysisForCompetitorAndTrackedRace(dashboardDispatchContext, competitor, trackedRace); + if(trackedRace != null) { + if (competitor != null) { + if (threeCompetitorsPassedSecondWayPoint(trackedRace) && raceProgressedFarEnough(competitor, trackedRace)) { + logger.log(Level.INFO, "Creating startanalysis for race " + trackedRace.getRace().getName() + " and competitor: " + competitor.getName()); + result = StartAnalysisDTOFactory.createStartAnalysisForCompetitorAndTrackedRace(dashboardDispatchContext, competitor, trackedRace); + } else { + logger.log(Level.INFO, "Waiting to create startanalysis for race " + trackedRace.getRace().getName() + " and competitor: " + competitor.getName()); + } } else { - logger.log(Level.INFO, "Waiting to create startanalysis for race " + trackedRace.getRace().getName() + " and competitor: " + competitor.getName()); + result = StartAnalysisDTOFactory.createStartAnalysisForCompetitorAndTrackedRace(dashboardDispatchContext, competitor, trackedRace); } - } + } return result; } } diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/server/util/actions/startanalysis/StartAnalysisDTOFactory.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/server/util/actions/startanalysis/StartAnalysisDTOFactory.java index a2de29ccd6d..13dbb033026 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/server/util/actions/startanalysis/StartAnalysisDTOFactory.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/server/util/actions/startanalysis/StartAnalysisDTOFactory.java @@ -45,19 +45,22 @@ public final class StartAnalysisDTOFactory extends AbstractStartAnalysisCreation List competitors = new ArrayList(); Waypoint secondWaypoint = trackedRace.getRace().getCourse().getFirstLeg().getTo(); List markPassingsInOrder = convertMarkpPassingsIteratorToList(trackedRace.getMarkPassingsInOrder(secondWaypoint).iterator()); - boolean isCompetitorOneOfFirstThree = false; + boolean isCompetitorNullOrOneOfFirstThreeCompetitors = false; for (int i = 0; i < MINIMUM_MARKPASSIINGS_AT_FIRST_MARK; i++) { competitors.add(createStartAnalysisCompetitorDTO(dashboardDispatchContext, trackedRace, i + 1, markPassingsInOrder.get(i).getCompetitor())); - if (markPassingsInOrder.get(i).getCompetitor().equals(competitor)) { - isCompetitorOneOfFirstThree = true; + if (competitor == null || markPassingsInOrder.get(i).getCompetitor().equals(competitor)) { + isCompetitorNullOrOneOfFirstThreeCompetitors = true; } } - if (!isCompetitorOneOfFirstThree) { + if (competitor != null && !isCompetitorNullOrOneOfFirstThreeCompetitors) { int rankOfCompetitorWhilePassingSecondWaypoint = getRankOfCompetitorWhilePassingSecondWaypoint(competitor, trackedRace); competitors.add(createStartAnalysisCompetitorDTO(dashboardDispatchContext, trackedRace, rankOfCompetitorWhilePassingSecondWaypoint, competitor)); } - startAnalysisDTO.competitor = dashboardDispatchContext.getRacingEventService().getBaseDomainFactory().getCompetitorStore().convertToCompetitorDTO(competitor); + if (competitor != null) { + startAnalysisDTO.competitor = dashboardDispatchContext.getRacingEventService().getBaseDomainFactory().getCompetitorStore().convertToCompetitorDTO(competitor); + logger.log(Level.INFO, "Created startanalysis for competitor"+competitor); + } startAnalysisDTO.startAnalysisCompetitorDTOs = competitors; final Boolean isGateStart = trackedRace.isGateStart(); if(isGateStart == Boolean.TRUE){ @@ -77,7 +80,7 @@ public final class StartAnalysisDTOFactory extends AbstractStartAnalysisCreation startAnalysisDTO.tailLenghtInMilliseconds = ONE_MINUTE_INTERVALL_IN_MILLISECONDS; } startAnalysisDTO.regattaAndRaceIdentifier = trackedRace.getRaceIdentifier(); - logger.log(Level.INFO, "Created startanalysis for competitor " + competitor.getName() + " and "+ trackedRace.getRace().getName()); + logger.log(Level.INFO, "Created startanalysis for "+ trackedRace.getRace().getName()); return startAnalysisDTO; } @@ -185,8 +188,7 @@ public final class StartAnalysisDTOFactory extends AbstractStartAnalysisCreation } } - private static StartAnalysisCompetitorDTO createStartAnalysisCompetitorDTO(DashboardDispatchContext dashboardDispatchContext, TrackedRace trackedRace, int rank, - Competitor competitor) { + private static StartAnalysisCompetitorDTO createStartAnalysisCompetitorDTO(DashboardDispatchContext dashboardDispatchContext, TrackedRace trackedRace, int rank, Competitor competitor) { StartAnalysisCompetitorDTO startAnalysisCompetitorDTOsForRace = new StartAnalysisCompetitorDTO(); startAnalysisCompetitorDTOsForRace.competitorDTO = dashboardDispatchContext.getRacingEventService().getBaseDomainFactory().getCompetitorStore() .convertToCompetitorDTO(competitor); diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/server/util/actions/startlineadvantage/DefaultPolarWindAngleBoatSpeedFunction.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/server/util/actions/startlineadvantage/DefaultPolarWindAngleBoatSpeedFunction.java index 7b16e26be3d..e2365db78ec 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/server/util/actions/startlineadvantage/DefaultPolarWindAngleBoatSpeedFunction.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/server/util/actions/startlineadvantage/DefaultPolarWindAngleBoatSpeedFunction.java @@ -4,6 +4,9 @@ import org.apache.commons.math.ArgumentOutsideDomainException; import org.apache.commons.math.analysis.interpolation.SplineInterpolator; import org.apache.commons.math.analysis.polynomials.PolynomialSplineFunction; +import com.sap.sailing.domain.base.SpeedWithConfidence; +import com.sap.sailing.domain.base.impl.SpeedWithConfidenceImpl; +import com.sap.sailing.domain.common.Bearing; import com.sap.sailing.domain.common.Speed; import com.sap.sailing.domain.common.impl.KnotSpeedImpl; @@ -27,11 +30,11 @@ public class DefaultPolarWindAngleBoatSpeedFunction { windAngleBoatBearingSpeedFunction = splineInterpolator.interpolate(windAngleXValues, boatBearingYValues); } - public Speed getBoatSpeedForWindAngleAndSpeed(double angle, double speed) { - Speed result = null; + public SpeedWithConfidence getBoatSpeedForWindAngleAndSpeed(Bearing angleToWind, Speed speed) { + SpeedWithConfidence result = null; try { - double boatSpeed = windAngleBoatBearingSpeedFunction.value(convert360AngleTo180RangeAngle(angle)); - result = new KnotSpeedImpl(boatSpeed); + KnotSpeedImpl boatSpeed = new KnotSpeedImpl(windAngleBoatBearingSpeedFunction.value(convert360AngleTo180RangeAngle(angleToWind.getDegrees()))); + result = new SpeedWithConfidenceImpl(boatSpeed, 0.5 , null); } catch (ArgumentOutsideDomainException e) { e.printStackTrace(); } diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/server/util/actions/startlineadvantage/StartlineAdvantagesByWindCalculator.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/server/util/actions/startlineadvantage/StartlineAdvantagesByWindCalculator.java index 806bd4bbf3c..a04a9ed9e65 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/server/util/actions/startlineadvantage/StartlineAdvantagesByWindCalculator.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/server/util/actions/startlineadvantage/StartlineAdvantagesByWindCalculator.java @@ -10,12 +10,16 @@ import com.sap.sailing.dashboards.gwt.server.util.actions.startlineadvantage.pre import com.sap.sailing.dashboards.gwt.shared.dispatch.DashboardDispatchContext; import com.sap.sailing.dashboards.gwt.shared.dto.StartLineAdvantageDTO; import com.sap.sailing.dashboards.gwt.shared.dto.StartlineAdvantagesWithMaxAndAverageDTO; +import com.sap.sailing.domain.base.DomainFactory; +import com.sap.sailing.domain.base.SpeedWithConfidence; import com.sap.sailing.domain.common.Bearing; import com.sap.sailing.domain.common.Distance; import com.sap.sailing.domain.common.Position; import com.sap.sailing.domain.common.Speed; import com.sap.sailing.domain.common.impl.DegreeBearingImpl; +import com.sap.sailing.domain.common.impl.KnotSpeedImpl; import com.sap.sailing.domain.common.impl.MeterDistance; +import com.sap.sailing.domain.polars.NotEnoughDataHasBeenAddedException; import com.sap.sailing.domain.tracking.TrackedRace; import com.sap.sse.common.TimePoint; import com.sap.sse.common.Util.Pair; @@ -24,34 +28,38 @@ import com.sap.sse.common.Util.Pair; * @author Alexander Ries (D062114) * */ -public class StartlineAdvantagesByWindCalculator extends AbstracPreCalculationDataRetriever { +public class StartlineAdvantagesByWindCalculator extends AbstracPreCalculationDataRetriever { private DashboardDispatchContext dashboardDispatchContext; + private DomainFactory domainFactory; private DefaultPolarWindAngleBoatSpeedFunction defaultPolarSpeedWindAngleFunction; - - private final Logger logger = Logger.getLogger(StartlineAdvantagesByWindCalculator.class.getName()); - - public StartlineAdvantagesByWindCalculator(DashboardDispatchContext dashboardDispatchContext){ + + private final Logger logger = Logger.getLogger(StartlineAdvantagesByWindCalculator.class.getName()); + + public StartlineAdvantagesByWindCalculator(DashboardDispatchContext dashboardDispatchContext, DomainFactory domainFactory) { + super(domainFactory); this.dashboardDispatchContext = dashboardDispatchContext; + this.domainFactory = domainFactory; this.defaultPolarSpeedWindAngleFunction = new DefaultPolarWindAngleBoatSpeedFunction(); } - - public StartlineAdvantagesWithMaxAndAverageDTO getStartLineAdvantagesAccrossLineFromTrackedRaceAtTimePoint(TrackedRace trackedRace,TimePoint timepoint) { + + public StartlineAdvantagesWithMaxAndAverageDTO getStartLineAdvantagesAccrossLineFromTrackedRaceAtTimePoint( + TrackedRace trackedRace, TimePoint timepoint) { StartlineAdvantagesWithMaxAndAverageDTO result = new StartlineAdvantagesWithMaxAndAverageDTO(); if (trackedRace != null) { retrieveDataForCalculation(trackedRace, dashboardDispatchContext.getPolarDataService()); - if (wind != null) { + if (getWind() != null) { Pair startlineAdvantagesAndConfidencesAsArray = null; if (isStartlineCompletelyUnderneathLaylines()) { logger.log(Level.INFO, "Startline is completely underneath laylines"); - Pair advantagesRange = new Pair(0.0, startlineLenghtInMeters); + Pair advantagesRange = new Pair(0.0, getStartlineLenghtInMeters()); List startlineAdvantages = calculateStartlineAdvantagesUnderneathLaylinesInRange(advantagesRange); double maximum = getMaximumAdvantageOfStartlineAdvantageDTOs(startlineAdvantages); result.maximum = maximum; startlineAdvantagesAndConfidencesAsArray = convertStartLineAdvantageDTOListToPointAndConfidenceArrays(startlineAdvantages); } else if (isStartlineCompletelyAboveLaylines()) { logger.log(Level.INFO, "Startline is completely above laylines"); - Pair advantagesRange = new Pair(0.0, startlineLenghtInMeters); + Pair advantagesRange = new Pair(0.0, getStartlineLenghtInMeters()); List startlineAdvantages = calculatePolarBasedStartlineAdvantagesInRange(advantagesRange); subtractMinimumOfAllStartlineAdvantages(startlineAdvantages); double maximum = getMaximumAdvantageOfStartlineAdvantageDTOs(startlineAdvantages); @@ -83,105 +91,112 @@ public class StartlineAdvantagesByWindCalculator extends AbstracPreCalculationD } return result; } - - private boolean isBearingAboveAdvantageLines(Bearing bearing){ + + private boolean isBearingAboveAdvantageLines(Bearing bearing) { boolean result = false; - Bearing bearingOfRightLaylineInDeg = new DegreeBearingImpl(wind.getBearing().getDegrees() - meouvreAngle / 2); - Bearing bearingOfLeftLaylineInDeg = new DegreeBearingImpl(wind.getBearing().getDegrees() + meouvreAngle / 2); - if (bearing.getDegrees() < bearingOfRightLaylineInDeg.getDegrees() && bearing.getDegrees() > 0 || - bearing.getDegrees() > bearingOfLeftLaylineInDeg.getDegrees() && bearing.getDegrees() < 360) { + Bearing bearingOfRightLaylineInDeg = new DegreeBearingImpl(getWind().getBearing().getDegrees() + - getManeuverAngle() / 2); + Bearing bearingOfLeftLaylineInDeg = new DegreeBearingImpl(getWind().getBearing().getDegrees() + + getManeuverAngle() / 2); + if (bearing.getDegrees() < bearingOfRightLaylineInDeg.getDegrees() && bearing.getDegrees() > 0 + || bearing.getDegrees() > bearingOfLeftLaylineInDeg.getDegrees() && bearing.getDegrees() < 360) { result = true; } return result; } - - private boolean isBearingUnderneathAdvantageLines(Bearing bearing){ + + private boolean isBearingUnderneathAdvantageLines(Bearing bearing) { boolean result = false; - Bearing bearingOfRightLaylineInDeg = new DegreeBearingImpl(wind.getBearing().getDegrees() - meouvreAngle / 2); - Bearing bearingOfLeftLaylineInDeg = new DegreeBearingImpl(wind.getBearing().getDegrees() + meouvreAngle / 2); - logger.log(Level.INFO, "Underneath bearingOfRightLaylineInDeg?"+bearingOfRightLaylineInDeg); - logger.log(Level.INFO, "Underneath bearingOfLeftLaylineInDeg?"+bearingOfLeftLaylineInDeg); - if (bearing.getDegrees() > bearingOfRightLaylineInDeg.getDegrees() && bearing.getDegrees() < bearingOfLeftLaylineInDeg.getDegrees()) { + Bearing bearingOfRightLaylineInDeg = new DegreeBearingImpl(getWind().getBearing().getDegrees() + - getManeuverAngle() / 2); + Bearing bearingOfLeftLaylineInDeg = new DegreeBearingImpl(getWind().getBearing().getDegrees() + + getManeuverAngle() / 2); + logger.log(Level.INFO, "Underneath bearingOfRightLaylineInDeg?" + bearingOfRightLaylineInDeg); + logger.log(Level.INFO, "Underneath bearingOfLeftLaylineInDeg?" + bearingOfLeftLaylineInDeg); + if (bearing.getDegrees() > bearingOfRightLaylineInDeg.getDegrees() + && bearing.getDegrees() < bearingOfLeftLaylineInDeg.getDegrees()) { result = true; } return result; } - + private boolean isStartlineCompletelyAboveLaylines() { boolean result = false; - Bearing bearingRCBoatToFirstMark = new DegreeBearingImpl( - startlineAndFirstMarkPositions.firstMarkPosition.getBearingGreatCircle( - startlineAndFirstMarkPositions.startBoatPosition).getDegrees()); - Bearing bearingPinEndToFirstMark = new DegreeBearingImpl( - startlineAndFirstMarkPositions.firstMarkPosition.getBearingGreatCircle( - startlineAndFirstMarkPositions.pinEndPosition).getDegrees()); - if (isBearingAboveAdvantageLines(bearingRCBoatToFirstMark) && isBearingAboveAdvantageLines(bearingPinEndToFirstMark)) { + Bearing bearingRCBoatToFirstMark = new DegreeBearingImpl(getStartlineAndFirstMarkPositions().firstMarkPosition + .getBearingGreatCircle(getStartlineAndFirstMarkPositions().startBoatPosition).getDegrees()); + Bearing bearingPinEndToFirstMark = new DegreeBearingImpl(getStartlineAndFirstMarkPositions().firstMarkPosition + .getBearingGreatCircle(getStartlineAndFirstMarkPositions().pinEndPosition).getDegrees()); + if (isBearingAboveAdvantageLines(bearingRCBoatToFirstMark) + && isBearingAboveAdvantageLines(bearingPinEndToFirstMark)) { result = true; } return result; } - + private boolean isStartlineCompletelyUnderneathLaylines() { boolean result = false; - Bearing bearingFirstMarkToRCBoat = new DegreeBearingImpl( - startlineAndFirstMarkPositions.firstMarkPosition.getBearingGreatCircle( - startlineAndFirstMarkPositions.startBoatPosition).getDegrees()); - Bearing bearingFirstMarkToPinEnd = new DegreeBearingImpl( - startlineAndFirstMarkPositions.firstMarkPosition.getBearingGreatCircle( - startlineAndFirstMarkPositions.pinEndPosition).getDegrees()); - logger.log(Level.INFO, "Underneath RC?"+bearingFirstMarkToRCBoat); - logger.log(Level.INFO, "Underneath PIN?"+bearingFirstMarkToPinEnd); - if (isBearingUnderneathAdvantageLines(bearingFirstMarkToRCBoat) && isBearingUnderneathAdvantageLines(bearingFirstMarkToPinEnd)) { + Bearing bearingFirstMarkToRCBoat = new DegreeBearingImpl(getStartlineAndFirstMarkPositions().firstMarkPosition + .getBearingGreatCircle(getStartlineAndFirstMarkPositions().startBoatPosition).getDegrees()); + Bearing bearingFirstMarkToPinEnd = new DegreeBearingImpl(getStartlineAndFirstMarkPositions().firstMarkPosition + .getBearingGreatCircle(getStartlineAndFirstMarkPositions().pinEndPosition).getDegrees()); + logger.log(Level.INFO, "Underneath RC?" + bearingFirstMarkToRCBoat); + logger.log(Level.INFO, "Underneath PIN?" + bearingFirstMarkToPinEnd); + if (isBearingUnderneathAdvantageLines(bearingFirstMarkToRCBoat) + && isBearingUnderneathAdvantageLines(bearingFirstMarkToPinEnd)) { result = true; } return result; } - - private Pair getStartAndEndPointOfPolarBasedStartlineAdvatagesInDistancesToRCBoat(Position rightIntersection, Position leftIntersection) { + + private Pair getStartAndEndPointOfPolarBasedStartlineAdvatagesInDistancesToRCBoat( + Position rightIntersection, Position leftIntersection) { Pair result = null; - if(rightIntersection != null && leftIntersection == null) { - double distanceFromIntersectionToRCBoatInMeters = rightIntersection.getDistance(startlineAndFirstMarkPositions.startBoatPosition).getMeters(); + if (rightIntersection != null && leftIntersection == null) { + double distanceFromIntersectionToRCBoatInMeters = rightIntersection.getDistance( + getStartlineAndFirstMarkPositions().startBoatPosition).getMeters(); result = new Pair(0.0, distanceFromIntersectionToRCBoatInMeters); - } else if(rightIntersection == null && leftIntersection != null) { - double distanceFromIntersectionToRCBoatInMeters = leftIntersection.getDistance(startlineAndFirstMarkPositions.startBoatPosition).getMeters(); - result = new Pair(distanceFromIntersectionToRCBoatInMeters, startlineLenghtInMeters); - } else if(rightIntersection != null && leftIntersection != null) { - result = new Pair(0.0, startlineLenghtInMeters); + } else if (rightIntersection == null && leftIntersection != null) { + double distanceFromIntersectionToRCBoatInMeters = leftIntersection.getDistance( + getStartlineAndFirstMarkPositions().startBoatPosition).getMeters(); + result = new Pair(distanceFromIntersectionToRCBoatInMeters, getStartlineLenghtInMeters()); + } else if (rightIntersection != null && leftIntersection != null) { + result = new Pair(0.0, getStartlineLenghtInMeters()); } return result; } - - private Position getIntersectionOfRightLaylineAndStartline () { + + private Position getIntersectionOfRightLaylineAndStartline() { Position result = null; - Bearing bearingOfRightLaylineInDeg = new DegreeBearingImpl(wind.getBearing().getDegrees() - meouvreAngle / 2); + Bearing bearingOfRightLaylineInDeg = new DegreeBearingImpl(getWind().getBearing().getDegrees() + - getManeuverAngle() / 2); result = calculateIntersectionPointsOfStartlineAndLaylineWithBearing(bearingOfRightLaylineInDeg); return result; } - - private Position getIntersectionOfLeftLaylineAndStartline () { + + private Position getIntersectionOfLeftLaylineAndStartline() { Position result = null; - Bearing bearingOfRightLaylineInDeg = new DegreeBearingImpl(wind.getBearing().getDegrees() + meouvreAngle / 2); + Bearing bearingOfRightLaylineInDeg = new DegreeBearingImpl(getWind().getBearing().getDegrees() + + getManeuverAngle() / 2); result = calculateIntersectionPointsOfStartlineAndLaylineWithBearing(bearingOfRightLaylineInDeg); return result; } - + private Position calculateIntersectionPointsOfStartlineAndLaylineWithBearing(Bearing bearing) { Position result = null; - Bearing bearingOfStartlineInRad = startlineAndFirstMarkPositions.startBoatPosition - .getBearingGreatCircle(startlineAndFirstMarkPositions.pinEndPosition); + Bearing bearingOfStartlineInRad = getStartlineAndFirstMarkPositions().startBoatPosition + .getBearingGreatCircle(getStartlineAndFirstMarkPositions().pinEndPosition); Bearing bearingOfStartlineInDeg = new DegreeBearingImpl(bearingOfStartlineInRad.getDegrees()); logger.log(Level.INFO, "bearingOfStartlineInDeg " + bearingOfStartlineInDeg); logger.log(Level.INFO, "bearingOfLaylineInDeg " + bearing); - Position intersectionPointLaylineStartline = startlineAndFirstMarkPositions.firstMarkPosition - .getIntersection(bearing, startlineAndFirstMarkPositions.pinEndPosition, - bearingOfStartlineInDeg); + Position intersectionPointLaylineStartline = getStartlineAndFirstMarkPositions().firstMarkPosition.getIntersection( + bearing, getStartlineAndFirstMarkPositions().pinEndPosition, bearingOfStartlineInDeg); logger.log(Level.INFO, "rightIntersectionPointLaylineStartline " + intersectionPointLaylineStartline); Bearing bearingIntersectionPointToFirstMark = new DegreeBearingImpl( - startlineAndFirstMarkPositions.firstMarkPosition.getBearingGreatCircle( + getStartlineAndFirstMarkPositions().firstMarkPosition.getBearingGreatCircle( intersectionPointLaylineStartline).getDegrees()); - if (bearingIntersectionPointToFirstMark.getDegrees() < bearing.getDegrees() + 1 && - bearingIntersectionPointToFirstMark.getDegrees() > bearing.getDegrees() - 1 && - isOnStartline(intersectionPointLaylineStartline)) { + if (bearingIntersectionPointToFirstMark.getDegrees() < bearing.getDegrees() + 1 + && bearingIntersectionPointToFirstMark.getDegrees() > bearing.getDegrees() - 1 + && isOnStartline(intersectionPointLaylineStartline)) { result = intersectionPointLaylineStartline; logger.log(Level.INFO, "Layline crosses startline"); } @@ -192,17 +207,19 @@ public class StartlineAdvantagesByWindCalculator extends AbstracPreCalculationD private boolean isOnStartline(Position position) { boolean result = false; - Distance distanceToStartline = position.getDistanceToLine(startlineAndFirstMarkPositions.startBoatPosition, startlineAndFirstMarkPositions.pinEndPosition); + Distance distanceToStartline = position.getDistanceToLine(getStartlineAndFirstMarkPositions().startBoatPosition, + getStartlineAndFirstMarkPositions().pinEndPosition); if (distanceToStartline.getMeters() < 1) { result = true; } return result; } - private List addClosingZeroPointToMixedAdvantages(List advantages, Pair rangePinEndStartlineAdvantage) { + private List addClosingZeroPointToMixedAdvantages(List advantages, + Pair rangePinEndStartlineAdvantage) { StartLineAdvantageDTO startLineAdvantageDTO = new StartLineAdvantageDTO(); startLineAdvantageDTO.confidence = 1.0; - if(rangePinEndStartlineAdvantage.getA() > 0) { + if (rangePinEndStartlineAdvantage.getA() > 0) { startLineAdvantageDTO.distanceToRCBoatInMeters = rangePinEndStartlineAdvantage.getB(); startLineAdvantageDTO.startLineAdvantage = 0.0; advantages.add(startLineAdvantageDTO); @@ -213,40 +230,44 @@ public class StartlineAdvantagesByWindCalculator extends AbstracPreCalculationD } return advantages; } - - private Pair getPinEndStartlineAdvantagesRangeFromPolarAdvantagesRange(Pair rangePolarBasedStartlineAdvatages) { + + private Pair getPinEndStartlineAdvantagesRangeFromPolarAdvantagesRange( + Pair rangePolarBasedStartlineAdvatages) { Pair result = null; double pinEndStartlineAdvantagesStart; double pinEndStartlineAdvantagesEnd; - if(rangePolarBasedStartlineAdvatages.getA().doubleValue() == 0.0 && rangePolarBasedStartlineAdvatages.getB().doubleValue() != startlineLenghtInMeters) { + if (rangePolarBasedStartlineAdvatages.getA().doubleValue() == 0.0 + && rangePolarBasedStartlineAdvatages.getB().doubleValue() != getStartlineLenghtInMeters()) { pinEndStartlineAdvantagesStart = rangePolarBasedStartlineAdvatages.getB().doubleValue(); - pinEndStartlineAdvantagesEnd = startlineLenghtInMeters; + pinEndStartlineAdvantagesEnd = getStartlineLenghtInMeters(); result = new Pair(pinEndStartlineAdvantagesStart, pinEndStartlineAdvantagesEnd); - } else if (rangePolarBasedStartlineAdvatages.getA().doubleValue() != 0.0 && rangePolarBasedStartlineAdvatages.getB().doubleValue() == startlineLenghtInMeters) { + } else if (rangePolarBasedStartlineAdvatages.getA().doubleValue() != 0.0 + && rangePolarBasedStartlineAdvatages.getB().doubleValue() == getStartlineLenghtInMeters()) { pinEndStartlineAdvantagesStart = 0.0; pinEndStartlineAdvantagesEnd = rangePolarBasedStartlineAdvatages.getB().doubleValue(); result = new Pair(pinEndStartlineAdvantagesStart, pinEndStartlineAdvantagesEnd); } return result; } - + private List calculateStartlineAdvantagesUnderneathLaylinesInRange( Pair rangePinEndStartlineAdvantage) { List result = new ArrayList(); if (rangePinEndStartlineAdvantage != null) { - logger.log(Level.INFO, "PinEnd startline advantages range " + rangePinEndStartlineAdvantage.getA() + " - "+ rangePinEndStartlineAdvantage.getB()); + logger.log(Level.INFO, "PinEnd startline advantages range " + rangePinEndStartlineAdvantage.getA() + " - " + + rangePinEndStartlineAdvantage.getB()); StartLineAdvantageDTO rightEdgeAdvantage = new StartLineAdvantageDTO(); rightEdgeAdvantage.confidence = 1.0; rightEdgeAdvantage.distanceToRCBoatInMeters = rangePinEndStartlineAdvantage.getA(); StartLineAdvantageDTO leftEdgeAdvantage = new StartLineAdvantageDTO(); leftEdgeAdvantage.confidence = 1.0; leftEdgeAdvantage.distanceToRCBoatInMeters = rangePinEndStartlineAdvantage.getB(); - if (startlineAdvantageAtPinEndInMeters >= 0) { - leftEdgeAdvantage.startLineAdvantage = startlineAdvantageAtPinEndInMeters; + if (getStartlineAdvantageAtPinEndInMeters() >= 0) { + leftEdgeAdvantage.startLineAdvantage = getStartlineAdvantageAtPinEndInMeters(); rightEdgeAdvantage.startLineAdvantage = 0.0; } else { leftEdgeAdvantage.startLineAdvantage = 0.0; - rightEdgeAdvantage.startLineAdvantage = Math.abs(startlineAdvantageAtPinEndInMeters); + rightEdgeAdvantage.startLineAdvantage = Math.abs(getStartlineAdvantageAtPinEndInMeters()); } result.add(rightEdgeAdvantage); result.add(leftEdgeAdvantage); @@ -255,46 +276,53 @@ public class StartlineAdvantagesByWindCalculator extends AbstracPreCalculationD } return result; } - - private Pair convertStartLineAdvantageDTOListToPointAndConfidenceArrays(List startLineAdvantageDTOList) { + + private Pair convertStartLineAdvantageDTOListToPointAndConfidenceArrays( + List startLineAdvantageDTOList) { Pair result = null; - if(startLineAdvantageDTOList != null && startLineAdvantageDTOList.size() > 0) { + if (startLineAdvantageDTOList != null && startLineAdvantageDTOList.size() > 0) { Number[][] distanceToRCBoatToStartlineAdvantage = new Number[startLineAdvantageDTOList.size()][2]; Number[][] distanceToRCBoatToConfidence = new Number[startLineAdvantageDTOList.size()][2]; - for(int i = 0; i < startLineAdvantageDTOList.size(); i++) { + for (int i = 0; i < startLineAdvantageDTOList.size(); i++) { StartLineAdvantageDTO startLineAdvantageDTO = startLineAdvantageDTOList.get(i); distanceToRCBoatToStartlineAdvantage[i][0] = startLineAdvantageDTO.distanceToRCBoatInMeters; distanceToRCBoatToStartlineAdvantage[i][1] = startLineAdvantageDTO.startLineAdvantage; distanceToRCBoatToConfidence[i][0] = startLineAdvantageDTO.distanceToRCBoatInMeters; distanceToRCBoatToConfidence[i][1] = startLineAdvantageDTO.confidence; } - result = new Pair(distanceToRCBoatToStartlineAdvantage, distanceToRCBoatToConfidence); + result = new Pair(distanceToRCBoatToStartlineAdvantage, + distanceToRCBoatToConfidence); } return result; - } - - private List calculatePolarBasedStartlineAdvantagesInRange(Pair rangePinEndStartlineAdvantage) { + } + + private List calculatePolarBasedStartlineAdvantagesInRange( + Pair rangePinEndStartlineAdvantage) { List result = new ArrayList(); if (rangePinEndStartlineAdvantage != null) { - logger.log(Level.INFO, "PolarBased startline advantages range " + rangePinEndStartlineAdvantage.getA() + " - "+ rangePinEndStartlineAdvantage.getB()); - Bearing bearingOfStartlineInRad = startlineAndFirstMarkPositions.startBoatPosition - .getBearingGreatCircle(startlineAndFirstMarkPositions.pinEndPosition); + logger.log(Level.INFO, "PolarBased startline advantages range " + rangePinEndStartlineAdvantage.getA() + + " - " + rangePinEndStartlineAdvantage.getB()); + Bearing bearingOfStartlineInRad = getStartlineAndFirstMarkPositions().startBoatPosition + .getBearingGreatCircle(getStartlineAndFirstMarkPositions().pinEndPosition); Bearing bearingOfStartlineInDeg = new DegreeBearingImpl(bearingOfStartlineInRad.getDegrees()); - for(double i = rangePinEndStartlineAdvantage.getA().doubleValue(); i < rangePinEndStartlineAdvantage.getB().doubleValue()-1 ; i++) { + for (double i = rangePinEndStartlineAdvantage.getA().doubleValue(); i < rangePinEndStartlineAdvantage + .getB().doubleValue() - 1; i++) { StartLineAdvantageDTO startlineAdvantage = new StartLineAdvantageDTO(); startlineAdvantage.confidence = 0.5; startlineAdvantage.distanceToRCBoatInMeters = i; - Position startingPosition = startlineAndFirstMarkPositions.startBoatPosition.translateRhumb(bearingOfStartlineInDeg, new MeterDistance(i)); - Distance startingPositionToFirstMarkDistance = startingPosition.getDistance(startlineAndFirstMarkPositions.firstMarkPosition); - Bearing bearingOfFirstMarkToStartPositionPositionInRad = startlineAndFirstMarkPositions.firstMarkPosition - .getBearingGreatCircle(startingPosition); + Position startingPosition = getStartlineAndFirstMarkPositions().startBoatPosition.translateRhumb(bearingOfStartlineInDeg, new MeterDistance(i)); + Distance startingPositionToFirstMarkDistance = startingPosition.getDistance(getStartlineAndFirstMarkPositions().firstMarkPosition); + Bearing bearingOfFirstMarkToStartPositionPositionInRad = getStartlineAndFirstMarkPositions().firstMarkPosition.getBearingGreatCircle(startingPosition); Bearing bearingOfFirstMarkToStartPositionPositionInDeg = new DegreeBearingImpl(bearingOfFirstMarkToStartPositionPositionInRad.getDegrees()); - double angleToWind = Math.abs(wind.getBearing().getDifferenceTo(bearingOfFirstMarkToStartPositionPositionInDeg).getDegrees()); - logger.log(Level.INFO, "angleToWind"+angleToWind); - Speed speed = defaultPolarSpeedWindAngleFunction.getBoatSpeedForWindAngleAndSpeed(angleToWind, wind.getBeaufort()); - logger.log(Level.INFO, "Speed"+speed.getKnots()); - logger.log(Level.INFO, "startingPositionToFirstMarkDistance.getMeters()"+startingPositionToFirstMarkDistance.getMeters()); - startlineAdvantage.startLineAdvantage = Math.abs((startingPositionToFirstMarkDistance.getMeters()/speed.getMetersPerSecond())*speed.getMetersPerSecond()); + DegreeBearingImpl angleToWind = new DegreeBearingImpl(Math.abs(getWind().getBearing().getDifferenceTo(bearingOfFirstMarkToStartPositionPositionInDeg).getDegrees())); + logger.log(Level.INFO, "angleToWind" + angleToWind); + SpeedWithConfidence speedWithConfidence = getBoatSpeedWithConfidenceForWindAngleAndStrength(angleToWind); + Speed speed = speedWithConfidence.getObject(); + logger.log(Level.INFO, "Speed: " + speed.getKnots()+" Confidence: "+speedWithConfidence.getConfidence()); + logger.log(Level.INFO, "startingPositionToFirstMarkDistance.getMeters()" + startingPositionToFirstMarkDistance.getMeters()); + startlineAdvantage.startLineAdvantage = Math + .abs((startingPositionToFirstMarkDistance.getMeters() / speed.getMetersPerSecond()) + * speed.getMetersPerSecond()); result.add(startlineAdvantage); } } else { @@ -302,22 +330,23 @@ public class StartlineAdvantagesByWindCalculator extends AbstracPreCalculationD } return result; } - - private List subtractAgainstMaximumOfAllStartlineAdvantages(List advantages, double maximum) { - for(StartLineAdvantageDTO startLineAdvantageDTO : advantages) { - startLineAdvantageDTO.startLineAdvantage = maximum-startLineAdvantageDTO.startLineAdvantage; + + private List subtractAgainstMaximumOfAllStartlineAdvantages( + List advantages, double maximum) { + for (StartLineAdvantageDTO startLineAdvantageDTO : advantages) { + startLineAdvantageDTO.startLineAdvantage = maximum - startLineAdvantageDTO.startLineAdvantage; } return advantages; } - + private List subtractMinimumOfAllStartlineAdvantages(List advantages) { double minimum = getMinimumAdvantageOfStartlineAdvantageDTOs(advantages); - for(StartLineAdvantageDTO startLineAdvantageDTO : advantages) { - startLineAdvantageDTO.startLineAdvantage = startLineAdvantageDTO.startLineAdvantage-minimum; + for (StartLineAdvantageDTO startLineAdvantageDTO : advantages) { + startLineAdvantageDTO.startLineAdvantage = startLineAdvantageDTO.startLineAdvantage - minimum; } return advantages; } - + private Double getMaximumAdvantageOfStartlineAdvantageDTOs(List advantages) { Double result = null; List sortedAdvantages = new ArrayList(); @@ -328,15 +357,27 @@ public class StartlineAdvantagesByWindCalculator extends AbstracPreCalculationD } return result; } - + private double getMinimumAdvantageOfStartlineAdvantageDTOs(List advantages) { double result = 0; List sortedAdvantages = new ArrayList(); sortedAdvantages.addAll(advantages); - if(sortedAdvantages != null && sortedAdvantages.size() > 0) { - Collections.sort(sortedAdvantages, StartLineAdvantageDTO.startlineAdvantageComparatorByAdvantageDesc); - result = sortedAdvantages.get(sortedAdvantages.size()-1).startLineAdvantage; + if (sortedAdvantages != null && sortedAdvantages.size() > 0) { + Collections.sort(sortedAdvantages, StartLineAdvantageDTO.startlineAdvantageComparatorByAdvantageDesc); + result = sortedAdvantages.get(sortedAdvantages.size() - 1).startLineAdvantage; } return result; } + + private SpeedWithConfidence getBoatSpeedWithConfidenceForWindAngleAndStrength(Bearing angleToWind) { + SpeedWithConfidence result = null; + try { + result = dashboardDispatchContext.getPolarDataService().getSpeed(domainFactory.getOrCreateBoatClass("Extreme 40"), new KnotSpeedImpl(getWind().getBeaufort()), angleToWind); + } catch (NotEnoughDataHasBeenAddedException e) { + result = defaultPolarSpeedWindAngleFunction.getBoatSpeedForWindAngleAndSpeed(angleToWind, new KnotSpeedImpl(getWind().getBeaufort())); + e.printStackTrace(); + } + return result; + + } } diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/server/util/actions/startlineadvantage/precalculation/AbstracPreCalculationDataRetriever.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/server/util/actions/startlineadvantage/precalculation/AbstracPreCalculationDataRetriever.java index 1cf1ab8d0e9..5a71f40268f 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/server/util/actions/startlineadvantage/precalculation/AbstracPreCalculationDataRetriever.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/server/util/actions/startlineadvantage/precalculation/AbstracPreCalculationDataRetriever.java @@ -1,7 +1,6 @@ package com.sap.sailing.dashboards.gwt.server.util.actions.startlineadvantage.precalculation; -import com.sap.sailing.domain.base.impl.BoatClassImpl; -import com.sap.sailing.domain.common.BoatClassMasterdata; +import com.sap.sailing.domain.base.DomainFactory; import com.sap.sailing.domain.common.ManeuverType; import com.sap.sailing.domain.common.Wind; import com.sap.sailing.domain.polars.PolarDataService; @@ -15,17 +14,46 @@ public abstract class AbstracPreCalculationDataRetriever implements PreCalculati PreCalculationStartlineAdvantageRetriever, PreCalculationWindRetriever, PreCalculationPolarDataRetriever { - public StartlineAndFirstMarkPositions startlineAndFirstMarkPositions; - public double startlineAdvantageAtPinEndInMeters; - public double startlineLenghtInMeters; - public Wind wind; - public double meouvreAngle; + private StartlineAndFirstMarkPositions startlineAndFirstMarkPositions; + private double startlineAdvantageAtPinEndInMeters; + private double startlineLenghtInMeters; + private Wind wind; + private double maneuverAngle; + private final DomainFactory domainFactory; + + public AbstracPreCalculationDataRetriever(DomainFactory domainFactory) { + super(); + this.domainFactory = domainFactory; + } + protected void retrieveDataForCalculation(TrackedRace trackedRace, PolarDataService polarDataService) { startlineAndFirstMarkPositions = retrieveMarkPositions(trackedRace); startlineAdvantageAtPinEndInMeters = retrieveStartlineAdvantage(trackedRace); startlineLenghtInMeters = retrieveStartlineLenght(trackedRace); wind = retrieveWindAtPosition(startlineAndFirstMarkPositions.startBoatPosition, trackedRace); - meouvreAngle = retrieveManouvreAngleAtWindSpeedAndBoatClass(new BoatClassImpl("Extreme40", BoatClassMasterdata.EXTREME_40), ManeuverType.TACK, wind, polarDataService); + maneuverAngle = retrieveManouvreAngleAtWindSpeedAndBoatClass(domainFactory.getOrCreateBoatClass("Extreme 40"), ManeuverType.TACK, wind, polarDataService); } + + protected StartlineAndFirstMarkPositions getStartlineAndFirstMarkPositions() { + return startlineAndFirstMarkPositions; + } + + protected double getStartlineAdvantageAtPinEndInMeters() { + return startlineAdvantageAtPinEndInMeters; + } + + protected double getStartlineLenghtInMeters() { + return startlineLenghtInMeters; + } + + protected Wind getWind() { + return wind; + } + + protected double getManeuverAngle() { + return maneuverAngle; + } + + } diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/server/util/actions/startlineadvantage/precalculation/PreCalculationPolarDataRetriever.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/server/util/actions/startlineadvantage/precalculation/PreCalculationPolarDataRetriever.java index c7068933782..9ab19d1fe1d 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/server/util/actions/startlineadvantage/precalculation/PreCalculationPolarDataRetriever.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/server/util/actions/startlineadvantage/precalculation/PreCalculationPolarDataRetriever.java @@ -15,13 +15,11 @@ import com.sap.sailing.domain.polars.PolarDataService; public interface PreCalculationPolarDataRetriever { default double retrieveManouvreAngleAtWindSpeedAndBoatClass(BoatClass boatClass, ManeuverType maneuverType, Speed windSpeed, PolarDataService polarDataService) { - double result = 0; + double result = DefaultPolarValues.getManouvreAngle(ManeuverType.TACK); try { if (boatClass != null && maneuverType != null && windSpeed != null) { BearingWithConfidence bearingWithConfidence = polarDataService.getManeuverAngle(boatClass, maneuverType, windSpeed); result = bearingWithConfidence.getObject().getDegrees(); - } else { - result = DefaultPolarValues.getManouvreAngle(ManeuverType.TACK); } } catch (NotEnoughDataHasBeenAddedException | NullPointerException e) { e.printStackTrace(); diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/shared/dispatch/RequiresLiveRaceAndCachesMovingAverageAction.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/shared/dispatch/RequiresLiveRaceAndCachesMovingAverageAction.java index 38db9e20d6f..90044d4fd6b 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/shared/dispatch/RequiresLiveRaceAndCachesMovingAverageAction.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/shared/dispatch/RequiresLiveRaceAndCachesMovingAverageAction.java @@ -20,11 +20,12 @@ public abstract class RequiresLiveRaceAndCachesMovingAverageAction + + + + diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/resources/com/sap/sailing/dashboards/gwt/client/images/left.png b/java/com.sap.sailing.dashboards.gwt/src/main/resources/com/sap/sailing/dashboards/gwt/client/images/left.png new file mode 100644 index 00000000000..383af6aeac2 Binary files /dev/null and b/java/com.sap.sailing.dashboards.gwt/src/main/resources/com/sap/sailing/dashboards/gwt/client/images/left.png differ diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/resources/com/sap/sailing/dashboards/gwt/client/images/left_disabled.png b/java/com.sap.sailing.dashboards.gwt/src/main/resources/com/sap/sailing/dashboards/gwt/client/images/left_disabled.png new file mode 100644 index 00000000000..ae93717cffd Binary files /dev/null and b/java/com.sap.sailing.dashboards.gwt/src/main/resources/com/sap/sailing/dashboards/gwt/client/images/left_disabled.png differ diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/resources/com/sap/sailing/dashboards/gwt/client/images/leftarrow.png b/java/com.sap.sailing.dashboards.gwt/src/main/resources/com/sap/sailing/dashboards/gwt/client/images/leftarrow.png deleted file mode 100644 index de562344f94..00000000000 Binary files a/java/com.sap.sailing.dashboards.gwt/src/main/resources/com/sap/sailing/dashboards/gwt/client/images/leftarrow.png and /dev/null differ diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/resources/com/sap/sailing/dashboards/gwt/client/images/leftarrow_disabled.png b/java/com.sap.sailing.dashboards.gwt/src/main/resources/com/sap/sailing/dashboards/gwt/client/images/leftarrow_disabled.png deleted file mode 100644 index 9af5de2c43c..00000000000 Binary files a/java/com.sap.sailing.dashboards.gwt/src/main/resources/com/sap/sailing/dashboards/gwt/client/images/leftarrow_disabled.png and /dev/null differ diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/resources/com/sap/sailing/dashboards/gwt/client/images/right.png b/java/com.sap.sailing.dashboards.gwt/src/main/resources/com/sap/sailing/dashboards/gwt/client/images/right.png new file mode 100644 index 00000000000..7100d546a72 Binary files /dev/null and b/java/com.sap.sailing.dashboards.gwt/src/main/resources/com/sap/sailing/dashboards/gwt/client/images/right.png differ diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/resources/com/sap/sailing/dashboards/gwt/client/images/right_disabled.png b/java/com.sap.sailing.dashboards.gwt/src/main/resources/com/sap/sailing/dashboards/gwt/client/images/right_disabled.png new file mode 100644 index 00000000000..b7c2bfe146e Binary files /dev/null and b/java/com.sap.sailing.dashboards.gwt/src/main/resources/com/sap/sailing/dashboards/gwt/client/images/right_disabled.png differ diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/resources/com/sap/sailing/dashboards/gwt/client/images/rightarrow.png b/java/com.sap.sailing.dashboards.gwt/src/main/resources/com/sap/sailing/dashboards/gwt/client/images/rightarrow.png deleted file mode 100644 index 7a560b168b2..00000000000 Binary files a/java/com.sap.sailing.dashboards.gwt/src/main/resources/com/sap/sailing/dashboards/gwt/client/images/rightarrow.png and /dev/null differ diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/resources/com/sap/sailing/dashboards/gwt/client/images/rightarrow_disabled.png b/java/com.sap.sailing.dashboards.gwt/src/main/resources/com/sap/sailing/dashboards/gwt/client/images/rightarrow_disabled.png deleted file mode 100644 index 38f2eaef9db..00000000000 Binary files a/java/com.sap.sailing.dashboards.gwt/src/main/resources/com/sap/sailing/dashboards/gwt/client/images/rightarrow_disabled.png and /dev/null differ diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/resources/com/sap/sailing/dashboards/gwt/client/images/settings_disabled.png b/java/com.sap.sailing.dashboards.gwt/src/main/resources/com/sap/sailing/dashboards/gwt/client/images/settings_disabled.png new file mode 100644 index 00000000000..559e4f252f6 Binary files /dev/null and b/java/com.sap.sailing.dashboards.gwt/src/main/resources/com/sap/sailing/dashboards/gwt/client/images/settings_disabled.png differ diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/resources/com/sap/sailing/dashboards/gwt/client/images/windarrow.png b/java/com.sap.sailing.dashboards.gwt/src/main/resources/com/sap/sailing/dashboards/gwt/client/images/windarrow.png index 1d71881caa8..fc8859e921a 100644 Binary files a/java/com.sap.sailing.dashboards.gwt/src/main/resources/com/sap/sailing/dashboards/gwt/client/images/windarrow.png and b/java/com.sap.sailing.dashboards.gwt/src/main/resources/com/sap/sailing/dashboards/gwt/client/images/windarrow.png differ diff --git a/java/com.sap.sailing.domain.shared.android.test/src/com/sap/sailing/domain/racelog/test/RegattaLogRevocationTest.java b/java/com.sap.sailing.domain.shared.android.test/src/com/sap/sailing/domain/racelog/test/RegattaLogRevocationTest.java new file mode 100644 index 00000000000..0385d170e5e --- /dev/null +++ b/java/com.sap.sailing.domain.shared.android.test/src/com/sap/sailing/domain/racelog/test/RegattaLogRevocationTest.java @@ -0,0 +1,75 @@ +package com.sap.sailing.domain.racelog.test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; + +import java.util.Collection; + +import org.junit.Before; +import org.junit.Test; + +import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor; +import com.sap.sailing.domain.abstractlog.impl.LogEventAuthorImpl; +import com.sap.sailing.domain.abstractlog.regatta.RegattaLog; +import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDefineMarkEvent; +import com.sap.sailing.domain.abstractlog.regatta.events.impl.RegattaLogDefineMarkEventImpl; +import com.sap.sailing.domain.abstractlog.regatta.impl.RegattaLogImpl; +import com.sap.sailing.domain.abstractlog.regatta.tracking.analyzing.impl.RegattaLogDefinedMarkAnalyzer; +import com.sap.sailing.domain.base.Mark; +import com.sap.sailing.domain.base.impl.MarkImpl; +import com.sap.sailing.domain.common.abstractlog.NotRevokableException; +import com.sap.sse.common.TimePoint; +import com.sap.sse.common.Util; +import com.sap.sse.common.impl.MillisecondsTimePoint; + +public class RegattaLogRevocationTest { + private RegattaLog serverRegattaLog; + private AbstractLogEventAuthor serverAuthor = new LogEventAuthorImpl("server", 2); + + @Before + public void setup() { + serverRegattaLog = new RegattaLogImpl("server"); + } + + private static TimePoint now() { + return MillisecondsTimePoint.now(); + } + + private static void assertNumUnrevoked(RegattaLog regattaLog, int expectedNum) { + regattaLog.lockForRead(); + try { + assertEquals(expectedNum, Util.size(regattaLog.getUnrevokedEvents())); + } finally { + regattaLog.unlockAfterRead(); + } + } + + private static void assertNumAll(RegattaLog regattaLog, int expectedNum) { + regattaLog.lockForRead(); + try { + assertEquals(expectedNum, Util.size(regattaLog.getRawFixes())); + } finally { + regattaLog.unlockAfterRead(); + } + } + + @Test + public void testRevokingMarkDefinition() throws NotRevokableException { + final Mark mark = new MarkImpl("Mark Name"); + RegattaLogDefineMarkEvent event = new RegattaLogDefineMarkEventImpl( + now(), serverAuthor, now(), "id", mark); + serverRegattaLog.add(event); + RegattaLogDefinedMarkAnalyzer analyzer = new RegattaLogDefinedMarkAnalyzer(serverRegattaLog); + final Collection marksBeforeRevoke = analyzer.analyze(); + assertEquals(1, marksBeforeRevoke.size()); + assertSame(mark, marksBeforeRevoke.iterator().next()); + assertNumUnrevoked(serverRegattaLog, 1); + + serverRegattaLog.revokeEvent(serverAuthor, event); + assertNumUnrevoked(serverRegattaLog, 0); + assertNumAll(serverRegattaLog, 2); + final Collection marksAfterRevoke = analyzer.analyze(); + assertTrue(marksAfterRevoke.isEmpty()); + } +} diff --git a/java/com.sap.sailing.domain.shared.android/src/com/sap/sailing/domain/abstractlog/regatta/events/RegattaLogDefineMarkEvent.java b/java/com.sap.sailing.domain.shared.android/src/com/sap/sailing/domain/abstractlog/regatta/events/RegattaLogDefineMarkEvent.java index 03c39fb4e67..20adea9d4e0 100644 --- a/java/com.sap.sailing.domain.shared.android/src/com/sap/sailing/domain/abstractlog/regatta/events/RegattaLogDefineMarkEvent.java +++ b/java/com.sap.sailing.domain.shared.android/src/com/sap/sailing/domain/abstractlog/regatta/events/RegattaLogDefineMarkEvent.java @@ -1,5 +1,6 @@ package com.sap.sailing.domain.abstractlog.regatta.events; +import com.sap.sailing.domain.abstractlog.Revokable; import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEvent; import com.sap.sailing.domain.base.Mark; @@ -7,6 +8,6 @@ import com.sap.sailing.domain.base.Mark; * Defines a mark, that can then be used to build a course. * */ -public interface RegattaLogDefineMarkEvent extends RegattaLogEvent { +public interface RegattaLogDefineMarkEvent extends RegattaLogEvent, Revokable { Mark getMark(); } diff --git a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/base/RaceColumn.java b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/base/RaceColumn.java index 821ce4d4c7f..994ed805998 100644 --- a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/base/RaceColumn.java +++ b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/base/RaceColumn.java @@ -1,7 +1,9 @@ package com.sap.sailing.domain.base; import com.sap.sailing.domain.abstractlog.race.RaceLog; +import com.sap.sailing.domain.abstractlog.race.RaceLogCourseDesignChangedEvent; import com.sap.sailing.domain.abstractlog.regatta.RegattaLog; +import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogDefineMarkEvent; import com.sap.sailing.domain.common.RaceIdentifier; import com.sap.sailing.domain.common.abstractlog.NotRevokableException; import com.sap.sailing.domain.common.racelog.tracking.CompetitorRegistrationOnRaceLogDisabledException; @@ -255,17 +257,38 @@ public interface RaceColumn extends Named { Iterable getAllCompetitors(Fleet fleet); /** - * Provides the combined set of marks from all {@link #getTrackedRace(Fleet) tracked races attached to this - * column} or, in case a fleet does not have a tracked race attached, the marks registered through the + * Provides the combined set of marks from the courses of all {@link #getTrackedRace(Fleet) tracked races attached + * to this column} or, in case a fleet does not have a tracked race attached, the marks registered through the * {@link #getRegattaLog() regatta log} for the regatta-like object to which this column belongs (flexible - * leaderboard or regatta). + * leaderboard or regatta) and used in a {@link RaceLogCourseDesignChangedEvent}. + *

+ * + * See also {@link #getAvailableMarks()}. */ - Iterable getAllMarks(); + Iterable getCourseMarks(); /** - * Same as {@link #getAllMarks()}, but restricted to the single race identified by the fleet parameter. + * Same as {@link #getCourseMarks()}, but restricted to the single race identified by the fleet parameter + * and in case of an existing {@link TrackedRace} restricted to the marks actually used by the + * {@link TrackedRace#getRace() race's} {@link RaceDefinition#getCourse() course}. */ - Iterable getMarks(Fleet fleet); + Iterable getCourseMarks(Fleet fleet); + + /** + * Provides the set of marks available for use in course designs for races in this column. This includes, in + * particular, those marks defined on the {@link RegattaLog} using {@link RegattaLogDefineMarkEvent} objects. + * Additionally, all marks that any of the {@link TrackedRace}s attached to this column have "seen" (as + * returned by their {@link TrackedRace#getMarks()} method) will be added. + */ + Iterable getAvailableMarks(); + + /** + * Like {@link #getAvailableMarks()}, but restricted to the race identified by the {@code fleet} parameter. While + * marks from the {@link RegattaLog} are available to all races of the regatta and therefore also to all races in + * this column, in case a {@link TrackedRace} exists for the {@code fleet}, only that race's + * {@link TrackedRace#getMarks() marks} will be added to the result. + */ + Iterable getAvailableMarks(Fleet fleet); /** * Returns the competitor set registered in the race column's race log associated to the passed fleet. If competitor @@ -345,4 +368,5 @@ public interface RaceColumn extends Named { * {@link MetaLeaderboard} */ void deregisterCompetitors(Iterable currentlyRegisteredCompetitors, Fleet fleet) throws CompetitorRegistrationOnRaceLogDisabledException; + } diff --git a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/base/impl/AbstractRaceColumn.java b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/base/impl/AbstractRaceColumn.java index bc797de581b..698922f3a08 100755 --- a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/base/impl/AbstractRaceColumn.java +++ b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/base/impl/AbstractRaceColumn.java @@ -321,30 +321,16 @@ public abstract class AbstractRaceColumn extends SimpleAbstractRaceColumn implem } @Override - public Iterable getAllMarks() { + public Iterable getCourseMarks() { final Set result = new HashSet<>(); - // if the marks from the regatta log are to be used because a slot has no TrackedRace attached, - // those regatta log marks only need to be added to the result once - boolean regattaLogMarksAlreadyAdded = false; for (Fleet fleet : getFleets()) { - TrackedRace trackedRace = getTrackedRace(fleet); - if (trackedRace != null) { - for (Waypoint waypoint : trackedRace.getRace().getCourse().getWaypoints()) { - Util.addAll(waypoint.getMarks(), result); - } - } else if (!regattaLogMarksAlreadyAdded) { - // if no tracked race is found, use marks from regatta log - RegattaLog regattaLog = getRegattaLog(); - Collection viaRegattaLog = new RegattaLogDefinedMarkAnalyzer(regattaLog).analyze(); - result.addAll(viaRegattaLog); - regattaLogMarksAlreadyAdded = true; - } + Util.addAll(getCourseMarks(fleet), result); } return result; } @Override - public Iterable getMarks(Fleet fleet) { + public Iterable getCourseMarks(Fleet fleet) { final Set result = new HashSet<>(); final TrackedRace trackedRace = getTrackedRace(fleet); if (trackedRace != null) { @@ -353,19 +339,45 @@ public abstract class AbstractRaceColumn extends SimpleAbstractRaceColumn implem } } else { // if no tracked race is found, use marks from race course if present in racelog - // if not the marks defined in the regatta log LastPublishedCourseDesignFinder courseDesginFinder = new LastPublishedCourseDesignFinder(getRaceLog(fleet)); final CourseBase courseBase = courseDesginFinder.analyze(); if (courseBase != null) { - // TODO why do we collect the marks from the course definition here but not in getAllMarks()? courseBase.getWaypoints().forEach((waypoint) -> Util.addAll(waypoint.getMarks(), result)); - } else { - Util.addAll(new RegattaLogDefinedMarkAnalyzer(getRegattaLog()).analyze(), result); } } return result; } + @Override + public Iterable getAvailableMarks() { + final Set result = new HashSet<>(); + // add the marks from the regatta log to the result + RegattaLog regattaLog = getRegattaLog(); + Collection viaRegattaLog = new RegattaLogDefinedMarkAnalyzer(regattaLog).analyze(); + result.addAll(viaRegattaLog); + for (Fleet fleet : getFleets()) { + TrackedRace trackedRace = getTrackedRace(fleet); + if (trackedRace != null) { + Util.addAll(trackedRace.getMarks(), result); + } + } + return result; + } + + @Override + public Iterable getAvailableMarks(Fleet fleet) { + final Set result = new HashSet<>(); + // add the marks from the regatta log to the result + RegattaLog regattaLog = getRegattaLog(); + Collection viaRegattaLog = new RegattaLogDefinedMarkAnalyzer(regattaLog).analyze(); + result.addAll(viaRegattaLog); + TrackedRace trackedRace = getTrackedRace(fleet); + if (trackedRace != null) { + Util.addAll(trackedRace.getMarks(), result); + } + return result; + } + @Override public void enableCompetitorRegistrationOnRaceLog(Fleet fleet) { TimePoint now = MillisecondsTimePoint.now(); diff --git a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/leaderboard/meta/MetaLeaderboardColumn.java b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/leaderboard/meta/MetaLeaderboardColumn.java index 0583a1db0df..f9016dbef70 100755 --- a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/leaderboard/meta/MetaLeaderboardColumn.java +++ b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/leaderboard/meta/MetaLeaderboardColumn.java @@ -229,12 +229,22 @@ public class MetaLeaderboardColumn extends SimpleAbstractRaceColumn implements R } @Override - public Iterable getAllMarks() { + public Iterable getCourseMarks() { return Collections.emptySet(); } @Override - public Iterable getMarks(Fleet fleet) { + public Iterable getCourseMarks(Fleet fleet) { + return Collections.emptySet(); + } + + @Override + public Iterable getAvailableMarks() { + return Collections.emptySet(); + } + + @Override + public Iterable getAvailableMarks(Fleet fleet) { return Collections.emptySet(); } diff --git a/java/com.sap.sailing.gwt.ui/Leaderboard.css b/java/com.sap.sailing.gwt.ui/Leaderboard.css index 2b70414a4b7..92b5cf8adae 100755 --- a/java/com.sap.sailing.gwt.ui/Leaderboard.css +++ b/java/com.sap.sailing.gwt.ui/Leaderboard.css @@ -54,7 +54,7 @@ table { .leaderboardContent td, .leaderboardContent th { vertical-align: bottom; line-height: 1.3; - padding-top: 2px; +/* padding-top: 2px; */ } .leaderboardContent-toolbar { diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/AdminConsoleTable.css b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/AdminConsoleTable.css index 1ae3a5988c9..15de74761f6 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/AdminConsoleTable.css +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/AdminConsoleTable.css @@ -1,162 +1,164 @@ -.cellTableWidget { - border-left: 1px solid #c9caca; - border-top: 1px solid #c9caca; -} - -/** v-align images in the table header - * grey background for table header - */ -.cellTableHeader { - position: relative; - vertical-align: middle; - background-color: #e5e5e5; - border-right: 1px solid #ffffff !important; - border-top: none !important; - border-bottom: 1px solid #c9caca !important; - padding: 3px 12px; - text-align: center; -} - -.cellTableFirstColumnHeader { - position: relative; - vertical-align: middle; - background-color: #e5e5e5; - border-left: none !important; - border-right: 1px solid #ffffff !important; - border-top: none !important; - border-bottom: 1px solid #c9caca !important; - padding: 3px 12px; - text-align: center; -} - -.cellTableLastColumnHeader { - position: relative; - vertical-align: middle; - background-color: #e5e5e5; - border-right: 1px solid #c9caca !important; - border-top: none !important; - border-bottom: 1px solid #c9caca !important; - padding: 3px 12px; - text-align: center; -} - -.cellTableHeader > span > img:first-child { - position: relative; - vertical-align: middle; -} - -.cellTableEvenRow { - border-bottom: 1px solid #e5e5e5; - background-color: rgba(255,255,255,0.5); -} - -.cellTableEvenRowCell { - border-right: 1px solid #c9caca !important; - border-left: none; - border-top: none !important; - border-bottom: 1px solid #c9caca !important; - padding: 5px 10px 5px !important; - white-space: nowrap; -} - -.cellTableOddRow { - border-bottom: 1px solid #e5e5e5; - background-color: rgba(242,242,242,0.5); -} - -.cellTableOddRowCell { - border-left: none !important; - border-right: 1px solid #c9caca !important; - border-top: none !important; - border-bottom: 1px solid #c9caca !important; - padding: 5px 10px 5px !important; - white-space: nowrap; -} - -.cellTableHoveredRow { - background-color: rgba(229,242,249,0.5); - border-bottom: 1px solid #e5e5e5; -} - -.cellTableSelectedRow { - color: #000000; - background-color: rgba(229,242,249,0.5); - border-right: 2px solid #21a0e4 !important; - border-left: 2px solid #21a0e4 !important; - border: 2px solid #21a0e4; -} - -.cellTableSelectedRow > td:FIRST-CHILD { - border-left: 2px solid rgba(33,160,228,0.5) !important; -} - -.cellTableSelectedRow > td:LAST-CHILD { - border-right: 2px solid rgba(33,160,228,0.5) !important; -} - -.cellTableSelectedRowCell { - border-left: none; - border-right: 1px solid #e5e5e5; - border-top: 2px solid #21a0e4 !important; - border-bottom: 2px solid #21a0e4 !important; -} - -.cellTableRaceColumnHeader { - background-color: #e0e0e0; - padding: 3px 12px; -} - -.cellTableLegColumnHeader { - background-color: #efefef; - padding: 3px 12px; -} - -.cellTableLegDetailColumnHeader { - background-color: #f4f5f6; - padding: 3px 12px; -} - -.cellTableRaceColumn { - background-color: #e0e0e0 !important; -} - -.cellTableLegColumn { - background-color: #efefef !important; -} - -.cellTableLegDetailColumn { - background-color: #ffffff !important; -} - -.cellTableTotalColumn { - background-color: #e0e0e0 !important; -} - -.cellTableCheckboxColumnCell { - padding: 1px 1px 1px !important; - vertical-align: middle !important; - text-align: center; -} - -.cellTableCheckboxSelected { - margin-left: 0px; /* account for the selection border that pushes a selected checkbox to the side */ - margin-top: 0px; - margin-bottom: 0px; - margin-right: 2px; - height: 18px; - width: 18px; - border: solid 1px #acacac; - background-color: #cacaca; - vertical-align: middle; -} - -.cellTableCheckboxDeselected { - margin-left: 2px; /* account for the selection border that pushes a selected checkbox to the side */ - margin-top: 0px; - margin-bottom: 0px; - margin-right: 2px; - border: solid 1px #acacac; - height: 18px; - width: 18px; - vertical-align: middle; -} +.cellTableWidget { + border-left: 1px solid #c9caca; + border-top: 1px solid #c9caca; + border-collapse: collapse; +} + + + +/** v-align images in the table header + * grey background for table header + */ +.cellTableHeader { + position: relative; + vertical-align: bottom; + background-color: #e5e5e5; + border-right: 0px solid #c9caca !important; + border-top: none !important; + border-bottom: 1px solid #c9caca !important; + padding: 3px 5px; + padding-bottom: 5px; + text-align: center; + text-shadow: none !important; +} + +.cellTableFirstColumnHeader { + position: relative; + vertical-align: bottom; + background-color: #e5e5e5; + border-left: none !important; + border-right: 1px solid #c9caca !important; + border-top: none !important; + border-bottom: 1px solid #c9caca !important; + text-align: center; +} + +.cellTableLastColumnHeader { + position: relative; + vertical-align: bottom; + background-color: #e5e5e5; + border-right: 1px solid #c9caca !important; + border-top: none !important; + border-bottom: 1px solid #c9caca !important; + text-align: center; +} + +.cellTableHeader > span > img:first-child { + position: relative; + vertical-align: middle; +} + +.cellTableEvenRow { + background-color: rgba(255,255,255,0.5); +} + +.cellTableOddRow { + background-color: rgba(242,242,242,0.5); +} + +.cellTableSelectedRow { + color: #000000; + background-color: rgba(229,242,249,0.6); +} + +.cellTableSelectedRow > td:FIRST-CHILD { + border-left: 1px solid rgba(33,160,228,0.6) !important; +} + +.cellTableSelectedRow > td:LAST-CHILD { + border-right: 1px solid rgba(33,160,228,0.6) !important; +} +.cellTableSelectedRow > td { +} + +.cellTableCell { + overflow: inherit; + font-size: 12px !important; + line-height: 1.5em !important; +} +.cellTableSelectedRowCell { + border-top: 2px double #21a0e4 !important; + border-bottom: 2px double #21a0e4 !important; + padding: 7px 7px 6px 7px !important; +} + +.cellTableEvenRowCell, .cellTableOddRowCell { + border: 1px solid #c9caca; + padding: 7px; + white-space: nowrap; +} + +.cellTableCheckboxColumnCell { + padding: 1px 1px 1px !important; + vertical-align: middle !important; + text-align: center; +} + +.cellTableCheckboxSelected { + margin: auto auto; + height: 13px; + width: 13px; + border: 1px solid #fcbb22; + background-color: #fcbb22; + vertical-align: middle; +} + +.cellTableCheckboxDeselected { + margin: auto auto; + height: 13px; + width: 13px; + border: solid 1px #acacac; + vertical-align: middle; +} + +.cellTableHoveredRow { + background-color: rgba(229,242,249,0.5); + border-bottom: 1px solid #e5e5e5; +} + + +.cellTableRaceColumnHeader { + background-color: #e5e5e5; +} + +.cellTableRaceColumnHeader span:first-child{ + display: block; +} + +.cellTableRaceColumnHeader span input, .cellTableRaceColumnHeader span img{ + margin: 0 auto; +} + +.cellTableRaceColumnHeader span img { + float: left; +} + +.cellTableLegColumnHeader { + background-color: #efefef; + +} + +.cellTableLegDetailColumnHeader { + background-color: #f4f5f6; +} + +.cellTableRaceColumnHeader span > div, .cellTableLegColumnHeader span > div { + width: 19px !important; + height: 19px !important; +} + +.cellTableRaceColumn { + background-color: #e0e0e0 !important; +} + +.cellTableLegColumn { + background-color: #efefef !important; +} + +.cellTableLegDetailColumn { + background-color: #ffffff !important; +} + +.cellTableTotalColumn { + background-color: #e0e0e0 !important; +} diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/DeviceConfigurationCreateSingleMatcherDialog.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/DeviceConfigurationCreateSingleMatcherDialog.java index 1316ae6742f..e20bace0111 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/DeviceConfigurationCreateSingleMatcherDialog.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/DeviceConfigurationCreateSingleMatcherDialog.java @@ -40,20 +40,22 @@ public class DeviceConfigurationCreateSingleMatcherDialog extends DataEntryDialo } - private TextBox identifierBox; + private final TextBox identifierBox; + private final StringMessages stringMessages; public DeviceConfigurationCreateSingleMatcherDialog(StringMessages stringMessages, Validator validator, com.sap.sse.gwt.client.dialog.DataEntryDialog.DialogCallback callback) { super(stringMessages.createDeviceConfiguration(), stringMessages.forWhichDeviceShouldConfigurationApply(), stringMessages.create(), stringMessages.cancel(), validator, callback); + this.stringMessages = stringMessages; this.identifierBox = createTextBox(""); } @Override protected Widget getAdditionalWidget() { Grid grid = new Grid(1, 2); - grid.setWidget(0, 0, createLabel("Identifier")); + grid.setWidget(0, 0, createLabel(stringMessages.raceManagerDeviceName())); grid.setWidget(0, 1, identifierBox); return grid; } diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages.java index d690033ee0d..a1994551b29 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages.java @@ -176,6 +176,7 @@ public interface StringMessages extends com.sap.sse.gwt.client.StringMessages, c String secondsUnit(); String secondsPerNauticalMileUnit(); String metersUnit(); + String degreesUnit(); @Override String close(); String compareCompetitors(); @@ -1261,9 +1262,9 @@ public interface StringMessages extends com.sap.sse.gwt.client.StringMessages, c String valueDescending(); String sortBy(); - String dashboardWindBotLoadingText(); - String dashboardWindBotLoadingMessage(); - String dashboardWindBotNotAvailable(); + String dashboardHeader(); + String dashboardNoWindBotAvailableHeader(); + String dashboardNoWindBotAvailableMessage(); String dashboardWindBot(); String dashboardTrueWindSpeed(); String dashboardTrueWindDirection(); @@ -1274,10 +1275,17 @@ public interface StringMessages extends com.sap.sse.gwt.client.StringMessages, c String dashboardAverageWindMinutes(int minutes); String dashboardWindChartHint(); + String dashboardSelectCompetitor(); + String dashboardStartAnalysesHeader(); String dashboardNewStartAnalysisAvailable(); - - String dashboardStartlineAdvantagesByWind(); - String dashboardStartlineAdvantageByGeometry(); + String dashboardNoStartAnalysesAvailableHeader(); + String dashboardNoStartAnalysesAvailableMessage(); + String dashboardNoStartlineAdvantagesByWindAvailableHeader(); + String dashboardNoStartlineAdvantagesByWindAvailableMessage(); + String dashboardNoStartlineAdvantagesByGeometryAvailableHeader(); + String dashboardNoStartlineAdvantagesByGeometryAvailableMessage(); + String dashboardStartlineAdvantagesByWindHeader(); + String dashboardStartlineAdvantageByGeometryHeader(); String dashboardRankAtFirstMark(); String dashboardTeam(); String dashboardDistanceToLineInM(); @@ -1490,4 +1498,5 @@ public interface StringMessages extends com.sap.sse.gwt.client.StringMessages, c String qrSync(); String thereIsNoIdentifierSet(); String couldNotObtainAccessTokenForUser(String message); + String raceManagerDeviceName(); } diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages.properties b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages.properties index a8e7a0c6851..ae1417c1b07 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages.properties +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages.properties @@ -179,6 +179,7 @@ in=in secondsUnit=s secondsPerNauticalMileUnit=s/NM metersUnit=m +degreesUnit=° close=Close compareCompetitors=Compare competitors description=Description @@ -1225,9 +1226,9 @@ groupName=Group Name valueAscending=Value (Ascending) valueDescending=Value (Descending) sortBy=Sort by -dashboardWindBotLoadingText=Waiting for wind bot data... -dashboardWindBotLoadingMessage=Depending on your connection this operation might take some minutes to complete the first time. It can also take some time if there is no data available right now. -dashboardWindBotNotAvailable=Wind bot not available. +dashboardHeader=Dashboard +dashboardNoWindBotAvailableHeader=Wind Bot is not available. +dashboardNoWindBotAvailableMessage=To receive live wind data from wind measurement units, ensure that the wind bot is switched on and connected to the SAP Sailing Analytics. dashboardWindBot=Wind Bot dashboardTrueWindSpeed=TWS dashboardTrueWindDirection=TWD @@ -1237,9 +1238,17 @@ dashboardLiveWind=live dashboardAverageWind=average dashboardAverageWindMinutes=({0} minutes) dashboardWindChartHint=Tap on chart to change interval +dashboardSelectCompetitor=Select Competitor +dashboardStartAnalysesHeader=Start Analyses dashboardNewStartAnalysisAvailable=New start analysis available -dashboardStartlineAdvantagesByWind=Startline advantage by wind -dashboardStartlineAdvantageByGeometry=Startline advantage by geometry +dashboardNoStartAnalysesAvailableHeader=No Start Analyses available. +dashboardNoStartAnalysesAvailableMessage=There is a Start Analysis created from each race start. Please stand by till racing has been started. +dashboardNoStartlineAdvantagesByWindAvailableHeader=No Startline Advantages available. +dashboardNoStartlineAdvantagesByWindAvailableMessage=For calculating the startline advantage there needs to be a course set by the race commitee. +dashboardNoStartlineAdvantagesByGeometryAvailableHeader=No Startline Advantage available. +dashboardNoStartlineAdvantagesByGeometryAvailableMessage=For calculating the startline advantage there needs to be a course set by the race commitee. +dashboardStartlineAdvantagesByWindHeader=Startline Advantages by Wind +dashboardStartlineAdvantageByGeometryHeader=Startline Advantage by Geometry dashboardRankAtFirstMark=Rank at first mark dashboardTeam=Team dashboardDistanceToLineInM=Distance to line in m @@ -1435,7 +1444,6 @@ profile=Profile showOnlyCompetitorsOfLog=Show only competitors registered in Log confirmLosingCompetitorEditsWhenTogglingLogBasedView=This will reset your current, unsaved changes to the competitors.\nDo you really want to continue? removalOfMarkDisabledMayBeUsedInRaces=Removal deavticated, marks are used in races {0} -pleaseCreateAtLeastOneMappingBy=Plase create at list one mapping by first selecting a track on the left hand side and then selecting a mark or competitor on the right hand side createDefaultLeaderboardGroup=Would you like to create a default LeaderboardGroup for your event? pleaseCreateAtLeastOneMappingBy=Please create at least one mapping by first selecting a track on the left hand side and then selecting a mark or competitor on the right hand side matcherType=Matcher type @@ -1457,4 +1465,5 @@ defaultLocale=Default defaultSailorsInfoLinkInfoText=The default link is used unless a language specific overwrite exists. If no default exists, there will be no link for languages that do not explicitly have one set. qrSync=QR-Sync thereIsNoIdentifierSet=There is no identifier set. -couldNotObtainAccessTokenForUser=Could not obtain access token for user {0} \ No newline at end of file +couldNotObtainAccessTokenForUser=Could not obtain access token for user {0} +raceManagerDeviceName=Device Name \ No newline at end of file diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages_de.properties b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages_de.properties index a892380ba8d..e9bec87776f 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages_de.properties +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages_de.properties @@ -181,6 +181,7 @@ in=in secondsUnit=s secondsPerNauticalMileUnit=s/sm metersUnit=m +degreesUnit=° close=Schließen compareCompetitors=Teilnehmer vergleichen description=Beschreibung @@ -1212,9 +1213,9 @@ groupName=Gruppename valueAscending=Wert (Aufsteigend) valueDescending=Wert (Absteigend) sortBy=Sortiert nach -dashboardWindBotLoadingText=Lade Windmesser Daten ... -dashboardWindBotLoadingMessage=Je nach Qualität Ihrer Verbindung kann dieser Vorgang ein paar Minuten dauern. -dashboardWindBotNotAvailable=Keine Verbindung zu Windmesser. +dashboardHeader=Dashboard +dashboardNoWindBotAvailableHeader=Wind Bot nicht verfügbar. +dashboardNoWindBotAvailableMessage=Um live Daten von Wind Messgeräten zu empfangen, muss der Wind Bot mit der SAP Sailing Analytics verknüpft sein. dashboardWindBot=Windmesser dashboardTrueWindSpeed=Wind Geschwindigkeit dashboardTrueWindDirection=Wind Richtung @@ -1224,9 +1225,17 @@ dashboardLiveWind=live dashboardAverageWind=average dashboardAverageWindMinutes=({0} minutes) dashboardWindChartHint=Auf Chart drücken um Interval zu ändern -dashboardNewStartAnalysisAvailable=Neue Startanalyse verfügbar -dashboardStartlineAdvantagesByWind=Startlininien Vorteil nach Wind -dashboardStartlineAdvantageByGeometry=Startlininien Vorteil nach Geometrie +dashboardSelectCompetitor=Segler auswählen +dashboardStartAnalysesHeader=Start Analysen +dashboardNewStartAnalysisAvailable=Neue Start Analyse verfügbar. +dashboardNoStartAnalysesAvailableHeader=Keine Start Analysen verfügbar. +dashboardNoStartAnalysesAvailableMessage=Es wird eine Start Analyse für jeden Renn Start erstellt. Bitte warten bis die Rennen starten. +dashboardNoStartlineAdvantagesByWindAvailableHeader=Kein Startlinien Vorteil verfügbar. +dashboardNoStartlineAdvantagesByWindAvailableMessage=Um den Startlinien Vorteil zu berrechnen muss die Regattaleitung einen Kurs in im Race Manager gesetzt haben. +dashboardNoStartlineAdvantagesByGeometryAvailableHeader=Keine Startlinien Vorteile verfügbar. +dashboardNoStartlineAdvantagesByGeometryAvailableMessage=Um den Startlinien Vorteile zu berrechnen muss die Regattaleitung einen Kurs in im Race Manager gesetzt haben. +dashboardStartlineAdvantagesByWindHeader=Startlinien Vorteile nach Wind +dashboardStartlineAdvantageByGeometryHeader=Startlinien Vorteile nach Geometrie dashboardRankAtFirstMark=Position an erster Bahnmarke dashboardTeam=Team dashboardDistanceToLineInM=Distanz zur Linie in m @@ -1447,4 +1456,5 @@ defaultLocale=Standard defaultSailorsInfoLinkInfoText=Der Standardwert wird verwendet, sofern kein Sprach-abhängiger Selglerinfo-Link hinterlegt wurde. Wenn kein Standardwert angegeben ist, so erscheint kein Selgerinfo-Link bei Sprachen, welche keinen Sprach-spezifischen Link definiert haben. qrSync=QR-Sync thereIsNoIdentifierSet=Es ist noch keine Kennung gesetzt. -couldNotObtainAccessTokenForUser=Zugangscode für Benutzer {0} konnte nicht bezogen werden \ No newline at end of file +couldNotObtainAccessTokenForUser=Zugangscode für Benutzer {0} konnte nicht bezogen werden +raceManagerDeviceName=Gerätename \ No newline at end of file diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages_ru.properties b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages_ru.properties index 83bca313590..e43b12f8808 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages_ru.properties +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages_ru.properties @@ -177,6 +177,7 @@ in=в secondsUnit=с secondsPerNauticalMileUnit=с/NM metersUnit=м +degreesUnit=° close=Закрыть compareCompetitors=Сравнить участников description=Описание @@ -1155,9 +1156,9 @@ groupName=Group Name valueAscending=Value (Ascending) valueDescending=Value (Descending) sortBy=Sort by -dashboardWindBotLoadingText=Loading wind bot data ... -dashboardWindBotLoadingMessage=Depending on your connection this operation might take some minutes to complete the first time. -dashboardWindBotNotAvailable=Wind bot not available. +dashboardHeader=Dashboard +dashboardNoWindBotAvailableHeader=Wind Bot not available. +dashboardNoWindBotAvailableMessage=To receive live wind data from wind measurement units, ensure that the wind bot is switched on and connected to the SAP Sailing Analytics. dashboardWindBot=Wind Bot dashboardTrueWindSpeed=TWS dashboardTrueWindDirection=TWD @@ -1167,9 +1168,17 @@ dashboardLiveWind=live dashboardAverageWind=average dashboardAverageWindMinutes=({0} minutes) dashboardWindChartHint=Tap on chart to change interval +dashboardStartAnalysesHeader=Start Analyses +dashboardSelectCompetitor=Select Competitor dashboardNewStartAnalysisAvailable=New start analysis available -dashboardStartlineAdvantagesByWind=Startline advantage by wind -dashboardStartlineAdvantageByGeometry=Startline advantage by geometry +dashboardNoStartAnalysesAvailableHeader=No Start Analyses available. +dashboardNoStartAnalysesAvailableMessage=There is a Start Analysis created from each race start. Please stand by till racing has been started. +dashboardNoStartlineAdvantagesByWindAvailableHeader=No Startline Advantages available. +dashboardNoStartlineAdvantagesByWindAvailableMessage=For calculating the startline advantage there needs to be a course set by the race commitee. +dashboardNoStartlineAdvantagesByGeometryAvailableHeader=No Startline Advantage available. +dashboardNoStartlineAdvantagesByGeometryAvailableMessage=For calculating the startline advantage there needs to be a course set by the race commitee. +dashboardStartlineAdvantagesByWindHeader=Startline Advantages by Wind +dashboardStartlineAdvantageByGeometryHeader=Startline Advantage by Geometry dashboardRankAtFirstMark=Rank at first mark dashboardTeam=Team dashboardDistanceToLineInM=Distance to line in m @@ -1357,7 +1366,6 @@ scoringSchemeHighPointFirstGetsTwelveOrEight=High Point, winner gets 12 points ( scoringSchemeHighPointFirstGetsTwelveOrEightDescription=Score in points. Winner scores 12 points, 2nd - 11 points, .... A tie is broken in favour of the competitor having won most races, if tie remains then tie is broken by the rank in the last race scored. scoringSchemeHighPointEssOverall12=High Point System ESS Overall (12) scoringSchemeHighPointEssOverall12Description=Score in points. Winner of an act scores 12 points, 2nd - 11 points, .... Any tie in the overall Extreme Sailing Series is broken in favour of the competitor with the most Act wins. If that does not break the tie, the result in the last Act will be used. -pleaseCreateAtLeastOneMappingBy=Plase create at list one mapping by first selecting a track on the left hand side and then selecting a mark or competitor on the right hand side createDefaultLeaderboardGroup=Would you like to create a default LeaderboardGroup for your event? pleaseCreateAtLeastOneMappingBy=Please create at least one mapping by first selecting a track on the left hand side and then selecting a mark or competitor on the right hand side matcherType=Matcher type @@ -1379,4 +1387,5 @@ defaultLocale=Default defaultSailorsInfoLinkInfoText=The default link is used unless a language specific overwrite exists. If no default exists, there will be no link for languages that do not explicitly have one set. qrSync=QR-Sync thereIsNoIdentifierSet=There is no identifier set. -couldNotObtainAccessTokenForUser=Could not obtain access token for user {0} \ No newline at end of file +couldNotObtainAccessTokenForUser=Could not obtain access token for user {0} +raceManagerDeviceName=Device Name \ No newline at end of file diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages_zh.properties b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages_zh.properties index 7a953a3e9e3..1db85e36f16 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages_zh.properties +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages_zh.properties @@ -128,7 +128,9 @@ raceLogReloaded=Race log successfully reloaded from database legend=Legend courseDesignerMode=Course designer configureLeaderboardUrlDescription=Configure a leaderboard and obtain the resulting URL from the link +dashboardHeader=Dashboard dashboardAverageWind=average +dashboardSelectCompetitor=Select Competitor welcomeToSailingAnalytics=Welcome to SAP Sailing Analytics courseOverGroundTrueDegreesTooltip=实际航向角度 mediaSelectVideoCaption={0} Videos @@ -160,7 +162,6 @@ explainReplicationServletPort=Servlet port number that is used to connect to reg numberOfManeuvers=操作 successfullyAllowedCompetitorReset=Successfully allowed reload of competitor(s) {0}. pleaseEnterAName=Please enter a name -dashboardStartlineAdvantageByGeometry=Startline advantage by geometry confidence=Confidence from=从 start=起航 @@ -351,7 +352,10 @@ raceIsRunning=正在进行 starboardSide=右舷 polarSheetMinimumWindConfidence=Minimum wind confidence value group=分组 +dashboardStartAnalysesHeader=Start Analyses dashboardNewStartAnalysisAvailable=New start analysis available +dashboardNoStartAnalysesAvailableHeader=No Start Analyses available. +dashboardNoStartAnalysesAvailableMessage=There is a Start Analysis created from each race start. Please stand by till racing has been started. actionAddWindData=Add wind data competitorSearchFilter=Competitor Search Filter dataCount=Data Size @@ -861,6 +865,7 @@ selectAFilterCriteria=Select a filter criteria errorWhileTryingToSetWindSourceForRace=Error while trying to set "wind starts upwind" flag pleaseEnterASailNumber=Please enter a sail number metersUnit=m +degreesUnit=° isPublic=Is public speedOverGroundWhenPassingStartTooltip=参赛队越过起航线时的实际速度 successfullyUpdatedSailingServers=Successfully updated SailingServer instances @@ -982,7 +987,6 @@ overallStandings=总排名 setClosingTimePoint=Set Timepoint that closes open time range registeredCompetitors=Registered Competitors timePointMustBeBeforeEndOfTracking=Time point must be before end of tracking. -dashboardWindBotNotAvailable=Wind bot not available. untracked=Untracked scoringSchemeWinnerGetsEightAndInterpolation=High Point System, Winner 8 Points, Interpolated export=Export @@ -1095,7 +1099,8 @@ windwardDistanceToGoInMetersTooltip=迎/顺风航段时参赛队的位置离开 papaDisplayed=Start mode flag - four minutes till start sheetNameTooltip=You can name your polar sheet using the text field.nA name will be generated using the boat classnif no name is provided. competitorsFilter=参赛队过滤 -dashboardStartlineAdvantagesByWind=Startline advantage by wind +dashboardStartlineAdvantagesByWindHeader=Startline Advantages by Wind +dashboardStartlineAdvantageByGeometryHeader=Startline Advantage by Geometry dashboardSecondsAbreviation=s pleaseEnterNonEmptyDescription=Please enter a non-empty description polarSheetChart=Polar Sheet @@ -1252,8 +1257,12 @@ eventsCount[one]={0,number} event competitorsCount={0,number} competitors courseAreaName=Course area: {0} competitorsCount[one]={0,number} competitor� -dashboardWindBotLoadingText=Loading wind bot data ... -dashboardWindBotLoadingMessage=Depending on your connection this operation might take some minutes to complete the first time. +dashboardNoWindBotAvailableHeader=Wind Bot not available. +dashboardNoWindBotAvailableMessage=To receive live wind data from wind measurement units, ensure that the wind bot is switched on and connected to the SAP Sailing Analytics. +dashboardNoStartlineAdvantagesByWindAvailableHeader=No Startline Advantages available. +dashboardNoStartlineAdvantagesByWindAvailableMessage=For calculating the startline advantage there needs to be a course set by the race commitee. +dashboardNoStartlineAdvantagesByGeometryAvailableHeader=No Startline Advantage available. +dashboardNoStartlineAdvantagesByGeometryAvailableMessage=For calculating the startline advantage there needs to be a course set by the race commitee. currentOfTotalLegs=航段 {0,number}/{1,number} clone=Clone changed=Changed @@ -1372,7 +1381,6 @@ scoringSchemeHighPointFirstGetsTwelveOrEight=High Point, winner gets 12 points ( scoringSchemeHighPointFirstGetsTwelveOrEightDescription=Score in points. Winner scores 12 points, 2nd - 11 points, .... A tie is broken in favour of the competitor having won most races, if tie remains then tie is broken by the rank in the last race scored. scoringSchemeHighPointEssOverall12=High Point System ESS Overall (12) scoringSchemeHighPointEssOverall12Description=Score in points. Winner of an act scores 12 points, 2nd - 11 points, .... Any tie in the overall Extreme Sailing Series is broken in favour of the competitor with the most Act wins. If that does not break the tie, the result in the last Act will be used. -pleaseCreateAtLeastOneMappingBy=Plase create at list one mapping by first selecting a track on the left hand side and then selecting a mark or competitor on the right hand side createDefaultLeaderboardGroup=Would you like to create a default LeaderboardGroup for your event? pleaseCreateAtLeastOneMappingBy=Please create at least one mapping by first selecting a track on the left hand side and then selecting a mark or competitor on the right hand side matcherType=Matcher type @@ -1394,4 +1402,5 @@ defaultLocale=Default defaultSailorsInfoLinkInfoText=The default link is used unless a language specific overwrite exists. If no default exists, there will be no link for languages that do not explicitly have one set. qrSync=QR-Sync thereIsNoIdentifierSet=There is no identifier set. -couldNotObtainAccessTokenForUser=Could not obtain access token for user {0} \ No newline at end of file +couldNotObtainAccessTokenForUser=Could not obtain access token for user {0} +raceManagerDeviceName=Device Name \ No newline at end of file diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/racemap/CombinedWindPanel.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/racemap/CombinedWindPanel.java index 40d5bcbc314..aa92c3f2602 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/racemap/CombinedWindPanel.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/racemap/CombinedWindPanel.java @@ -23,22 +23,23 @@ public class CombinedWindPanel extends FlowPanel { private Canvas canvas; - private CombinedWindPanelStyle combinedWindPanelStyle; + private RaceMapStyle raceMapStyle; private final CoordinateSystem coordinateSystem; - public CombinedWindPanel(RaceMapImageManager theRaceMapResources, CombinedWindPanelStyle combinedWindPanelStyle, + public CombinedWindPanel(RaceMapImageManager theRaceMapResources, RaceMapStyle raceMapStyle, StringMessages stringMessages, CoordinateSystem coordinateSystem) { + raceMapStyle.ensureInjected(); this.stringMessages = stringMessages; this.coordinateSystem = coordinateSystem; this.raceMapResources = theRaceMapResources; - this.combinedWindPanelStyle = combinedWindPanelStyle; - addStyleName(combinedWindPanelStyle.combinedWindPanel()); + this.raceMapStyle = raceMapStyle; + addStyleName(raceMapStyle.raceMapIndicatorPanel()); transformer = raceMapResources.getCombinedWindIconTransformer(); canvas = transformer.getCanvas(); - canvas.addStyleName(this.combinedWindPanelStyle.combinedWindPanelCanvas()); + canvas.addStyleName(this.raceMapStyle.raceMapIndicatorPanelCanvas()); add(canvas); textLabel = new Label(""); - textLabel.addStyleName(this.combinedWindPanelStyle.combinedWindPanelTextLabel()); + textLabel.addStyleName(this.raceMapStyle.raceMapIndicatorPanelTextLabel()); add(textLabel); } diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/racemap/CombinedWindPanelStyle.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/racemap/CombinedWindPanelStyle.java deleted file mode 100644 index a1d84ffb09d..00000000000 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/racemap/CombinedWindPanelStyle.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.sap.sailing.gwt.ui.client.shared.racemap; - -import com.google.gwt.resources.client.CssResource; -import com.google.gwt.resources.client.CssResource.Shared; - -@Shared -public interface CombinedWindPanelStyle extends CssResource { - public String combinedWindPanel(); - public String combinedWindPanelTextLabel(); - public String combinedWindPanelCanvas(); -} diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/racemap/CombinedWindPanel.css b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/racemap/RaceMap.css similarity index 73% rename from java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/racemap/CombinedWindPanel.css rename to java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/racemap/RaceMap.css index 2a333cf891c..9c8056bcd53 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/racemap/CombinedWindPanel.css +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/racemap/RaceMap.css @@ -1,6 +1,6 @@ @CHARSET "UTF-8"; -.combinedWindPanel { +.raceMapIndicatorPanel { -moz-border-radius: 4px; -webkit-border-radius: 4px; -o-border-radius: 4px; @@ -10,7 +10,7 @@ border: 1px solid #C9CACA; } -.combinedWindPanelTextLabel { +.raceMapIndicatorPanelTextLabel { height: 12px; width: 55px; vertical-align: middle; @@ -18,8 +18,12 @@ text-align: center; } -.combinedWindPanelCanvas{ +.raceMapIndicatorPanelCanvas { width: 55px; margin-left: 6px; cursor: pointer; -} \ No newline at end of file +} + +.combinedWindPanel {} + +.trueNorthIndicator {} \ No newline at end of file diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/racemap/RaceMap.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/racemap/RaceMap.java index c0efaa1bd7b..d8a3d76289a 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/racemap/RaceMap.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/racemap/RaceMap.java @@ -409,7 +409,7 @@ public class RaceMap extends AbsolutePanel implements TimeListener, CompetitorSe public RaceMap(SailingServiceAsync sailingService, AsyncActionsExecutor asyncActionsExecutor, ErrorReporter errorReporter, Timer timer, CompetitorSelectionProvider competitorSelection, StringMessages stringMessages, boolean showMapControls, boolean showViewStreamlets, boolean showViewStreamletColors, boolean showViewSimulation, - RegattaAndRaceIdentifier raceIdentifier, CombinedWindPanelStyle combinedWindPanelStyle, boolean showHeaderPanel) { + RegattaAndRaceIdentifier raceIdentifier, RaceMapResources raceMapResources, boolean showHeaderPanel) { this.setSize("100%", "100%"); this.showMapControls = showMapControls; this.stringMessages = stringMessages; @@ -419,7 +419,7 @@ public class RaceMap extends AbsolutePanel implements TimeListener, CompetitorSe this.errorReporter = errorReporter; this.timer = timer; timer.addTimeListener(this); - raceMapImageManager = new RaceMapImageManager(); + raceMapImageManager = new RaceMapImageManager(raceMapResources); markDTOs = new HashMap(); courseSidelines = new HashMap<>(); courseMiddleLines = new HashMap<>(); @@ -446,9 +446,9 @@ public class RaceMap extends AbsolutePanel implements TimeListener, CompetitorSe panelForLeftHeaderLabels = new AbsolutePanel(); panelForRightHeaderLabels = new AbsolutePanel(); initializeData(showMapControls, showHeaderPanel); - combinedWindPanel = new CombinedWindPanel(raceMapImageManager, combinedWindPanelStyle, stringMessages, coordinateSystem); + combinedWindPanel = new CombinedWindPanel(raceMapImageManager, raceMapResources.raceMapStyle(), stringMessages, coordinateSystem); combinedWindPanel.setVisible(false); - trueNorthIndicatorPanel = new TrueNorthIndicatorPanel(this, raceMapImageManager, combinedWindPanelStyle, stringMessages, coordinateSystem); + trueNorthIndicatorPanel = new TrueNorthIndicatorPanel(this, raceMapImageManager, raceMapResources.raceMapStyle(), stringMessages, coordinateSystem); trueNorthIndicatorPanel.setVisible(true); orientationChangeInProgress = false; mapFirstZoomDone = false; @@ -632,8 +632,9 @@ public class RaceMap extends AbsolutePanel implements TimeListener, CompetitorSe if (showHeaderPanel) { createHeaderPanel(map); } - createSettingsButton(map); - + if (showMapControls) { + createSettingsButton(map); + } // Data has been initialized RaceMap.this.isMapInitialized = true; RaceMap.this.redraw(); diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/racemap/RaceMapImageManager.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/racemap/RaceMapImageManager.java index 4dffc1946d0..2ef5252955e 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/racemap/RaceMapImageManager.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/racemap/RaceMapImageManager.java @@ -5,7 +5,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import com.google.gwt.core.client.GWT; import com.google.gwt.maps.client.MapWidget; import com.google.gwt.maps.client.base.Point; import com.google.gwt.maps.client.base.Size; @@ -39,9 +38,10 @@ public class RaceMapImageManager { protected Map, Marker> maneuverIconsForTypeAndDirectionIndicatingColor; - private static RaceMapResources resources = GWT.create(RaceMapResources.class); - - public RaceMapImageManager() { + private final RaceMapResources resources; + + public RaceMapImageManager(RaceMapResources resources) { + this.resources = resources; maneuverIconsForTypeAndDirectionIndicatingColor = new HashMap, Marker>(); trueNorthIndicatorIconTransformer = new ImageTransformer(resources.trueNorthIndicatorIcon()); combinedWindIconTransformer = new ImageTransformer(resources.combinedWindIcon()); diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/racemap/RaceMapResources.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/racemap/RaceMapResources.java index 689799cb81c..368ba925ee1 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/racemap/RaceMapResources.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/racemap/RaceMapResources.java @@ -28,6 +28,6 @@ public interface RaceMapResources extends ClientBundle { @Source("com/sap/sailing/gwt/ui/client/images/maneuver_green.png") ImageResource maneuverMarkerGreen(); - @Source("CombinedWindPanel.css") - CombinedWindPanelStyle combinedWindPanelStyle(); + @Source("RaceMap.css") + RaceMapStyle raceMapStyle(); } \ No newline at end of file diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/racemap/RaceMapStyle.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/racemap/RaceMapStyle.java new file mode 100644 index 00000000000..4a2179a296b --- /dev/null +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/racemap/RaceMapStyle.java @@ -0,0 +1,21 @@ +package com.sap.sailing.gwt.ui.client.shared.racemap; + +import com.google.gwt.resources.client.CssResource; +import com.google.gwt.resources.client.CssResource.Shared; + +/** + * Contains class names for styles that can get overwritten in the {@link RaceMap}. + * The {@link RaceMap} may require customized styles of elements when it is used in + * different contexts. + * + * @author Alexander Ries + * + */ +@Shared +public interface RaceMapStyle extends CssResource { + public String raceMapIndicatorPanel(); + public String raceMapIndicatorPanelTextLabel(); + public String raceMapIndicatorPanelCanvas(); + public String combinedWindPanel(); + public String trueNorthIndicator(); +} diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/racemap/TrueNorthIndicatorPanel.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/racemap/TrueNorthIndicatorPanel.java index 28da66d7f61..ef7cd8e80a3 100755 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/racemap/TrueNorthIndicatorPanel.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/racemap/TrueNorthIndicatorPanel.java @@ -26,19 +26,20 @@ public class TrueNorthIndicatorPanel extends FlowPanel { private Canvas canvas; - private CombinedWindPanelStyle combinedWindPanelStyle; + private RaceMapStyle raceMapStyle; private final CoordinateSystem coordinateSystem; - public TrueNorthIndicatorPanel(final RaceMap map, RaceMapImageManager theRaceMapResources, CombinedWindPanelStyle combinedWindPanelStyle, + public TrueNorthIndicatorPanel(final RaceMap map, RaceMapImageManager theRaceMapResources, RaceMapStyle raceMapStyle, final StringMessages stringMessages, CoordinateSystem coordinateSystem) { this.stringMessages = stringMessages; this.coordinateSystem = coordinateSystem; this.raceMapResources = theRaceMapResources; - this.combinedWindPanelStyle = combinedWindPanelStyle; - addStyleName(combinedWindPanelStyle.combinedWindPanel()); + this.raceMapStyle = raceMapStyle; + addStyleName(raceMapStyle.raceMapIndicatorPanel()); + addStyleName(raceMapStyle.trueNorthIndicator()); transformer = raceMapResources.getTrueNorthIndicatorIconTransformer(); canvas = transformer.getCanvas(); - canvas.addStyleName(this.combinedWindPanelStyle.combinedWindPanelCanvas()); + canvas.addStyleName(this.raceMapStyle.raceMapIndicatorPanelCanvas()); add(canvas); canvas.addClickHandler(new ClickHandler() { @Override @@ -58,7 +59,7 @@ public class TrueNorthIndicatorPanel extends FlowPanel { } }); textLabel = new Label(""); - textLabel.addStyleName(this.combinedWindPanelStyle.combinedWindPanelTextLabel()); + textLabel.addStyleName(this.raceMapStyle.raceMapIndicatorPanelTextLabel()); add(textLabel); } diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/leaderboard/LeaderboardTable.css b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/leaderboard/LeaderboardTable.css index cf2f58f985d..11d9c412cda 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/leaderboard/LeaderboardTable.css +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/leaderboard/LeaderboardTable.css @@ -1,8 +1,11 @@ .cellTableWidget { border-left: 1px solid #c9caca; border-top: 1px solid #c9caca; + border-collapse: collapse; } + + /** v-align images in the table header * grey background for table header */ @@ -10,7 +13,7 @@ position: relative; vertical-align: bottom; background-color: #e5e5e5; - border-right: 1px solid #c9caca !important; + border-right: 0px solid #c9caca !important; border-top: none !important; border-bottom: 1px solid #c9caca !important; padding: 3px 5px; @@ -46,19 +49,43 @@ } .cellTableEvenRow { - border-bottom: 1px solid #e5e5e5; - background-color: rgba(255,255,255,0.5); + background-color: rgba(255,255,255,0.5); } -.cellTableEvenRowCell { - border-right: 1px solid #c9caca !important; - border-left: none; - border-top: none !important; - border-bottom: 1px solid #c9caca !important; - padding: 7px 7px 7px; +.cellTableOddRow { + background-color: rgba(242,242,242,0.5); +} + +.cellTableSelectedRow { + color: #000000; + background-color: rgba(229,242,249,0.6); +} + +.cellTableSelectedRow > td:FIRST-CHILD { + border-left: 1px solid rgba(33,160,228,0.6) !important; +} + +.cellTableSelectedRow > td:LAST-CHILD { + border-right: 1px solid rgba(33,160,228,0.6) !important; +} +.cellTableSelectedRow > td { +} + +.cellTableCell { + overflow: inherit; + font-size: 12px !important; + line-height: 1.5em !important; +} +.cellTableSelectedRowCell { + border-top: 2px double #21a0e4 !important; + border-bottom: 2px double #21a0e4 !important; + padding: 7px 7px 6px 7px !important; +} + +.cellTableEvenRowCell, .cellTableOddRowCell { + border: 1px solid #c9caca; + padding: 7px; white-space: nowrap; - font-size: 12px !important; - line-height: 1.5 !important; } .cellTableCheckboxColumnCell { @@ -68,71 +95,27 @@ } .cellTableCheckboxSelected { - margin-left: 0px; /* account for the selection border that pushes a selected checkbox to the side */ - margin-top: 0px; - margin-bottom: 0px; - margin-right: 2px; - height: 18px; - width: 18px; - border: solid 1px #fcbb22; + margin: auto auto; + height: 13px; + width: 13px; + border: 1px solid #fcbb22; background-color: #fcbb22; vertical-align: middle; } .cellTableCheckboxDeselected { - margin-left: 2px; /* account for the selection border that pushes a selected checkbox to the side */ - margin-top: 0px; - margin-bottom: 0px; - margin-right: 2px; + margin: auto auto; + height: 13px; + width: 13px; border: solid 1px #acacac; - height: 18px; - width: 18px; vertical-align: middle; } -.cellTableOddRow { - border-bottom: 1px solid #e5e5e5; - background-color: rgba(242,242,242,0.5); -} - -.cellTableOddRowCell { - border-left: none !important; - border-right: 1px solid #c9caca !important; - border-top: none !important; - border-bottom: 1px solid #c9caca !important; - padding: 7px 7px 7px; - white-space: nowrap; - font-size: 12px !important; - line-height: 1.5 !important; -} - .cellTableHoveredRow { background-color: rgba(229,242,249,0.5); border-bottom: 1px solid #e5e5e5; } -.cellTableSelectedRow { - color: #000000; - background-color: rgba(229,242,249,0.5); - border-right: 2px solid #21a0e4 !important; - border-left: 2px solid #21a0e4 !important; - border: 2px solid #21a0e4; -} - -.cellTableSelectedRow > td:FIRST-CHILD { - border-left: 2px solid rgba(33,160,228,0.5) !important; -} - -.cellTableSelectedRow > td:LAST-CHILD { - border-right: 2px solid rgba(33,160,228,0.5) !important; -} - -.cellTableSelectedRowCell { - border-left: none; - border-right: 1px solid #e5e5e5; - border-top: 2px solid #21a0e4 !important; - border-bottom: 2px solid #21a0e4 !important; -} .cellTableRaceColumnHeader { background-color: #e5e5e5; diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/raceboard/EmbeddedMapAndWindChartEntryPoint.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/raceboard/EmbeddedMapAndWindChartEntryPoint.java index 127cb23ee23..f1a0b2eb29c 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/raceboard/EmbeddedMapAndWindChartEntryPoint.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/raceboard/EmbeddedMapAndWindChartEntryPoint.java @@ -155,7 +155,7 @@ public class EmbeddedMapAndWindChartEntryPoint extends AbstractSailingEntryPoint final TimePanelSettings timePanelSettings = timePanel.getSettings(); timePanelSettings.setRefreshInterval(refreshInterval); timePanel.updateSettings(timePanelSettings); - raceMapResources.combinedWindPanelStyle().ensureInjected(); + raceMapResources.raceMapStyle().ensureInjected(); final CompetitorColorProvider colorProvider = new CompetitorColorProviderImpl(selectedRaceIdentifier, competitorBoats); final CompetitorSelectionProvider competitorSelection; if (showCompetitors) { @@ -165,7 +165,7 @@ public class EmbeddedMapAndWindChartEntryPoint extends AbstractSailingEntryPoint } final RaceMap raceMap = new RaceMap(sailingService, asyncActionsExecutor, /* errorReporter */ EmbeddedMapAndWindChartEntryPoint.this, timer, competitorSelection, getStringMessages(), showMapControls, showViewStreamlets, showViewStreamletColors, - showViewSimulation, selectedRaceIdentifier, raceMapResources.combinedWindPanelStyle(), /* showHeaderPanel */ false) { + showViewSimulation, selectedRaceIdentifier, raceMapResources, /* showHeaderPanel */ false) { @Override protected void showAdditionalControls(MapWidget map) { backToLivePlayButton.removeFromParent(); diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/raceboard/RaceBoardPanel.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/raceboard/RaceBoardPanel.java index 05eea8e29be..567de85eb3e 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/raceboard/RaceBoardPanel.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/raceboard/RaceBoardPanel.java @@ -170,10 +170,10 @@ public class RaceBoardPanel extends SimplePanel implements LeaderboardUpdateList final CompetitorColorProvider colorProvider = new CompetitorColorProviderImpl(selectedRaceIdentifier, competitorsAndTheirBoats); competitorSelectionProvider = new CompetitorSelectionModel(/* hasMultiSelection */ true, colorProvider); - raceMapResources.combinedWindPanelStyle().ensureInjected(); + raceMapResources.raceMapStyle().ensureInjected(); raceMap = new RaceMap(sailingService, asyncActionsExecutor, errorReporter, timer, competitorSelectionProvider, stringMessages, showMapControls, getConfiguration().isShowViewStreamlets(), getConfiguration().isShowViewStreamletColors(), getConfiguration().isShowViewSimulation(), - selectedRaceIdentifier, raceMapResources.combinedWindPanelStyle(), /* showHeaderPanel */ true) { + selectedRaceIdentifier, raceMapResources, /* showHeaderPanel */ true) { private static final String INDENT_SMALL_CONTROL_STYLE = "indentsmall"; private static final String INDENT_BIG_CONTROL_STYLE = "indentbig"; @Override diff --git a/java/com.sap.sailing.gwt.ui/src/main/resources/com/sap/sailing/gwt/home/solutions/RaceCommitteeAppNotes.html b/java/com.sap.sailing.gwt.ui/src/main/resources/com/sap/sailing/gwt/home/solutions/RaceCommitteeAppNotes.html index 7704a4b3255..7cd06cccd28 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/resources/com/sap/sailing/gwt/home/solutions/RaceCommitteeAppNotes.html +++ b/java/com.sap.sailing.gwt.ui/src/main/resources/com/sap/sailing/gwt/home/solutions/RaceCommitteeAppNotes.html @@ -4,6 +4,19 @@

What's New - SAP Sailing Race Manager

+
March 2016
+ +
    +
  • Added sign in/sign out into the app. The user has to be create in the backend, with leaderboard + permission. Without the permission, the user can't send data to the server.
  • +
  • We changed the QR Code, so it includes the user's access token. There is also a possibility to manual login into + the app, if no QR Code is available. The app doesn't store username and password.
  • +
  • The behavior of the red share icon has also slightly changed. If it is red and tapped, it will call the server + to check, if the users access token is still valid. If not the server response with a 401 error code and the user + has to enter his credentials.
  • +
  • You can force a user sign out within the overflow menu, if you need other user credentials.
  • +
+
February 2016
    diff --git a/java/com.sap.sailing.server.gateway/src/com/sap/sailing/server/gateway/impl/rc/MarksJsonExportServlet.java b/java/com.sap.sailing.server.gateway/src/com/sap/sailing/server/gateway/impl/rc/MarksJsonExportServlet.java index efcb71cc9f5..31bbdacf101 100644 --- a/java/com.sap.sailing.server.gateway/src/com/sap/sailing/server/gateway/impl/rc/MarksJsonExportServlet.java +++ b/java/com.sap.sailing.server.gateway/src/com/sap/sailing/server/gateway/impl/rc/MarksJsonExportServlet.java @@ -1,7 +1,6 @@ package com.sap.sailing.server.gateway.impl.rc; import java.io.IOException; -import java.util.UUID; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; @@ -58,22 +57,12 @@ public class MarksJsonExportServlet extends AbstractJsonHttpServlet { return; } JSONArray result = new JSONArray(); - final Iterable marks = raceColumn.getMarks(fleet); + final Iterable marks = raceColumn.getAvailableMarks(fleet); MarkJsonSerializer serializer = new MarkJsonSerializer(); for (Mark mark : marks) { - if (toUUID(mark.getId().toString()) != null) { - result.add(serializer.serialize(mark)); - } + result.add(serializer.serialize(mark)); } setJsonResponseHeader(response); result.writeJSONString(response.getWriter()); } - - private UUID toUUID(String value) { - try { - return UUID.fromString(value); - } catch (IllegalArgumentException iae) { - return null; - } - } } diff --git a/java/com.sap.sailing.server.gateway/src/com/sap/sailing/server/gateway/jaxrs/api/LeaderboardsResource.java b/java/com.sap.sailing.server.gateway/src/com/sap/sailing/server/gateway/jaxrs/api/LeaderboardsResource.java index ff04315885c..a72a3ab2d0a 100644 --- a/java/com.sap.sailing.server.gateway/src/com/sap/sailing/server/gateway/jaxrs/api/LeaderboardsResource.java +++ b/java/com.sap.sailing.server.gateway/src/com/sap/sailing/server/gateway/jaxrs/api/LeaderboardsResource.java @@ -539,7 +539,7 @@ public class LeaderboardsResource extends AbstractSailingServerResource { .type(MediaType.TEXT_PLAIN).build(); } else { for (RaceColumn raceColumn : leaderboard.getRaceColumns()) { - Util.addAll(raceColumn.getAllMarks(), marks); + Util.addAll(raceColumn.getCourseMarks(), marks); } } } else { @@ -558,13 +558,13 @@ public class LeaderboardsResource extends AbstractSailingServerResource { StringEscapeUtils.escapeHtml(leaderboardName) + "'.").type(MediaType.TEXT_PLAIN).build(); } else { - Util.addAll(raceColumn.getMarks(fleet), marks); + Util.addAll(raceColumn.getCourseMarks(fleet), marks); } } else { // Return all marks for a certain race column // if all races have a tracked race return all marks part of at least one tracked race // if at least one race doesn't have a tracked race, return also the marks defined in the RegattaLog - Util.addAll(raceColumn.getAllMarks(), marks); + Util.addAll(raceColumn.getCourseMarks(), marks); } } JSONArray array = new JSONArray(); diff --git a/java/com.sap.sailing.server/SailingServer (No Proxy OSX).launch b/java/com.sap.sailing.server/SailingServer (No Proxy OSX).launch index 70d5da234a1..64d68838215 100644 --- a/java/com.sap.sailing.server/SailingServer (No Proxy OSX).launch +++ b/java/com.sap.sailing.server/SailingServer (No Proxy OSX).launch @@ -1,38 +1,38 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/com.sap.sailing.server/SailingServer (No Proxy).launch b/java/com.sap.sailing.server/SailingServer (No Proxy).launch index fb49b67aa62..eb1a2722b78 100644 --- a/java/com.sap.sailing.server/SailingServer (No Proxy).launch +++ b/java/com.sap.sailing.server/SailingServer (No Proxy).launch @@ -1,38 +1,38 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/com.sap.sailing.server/SailingServer (No Proxy, Cached MTB).launch b/java/com.sap.sailing.server/SailingServer (No Proxy, Cached MTB).launch index f423d629372..a08607085cc 100755 --- a/java/com.sap.sailing.server/SailingServer (No Proxy, Cached MTB).launch +++ b/java/com.sap.sailing.server/SailingServer (No Proxy, Cached MTB).launch @@ -1,37 +1,37 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/com.sap.sailing.server/SailingServer (No Proxy, Jetty on 8889).launch b/java/com.sap.sailing.server/SailingServer (No Proxy, Jetty on 8889).launch index a1b211da85d..3d3b3b72ea9 100755 --- a/java/com.sap.sailing.server/SailingServer (No Proxy, Jetty on 8889).launch +++ b/java/com.sap.sailing.server/SailingServer (No Proxy, Jetty on 8889).launch @@ -1,32 +1,32 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/com.sap.sailing.server/SailingServer (No Proxy, Jetty on 8889, Cached MTB).launch b/java/com.sap.sailing.server/SailingServer (No Proxy, Jetty on 8889, Cached MTB).launch index 5fb70d15c55..95f214db6ad 100755 --- a/java/com.sap.sailing.server/SailingServer (No Proxy, Jetty on 8889, Cached MTB).launch +++ b/java/com.sap.sailing.server/SailingServer (No Proxy, Jetty on 8889, Cached MTB).launch @@ -1,32 +1,32 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/com.sap.sailing.server/SailingServer (No Proxy, Jetty on 8889, auto-replicate dev).launch b/java/com.sap.sailing.server/SailingServer (No Proxy, Jetty on 8889, auto-replicate dev).launch index 7327c33673a..ce754832c84 100644 --- a/java/com.sap.sailing.server/SailingServer (No Proxy, Jetty on 8889, auto-replicate dev).launch +++ b/java/com.sap.sailing.server/SailingServer (No Proxy, Jetty on 8889, auto-replicate dev).launch @@ -1,32 +1,32 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/com.sap.sailing.server/SailingServer (No Proxy, Jetty on 8889, auto-replicate).launch b/java/com.sap.sailing.server/SailingServer (No Proxy, Jetty on 8889, auto-replicate).launch index 3e59695678f..140ffe940f7 100644 --- a/java/com.sap.sailing.server/SailingServer (No Proxy, Jetty on 8889, auto-replicate).launch +++ b/java/com.sap.sailing.server/SailingServer (No Proxy, Jetty on 8889, auto-replicate).launch @@ -1,32 +1,32 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/com.sap.sailing.server/SailingServer (No Proxy, Jetty on 8890).launch b/java/com.sap.sailing.server/SailingServer (No Proxy, Jetty on 8890).launch index 4c27b93091f..ad8671fb860 100755 --- a/java/com.sap.sailing.server/SailingServer (No Proxy, Jetty on 8890).launch +++ b/java/com.sap.sailing.server/SailingServer (No Proxy, Jetty on 8890).launch @@ -1,32 +1,32 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/com.sap.sailing.server/SailingServer (No Proxy, Remote Debug SAP VM).launch b/java/com.sap.sailing.server/SailingServer (No Proxy, Remote Debug SAP VM).launch index 09a44db1439..4187f309ac1 100755 --- a/java/com.sap.sailing.server/SailingServer (No Proxy, Remote Debug SAP VM).launch +++ b/java/com.sap.sailing.server/SailingServer (No Proxy, Remote Debug SAP VM).launch @@ -1,31 +1,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/com.sap.sailing.server/SailingServer (No Proxy, winddbTest).launch b/java/com.sap.sailing.server/SailingServer (No Proxy, winddbTest).launch index a855c7db089..0b5043c7561 100755 --- a/java/com.sap.sailing.server/SailingServer (No Proxy, winddbTest).launch +++ b/java/com.sap.sailing.server/SailingServer (No Proxy, winddbTest).launch @@ -1,37 +1,37 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/com.sap.sailing.server/SailingServer (Proxy).launch b/java/com.sap.sailing.server/SailingServer (Proxy).launch index c74298fb3be..21dfc841aea 100755 --- a/java/com.sap.sailing.server/SailingServer (Proxy).launch +++ b/java/com.sap.sailing.server/SailingServer (Proxy).launch @@ -1,39 +1,39 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/com.sap.sailing.server/SailingServer (Proxy, Jetty on 8889).launch b/java/com.sap.sailing.server/SailingServer (Proxy, Jetty on 8889).launch index b19398528bb..e30859d3dbe 100755 --- a/java/com.sap.sailing.server/SailingServer (Proxy, Jetty on 8889).launch +++ b/java/com.sap.sailing.server/SailingServer (Proxy, Jetty on 8889).launch @@ -1,32 +1,32 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/com.sap.sailing.server/SailingServer (Proxy, Remote Debug SAP VM).launch b/java/com.sap.sailing.server/SailingServer (Proxy, Remote Debug SAP VM).launch index 57628771165..90b6f42c0f2 100755 --- a/java/com.sap.sailing.server/SailingServer (Proxy, Remote Debug SAP VM).launch +++ b/java/com.sap.sailing.server/SailingServer (Proxy, Remote Debug SAP VM).launch @@ -1,31 +1,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/com.sap.sailing.server/SailingServer (Proxy, SwissTiming Live Simulation).launch b/java/com.sap.sailing.server/SailingServer (Proxy, SwissTiming Live Simulation).launch index d9d2b3a236c..c8d7494d4d5 100755 --- a/java/com.sap.sailing.server/SailingServer (Proxy, SwissTiming Live Simulation).launch +++ b/java/com.sap.sailing.server/SailingServer (Proxy, SwissTiming Live Simulation).launch @@ -1,30 +1,30 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/com.sap.sailing.server/SailingServer (Proxy, winddbTest).launch b/java/com.sap.sailing.server/SailingServer (Proxy, winddbTest).launch index 4e8e768c965..c577be0479c 100755 --- a/java/com.sap.sailing.server/SailingServer (Proxy, winddbTest).launch +++ b/java/com.sap.sailing.server/SailingServer (Proxy, winddbTest).launch @@ -1,33 +1,33 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/com.sap.sse.gwt/META-INF/MANIFEST.MF b/java/com.sap.sse.gwt/META-INF/MANIFEST.MF index 59f798364a0..4dc211945df 100644 --- a/java/com.sap.sse.gwt/META-INF/MANIFEST.MF +++ b/java/com.sap.sse.gwt/META-INF/MANIFEST.MF @@ -9,9 +9,13 @@ Require-Bundle: com.google.gwt.osgi;bundle-version="2.7.0", com.sap.sse.common, com.sap.sse.filestorage Bundle-ActivationPolicy: lazy -Import-Package: javax.servlet;version="2.6.0", - javax.servlet.http;version="2.6.0", +Import-Package: com.google.gwt.core.ext, + com.google.gwt.core.ext.linker, + com.google.gwt.core.ext.linker.impl, + javax.servlet;version="2.6.0", javax.servlet.descriptor;version="2.6.0", + javax.servlet.http;version="2.6.0", + org.apache.commons.io, org.json.simple, org.json.simple.parser, org.osgi.framework, @@ -31,6 +35,7 @@ Export-Package: com.google.gwt.user.client.rpc.core.java.util, com.sap.sse.gwt.client.dialog, com.sap.sse.gwt.client.event, com.sap.sse.gwt.client.filestorage, + com.sap.sse.gwt.client.linker, com.sap.sse.gwt.client.media, com.sap.sse.gwt.client.mutationobserver, com.sap.sse.gwt.client.mvp, diff --git a/java/com.sap.sse.gwt/src/com/sap/sse/gwt/client/linker/ManifestLinker.java b/java/com.sap.sse.gwt/src/com/sap/sse/gwt/client/linker/ManifestLinker.java new file mode 100644 index 00000000000..2e26ee6790c --- /dev/null +++ b/java/com.sap.sse.gwt/src/com/sap/sse/gwt/client/linker/ManifestLinker.java @@ -0,0 +1,135 @@ +package com.sap.sse.gwt.client.linker; + +import java.io.IOException; +import java.util.Arrays; +import java.util.Date; + +import org.apache.commons.io.IOUtils; + +import com.google.gwt.core.ext.LinkerContext; +import com.google.gwt.core.ext.TreeLogger; +import com.google.gwt.core.ext.UnableToCompleteException; +import com.google.gwt.core.ext.linker.AbstractLinker; +import com.google.gwt.core.ext.linker.Artifact; +import com.google.gwt.core.ext.linker.ArtifactSet; +import com.google.gwt.core.ext.linker.EmittedArtifact; +import com.google.gwt.core.ext.linker.LinkerOrder; +import com.google.gwt.core.ext.linker.impl.SelectionInformation; + +/** + * This class creates an application manifest file for HTML 5 Offline Application Caching in the + * output folder of your client side gwt compilation results.

    + * Follow those steps to use HTML 5 Offline Application Caching in your bundle: + *
      + *
    1. Add {@code manifest="YOURMODULENAME/appcache.manifest"} to the {@code } tag in your base html file.
    2. + *
    3. Subclass {@link ManifestLinker} and override the method {@link #staticCachedFiles()}.
    4. + *
    5. Define a mime type mapping for the manifest extension in your web.xml file. + *
      + * {@code 
      + * manifest
      + * text/cache-manifest
      + * 
      + * }
      + *
    6. + *
    7. Define the subclassed linker in your gwt.xml file and add the linker.
    8. + *
      + * {@code 
      + * 
      + * }
      + *
    9. Make sure to import the those packages into your MANIFEST.MF file.
    10. + * com.google.gwt.core.ext
      + * com.google.gwt.core.ext.linker
      + * com.google.gwt.core.ext.linker.impl + *
    + * + * @author Alexander Ries + * + */ +@LinkerOrder(LinkerOrder.Order.POST) +public class ManifestLinker extends AbstractLinker { + + private static final String MANIFEST = "appcache.manifest"; + private static final String MANIFESTTEMPLATE = "cache.manifest.template"; + + @Override + public String getDescription() { + return ManifestLinker.class.getName(); + } + + @Override + public ArtifactSet link(TreeLogger logger, LinkerContext context, ArtifactSet artifacts, boolean onePermutation) throws UnableToCompleteException { + ArtifactSet result = new ArtifactSet(artifacts); + if (onePermutation) { + return result; + } + if (result.find(SelectionInformation.class).isEmpty()) { + logger.log(TreeLogger.INFO, "Warning: Clobbering " + MANIFEST + " to allow debugging. " + "Recompile before deploying your app!"); + artifacts = null; + } else { + result.add(emitLandingPageCacheManifest(context, logger, artifacts)); + } + return result; + } + + private Artifact emitLandingPageCacheManifest(LinkerContext context, TreeLogger logger, ArtifactSet artifacts) throws UnableToCompleteException { + StringBuilder publicSourcesSb = new StringBuilder(); + StringBuilder staticResoucesSb = new StringBuilder(); + if (artifacts != null) { + for (@SuppressWarnings("rawtypes") + Artifact artifact : artifacts) { + if (artifact instanceof EmittedArtifact) { + EmittedArtifact ea = (EmittedArtifact) artifact; + String pathName = ea.getPartialPath(); + if (pathName.endsWith("symbolMap") || + pathName.endsWith(".xml.gz") || + pathName.endsWith("rpc.log") || + pathName.endsWith("gwt.rpc") || + pathName.endsWith("manifest.txt") || + pathName.startsWith("rpcPolicyManifest")) { + } else { + publicSourcesSb.append(pathName + "\n"); + } + } + } + String[] cacheExtraFiles = getCacheExtraFiles(); + for (int i = 0; i < cacheExtraFiles.length; i++) { + staticResoucesSb.append(cacheExtraFiles[i]); + staticResoucesSb.append("\n"); + } + } + String cacheManifestString = createCache(logger, context, publicSourcesSb, staticResoucesSb); + return emitString(logger, cacheManifestString, MANIFEST); + } + + protected String createCache(TreeLogger logger, LinkerContext context, StringBuilder publicSourcesSb, StringBuilder staticResoucesSb) throws UnableToCompleteException { + try { + String manifest = IOUtils.toString(getClass().getResourceAsStream(appCacheManifestTemplate())); + manifest = manifest.replace("$UNIQUEID$", (new Date()).getTime() + "." + Math.random()).toString(); + manifest = manifest.replace("$STATICAPPFILES$", staticResoucesSb.toString()); + manifest = manifest.replace("$GENAPPFILES$", publicSourcesSb.toString()); + return manifest; + } catch (IOException e) { + //logger.log(TreeLogger.ERROR, "Could not read cache manifest template.", e); + throw new UnableToCompleteException(); + } + } + + private String[] getCacheExtraFiles() { + String[] cacheExtraFiles = staticCachedFiles(); + return cacheExtraFiles == null ? new String[0] : Arrays.copyOf(cacheExtraFiles, cacheExtraFiles.length); + } + + /** + * Override this method to provide static files for caching. + * Include at least your root HTML and CSS file. + * Also include all files referenced in your root HTML file. + * See {@link DashboardManifestLinker} as an example. + * */ + protected String[] staticCachedFiles() { + return null; + } + + protected String appCacheManifestTemplate() { + return MANIFESTTEMPLATE; + } +} diff --git a/mobile/com.sap.sailing.android.shared/build.gradle b/mobile/com.sap.sailing.android.shared/build.gradle index 8688b6c0633..26ee1c69d88 100644 --- a/mobile/com.sap.sailing.android.shared/build.gradle +++ b/mobile/com.sap.sailing.android.shared/build.gradle @@ -51,7 +51,7 @@ dependencies { /* Google Play Services */ compile "com.google.android.gms:play-services-location:${rootProject.ext.play_services}" - /* licence dialog */ + /* license dialog */ compile("de.psdev.licensesdialog:licensesdialog:${rootProject.ext.license_dialog}") /* all local jar-libs */ diff --git a/mobile/com.sap.sailing.android.shared/res/layout/fragment_about.xml b/mobile/com.sap.sailing.android.shared/res/layout/fragment_about.xml index eeed356f8e0..727c5695338 100644 --- a/mobile/com.sap.sailing.android.shared/res/layout/fragment_about.xml +++ b/mobile/com.sap.sailing.android.shared/res/layout/fragment_about.xml @@ -11,7 +11,7 @@ /> diff --git a/mobile/com.sap.sailing.android.shared/res/values-de/strings.xml b/mobile/com.sap.sailing.android.shared/res/values-de/strings.xml index 00171d91dd6..170eb3e5a64 100644 --- a/mobile/com.sap.sailing.android.shared/res/values-de/strings.xml +++ b/mobile/com.sap.sailing.android.shared/res/values-de/strings.xml @@ -41,6 +41,6 @@ Über diese App Datenschutz - Lizenzhinweise + Lizenzhinweise \ No newline at end of file diff --git a/mobile/com.sap.sailing.android.shared/res/values/preferences.xml b/mobile/com.sap.sailing.android.shared/res/values/preferences.xml index 0b9f6f463c5..924f5ccf26b 100644 --- a/mobile/com.sap.sailing.android.shared/res/values/preferences.xml +++ b/mobile/com.sap.sailing.android.shared/res/values/preferences.xml @@ -7,7 +7,7 @@ true webserviceUrlPref - http://dev.sapsailing.com/ + https://dev.sapsailing.com enableLifecycleLogging false diff --git a/mobile/com.sap.sailing.android.shared/res/values/strings.xml b/mobile/com.sap.sailing.android.shared/res/values/strings.xml index 31727b149bd..93da04781d5 100644 --- a/mobile/com.sap.sailing.android.shared/res/values/strings.xml +++ b/mobile/com.sap.sailing.android.shared/res/values/strings.xml @@ -57,7 +57,7 @@ About this app EULA - Licence Information + License Information (Request %1$d) %2$s\nHTTP response code: %3$d.\nHTTP response body: %4$s. @@ -65,4 +65,8 @@ (Request %d) HTTP request aborted. (Request %d) HTTP request failed. + + Currently %1$d events waiting to be sent.\nLast successful sent was at %2$s + Currently no event waiting to be sent. + \ No newline at end of file diff --git a/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/data/LoginData.java b/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/data/LoginData.java new file mode 100644 index 00000000000..8c57a824071 --- /dev/null +++ b/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/data/LoginData.java @@ -0,0 +1,18 @@ +package com.sap.sailing.android.shared.data; + +import com.sap.sse.common.Base64Utils; + +public class LoginData { + + private String username; + private String password; + + public LoginData(String username, String password) { + this.username = username; + this.password = password; + } + + public String getCredentials() { + return Base64Utils.toBase64((username + ":" + password).getBytes()); + } +} diff --git a/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/data/http/HttpJsonPostRequest.java b/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/data/http/HttpJsonPostRequest.java index 01381da8efa..28af17938f8 100644 --- a/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/data/http/HttpJsonPostRequest.java +++ b/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/data/http/HttpJsonPostRequest.java @@ -14,14 +14,20 @@ public class HttpJsonPostRequest extends HttpRequest { public final static String ContentType = "application/json;charset=UTF-8"; private String requestBody; + private String accessToken; public HttpJsonPostRequest(URL requestUrl, Context context) { - this(requestUrl, null, context); + this(requestUrl, null, context, null); } - + public HttpJsonPostRequest(URL requestUrl, String body, Context context) { + this(requestUrl, body, context, null); + } + + public HttpJsonPostRequest(URL requestUrl, String body, Context context, String accessToken) { super(requestUrl, context); this.requestBody = body; + this.accessToken = accessToken; } @Override @@ -32,6 +38,9 @@ public class HttpJsonPostRequest extends HttpRequest { connection.setRequestProperty("Content-Type", ContentType); connection.setRequestProperty("Accept", ContentType); + if (accessToken != null) { + connection.setRequestProperty("Authorization", "Bearer " + accessToken); + } OutputStream outputStream = new BufferedOutputStream(connection.getOutputStream()); try { sendBody(outputStream); diff --git a/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/data/http/HttpRequest.java b/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/data/http/HttpRequest.java index 9829cce07e1..50f3ed82c48 100644 --- a/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/data/http/HttpRequest.java +++ b/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/data/http/HttpRequest.java @@ -44,7 +44,7 @@ public abstract class HttpRequest { private final URL url; private final Context context; private boolean isCancelled; - private SharedPreferences pref; + protected SharedPreferences pref; public HttpRequest(URL url, Context context) { this(url, null, context); @@ -95,7 +95,7 @@ public abstract class HttpRequest { responseInputStream = doRequest(connection); } catch (FileNotFoundException fnfe) { if (HttpURLConnection.HTTP_UNAUTHORIZED == connection.getResponseCode()) { - throw new UnauthorizedException(); + throw new UnauthorizedException(connection.getHeaderField("WWW-Authenticate")); } // 404 errors... throw new FileNotFoundException(context.getString(R.string.http_request_exception, this.hashCode(), fnfe.getMessage(), connection.getResponseCode(), connection.getResponseMessage())); diff --git a/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/data/http/LoginGetRequest.java b/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/data/http/LoginGetRequest.java new file mode 100644 index 00000000000..51a745426e4 --- /dev/null +++ b/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/data/http/LoginGetRequest.java @@ -0,0 +1,33 @@ +package com.sap.sailing.android.shared.data.http; + +import java.io.BufferedInputStream; +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URL; + +import android.content.Context; + +import com.sap.sailing.android.shared.data.LoginData; + +public class LoginGetRequest extends HttpRequest { + + public final static String ContentType = "application/json;charset=UTF-8"; + private final LoginData loginData; + + public LoginGetRequest(URL url, Context context, LoginData login) { + super(url, context); + loginData = login; + } + + @Override + protected BufferedInputStream doRequest(HttpURLConnection connection) throws IOException { + connection.setRequestMethod("GET"); + connection.setChunkedStreamingMode(0); + + connection.setRequestProperty("Content-Type", ContentType); + connection.setRequestProperty("Accept", ContentType); + connection.setRequestProperty("Authorization", "Basic " + loginData.getCredentials()); + + return new BufferedInputStream(connection.getInputStream()); + } +} diff --git a/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/data/http/UnauthorizedException.java b/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/data/http/UnauthorizedException.java index 0208a7e40c8..9d396fd2d81 100644 --- a/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/data/http/UnauthorizedException.java +++ b/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/data/http/UnauthorizedException.java @@ -7,4 +7,8 @@ import java.io.IOException; */ public class UnauthorizedException extends IOException { private static final long serialVersionUID = 5913076970322227942L; + + public UnauthorizedException(String detailMessage) { + super(detailMessage); + } } diff --git a/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/services/sending/MessagePersistenceManager.java b/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/services/sending/MessagePersistenceManager.java index eb37655aadf..8aa5c25e06c 100644 --- a/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/services/sending/MessagePersistenceManager.java +++ b/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/services/sending/MessagePersistenceManager.java @@ -18,19 +18,19 @@ import com.sap.sailing.android.shared.logging.ExLog; import com.sap.sailing.android.shared.util.FileHandlerUtils; public class MessagePersistenceManager { - + private final static String TAG = MessagePersistenceManager.class.getName(); private final static String delayedMessagesFileName = "delayedMessages.txt"; protected Context context; protected List persistedMessages; - + private final MessageRestorer messageRestorer; public MessagePersistenceManager(Context context, MessageRestorer messageRestorer) { this.context = context; - persistedMessages = new ArrayList(); + persistedMessages = new ArrayList<>(); this.messageRestorer = messageRestorer; initializeFileAndPersistedMessages(); } @@ -60,14 +60,13 @@ public class MessagePersistenceManager { /** * @param payload will be URL-encoded to ensure that the resulting string does not contain newlines - * @throws UnsupportedEncodingException + * @throws UnsupportedEncodingException */ - private String getSerializedIntentForPersistence(String url, String callbackPayload, - String payload, String callbackClass) throws UnsupportedEncodingException { - String messageLine = String.format("%s;%s;%s;%s", callbackPayload, URLEncoder.encode(payload, - MessageSendingService.charsetName), + private String getSerializedIntentForPersistence(String url, String callbackPayload, + String payload, String callbackClass) throws UnsupportedEncodingException { + return String.format("%s;%s;%s;%s", callbackPayload, URLEncoder.encode(payload, + MessageSendingService.charsetName), url, callbackClass); - return messageLine; } public void removeIntent(Intent intent) throws UnsupportedEncodingException { @@ -86,7 +85,7 @@ public class MessagePersistenceManager { removePersistedMessage(messageLine); } } - + /** * Removes all pending messages and clears the persistence file. */ @@ -106,12 +105,12 @@ public class MessagePersistenceManager { public int getMessageCount() { return persistedMessages.size(); } - + public List getContent() { return persistedMessages; } - - public static interface MessageRestorer { + + public interface MessageRestorer { void restoreMessage(Context context, Intent messageIntent); } @@ -125,26 +124,26 @@ public class MessagePersistenceManager { String callbackClassString = lineParts[3]; Class callbackClass = null; - if (! "null".equals(callbackClassString)) { + if (!"null".equals(callbackClassString)) { try { @SuppressWarnings("unchecked") Class tmp = - (Class) Class.forName(callbackClassString); + (Class) Class.forName(callbackClassString); callbackClass = tmp; } catch (ClassNotFoundException e) { ExLog.e(context, TAG, "Could not find class for callback name: " + callbackClassString); } } - + // We are passing no message id, because we know it used to suppress message sending and // we want this message to be sent. Intent messageIntent = MessageSendingService.createMessageIntent(context, url, callbackPayload, null, payload, callbackClass); - + if (messageRestorer != null) { messageRestorer.restoreMessage(context, messageIntent); } - + if (messageIntent != null) { delayedIntents.add(messageIntent); } @@ -166,7 +165,7 @@ public class MessagePersistenceManager { fileContent = FileHandlerUtils.convertStreamToString(inputStream, context); inputStream.close(); } catch (IOException e) { - ExLog.w(context, TAG, "In Method getFileContent(): " + e.getClass().getName()+" / "+e.getMessage() + " fileContent is empty"); + ExLog.w(context, TAG, "In Method getFileContent(): " + e.getClass().getName() + " / " + e.getMessage() + " fileContent is empty"); } return fileContent; } diff --git a/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/services/sending/MessageSenderResult.java b/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/services/sending/MessageSenderResult.java new file mode 100644 index 00000000000..a9ceabd9995 --- /dev/null +++ b/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/services/sending/MessageSenderResult.java @@ -0,0 +1,50 @@ +package com.sap.sailing.android.shared.services.sending; + +import java.io.InputStream; + +import android.content.Intent; + +public class MessageSenderResult { + + private final Intent mIntent; + private final InputStream mInputStream; + private final Exception mException; + + public MessageSenderResult() { + this(null, null, null); + } + + public MessageSenderResult(Intent intent) { + this(intent, null, null); + } + + public MessageSenderResult(Intent intent, InputStream inputStream) { + this(intent, inputStream, null); + } + + public MessageSenderResult(Intent intent, Exception exception) { + this(intent, null, exception); + } + + public MessageSenderResult(Intent intent, InputStream inputStream, Exception exception) { + mIntent = intent; + mInputStream = inputStream; + mException = exception; + } + + public boolean isSuccessful() { + return mException == null; + } + + public Intent getIntent() { + return mIntent; + } + + public InputStream getInputStream() { + return mInputStream; + } + + public Exception getException() { + return mException; + } +} diff --git a/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/services/sending/MessageSenderTask.java b/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/services/sending/MessageSenderTask.java index deea1ae4272..2b86375a0d1 100644 --- a/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/services/sending/MessageSenderTask.java +++ b/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/services/sending/MessageSenderTask.java @@ -12,16 +12,10 @@ import android.os.Bundle; import com.sap.sailing.android.shared.data.http.HttpJsonPostRequest; import com.sap.sailing.android.shared.data.http.HttpRequest; import com.sap.sailing.android.shared.logging.ExLog; -import com.sap.sse.common.Util; -public class MessageSenderTask extends AsyncTask> { - +public class MessageSenderTask extends AsyncTask { + private static String TAG = MessageSenderTask.class.getName(); - - public interface MessageSendingListener { - public void onMessageSent(Intent intent, boolean success, InputStream inputStream); - } - private MessageSendingListener listener; private Context context; @@ -30,19 +24,18 @@ public class MessageSenderTask extends AsyncTask doInBackground(Intent... params) { - Util.Triple result; + protected MessageSenderResult doInBackground(Intent... params) { + MessageSenderResult result; Intent intent = params[0]; if (intent == null) { - return new Util.Triple(intent, false, null); + return new MessageSenderResult(); } Bundle extras = intent.getExtras(); String payload = extras.getString(MessageSendingService.PAYLOAD); String url = extras.getString(MessageSendingService.URL); if (payload == null || url == null) { - return new Util.Triple(intent, false, null); + return new MessageSenderResult(intent); } InputStream responseStream = null; try { @@ -50,22 +43,28 @@ public class MessageSenderTask extends AsyncTask(intent, true, responseStream); + result = new MessageSenderResult(intent, responseStream); } catch (IOException e) { - if (responseStream != null) { - try { - responseStream.close(); - } catch (IOException ie) { } - } ExLog.e(context, TAG, String.format("Post not successful, exception occured: %s", e.toString())); - result = new Util.Triple(intent, false, null); + result = new MessageSenderResult(intent, e); + } finally { + try { + if (responseStream != null) { + responseStream.close(); + } + } catch (IOException e) { + } } return result; } @Override - protected void onPostExecute(Util.Triple resultTriple) { - super.onPostExecute(resultTriple); - listener.onMessageSent(resultTriple.getA(), resultTriple.getB(), resultTriple.getC()); + protected void onPostExecute(MessageSenderResult result) { + super.onPostExecute(result); + listener.onMessageSent(result); + } + + public interface MessageSendingListener { + void onMessageSent(MessageSenderResult result); } } diff --git a/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/services/sending/MessageSendingService.java b/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/services/sending/MessageSendingService.java index a564685b8ea..298ca7ed455 100644 --- a/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/services/sending/MessageSendingService.java +++ b/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/services/sending/MessageSendingService.java @@ -11,6 +11,7 @@ import android.os.Binder; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; + import com.sap.sailing.android.shared.R; import com.sap.sailing.android.shared.logging.ExLog; import com.sap.sailing.android.shared.services.sending.MessagePersistenceManager.MessageRestorer; @@ -18,7 +19,6 @@ import com.sap.sailing.android.shared.services.sending.MessageSenderTask.Message import com.sap.sailing.android.shared.util.PrefUtils; import com.sap.sailing.domain.common.racelog.RaceLogServletConstants; -import java.io.InputStream; import java.io.Serializable; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; @@ -28,7 +28,7 @@ import java.util.*; * Service that handles sending messages to a webservice. Deals with an offline setting * by buffering the messages in a file, so that they can be sent when the connection is * re-established.
    - * + *

    * Use in the following way: Add the service declaration to your {@code AndroidManifest.xml}, * and also specify your class implementing the {@link MessagePersistenceManager.MessageRestorer} * as a meta-data tag with the key {@code com.sap.sailing.android.shared.services.sending.messageRestorer}. @@ -42,9 +42,9 @@ import java.util.*; * android:value="com.sap.sailing.racecommittee.app.services.sending.EventRestorer" /> * * } - * - * - * Message sending example: + *

    + *

    + * Message sending example: *

    {@code
      * context.startService(MessageSendingService.createMessageIntent(
      *      context, url, race.getId(), eventId, serializedEventAsJson, callbackClass));
    @@ -56,7 +56,7 @@ public class MessageSendingService extends Service implements MessageSendingList
         public final static String CALLBACK_CLASS = "callback";
         public final static String CALLBACK_PAYLOAD = "callbackPayload"; // passed back to callback
         public final static String MESSAGE_ID = "messageId";
    -    
    +
         public static final String charsetName = "UTF-8";
     
         protected final static String TAG = MessageSendingService.class.getName();
    @@ -66,7 +66,7 @@ public class MessageSendingService extends Service implements MessageSendingList
         private final IBinder mBinder = new MessageSendingBinder();
         private MessagePersistenceManager persistenceManager;
         private boolean isHandlerSet;
    -    
    +
         private Set suppressedMessageIds = new HashSet();
     
         private APIConnectivityListener apiConnectivityListener;
    @@ -86,9 +86,9 @@ public class MessageSendingService extends Service implements MessageSendingList
         };
     
         public interface MessageSendingServiceLogger {
    -        public void onMessageSentSuccessful();
    +        void onMessageSentSuccessful();
     
    -        public void onMessageSentFailed();
    +        void onMessageSentFailed();
         }
     
         public void setMessageSendingServiceLogger(MessageSendingServiceLogger logger) {
    @@ -107,7 +107,7 @@ public class MessageSendingService extends Service implements MessageSendingList
         }
     
         private Date lastSuccessfulSend;
    -    
    +
         public List getDelayedIntentsContent() {
             return persistenceManager.getContent();
         }
    @@ -119,16 +119,16 @@ public class MessageSendingService extends Service implements MessageSendingList
         public Date getLastSuccessfulSend() {
             return lastSuccessfulSend;
         }
    -    
    +
         public void clearDelayedIntents() {
             persistenceManager.removeAllMessages();
             // let's fake a successful send!
             serviceLogger.onMessageSentSuccessful();
         }
     
    -    public static Intent createMessageIntent(Context context, String url, 
    -    		Serializable callbackPayload, Serializable messageId, String payload,
    -            Class callbackClass) {
    +    public static Intent createMessageIntent(Context context, String url,
    +                                             Serializable callbackPayload, Serializable messageId, String payload,
    +                                             Class callbackClass) {
             Intent messageIntent = new Intent(context, MessageSendingService.class);
             messageIntent.setAction(context.getString(R.string.intent_send_message));
             messageIntent.putExtra(CALLBACK_PAYLOAD, callbackPayload);
    @@ -138,7 +138,7 @@ public class MessageSendingService extends Service implements MessageSendingList
             messageIntent.putExtra(CALLBACK_CLASS, callbackClass == null ? null : callbackClass.getName());
             return messageIntent;
         }
    -    
    +
         public static Intent createSendDelayedIntent(Context context) {
             Intent intent = new Intent(context, MessageSendingService.class);
             intent.setAction(context.getString(R.string.intent_send_saved_intents));
    @@ -153,7 +153,7 @@ public class MessageSendingService extends Service implements MessageSendingList
             ExLog.w(this, TAG, "Unable to extract message identifier from message intent.");
             return null;
         }
    -    
    +
         private MessagePersistenceManager getPersistenceManager() {
             ComponentName thisService = new ComponentName(this, this.getClass());
             MessageRestorer restorer = null;
    @@ -172,7 +172,7 @@ public class MessageSendingService extends Service implements MessageSendingList
                     } else {
                         @SuppressWarnings("unchecked")
                         // checked above
    -                    Class castedClass = (Class) clazz;
    +                            Class castedClass = (Class) clazz;
                         restorer = castedClass.getConstructor().newInstance();
                     }
                 }
    @@ -223,9 +223,9 @@ public class MessageSendingService extends Service implements MessageSendingList
         }
     
         private void handleSendMessages(Intent intent) {
    -        ExLog.i(this, TAG, String.format("Trying to send a message..."));
    +        ExLog.i(this, TAG, "Trying to send a message...");
             if (!isConnected()) {
    -            ExLog.i(this, TAG, String.format("Send aborted because there is no connection."));
    +            ExLog.i(this, TAG, "Send aborted because there is no connection.");
                 try {
                     persistenceManager.persistIntent(intent);
                 } catch (UnsupportedEncodingException e) {
    @@ -240,10 +240,10 @@ public class MessageSendingService extends Service implements MessageSendingList
         }
     
         private void handleDelayedMessages() {
    -        ExLog.i(this, TAG, String.format("Trying to resend stored messages..."));
    +        ExLog.i(this, TAG, "Trying to resend stored messages...");
             isHandlerSet = false;
             if (!isConnected()) {
    -            ExLog.i(this, TAG, String.format("Resend aborted because there is no connection."));
    +            ExLog.i(this, TAG, "Resend aborted because there is no connection.");
                 ConnectivityChangedReceiver.enable(this);
                 serviceLogger.onMessageSentFailed();
             } else {
    @@ -281,16 +281,15 @@ public class MessageSendingService extends Service implements MessageSendingList
         }
     
         @Override
    -    public void onMessageSent(Intent intent, boolean success, InputStream inputStream) {
    -        ExLog.i(this, "MS", "on message sent");
    -        int resendMillis = PrefUtils.getInt(this, R.string.preference_messageResendIntervalMillis_key,
    -                R.integer.preference_messageResendIntervalMillis_default);
    -        if (!success) {
    -            ExLog.i(this, "MS", "!success");
    +    public void onMessageSent(MessageSenderResult result) {
    +        ExLog.i(this, TAG, "onMessageSent");
    +        int resendMillis = PrefUtils.getInt(this, R.string.preference_messageResendIntervalMillis_key, R.integer.preference_messageResendIntervalMillis_default);
    +        if (!result.isSuccessful()) {
    +            ExLog.i(this, TAG, "!success");
                 reportApiConnectivity(APIConnectivity.transmissionError);
                 ExLog.w(this, TAG, "Error while posting intent to server. Will persist intent...");
                 try {
    -                persistenceManager.persistIntent(intent);
    +                persistenceManager.persistIntent(result.getIntent());
                 } catch (UnsupportedEncodingException e) {
                     ExLog.e(this, TAG, "Could not store message (unsupported encoding)");
                 }
    @@ -302,12 +301,12 @@ public class MessageSendingService extends Service implements MessageSendingList
                 reportUnsentGPSFixesCount();
                 serviceLogger.onMessageSentFailed();
             } else {
    -            ExLog.i(this, "MS", "success");
    +            ExLog.i(this, TAG, "success");
                 reportApiConnectivity(APIConnectivity.transmissionSuccess);
                 ExLog.i(this, TAG, "Message successfully sent.");
                 if (persistenceManager.areIntentsDelayed()) {
                     try {
    -                    persistenceManager.removeIntent(intent);
    +                    persistenceManager.removeIntent(result.getIntent());
                     } catch (UnsupportedEncodingException e) {
                         ExLog.e(this, TAG, "Could not remove message (unsupported encoding)");
                     }
    @@ -316,8 +315,8 @@ public class MessageSendingService extends Service implements MessageSendingList
                 if (serviceLogger != null) {
                     serviceLogger.onMessageSentSuccessful();
                 }
    -            
    -            String callbackClassString = intent.getStringExtra(CALLBACK_CLASS);
    +
    +            String callbackClassString = result.getIntent().getStringExtra(CALLBACK_CLASS);
                 ServerReplyCallback callback = null;
                 if (callbackClassString != null) {
                     try {
    @@ -328,51 +327,47 @@ public class MessageSendingService extends Service implements MessageSendingList
                     }
                 }
                 if (callback != null) {
    -                String raceId = intent.getStringExtra(CALLBACK_PAYLOAD);
    -                callback.processResponse(this, inputStream, raceId);
    +                String raceId = result.getIntent().getStringExtra(CALLBACK_PAYLOAD);
    +                callback.processResponse(this, result.getInputStream(), raceId);
                 }
    -            ExLog.i(this, "MS", "report");
    +            ExLog.i(this, TAG, "report");
                 reportUnsentGPSFixesCount();
             }
         }
     
         /**
          * checks if there is network connectivity
    -     * 
    +     *
          * @return connectivity check value
          */
         private boolean isConnected() {
             NetworkInfo activeNetwork = connectivityManager.getActiveNetworkInfo();
    -        if (activeNetwork == null) {
    -            return false;
    -        }
    -        return activeNetwork.isConnected();
    +        return activeNetwork != null && activeNetwork.isConnected();
         }
    -    
    +
         /**
          * a UUID that identifies this client session; can be used, e.g., to let the server identify subsequent requests coming from the same client
          */
         public final static UUID uuid = UUID.randomUUID();
    -    
    +
         public static String getRaceLogEventSendAndReceiveUrl(Context context, final String raceGroupName,
    -            final String raceName, final String fleetName) throws UnsupportedEncodingException {
    -        String url = String.format("%s/sailingserver/rc/racelog?"+
    -                RaceLogServletConstants.PARAMS_LEADERBOARD_NAME+"=%s&"+
    -                RaceLogServletConstants.PARAMS_RACE_COLUMN_NAME+"=%s&"+
    -                RaceLogServletConstants.PARAMS_RACE_FLEET_NAME+"=%s&"+
    -                RaceLogServletConstants.PARAMS_CLIENT_UUID+"=%s",
    +                                                          final String raceName, final String fleetName) throws UnsupportedEncodingException {
    +        String url = String.format("%s/sailingserver/rc/racelog?" +
    +                        RaceLogServletConstants.PARAMS_LEADERBOARD_NAME + "=%s&" +
    +                        RaceLogServletConstants.PARAMS_RACE_COLUMN_NAME + "=%s&" +
    +                        RaceLogServletConstants.PARAMS_RACE_FLEET_NAME + "=%s&" +
    +                        RaceLogServletConstants.PARAMS_CLIENT_UUID + "=%s",
                     PrefUtils.getString(context, R.string.preference_server_url_key, R.string.preference_server_url_default),
                     URLEncoder.encode(raceGroupName, charsetName),
    -                URLEncoder.encode(raceName, charsetName), 
    -				URLEncoder.encode(fleetName, charsetName), uuid);
    +                URLEncoder.encode(raceName, charsetName),
    +                URLEncoder.encode(fleetName, charsetName), uuid);
             return url;
         }
     
         /**
          * Register listener for API-connectivity
          *
    -     * @param listener
    -     *            class that wants to be notified of api-connectivity changes
    +     * @param listener class that wants to be notified of api-connectivity changes
          */
         public void registerAPIConnectivityListener(APIConnectivityListener listener) {
             apiConnectivityListener = listener;
    @@ -424,8 +419,6 @@ public class MessageSendingService extends Service implements MessageSendingList
     
         /**
          * Report the number of currently unsent GPS-fixes
    -     *
    -     * @param unsentGPSFixesCount
          */
         private void reportUnsentGPSFixesCount() {
             if (apiConnectivityListener != null) {
    diff --git a/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/ui/activities/SendingServiceAwareActivity.java b/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/ui/activities/SendingServiceAwareActivity.java
    index 21b552c66e5..bea1680d8ea 100644
    --- a/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/ui/activities/SendingServiceAwareActivity.java
    +++ b/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/ui/activities/SendingServiceAwareActivity.java
    @@ -20,7 +20,7 @@ import com.sap.sailing.android.shared.services.sending.MessageSendingService.Mes
     import com.sap.sailing.android.shared.util.PrefUtils;
     
     public abstract class SendingServiceAwareActivity extends ResilientActivity {
    -    
    +
         private class MessageSendingServiceConnection implements ServiceConnection, MessageSendingServiceLogger {
             @Override
             public void onServiceConnected(ComponentName className, IBinder service) {
    @@ -55,9 +55,9 @@ public abstract class SendingServiceAwareActivity extends ResilientActivity {
         protected boolean boundSendingService = false;
         protected MessageSendingService sendingService;
         private MessageSendingServiceConnection sendingServiceConnection;
    -    
    +
         private String sendingServiceStatus = "";
    -    
    +
         public SendingServiceAwareActivity() {
             this.sendingServiceConnection = new MessageSendingServiceConnection();
         }
    @@ -65,15 +65,15 @@ public abstract class SendingServiceAwareActivity extends ResilientActivity {
         @Override
         public void onStart() {
             super.onStart();
    -        
    +
             Intent intent = new Intent(this, MessageSendingService.class);
             bindService(intent, sendingServiceConnection, Context.BIND_AUTO_CREATE);
         }
    -    
    +
         @Override
         public void onStop() {
             super.onStop();
    -        
    +
             if (boundSendingService) {
                 unbindService(sendingServiceConnection);
                 boundSendingService = false;
    @@ -83,28 +83,27 @@ public abstract class SendingServiceAwareActivity extends ResilientActivity {
         protected void updateSendingServiceInformation() {
             if (menuItemLive == null)
                 return;
    -        
    +
             if (!boundSendingService)
                 return;
    -        
    -        int errorCount = this.sendingService.getDelayedIntentsCount();
    +
    +        int errorCount = sendingService.getDelayedIntentsCount();
             if (errorCount > 0) {
                 menuItemLive.setIcon(R.drawable.ic_menu_share_red);
                 Date lastSuccessfulSend = this.sendingService.getLastSuccessfulSend();
    -            sendingServiceStatus = String.format("Currently %d events waiting to be sent.\nLast successful sent was at %s", 
    -                    errorCount, lastSuccessfulSend == null ? "never" : lastSuccessfulSend);
    +            sendingServiceStatus = getString(R.string.sending_waiting, errorCount, lastSuccessfulSend == null ? "never" : lastSuccessfulSend);
             } else {
                 menuItemLive.setIcon(R.drawable.ic_menu_share);
    -            sendingServiceStatus = String.format("Currently no event waiting to be sent.", errorCount);
    +            sendingServiceStatus = getString(R.string.sending_no_waiting);
             }
         }
    -    
    +
         /**
          * @return the resource ID for the options menu, {@code 0} if none.
    -     *          The menu item displaying the connection status is added automatically.
    +     * The menu item displaying the connection status is added automatically.
          */
         protected abstract int getOptionsMenuResId();
    -    
    +
         @Override
         public boolean onCreateOptionsMenu(Menu menu) {
             MenuInflater inflater = getMenuInflater();
    @@ -115,7 +114,7 @@ public abstract class SendingServiceAwareActivity extends ResilientActivity {
             }
             return true;
         }
    -    
    +
         @Override
         public boolean onOptionsItemSelected(MenuItem item) {
             if (R.id.options_menu_live == item.getItemId()) {
    @@ -126,7 +125,7 @@ public abstract class SendingServiceAwareActivity extends ResilientActivity {
                 return super.onOptionsItemSelected(item);
             }
         }
    -    
    +
         @Override
         public boolean onPrepareOptionsMenu(Menu menu) {
             updateSendingServiceInformation();
    diff --git a/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/util/AuthCheckTask.java b/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/util/AuthCheckTask.java
    new file mode 100644
    index 00000000000..547ca6b78ff
    --- /dev/null
    +++ b/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/util/AuthCheckTask.java
    @@ -0,0 +1,78 @@
    +package com.sap.sailing.android.shared.util;
    +
    +import java.io.InputStream;
    +import java.io.InputStreamReader;
    +import java.net.MalformedURLException;
    +import java.net.URL;
    +
    +import org.json.simple.JSONObject;
    +import org.json.simple.parser.JSONParser;
    +
    +import android.content.Context;
    +import android.os.AsyncTask;
    +
    +import com.sap.sailing.android.shared.data.http.HttpJsonGetRequest;
    +import com.sap.sailing.android.shared.data.http.HttpRequest;
    +import com.sap.sailing.android.shared.logging.ExLog;
    +
    +public class AuthCheckTask extends AsyncTask {
    +
    +    private static final String TAG = AuthCheckTask.class.getName();
    +
    +    private final static String HELLO_REQUEST = "/security/api/restsecurity/hello";
    +
    +    private Context context;
    +    private URL url;
    +    private AuthCheckTaskListener listener;
    +    private Exception exception;
    +
    +    public AuthCheckTask(Context ctx, String baseUrl, AuthCheckTaskListener taskListener) {
    +        try {
    +            context = ctx;
    +            url = new URL(baseUrl + HELLO_REQUEST);
    +            listener = taskListener;
    +        } catch (MalformedURLException e) {
    +            ExLog.e(context, TAG, "Error: Failed to perform checking due to a MalformedURLException: " + e.getMessage());
    +        }
    +    }
    +
    +    @Override
    +    protected Boolean doInBackground(Void... params) {
    +        Boolean authenticated = false;
    +        if (url != null) {
    +            try {
    +                HttpRequest request = new HttpJsonGetRequest(url, context);
    +                InputStream responseStream = request.execute();
    +
    +                JSONParser parser = new JSONParser();
    +                JSONObject json = (JSONObject) parser.parse(new InputStreamReader(responseStream));
    +                if (json.containsKey("authenticated")) {
    +                    authenticated = (Boolean) json.get("authenticated");
    +                }
    +            } catch (Exception e) {
    +                exception = e;
    +            }
    +        } else {
    +            exception = new IllegalArgumentException();
    +        }
    +        return authenticated;
    +    }
    +
    +    @Override
    +    protected void onPostExecute(Boolean authenticated) {
    +        super.onPostExecute(authenticated);
    +        if (listener != null) {
    +            if (exception != null) {
    +                listener.onException(exception);
    +            } else {
    +                listener.onRequestReceived(authenticated);
    +            }
    +        }
    +    }
    +
    +    public interface AuthCheckTaskListener {
    +        void onRequestReceived(Boolean authenticated);
    +
    +        void onException(Exception exception);
    +    }
    +}
    diff --git a/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/util/LoginTask.java b/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/util/LoginTask.java
    new file mode 100644
    index 00000000000..b10cd51b2d9
    --- /dev/null
    +++ b/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/util/LoginTask.java
    @@ -0,0 +1,77 @@
    +package com.sap.sailing.android.shared.util;
    +
    +import java.io.InputStream;
    +import java.io.InputStreamReader;
    +import java.net.MalformedURLException;
    +import java.net.URL;
    +
    +import org.json.simple.JSONObject;
    +import org.json.simple.parser.JSONParser;
    +
    +import android.content.Context;
    +import android.os.AsyncTask;
    +
    +import com.sap.sailing.android.shared.data.LoginData;
    +import com.sap.sailing.android.shared.data.http.HttpRequest;
    +import com.sap.sailing.android.shared.data.http.LoginGetRequest;
    +import com.sap.sailing.android.shared.logging.ExLog;
    +
    +public class LoginTask extends AsyncTask {
    +
    +    private static final String TAG = LoginTask.class.getName();
    +
    +    private final static String TOKEN_REQUEST = "/security/api/restsecurity/access_token";
    +
    +    private URL url = null;
    +    private Context context;
    +    private LoginTaskListener listener;
    +    private Exception exception;
    +
    +    public LoginTask(Context context, String baseUrl, LoginTaskListener listener) {
    +        try {
    +            this.context = context.getApplicationContext();
    +            this.url = new URL(baseUrl + TOKEN_REQUEST);
    +            this.listener = listener;
    +        } catch (MalformedURLException e) {
    +            ExLog.e(context, TAG, "Error: Failed to perform checking due to a MalformedURLException: " + e.getMessage());
    +        }
    +    }
    +
    +    @Override
    +    protected String doInBackground(LoginData... params) {
    +        String access_token = null;
    +        if (url != null && params != null && params.length > 0) {
    +            try {
    +                HttpRequest request = new LoginGetRequest(url, context, params[0]);
    +                InputStream responseStream = request.execute();
    +
    +                JSONParser parser = new JSONParser();
    +                JSONObject result = (JSONObject) parser.parse(new InputStreamReader(responseStream));
    +                access_token = (String) result.get("access_token");
    +            } catch (Exception e) {
    +                exception = e;
    +            }
    +        } else {
    +            exception = new IllegalArgumentException();
    +        }
    +        return access_token;
    +    }
    +
    +    @Override
    +    protected void onPostExecute(String accessToken) {
    +        super.onPostExecute(accessToken);
    +        if (listener != null) {
    +            if (exception != null) {
    +                listener.onException(exception);
    +            } else {
    +                listener.onTokenReceived(accessToken);
    +            }
    +        }
    +    }
    +
    +    public interface LoginTaskListener {
    +        void onTokenReceived(String accessToken);
    +
    +        void onException(Exception exception);
    +    }
    +}
    diff --git a/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/util/LogoutTask.java b/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/util/LogoutTask.java
    new file mode 100644
    index 00000000000..16ee0a7cabe
    --- /dev/null
    +++ b/mobile/com.sap.sailing.android.shared/src/com/sap/sailing/android/shared/util/LogoutTask.java
    @@ -0,0 +1,44 @@
    +package com.sap.sailing.android.shared.util;
    +
    +import java.io.IOException;
    +import java.net.MalformedURLException;
    +import java.net.URL;
    +
    +import android.content.Context;
    +import android.os.AsyncTask;
    +
    +import com.sap.sailing.android.shared.data.http.HttpJsonGetRequest;
    +import com.sap.sailing.android.shared.data.http.HttpRequest;
    +import com.sap.sailing.android.shared.logging.ExLog;
    +
    +public class LogoutTask extends AsyncTask {
    +
    +    private static final String TAG = LogoutTask.class.getName();
    +    private static final String LOGOUT_REQUEST = "/security/api/restsecurity/remove_access_token";
    +
    +    private Context context;
    +    private URL url;
    +
    +    public LogoutTask(Context ctx, String baseUrl) {
    +        context = ctx;
    +        try {
    +            url = new URL(baseUrl + LOGOUT_REQUEST);
    +        } catch (MalformedURLException e) {
    +            ExLog.e(context, TAG, "Error: Failed to perform checking due to a MalformedURLException: " + e.getMessage());
    +
    +        }
    +    }
    +
    +    @Override
    +    protected Void doInBackground(String... params) {
    +        if (url != null && params != null && params.length > 0) {
    +            HttpRequest request = new HttpJsonGetRequest(url, context);
    +            try {
    +                request.execute();
    +            } catch (IOException e) {
    +                ExLog.e(context, TAG, "Logout not possible: " + e.getMessage());
    +            }
    +        }
    +        return null;
    +    }
    +}
    diff --git a/mobile/com.sap.sailing.android.tracking.app/build.gradle b/mobile/com.sap.sailing.android.tracking.app/build.gradle
    index 6ab855a8544..28f1e791c1f 100644
    --- a/mobile/com.sap.sailing.android.tracking.app/build.gradle
    +++ b/mobile/com.sap.sailing.android.tracking.app/build.gradle
    @@ -75,7 +75,7 @@ dependencies {
         compile "com.google.android.gms:play-services-gcm:${rootProject.ext.play_services}"
         compile "com.google.android.gms:play-services-location:${rootProject.ext.play_services}"
     
    -    /* licence dialog */
    +    /* license dialog */
         compile("de.psdev.licensesdialog:licensesdialog:${rootProject.ext.license_dialog}")
     
         /* local dependencies */
    diff --git a/mobile/com.sap.sailing.android.tracking.app/src/com/sap/sailing/android/tracking/app/ui/fragments/AboutFragment.java b/mobile/com.sap.sailing.android.tracking.app/src/com/sap/sailing/android/tracking/app/ui/fragments/AboutFragment.java
    index 7d6f5906003..076458c080c 100644
    --- a/mobile/com.sap.sailing.android.tracking.app/src/com/sap/sailing/android/tracking/app/ui/fragments/AboutFragment.java
    +++ b/mobile/com.sap.sailing.android.tracking.app/src/com/sap/sailing/android/tracking/app/ui/fragments/AboutFragment.java
    @@ -28,10 +28,10 @@ public class AboutFragment extends com.sap.sailing.android.ui.fragments.BaseFrag
         @Override
         public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
             View view = inflater.inflate(R.layout.fragment_about, container, false);
    -        view.findViewById(R.id.licence_button).setOnClickListener(new View.OnClickListener() {
    +        view.findViewById(R.id.license_button).setOnClickListener(new View.OnClickListener() {
                 @Override
                 public void onClick(View v) {
    -                showLicenceDialog();
    +                showLicenseDialog();
                 }
             });
             view.findViewById(R.id.eula_button).setOnClickListener(new View.OnClickListener() {
    @@ -45,7 +45,7 @@ public class AboutFragment extends com.sap.sailing.android.ui.fragments.BaseFrag
             return view;
         }
     
    -    private void showLicenceDialog() {
    +    private void showLicenseDialog() {
             Notices notices = new Notices();
             LicenseHelper licenseHelper = new LicenseHelper();
             notices.addNotice(licenseHelper.getAndroidSupportNotice());
    @@ -53,7 +53,7 @@ public class AboutFragment extends com.sap.sailing.android.ui.fragments.BaseFrag
             notices.addNotice(licenseHelper.getJsonSimpleNotice());
             notices.addNotice(licenseHelper.getDialogNotice());
             LicensesDialog.Builder builder = new LicensesDialog.Builder(getActivity());
    -        builder.setTitle(getString(R.string.licence_information));
    +        builder.setTitle(getString(R.string.license_information));
             builder.setNotices(notices);
             builder.build().show();
         }
    diff --git a/mobile/com.sap.sailing.buoy.positioning/build.gradle b/mobile/com.sap.sailing.buoy.positioning/build.gradle
    index ea9b08f4f89..6eea899e38c 100644
    --- a/mobile/com.sap.sailing.buoy.positioning/build.gradle
    +++ b/mobile/com.sap.sailing.buoy.positioning/build.gradle
    @@ -74,7 +74,7 @@ dependencies {
         /* Google Play Services */
         compile "com.google.android.gms:play-services-location:${rootProject.ext.play_services}"
     
    -    /* licence dialog */
    +    /* license dialog */
         compile("de.psdev.licensesdialog:licensesdialog:${rootProject.ext.license_dialog}")
     
         /* local dependencies */
    diff --git a/mobile/com.sap.sailing.buoy.positioning/src/com/sap/sailing/android/buoy/positioning/app/ui/fragments/AboutFragment.java b/mobile/com.sap.sailing.buoy.positioning/src/com/sap/sailing/android/buoy/positioning/app/ui/fragments/AboutFragment.java
    index 0c9e56c2652..25cc30fc0f0 100644
    --- a/mobile/com.sap.sailing.buoy.positioning/src/com/sap/sailing/android/buoy/positioning/app/ui/fragments/AboutFragment.java
    +++ b/mobile/com.sap.sailing.buoy.positioning/src/com/sap/sailing/android/buoy/positioning/app/ui/fragments/AboutFragment.java
    @@ -29,10 +29,10 @@ public class AboutFragment extends BaseFragment {
         @Override
         public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
             View view = inflater.inflate(R.layout.fragment_about, container, false);
    -        view.findViewById(R.id.licence_button).setOnClickListener(new View.OnClickListener() {
    +        view.findViewById(R.id.license_button).setOnClickListener(new View.OnClickListener() {
                 @Override
                 public void onClick(View v) {
    -                showLicenceDialog();
    +                showLicenseDialog();
                 }
             });
             view.findViewById(R.id.eula_button).setOnClickListener(new View.OnClickListener() {
    @@ -46,7 +46,7 @@ public class AboutFragment extends BaseFragment {
             return view;
         }
     
    -    private void showLicenceDialog() {
    +    private void showLicenseDialog() {
             Notices notices = new Notices();
             LicenseHelper licenseHelper = new LicenseHelper();
             notices.addNotice(licenseHelper.getAndroidSupportNotice());
    @@ -54,7 +54,7 @@ public class AboutFragment extends BaseFragment {
             notices.addNotice(licenseHelper.getJsonSimpleNotice());
             notices.addNotice(licenseHelper.getDialogNotice());
             LicensesDialog.Builder builder = new LicensesDialog.Builder(getActivity());
    -        builder.setTitle(getString(R.string.licence_information));
    +        builder.setTitle(getString(R.string.license_information));
             builder.setNotices(notices);
             builder.build().show();
         }
    diff --git a/mobile/com.sap.sailing.racecommittee.app/AndroidManifest.xml b/mobile/com.sap.sailing.racecommittee.app/AndroidManifest.xml
    index ff63e9cb333..00b33d16cf3 100644
    --- a/mobile/com.sap.sailing.racecommittee.app/AndroidManifest.xml
    +++ b/mobile/com.sap.sailing.racecommittee.app/AndroidManifest.xml
    @@ -53,6 +53,7 @@
                 
             
             
    +        
             
                 
                     
    diff --git a/mobile/com.sap.sailing.racecommittee.app/build.gradle b/mobile/com.sap.sailing.racecommittee.app/build.gradle
    index 63ec0abbc4d..ff444e72e88 100644
    --- a/mobile/com.sap.sailing.racecommittee.app/build.gradle
    +++ b/mobile/com.sap.sailing.racecommittee.app/build.gradle
    @@ -82,7 +82,7 @@ dependencies {
         /* Google Play Services */
         compile "com.google.android.gms:play-services-location:${rootProject.ext.play_services}"
     
    -    /* licence dialog */
    +    /* license dialog */
         compile("de.psdev.licensesdialog:licensesdialog:${rootProject.ext.license_dialog}")
     
         /* local dependencies */
    diff --git a/mobile/com.sap.sailing.racecommittee.app/res/drawable-hdpi/ic_change_role_white_48dp.png b/mobile/com.sap.sailing.racecommittee.app/res/drawable-hdpi/ic_change_role_white_48dp.png
    new file mode 100644
    index 00000000000..c29cb246f25
    Binary files /dev/null and b/mobile/com.sap.sailing.racecommittee.app/res/drawable-hdpi/ic_change_role_white_48dp.png differ
    diff --git a/mobile/com.sap.sailing.racecommittee.app/res/drawable-mdpi/ic_change_role_white_48dp.png b/mobile/com.sap.sailing.racecommittee.app/res/drawable-mdpi/ic_change_role_white_48dp.png
    new file mode 100644
    index 00000000000..e966f5104b8
    Binary files /dev/null and b/mobile/com.sap.sailing.racecommittee.app/res/drawable-mdpi/ic_change_role_white_48dp.png differ
    diff --git a/mobile/com.sap.sailing.racecommittee.app/res/drawable-xhdpi/ic_change_role_white_48dp.png b/mobile/com.sap.sailing.racecommittee.app/res/drawable-xhdpi/ic_change_role_white_48dp.png
    new file mode 100644
    index 00000000000..b811a20b301
    Binary files /dev/null and b/mobile/com.sap.sailing.racecommittee.app/res/drawable-xhdpi/ic_change_role_white_48dp.png differ
    diff --git a/mobile/com.sap.sailing.racecommittee.app/res/drawable-xxhdpi/ic_change_role_white_48dp.png b/mobile/com.sap.sailing.racecommittee.app/res/drawable-xxhdpi/ic_change_role_white_48dp.png
    new file mode 100644
    index 00000000000..02076b894fb
    Binary files /dev/null and b/mobile/com.sap.sailing.racecommittee.app/res/drawable-xxhdpi/ic_change_role_white_48dp.png differ
    diff --git a/mobile/com.sap.sailing.racecommittee.app/res/drawable-xxxhdpi/ic_change_role_white_48dp.png b/mobile/com.sap.sailing.racecommittee.app/res/drawable-xxxhdpi/ic_change_role_white_48dp.png
    new file mode 100644
    index 00000000000..e4cf3914bd9
    Binary files /dev/null and b/mobile/com.sap.sailing.racecommittee.app/res/drawable-xxxhdpi/ic_change_role_white_48dp.png differ
    diff --git a/mobile/com.sap.sailing.racecommittee.app/res/drawable/nav_drawer_header.png b/mobile/com.sap.sailing.racecommittee.app/res/drawable/nav_drawer_header.png
    index 01fab551c38..b4255dc43b6 100644
    Binary files a/mobile/com.sap.sailing.racecommittee.app/res/drawable/nav_drawer_header.png and b/mobile/com.sap.sailing.racecommittee.app/res/drawable/nav_drawer_header.png differ
    diff --git a/mobile/com.sap.sailing.racecommittee.app/res/drawable/round_button_no_fill.xml b/mobile/com.sap.sailing.racecommittee.app/res/drawable/round_button_no_fill.xml
    new file mode 100644
    index 00000000000..cdff28030c2
    --- /dev/null
    +++ b/mobile/com.sap.sailing.racecommittee.app/res/drawable/round_button_no_fill.xml
    @@ -0,0 +1,2 @@
    +
    +
    diff --git a/mobile/com.sap.sailing.racecommittee.app/res/drawable/round_button_transparent.xml b/mobile/com.sap.sailing.racecommittee.app/res/drawable/round_button_transparent.xml
    new file mode 100644
    index 00000000000..18e08d92f52
    --- /dev/null
    +++ b/mobile/com.sap.sailing.racecommittee.app/res/drawable/round_button_transparent.xml
    @@ -0,0 +1,15 @@
    +
    +
    +
    +    
    +    
    +
    +    
    +    
    +
    +    
    +    
    +
    +    
    +    
    +
    \ No newline at end of file
    diff --git a/mobile/com.sap.sailing.racecommittee.app/res/layout/accuracy.xml b/mobile/com.sap.sailing.racecommittee.app/res/layout/accuracy.xml
    index 80cc48ade0c..bb56ef5802b 100644
    --- a/mobile/com.sap.sailing.racecommittee.app/res/layout/accuracy.xml
    +++ b/mobile/com.sap.sailing.racecommittee.app/res/layout/accuracy.xml
    @@ -29,7 +29,7 @@
     
         
    +
    +
    +    
    +
    +        
    +
    +        
    +
    +        
    +    
    +
    +    
    +
    +        
    +    
    +
    +    
    +
    +        
    +    
    +
    +