From 1ea22dfa5a825e66401f624b628f4d0cd0c6d94d Mon Sep 17 00:00:00 2001 From: Papick Garcia Taboada Date: Wed, 8 Feb 2017 10:11:06 +0100 Subject: [PATCH 01/14] Now using safeuri for URLs from i18 sources --- .../desktop/partials/solutions/Solutions.java | 33 +++++++++++++++++-- .../partials/solutions/Solutions.ui.xml | 14 ++------ .../mobile/partials/solutions/Solutions.java | 23 +++++++++++++ .../partials/solutions/Solutions.ui.xml | 17 ++-------- 4 files changed, 59 insertions(+), 28 deletions(-) diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/partials/solutions/Solutions.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/partials/solutions/Solutions.java index e0ac16c303f..4d604df28b3 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/partials/solutions/Solutions.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/partials/solutions/Solutions.java @@ -2,8 +2,11 @@ package com.sap.sailing.gwt.home.desktop.partials.solutions; import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.Scheduler; +import com.google.gwt.dom.client.AnchorElement; import com.google.gwt.dom.client.DivElement; +import com.google.gwt.dom.client.ImageElement; import com.google.gwt.event.dom.client.ClickEvent; +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.uibinder.client.UiHandler; @@ -20,6 +23,7 @@ import com.sap.sailing.gwt.home.desktop.places.whatsnew.WhatsNewPlace.WhatsNewNa import com.sap.sailing.gwt.home.shared.app.PlaceNavigation; import com.sap.sailing.gwt.home.shared.places.solutions.SolutionsPlace; import com.sap.sailing.gwt.home.shared.places.solutions.SolutionsPlace.SolutionsNavigationTabs; +import com.sap.sailing.gwt.ui.client.StringMessages; public class Solutions extends Composite { interface SolutionsUiBinder extends UiBinder { @@ -29,6 +33,7 @@ public class Solutions extends Composite { private static final HyperlinkImpl HYPERLINK_IMPL = GWT.create(HyperlinkImpl.class); + @UiField StringMessages i18n; @UiField Anchor sailingAnalyticsAnchor; @UiField Anchor raceAnchor; @UiField Anchor inSightAnchor; @@ -44,13 +49,23 @@ public class Solutions extends Composite { @UiField DivElement postRaceDiv; @UiField DivElement simulatorDiv; - @UiField - Anchor sapInSailingAnchor; + @UiField Anchor sapInSailingAnchor; @UiField Anchor sailingAnalyticsDetailsAnchor; @UiField Anchor raceCommitteeAppDetailsAnchor; @UiField Anchor inSightAppDetailsAnchor; @UiField Anchor buoyPingerAppDetailsAnchor; @UiField Anchor simulatorAppDetailsAnchor; + + @UiField AnchorElement raceManagerPlayStoreLinkUi; + @UiField AnchorElement inSightAppStoreLinkUi; + @UiField AnchorElement buoyPingerPlayStoreLinkUi; + @UiField + AnchorElement inSightPlayStoreLinkUi; + + @UiField ImageElement raceManagerPlayStoreImgUi; + @UiField ImageElement inSightPlayStoreImgUi; + @UiField ImageElement buoyPingerPlayStoreImgUi; + @UiField ImageElement inSightAppStoreImgUi; private final PlaceNavigation sapInSailingNavigation; private final PlaceNavigation sailingAnalyticsNavigation; @@ -77,6 +92,20 @@ public class Solutions extends Composite { initWidget(uiBinder.createAndBindUi(this)); + String playstorebadgeSrc = UriUtils.fromString(i18n.playstoreBadge()).asString(); + String insightAppstoreSrc = UriUtils.fromString("images/home/appstore" + i18n.appstoreBadgeSuffix() + ".svg") + .asString(); + + + raceManagerPlayStoreLinkUi.setHref(UriUtils.fromString(i18n.playstoreRacecommitteeApp())); + inSightAppStoreLinkUi.setHref(UriUtils.fromString(i18n.appstoreSapSailInsight())); + buoyPingerPlayStoreLinkUi.setHref(UriUtils.fromString(i18n.playStoreBuoyPingerApp())); + inSightPlayStoreLinkUi.setHref(UriUtils.fromString(i18n.playstoreInsightApp())); + raceManagerPlayStoreImgUi.setSrc(playstorebadgeSrc); + inSightPlayStoreImgUi.setSrc(playstorebadgeSrc); + buoyPingerPlayStoreImgUi.setSrc(playstorebadgeSrc); + inSightAppStoreImgUi.setSrc(insightAppstoreSrc); + sailingAnalyticsDetailsNavigation = placesNavigator.getWhatsNewNavigation(WhatsNewNavigationTabs.SailingAnalytics); raceCommitteeAppDetailsNavigation = placesNavigator.getWhatsNewNavigation(WhatsNewNavigationTabs.RaceManagerApp); inSightAppDetailsNavigation = placesNavigator.getWhatsNewNavigation(WhatsNewNavigationTabs.InSightApp); diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/partials/solutions/Solutions.ui.xml b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/partials/solutions/Solutions.ui.xml index 72e5af6b50c..bbf099c7df5 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/partials/solutions/Solutions.ui.xml +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/partials/solutions/Solutions.ui.xml @@ -47,7 +47,6 @@ -
@@ -138,13 +137,10 @@ class="{style.storeBadgesContainer}" > Get it on Google Play + alt="Get it on Google Play" />
@@ -167,23 +163,19 @@

Get it on AppStore
Get it on Google Play + />
@@ -208,12 +200,10 @@ class="{style.storeBadgesContainer}" > Get it on Google Play
Get it on Google Play + alt="Get it on Google Play" /> @@ -139,25 +136,20 @@

Get it on Google Play + alt="Get it on Google Play"/>
@@ -182,13 +174,10 @@ class="{style.storeBadgesContainer}" > Get it on Google Play + alt="Get it on Google Play"/> From 0f7692030c5ec8496858550527fdc08f88396727 Mon Sep 17 00:00:00 2001 From: Papick Garcia Taboada Date: Wed, 8 Feb 2017 10:11:22 +0100 Subject: [PATCH 02/14] Added missing plural form for [one] --- .../java/com/sap/sailing/gwt/ui/client/StringMessages.properties | 1 + .../com/sap/sailing/gwt/ui/client/StringMessages_de.properties | 1 + 2 files changed, 2 insertions(+) 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 f999351676d..2fa7852c119 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 @@ -1337,6 +1337,7 @@ raceIsPlanned=Planned raceIsCanceled=Abandoned raceIsPostponed=Postponed startingInMinutes=Starts in {0,number} min +startingInMinutes[one]=Starts in {0,number} min startingInMinutes[none]=Starting now latestNews=Latest News resultsUpdate=Result update 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 306298386de..5bef4bae2f5 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 @@ -1325,6 +1325,7 @@ raceIsPlanned=Geplant raceIsCanceled=Abgebrochen raceIsPostponed=Verschoben startingInMinutes=Startet in {0,number} min +startingInMinutes[one]=Startet in {0,number} min startingInMinutes[none]=Startet gleich latestNews=Neuigkeiten resultsUpdate=Neue Ergebnisse From 4893c89fbb6de91de22ba417cf1d7a68a6899be8 Mon Sep 17 00:00:00 2001 From: Papick Garcia Taboada Date: Wed, 8 Feb 2017 10:32:28 +0100 Subject: [PATCH 03/14] Now using saferui for templates --- .../sailing/gwt/ui/adminconsole/ImagesListComposite.java | 6 ++++-- .../gwt/ui/adminconsole/LeaderboardGroupConfigPanel.java | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/ImagesListComposite.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/ImagesListComposite.java index 4cde584a316..04d156ceeca 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/ImagesListComposite.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/ImagesListComposite.java @@ -12,6 +12,8 @@ import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.safehtml.client.SafeHtmlTemplates; import com.google.gwt.safehtml.shared.SafeHtml; import com.google.gwt.safehtml.shared.SafeHtmlBuilder; +import com.google.gwt.safehtml.shared.SafeUri; +import com.google.gwt.safehtml.shared.UriUtils; import com.google.gwt.user.cellview.client.CellTable; import com.google.gwt.user.cellview.client.Column; import com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler; @@ -60,7 +62,7 @@ public class ImagesListComposite extends Composite { interface AnchorTemplates extends SafeHtmlTemplates { @SafeHtmlTemplates.Template("{1}") - SafeHtml cell(String url, String displayName); + SafeHtml cell(SafeUri url, String displayName); } private static AnchorTemplates ANCHORTEMPLATE = GWT.create(AnchorTemplates.class); @@ -155,7 +157,7 @@ public class ImagesListComposite extends Composite { if(index > 0) { linkName = link.substring(index+1, link.length()); } - return ANCHORTEMPLATE.cell(image.getSourceRef(), linkName); + return ANCHORTEMPLATE.cell(UriUtils.fromString(image.getSourceRef()), linkName); } }; diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/LeaderboardGroupConfigPanel.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/LeaderboardGroupConfigPanel.java index 9061e5d3663..4ca286b4ad1 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/LeaderboardGroupConfigPanel.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/LeaderboardGroupConfigPanel.java @@ -15,6 +15,8 @@ import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.safehtml.client.SafeHtmlTemplates; import com.google.gwt.safehtml.shared.SafeHtml; +import com.google.gwt.safehtml.shared.SafeUri; +import com.google.gwt.safehtml.shared.UriUtils; import com.google.gwt.user.cellview.client.CellTable.Resources; import com.google.gwt.user.cellview.client.Column; import com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler; @@ -62,7 +64,7 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements interface AnchorTemplates extends SafeHtmlTemplates { @SafeHtmlTemplates.Template("{1}") - SafeHtml cell(String url, String displayName); + SafeHtml cell(SafeUri url, String displayName); } private static AdminConsoleTableResources tableResources = GWT.create(AdminConsoleTableResources.class); @@ -508,7 +510,7 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements String link = URLEncoder.encode("/gwt/Spectator.html?leaderboardGroupName=" + group.getName() + "&showRaceDetails=true&"+RaceBoardPerspectiveSettings.PARAM_CAN_REPLAY_DURING_LIVE_RACES+"=true" + (debugParam != null && !debugParam.isEmpty() ? "&gwt.codesvr=" + debugParam : "")); - return ANCHORTEMPLATE.cell(link, group.getName()); + return ANCHORTEMPLATE.cell(UriUtils.fromString(link), group.getName()); } }; groupNameColumn.setSortable(true); From ccafb696e490518c369aa62650056912ce46623d Mon Sep 17 00:00:00 2001 From: Papick Garcia Taboada Date: Wed, 8 Feb 2017 13:24:20 +0100 Subject: [PATCH 04/14] Reduced number of GWT compile warnings --- .../places/whatsnew/WhatsNewResources.java | 12 +- .../resources}/BuoyPingerAppNotes.html | 0 .../whatsnew/resources}/InSightAppNotes.html | 0 .../resources}/RaceCommitteeAppNotes.html | 0 .../resources}/SailingAnalyticsNotes.html | 0 .../resources}/SailingSimulatorNotes.html | 0 .../whatsnew/{ => resources}/WhatsNew.css | 0 .../adminconsole/LeaderboardConfigPanel.java | 5 +- .../gwt/ui/adminconsole/RaceTableWrapper.java | 4 +- .../ui/adminconsole/VideosListComposite.java | 6 +- .../shared/controls/MultipleLinkCell.java | 14 +- .../gwt/ui/leaderboard/LeaderboardPanel.java | 970 ++++++++++-------- .../gwt/ui/leaderboard/MinMaxRenderer.java | 23 +- 13 files changed, 566 insertions(+), 468 deletions(-) rename java/com.sap.sailing.gwt.ui/src/main/{resources/com/sap/sailing/gwt/home/solutions => java/com/sap/sailing/gwt/home/desktop/places/whatsnew/resources}/BuoyPingerAppNotes.html (100%) rename java/com.sap.sailing.gwt.ui/src/main/{resources/com/sap/sailing/gwt/home/solutions => java/com/sap/sailing/gwt/home/desktop/places/whatsnew/resources}/InSightAppNotes.html (100%) rename java/com.sap.sailing.gwt.ui/src/main/{resources/com/sap/sailing/gwt/home/solutions => java/com/sap/sailing/gwt/home/desktop/places/whatsnew/resources}/RaceCommitteeAppNotes.html (100%) rename java/com.sap.sailing.gwt.ui/src/main/{resources/com/sap/sailing/gwt/home/solutions => java/com/sap/sailing/gwt/home/desktop/places/whatsnew/resources}/SailingAnalyticsNotes.html (100%) rename java/com.sap.sailing.gwt.ui/src/main/{resources/com/sap/sailing/gwt/home/solutions => java/com/sap/sailing/gwt/home/desktop/places/whatsnew/resources}/SailingSimulatorNotes.html (100%) rename java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/places/whatsnew/{ => resources}/WhatsNew.css (100%) diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/places/whatsnew/WhatsNewResources.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/places/whatsnew/WhatsNewResources.java index 657ffcdefd4..0c53da1cf48 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/places/whatsnew/WhatsNewResources.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/places/whatsnew/WhatsNewResources.java @@ -8,22 +8,22 @@ import com.google.gwt.resources.client.TextResource; public interface WhatsNewResources extends ClientBundle { public static final WhatsNewResources INSTANCE = GWT.create(WhatsNewResources.class); - @Source("com/sap/sailing/gwt/home/solutions/SailingAnalyticsNotes.html") + @Source("resources/SailingAnalyticsNotes.html") public TextResource getSailingAnalyticsNotesHtml(); - @Source("com/sap/sailing/gwt/home/solutions/SailingSimulatorNotes.html") + @Source("resources/SailingSimulatorNotes.html") public TextResource getSailingSimulatorNotesHtml(); - @Source("com/sap/sailing/gwt/home/solutions/RaceCommitteeAppNotes.html") + @Source("resources/RaceCommitteeAppNotes.html") public TextResource getRaceCommitteeAppNotesHtml(); - @Source("com/sap/sailing/gwt/home/solutions/InSightAppNotes.html") + @Source("resources/InSightAppNotes.html") public TextResource getInSightAppNotesHtml(); - @Source("com/sap/sailing/gwt/home/solutions/BuoyPingerAppNotes.html") + @Source("resources/BuoyPingerAppNotes.html") public TextResource getBuoyPingerAppNotesHtml(); - @Source("WhatsNew.css") + @Source("resources/WhatsNew.css") LocalCss css(); public interface LocalCss extends CssResource { diff --git a/java/com.sap.sailing.gwt.ui/src/main/resources/com/sap/sailing/gwt/home/solutions/BuoyPingerAppNotes.html b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/places/whatsnew/resources/BuoyPingerAppNotes.html similarity index 100% rename from java/com.sap.sailing.gwt.ui/src/main/resources/com/sap/sailing/gwt/home/solutions/BuoyPingerAppNotes.html rename to java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/places/whatsnew/resources/BuoyPingerAppNotes.html diff --git a/java/com.sap.sailing.gwt.ui/src/main/resources/com/sap/sailing/gwt/home/solutions/InSightAppNotes.html b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/places/whatsnew/resources/InSightAppNotes.html similarity index 100% rename from java/com.sap.sailing.gwt.ui/src/main/resources/com/sap/sailing/gwt/home/solutions/InSightAppNotes.html rename to java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/places/whatsnew/resources/InSightAppNotes.html 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/java/com/sap/sailing/gwt/home/desktop/places/whatsnew/resources/RaceCommitteeAppNotes.html similarity index 100% rename from java/com.sap.sailing.gwt.ui/src/main/resources/com/sap/sailing/gwt/home/solutions/RaceCommitteeAppNotes.html rename to java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/places/whatsnew/resources/RaceCommitteeAppNotes.html diff --git a/java/com.sap.sailing.gwt.ui/src/main/resources/com/sap/sailing/gwt/home/solutions/SailingAnalyticsNotes.html b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/places/whatsnew/resources/SailingAnalyticsNotes.html similarity index 100% rename from java/com.sap.sailing.gwt.ui/src/main/resources/com/sap/sailing/gwt/home/solutions/SailingAnalyticsNotes.html rename to java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/places/whatsnew/resources/SailingAnalyticsNotes.html diff --git a/java/com.sap.sailing.gwt.ui/src/main/resources/com/sap/sailing/gwt/home/solutions/SailingSimulatorNotes.html b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/places/whatsnew/resources/SailingSimulatorNotes.html similarity index 100% rename from java/com.sap.sailing.gwt.ui/src/main/resources/com/sap/sailing/gwt/home/solutions/SailingSimulatorNotes.html rename to java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/places/whatsnew/resources/SailingSimulatorNotes.html diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/places/whatsnew/WhatsNew.css b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/places/whatsnew/resources/WhatsNew.css similarity index 100% rename from java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/places/whatsnew/WhatsNew.css rename to java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/places/whatsnew/resources/WhatsNew.css diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/LeaderboardConfigPanel.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/LeaderboardConfigPanel.java index 879284e8fad..8ebad350c93 100755 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/LeaderboardConfigPanel.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/LeaderboardConfigPanel.java @@ -18,6 +18,7 @@ import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.safehtml.client.SafeHtmlTemplates; import com.google.gwt.safehtml.shared.SafeHtml; import com.google.gwt.safehtml.shared.SafeHtmlBuilder; +import com.google.gwt.safehtml.shared.SafeUri; import com.google.gwt.safehtml.shared.UriUtils; import com.google.gwt.user.cellview.client.CellTable; import com.google.gwt.user.cellview.client.Column; @@ -78,7 +79,7 @@ TrackedRaceChangedListener, LeaderboardsDisplayer { interface AnchorTemplates extends SafeHtmlTemplates { @SafeHtmlTemplates.Template("{1}") - SafeHtml cell(String url, String displayName); + SafeHtml cell(SafeUri url, String displayName); } public LeaderboardConfigPanel(final SailingServiceAsync sailingService, RegattaRefresher regattaRefresher, @@ -146,7 +147,7 @@ TrackedRaceChangedListener, LeaderboardsDisplayer { leaderboardUrlParams.put("displayName", object.displayName); } String link = EntryPointLinkFactory.createLeaderboardLink(leaderboardUrlParams); - return ANCHORTEMPLATE.cell(link, object.name); + return ANCHORTEMPLATE.cell(UriUtils.fromString(link), object.name); } }; diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/RaceTableWrapper.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/RaceTableWrapper.java index 8a5819a8dbb..4af141ec9fb 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/RaceTableWrapper.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/RaceTableWrapper.java @@ -7,6 +7,7 @@ import java.util.Map; import com.google.gwt.core.client.GWT; import com.google.gwt.safehtml.shared.SafeHtml; import com.google.gwt.safehtml.shared.SafeHtmlUtils; +import com.google.gwt.safehtml.shared.UriUtils; import com.google.gwt.user.cellview.client.Column; import com.google.gwt.user.cellview.client.TextColumn; import com.sap.sailing.domain.common.RegattaNameAndRaceName; @@ -56,7 +57,8 @@ extends TableWrapper { params.put("raceName", raceIdentifier.getRaceName()); params.put("canReplayDuringLiveRaces", "true"); String link = EntryPointLinkFactory.createRaceBoardLink(params); - return ANCHORTEMPLATE.cell(link, raceInLeaderboardDTOAndFleetName.getA().getRaceColumnName()); + return ANCHORTEMPLATE.cell(UriUtils.fromString(link), + raceInLeaderboardDTOAndFleetName.getA().getRaceColumnName()); } else { return SafeHtmlUtils.fromString(raceInLeaderboardDTOAndFleetName.getA().getRaceColumnName()); } diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/VideosListComposite.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/VideosListComposite.java index 9a22dc6182e..8b426fac4e7 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/VideosListComposite.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/VideosListComposite.java @@ -12,6 +12,8 @@ import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.safehtml.client.SafeHtmlTemplates; import com.google.gwt.safehtml.shared.SafeHtml; import com.google.gwt.safehtml.shared.SafeHtmlBuilder; +import com.google.gwt.safehtml.shared.SafeUri; +import com.google.gwt.safehtml.shared.UriUtils; import com.google.gwt.user.cellview.client.CellTable; import com.google.gwt.user.cellview.client.Column; import com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler; @@ -58,7 +60,7 @@ public class VideosListComposite extends Composite { interface AnchorTemplates extends SafeHtmlTemplates { @SafeHtmlTemplates.Template("{1}") - SafeHtml cell(String url, String displayName); + SafeHtml cell(SafeUri url, String displayName); } private static AnchorTemplates ANCHORTEMPLATE = GWT.create(AnchorTemplates.class); @@ -138,7 +140,7 @@ public class VideosListComposite extends Composite { if(linkName.length() >= 25) { linkName = linkName.substring(0, 22) + "..."; } - return ANCHORTEMPLATE.cell(video.getSourceRef(), linkName); + return ANCHORTEMPLATE.cell(UriUtils.fromString(video.getSourceRef()), linkName); } }; diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/controls/MultipleLinkCell.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/controls/MultipleLinkCell.java index 644279225cf..3cb335254a7 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/controls/MultipleLinkCell.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/shared/controls/MultipleLinkCell.java @@ -5,15 +5,17 @@ import static com.google.gwt.dom.client.BrowserEvents.MOUSEDOWN; import java.util.List; +import com.google.gwt.cell.client.AbstractCell; +import com.google.gwt.cell.client.ValueUpdater; import com.google.gwt.core.client.GWT; +import com.google.gwt.dom.client.Element; +import com.google.gwt.dom.client.EventTarget; import com.google.gwt.dom.client.NativeEvent; import com.google.gwt.safehtml.client.SafeHtmlTemplates; import com.google.gwt.safehtml.shared.SafeHtml; -import com.google.gwt.cell.client.AbstractCell; -import com.google.gwt.cell.client.ValueUpdater; -import com.google.gwt.dom.client.Element; -import com.google.gwt.dom.client.EventTarget; import com.google.gwt.safehtml.shared.SafeHtmlBuilder; +import com.google.gwt.safehtml.shared.SafeUri; +import com.google.gwt.safehtml.shared.UriUtils; /** * Represent cell with multiple links. Link is represented as static nested class {@link CellLink}. @@ -76,7 +78,7 @@ public class MultipleLinkCell extends AbstractCell{2}") - SafeHtml cell(String target, String href, String text); + SafeHtml cell(String target, SafeUri href, String text); } private static LinkTemplates linkTemplates = GWT.create(LinkTemplates.class); @@ -137,7 +139,7 @@ public class MultipleLinkCell extends AbstractCell"); } - rendered = linkTemplates.cell(link.getTarget(), link.getHref(), link.getText()); + rendered = linkTemplates.cell(link.getTarget(), UriUtils.fromString(link.getHref()), link.getText()); sb.append(rendered); } } diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/leaderboard/LeaderboardPanel.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/leaderboard/LeaderboardPanel.java index ff6d143bc2f..e2eaf31cc1d 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/leaderboard/LeaderboardPanel.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/leaderboard/LeaderboardPanel.java @@ -30,6 +30,8 @@ import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.shared.HandlerRegistration; import com.google.gwt.i18n.client.NumberFormat; import com.google.gwt.resources.client.ImageResource; +import com.google.gwt.safecss.shared.SafeStyles; +import com.google.gwt.safecss.shared.SafeStylesBuilder; import com.google.gwt.safehtml.client.SafeHtmlTemplates; import com.google.gwt.safehtml.shared.SafeHtml; import com.google.gwt.safehtml.shared.SafeHtmlBuilder; @@ -130,246 +132,216 @@ import com.sap.sse.gwt.client.useragent.UserAgentDetails; * @author Axel Uhl (D043530) * */ -public class LeaderboardPanel extends SimplePanel implements Component, TimeListener, PlayStateListener, DisplayedLeaderboardRowsProvider, - IsEmbeddableComponent, CompetitorSelectionChangeListener, LeaderboardFetcher, BusyStateProvider, LeaderboardUpdateProvider { +public class LeaderboardPanel extends SimplePanel implements Component, TimeListener, + PlayStateListener, DisplayedLeaderboardRowsProvider, IsEmbeddableComponent, CompetitorSelectionChangeListener, + LeaderboardFetcher, BusyStateProvider, LeaderboardUpdateProvider { public static final String LOAD_LEADERBOARD_DATA_CATEGORY = "loadLeaderboardData"; - protected static final NumberFormat scoreFormat = NumberFormat.getFormat("0.##"); - private final SailingServiceAsync sailingService; - private static String IS_LIVE_TEXT_COLOR = "#FF0000"; private static String DEFAULT_TEXT_COLOR = "#000000"; - private static final String STYLE_LEADERBOARD_CONTENT = "leaderboardContent"; private static final String STYLE_LEADERBOARD_INFO = "leaderboardInfo"; private static final String STYLE_LEADERBOARD_TOOLBAR = "leaderboardContent-toolbar"; private static final String STYLE_LEADERBOARD_LIVE_RACE = "leaderboardContent-liverace"; - - interface RaceColumnTemplates extends SafeHtmlTemplates { - @SafeHtmlTemplates.Template("
") - SafeHtml cellFrameWithTextColorAndFleetBorder(String textColor, String borderStyle); + private static RaceColumnTemplate raceColumnTemplate = new RaceColumnTemplate(); - @SafeHtmlTemplates.Template("
") - SafeHtml cellFrameWithTextColor(String textColor); - @SafeHtmlTemplates.Template("
") - SafeHtml cellWithImageResourceAndText(ImageResource image, String text); + static class RaceColumnTemplate { + private MyTemplate template = GWT.create(MyTemplate.class); + + interface MyTemplate extends SafeHtmlTemplates { + @SafeHtmlTemplates.Template("
") + SafeHtml styledDiv(SafeStyles style); + } + + /** + * Originally in the safehtml template: color:{0}; border-bottom: 3px solid {1}; + * + * @param textColor + * @param borderColor + * @return + */ + public SafeHtml cellFrameWithTextColorAndFleetBorder(String textColor, String borderColor) { + SafeStylesBuilder sb = new SafeStylesBuilder(); + sb.trustedColor(textColor); + sb.trustedNameAndValue("border-bottom", "3px solid " + borderColor); + return template.styledDiv(sb.toSafeStyles()); + } + + /** + * + * Originally in the safehtml template: color:{0}; + * + * @param textColor + * @return + */ + public SafeHtml cellFrameWithTextColor(String textColor) { + SafeStylesBuilder sb = new SafeStylesBuilder(); + sb.trustedColor(textColor); + return template.styledDiv(sb.toSafeStyles()); + } } - private static RaceColumnTemplates raceColumnTemplate = GWT.create(RaceColumnTemplates.class); - /** * The leaderboard name is used to * {@link SailingServiceAsync#getLeaderboardByName(String, java.util.Date, String[], boolean, String, com.google.gwt.user.client.rpc.AsyncCallback) * obtain the leaderboard contents} from the server. It may change in case the leaderboard is renamed. */ private String leaderboardName; - private final ErrorReporter errorReporter; - private final StringMessages stringMessages; - private final FlushableSortedCellTableWithStylableHeaders leaderboardTable; - private final MultiSelectionModel leaderboardSelectionModel; - private LeaderboardDTO leaderboard; - private final TotalRankColumn totalRankColumn; - private final SelectionCheckboxColumn selectionCheckboxColumn; - /** * Passed to the {@link ManeuverCountRaceColumn}. Modifications to this list will modify the column's children list * when updated the next time. */ private final List selectedManeuverDetails; - /** * Passed to the {@link LegColumn}. Modifications to this list will modify the column's children list when updated * the next time. */ private final List selectedLegDetails; - /** * Passed to the {@link TextRaceColumn}. Modifications to this list will modify the column's children list when * updated the next time. */ private final List selectedRaceDetails; - private final List selectedOverallDetailColumns; - private final Map> overallDetailColumnMap; - private RaceColumnSelection raceColumnSelection; - protected final String RACE_COLUMN_HEADER_STYLE; - protected final String LEG_DETAIL_COLUMN_HEADER_STYLE; - protected final String LEG_DETAIL_COLUMN_STYLE; - protected final String LEG_COLUMN_HEADER_STYLE; - protected final String RACE_COLUMN_STYLE; - protected final String LEG_COLUMN_STYLE; - protected final String TOTAL_COLUMN_STYLE; - private final Timer timer; - /** - * A {@link LeaderboardDTO} tells something about the live delay through its {@link LeaderboardDTO#getDelayToLiveInMillisForLatestRace()} method. - * If this flag is true, the live delay in the {@link #timer} will be adjusted each time the {@link #updateLeaderboard(LeaderboardDTO)} - * method is invoked. Otherwise, the timer's delay will be left alone which is helpful, e.g., if the leaderboard panel is embedded - * in a race board panel that focuses on one particular race which may not be the same as the one controlling the leaderboard's overall - * live delay. + * A {@link LeaderboardDTO} tells something about the live delay through its + * {@link LeaderboardDTO#getDelayToLiveInMillisForLatestRace()} method. If this flag is true, the live + * delay in the {@link #timer} will be adjusted each time the {@link #updateLeaderboard(LeaderboardDTO)} method is + * invoked. Otherwise, the timer's delay will be left alone which is helpful, e.g., if the leaderboard panel is + * embedded in a race board panel that focuses on one particular race which may not be the same as the one + * controlling the leaderboard's overall live delay. */ private final boolean adjustTimerDelay; - private boolean autoExpandPreSelectedRace; - private boolean autoExpandLastRaceColumn; - /** - * When true, the race columns don't display the competitors' scores in the race represented by the column - * but the cumulative score up to that race. + * When true, the race columns don't display the competitors' scores in the race represented by the + * column but the cumulative score up to that race. */ private boolean showAddedScores; - private boolean showCompetitorSailId; private boolean showCompetitorFullName; - /** - * When true then an additional column just before the overall points is displayed that sums up - * the number of races sailed per competitor. + * When true then an additional column just before the overall points is displayed that sums up the + * number of races sailed per competitor. */ private boolean showOverallColumnWithNumberOfRacesCompletedPerCompetitor; - /** * Remembers whether the auto-expand of the pre-selected race (see {@link #autoExpandPreSelectedRace}) or last * selected race {@link #autoExpandLastRaceColumn} has been performed once. It must not be performed another time. */ private boolean autoExpandPerformedOnce; - /** * This anchor's HTML holds the image tag for the play/pause button that needs to be updated when the {@link #timer} * changes its playing state */ private Anchor playPause; - private final CompetitorSelectionProvider competitorSelectionProvider; private final HorizontalPanel filterControlPanel; private Label filterStatusLabel; private Button filterClearButton; - /** * The handler for changes in the leaderboard table's selection; its registration is kept in - * {@link #leaderboardAsTableSelectionModelRegistration} while it is registered as a selection handler - * on the {@link #leaderboardTable}. + * {@link #leaderboardAsTableSelectionModelRegistration} while it is registered as a selection handler on the + * {@link #leaderboardTable}. */ private final Handler selectionChangeHandler; - /** * While the {@link #selectionChangeHandler} is registered as a selection change handler on the - * {@link #leaderboardTable}'s selection model, this field holds the registration which can be used to - * remove the registration again. We'll use this to temporarily suspend selection events when actively - * modifying / adjusting the table selection to match the {@link #competitorSelectionProvider}. + * {@link #leaderboardTable}'s selection model, this field holds the registration which can be used to remove the + * registration again. We'll use this to temporarily suspend selection events when actively modifying / adjusting + * the table selection to match the {@link #competitorSelectionProvider}. */ private HandlerRegistration leaderboardAsTableSelectionModelRegistration; - /** * If this is null, all leaderboard columns added by updating the leaderboard from the server are - * automatically added to the table. Otherwise, only the column whose - * {@link RaceColumnDTO#getRaceIdentifier(String) race identifier} matches the value of this attribute will be - * added. + * automatically added to the table. Otherwise, only the column whose {@link RaceColumnDTO#getRaceIdentifier(String) + * race identifier} matches the value of this attribute will be added. */ private final RegattaAndRaceIdentifier preSelectedRace; - private final FlowPanel contentPanel; - private HorizontalPanel refreshAndSettingsPanel; private Label scoreCorrectionLastUpdateTimeLabel; private Label scoreCorrectionCommentLabel; - private Label liveRaceLabel; - + private Label liveRaceLabel; private boolean isEmbedded; - private static final LeaderboardResources resources = GWT.create(LeaderboardResources.class); private static final ComponentResources componentResources = GWT.create(ComponentResources.class); private static final LeaderboardTableResources tableResources = GWT.create(LeaderboardTableResources.class); - private ImageResource pauseIcon; private ImageResource playIcon; - /** - * For a leaderboard, zero or more tasks may be currently busy. The counter keeps track. If it goes - * to {@code 0}, the {@link #busyIndicator} is set to non-busy. If it goes from {@code 0} to {@code 1} - * the {@link #busyIndicator} is set to busy. + * For a leaderboard, zero or more tasks may be currently busy. The counter keeps track. If it goes to {@code 0}, + * the {@link #busyIndicator} is set to non-busy. If it goes from {@code 0} to {@code 1} the {@link #busyIndicator} + * is set to busy. */ private int busyTaskCounter; private final BusyIndicator busyIndicator; private final Set busyStateChangeListeners; - /** * Tells whether the leaderboard settings were explicitly changed by an external call to * {@link #updateSettings(LeaderboardSettings)}. If so, a {@link #playStateChanged(PlayStates, PlayModes) play state * change} will not automatically lead to a settings change. */ private boolean settingsUpdatedExplicitly = false; - /** * Tells if the leaderboard is currently handling a {@link #playStateChanged(PlayStates, PlayModes) play state * change}. If this is the case, a call to {@link #updateSettings(LeaderboardSettings)} won't set the * {@link #settingsUpdatedExplicitly} flag. */ private boolean currentlyHandlingPlayStateChange; - private PlayModes oldPlayMode; - private final AsyncActionsExecutor asyncActionsExecutor; - /** * See also {@link #getDefaultSortColumn()}. If no other column is explicitly selected for sorting and this * attribute holds a non-null string identifying a valid race by name that is represented in this * leaderboard panel then sort by it. Otherwise, default sorting will default to the overall rank column. */ private String raceNameForDefaultSorting; - /** * Can be used to disallow users to drill into the race details. */ private final boolean showRaceDetails; - /** - * The {@link LastNRacesColumnSelection} column selection strategy requires a {@link RaceTimesInfoProvider}. This can either be injected - * by passing a non-null object of that type to the constructor, or such an object is created and remembered in this - * attribute when required the first time. + * The {@link LastNRacesColumnSelection} column selection strategy requires a {@link RaceTimesInfoProvider}. This + * can either be injected by passing a non-null object of that type to the constructor, or such an + * object is created and remembered in this attribute when required the first time. */ private RaceTimesInfoProvider raceTimesInfoProvider; private RaceTimesInfoProviderListener raceTimesInfoProviderListener; - private int blurInOnSelectionChanged; - /** - * When an element in the leaderboard receives focus, it needs to be blurred again to keep the surrounding scroll panel - * from scrolling anything into view + * When an element in the leaderboard receives focus, it needs to be blurred again to keep the surrounding scroll + * panel from scrolling anything into view */ private Element elementToBlur; private boolean showSelectionCheckbox; - private final List leaderboardUpdateListener; - private boolean initialCompetitorFilterHasBeenApplied = false; private final boolean showCompetitorFilterStatus; - private CompetitorFilterPanel competitorFilterPanel; - /** - * Whether or not a second scroll bar, synchronized with the invisible native scroll bar, shall appear at - * the bottom of the viewport. See {@link OverlayAssistantScrollPanel}. + * Whether or not a second scroll bar, synchronized with the invisible native scroll bar, shall appear at the bottom + * of the viewport. See {@link OverlayAssistantScrollPanel}. */ private final boolean enableSyncedScroller; @@ -399,9 +371,9 @@ public class LeaderboardPanel extends SimplePanel implements Component> columnsToExpandAgain = new ArrayList>(); for (int i = 0; i < getLeaderboardTable().getColumnCount(); i++) { Column c = getLeaderboardTable().getColumn(i); @@ -478,7 +451,8 @@ public class LeaderboardPanel extends SimplePanel implements Component raceColumnByRaceName = getRaceColumnByRaceName(newSettings.getNameOfRaceToSort()); + final RaceColumn raceColumnByRaceName = getRaceColumnByRaceName( + newSettings.getNameOfRaceToSort()); if (raceColumnByRaceName != null) { getLeaderboardTable().sortColumn(raceColumnByRaceName, /* ascending */true); } @@ -527,7 +501,8 @@ public class LeaderboardPanel extends SimplePanel implements Component( new AsyncCallback() { @Override @@ -550,7 +525,7 @@ public class LeaderboardPanel extends SimplePanel implements Component raceTimesInfo, long clientTimeWhenRequestWasSent, Date serverTimeDuringRequest, long clientTimeWhenResponseWasReceived) { - // remove - timer.adjustClientServerOffset(clientTimeWhenRequestWasSent, serverTimeDuringRequest, clientTimeWhenResponseWasReceived); + public void raceTimesInfosReceived(Map raceTimesInfo, + long clientTimeWhenRequestWasSent, Date serverTimeDuringRequest, + long clientTimeWhenResponseWasReceived) { + // remove + timer.adjustClientServerOffset(clientTimeWhenRequestWasSent, serverTimeDuringRequest, + clientTimeWhenResponseWasReceived); // remove the listener only in case a leaderboard has already been loaded - if(getLeaderboard() != null) { + if (getLeaderboard() != null) { updateLeaderboard(getLeaderboard()); getRaceTimesInfoProvider().removeRaceTimesInfoProviderListener(raceTimesInfoProviderListener); raceTimesInfoProviderListener = null; @@ -582,9 +560,10 @@ public class LeaderboardPanel extends SimplePanel implements Component + * A leaderboard panel may have been provided with a valid {@link RaceTimesInfoProvider} upon creation; in this + * case, that object will be returned. If none was provided to the constructor, one is created and remembered if no + * previously created/remembered object exists. + *

* * Precondition: {@link #timer} is not null */ @@ -601,20 +580,21 @@ public class LeaderboardPanel extends SimplePanel implements Component { private final CompetitorColumnBase base; - + protected CompetitorColumn(CompetitorColumnBase base) { super(base.getCell(getLeaderboard()), SortingOrder.ASCENDING, LeaderboardPanel.this); this.base = base; } - public CompetitorColumn(CompositeCell compositeCell, CompetitorColumnBase base) { + public CompetitorColumn(CompositeCell compositeCell, + CompetitorColumnBase base) { super(compositeCell, SortingOrder.ASCENDING, LeaderboardPanel.this); this.base = base; } @@ -643,11 +623,11 @@ public class LeaderboardPanel extends SimplePanel implements Component extends LeaderboardSortableColumnWithMinMax { private final CompetitorFetcher competitorFetcher; - + protected SailIDColumn(CompetitorFetcher competitorFetcher) { super(new TextCell(), SortingOrder.ASCENDING, LeaderboardPanel.this); this.competitorFetcher = competitorFetcher; @@ -680,16 +660,19 @@ public class LeaderboardPanel extends SimplePanel implements Component() { @Override public int compare(T o1, T o2) { - return competitorFetcher.getCompetitor(o1).getSailID() == null ? competitorFetcher.getCompetitor(o2).getSailID() == null ? 0 : -1 - : competitorFetcher.getCompetitor(o2).getSailID() == null ? 1 : Collator.getInstance().compare( - competitorFetcher.getCompetitor(o1).getSailID(), competitorFetcher.getCompetitor(o2).getSailID()); + return competitorFetcher.getCompetitor(o1).getSailID() == null + ? competitorFetcher.getCompetitor(o2).getSailID() == null ? 0 : -1 + : competitorFetcher.getCompetitor(o2).getSailID() == null ? 1 + : Collator.getInstance().compare(competitorFetcher.getCompetitor(o1).getSailID(), + competitorFetcher.getCompetitor(o2).getSailID()); } }; } @Override public SafeHtmlHeader getHeader() { - return new SafeHtmlHeaderWithTooltip(SafeHtmlUtils.fromString(stringMessages.competitor()), stringMessages.sailIdColumnTooltip()); + return new SafeHtmlHeaderWithTooltip(SafeHtmlUtils.fromString(stringMessages.competitor()), + stringMessages.sailIdColumnTooltip()); } @Override @@ -698,20 +681,21 @@ public class LeaderboardPanel extends SimplePanel implements Component"); } - if (flagImageURL != null && !flagImageURL.isEmpty()) { - sb.appendHtmlConstant(""); + sb.appendHtmlConstant(""); sb.appendHtmlConstant(" "); } else { final ImageResource flagImageResource; - if (twoLetterIsoCountryCode==null || twoLetterIsoCountryCode.isEmpty()) { + if (twoLetterIsoCountryCode == null || twoLetterIsoCountryCode.isEmpty()) { flagImageResource = FlagImageResolver.getEmptyFlagImageResource(); } else { flagImageResource = FlagImageResolver.getFlagImageResource(twoLetterIsoCountryCode); @@ -742,12 +726,11 @@ public class LeaderboardPanel extends SimplePanel implements Component extends ExpandableSortableColumn { private RaceColumnDTO race; - private final String headerStyle; private final String columnStyle; - public RaceColumn(RaceColumnDTO race, boolean enableExpansion, Cell cell, - SortingOrder preferredSortingOrder, String headerStyle, String columnStyle) { + public RaceColumn(RaceColumnDTO race, boolean enableExpansion, Cell cell, SortingOrder preferredSortingOrder, + String headerStyle, String columnStyle) { super(LeaderboardPanel.this, enableExpansion, cell, preferredSortingOrder, stringMessages, LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, selectedRaceDetails, LeaderboardPanel.this); setHorizontalAlignment(ALIGN_CENTER); @@ -759,9 +742,9 @@ public class LeaderboardPanel extends SimplePanel implements Component"); } - html.appendEscaped(entry.reasonForMaxPoints == MaxPointsReason.NONE ? "" : entry.reasonForMaxPoints.name()); + html.appendEscaped( + entry.reasonForMaxPoints == MaxPointsReason.NONE ? "" : entry.reasonForMaxPoints.name()); if (entry.discarded) { html.appendHtmlConstant(""); } @@ -864,21 +849,21 @@ public class LeaderboardPanel extends SimplePanel implements Component 0 ? 1 : intermediate_result < 0 ? -1 : 0; } else { result = intermediate_result > 0 ? -1 : intermediate_result < 0 ? 1 : 0; } } else { - List competitorsFromBestToWorst = getLeaderboard().getCompetitorsFromBestToWorst( - race); + List competitorsFromBestToWorst = getLeaderboard() + .getCompetitorsFromBestToWorst(race); int o1Rank = competitorsFromBestToWorst.indexOf(o1.competitor) + 1; int o2Rank = competitorsFromBestToWorst.indexOf(o2.competitor) + 1; - result = o1Rank == 0 ? o2Rank == 0 ? 0 : isAscending() ? 1 : -1 : o2Rank == 0 ? isAscending() ? -1 - : 1 : o1Rank - o2Rank; + result = o1Rank == 0 ? o2Rank == 0 ? 0 : isAscending() ? 1 : -1 + : o2Rank == 0 ? isAscending() ? -1 : 1 : o1Rank - o2Rank; } return result; } @@ -892,24 +877,26 @@ public class LeaderboardPanel extends SimplePanel implements Component getHeader() { - SortableExpandableColumnHeader header = new SortableExpandableColumnHeader(/* title */race.getRaceColumnName(), - /* iconURL */race.isMedalRace() ? "/gwt/images/medal_small.png" : null, LeaderboardPanel.this, this, stringMessages); + SortableExpandableColumnHeader header = new SortableExpandableColumnHeader( + /* title */race.getRaceColumnName(), + /* iconURL */race.isMedalRace() ? "/gwt/images/medal_small.png" : null, LeaderboardPanel.this, this, + stringMessages); return header; } } public static DetailType[] getAvailableRaceDetailColumnTypes() { return new DetailType[] { DetailType.RACE_GAP_TO_LEADER_IN_SECONDS, - DetailType.RACE_AVERAGE_SPEED_OVER_GROUND_IN_KNOTS, - DetailType.RACE_DISTANCE_TRAVELED, DetailType.RACE_DISTANCE_TRAVELED_INCLUDING_GATE_START, - DetailType.RACE_TIME_TRAVELED, DetailType.RACE_CALCULATED_TIME_TRAVELED, + DetailType.RACE_AVERAGE_SPEED_OVER_GROUND_IN_KNOTS, DetailType.RACE_DISTANCE_TRAVELED, + DetailType.RACE_DISTANCE_TRAVELED_INCLUDING_GATE_START, DetailType.RACE_TIME_TRAVELED, + DetailType.RACE_CALCULATED_TIME_TRAVELED, DetailType.RACE_CALCULATED_TIME_AT_ESTIMATED_ARRIVAL_AT_COMPETITOR_FARTHEST_AHEAD, - DetailType.RACE_CURRENT_SPEED_OVER_GROUND_IN_KNOTS, DetailType.RACE_CURRENT_RIDE_HEIGHT_IN_METERS, - DetailType.RACE_DISTANCE_TO_COMPETITOR_FARTHEST_AHEAD_IN_METERS, - DetailType.NUMBER_OF_MANEUVERS, DetailType.DISPLAY_LEGS, DetailType.CURRENT_LEG, + DetailType.RACE_CURRENT_SPEED_OVER_GROUND_IN_KNOTS, DetailType.RACE_CURRENT_RIDE_HEIGHT_IN_METERS, + DetailType.RACE_DISTANCE_TO_COMPETITOR_FARTHEST_AHEAD_IN_METERS, DetailType.NUMBER_OF_MANEUVERS, + DetailType.DISPLAY_LEGS, DetailType.CURRENT_LEG, DetailType.RACE_AVERAGE_ABSOLUTE_CROSS_TRACK_ERROR_IN_METERS, DetailType.RACE_AVERAGE_SIGNED_CROSS_TRACK_ERROR_IN_METERS, - DetailType.RACE_RATIO_BETWEEN_TIME_SINCE_LAST_POSITION_FIX_AND_AVERAGE_SAMPLING_INTERVAL}; + DetailType.RACE_RATIO_BETWEEN_TIME_SINCE_LAST_POSITION_FIX_AND_AVERAGE_SAMPLING_INTERVAL }; } public static DetailType[] getAvailableRaceStartAnalysisColumnTypes() { @@ -921,13 +908,10 @@ public class LeaderboardPanel extends SimplePanel implements Component implements RaceNameProvider { @@ -965,71 +949,96 @@ public class LeaderboardPanel extends SimplePanel implements Component> result = new HashMap<>(); result.put(DetailType.RACE_RATIO_BETWEEN_TIME_SINCE_LAST_POSITION_FIX_AND_AVERAGE_SAMPLING_INTERVAL, - new TimeSinceLastGpsFixColumn(DetailType.RACE_RATIO_BETWEEN_TIME_SINCE_LAST_POSITION_FIX_AND_AVERAGE_SAMPLING_INTERVAL, - new RaceRatioBetweenTimeSinceLastPositionFixAndAverageSamplingInterval(), LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, LeaderboardPanel.this)); + new TimeSinceLastGpsFixColumn( + DetailType.RACE_RATIO_BETWEEN_TIME_SINCE_LAST_POSITION_FIX_AND_AVERAGE_SAMPLING_INTERVAL, + new RaceRatioBetweenTimeSinceLastPositionFixAndAverageSamplingInterval(), + LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, LeaderboardPanel.this)); result.put(DetailType.RACE_DISTANCE_TRAVELED, - new FormattedDoubleDetailTypeColumn(DetailType.RACE_DISTANCE_TRAVELED, new RaceDistanceTraveledInMeters(), - LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, LeaderboardPanel.this)); + new FormattedDoubleDetailTypeColumn(DetailType.RACE_DISTANCE_TRAVELED, + new RaceDistanceTraveledInMeters(), LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, + LeaderboardPanel.this)); result.put(DetailType.RACE_DISTANCE_TRAVELED_INCLUDING_GATE_START, - new FormattedDoubleDetailTypeColumn(DetailType.RACE_DISTANCE_TRAVELED_INCLUDING_GATE_START, new RaceDistanceTraveledIncludingGateStartInMeters(), - LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, LeaderboardPanel.this)); - result.put(DetailType.RACE_AVERAGE_SPEED_OVER_GROUND_IN_KNOTS, - new FormattedDoubleDetailTypeColumn(DetailType.RACE_AVERAGE_SPEED_OVER_GROUND_IN_KNOTS, new RaceAverageSpeedInKnots(), - LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, LeaderboardPanel.this)); + new FormattedDoubleDetailTypeColumn(DetailType.RACE_DISTANCE_TRAVELED_INCLUDING_GATE_START, + new RaceDistanceTraveledIncludingGateStartInMeters(), LEG_COLUMN_HEADER_STYLE, + LEG_COLUMN_STYLE, LeaderboardPanel.this)); + result.put(DetailType.RACE_AVERAGE_SPEED_OVER_GROUND_IN_KNOTS, + new FormattedDoubleDetailTypeColumn(DetailType.RACE_AVERAGE_SPEED_OVER_GROUND_IN_KNOTS, + new RaceAverageSpeedInKnots(), LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, + LeaderboardPanel.this)); result.put(DetailType.RACE_GAP_TO_LEADER_IN_SECONDS, - new FormattedDoubleDetailTypeColumn(DetailType.RACE_GAP_TO_LEADER_IN_SECONDS, new RaceGapToLeaderInSeconds(), - LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, LeaderboardPanel.this)); + new FormattedDoubleDetailTypeColumn(DetailType.RACE_GAP_TO_LEADER_IN_SECONDS, + new RaceGapToLeaderInSeconds(), LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, + LeaderboardPanel.this)); result.put(DetailType.RACE_CURRENT_SPEED_OVER_GROUND_IN_KNOTS, - new FormattedDoubleDetailTypeColumn(DetailType.RACE_CURRENT_SPEED_OVER_GROUND_IN_KNOTS, new RaceCurrentSpeedOverGroundInKnots(), - LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, LeaderboardPanel.this)); - result.put(DetailType.RACE_CURRENT_RIDE_HEIGHT_IN_METERS, new RideHeightColumn(DetailType.RACE_CURRENT_RIDE_HEIGHT_IN_METERS, - new RaceCurrentRideHeightInMeters(), LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, LeaderboardPanel.this)); + new FormattedDoubleDetailTypeColumn(DetailType.RACE_CURRENT_SPEED_OVER_GROUND_IN_KNOTS, + new RaceCurrentSpeedOverGroundInKnots(), LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, + LeaderboardPanel.this)); + result.put(DetailType.RACE_CURRENT_RIDE_HEIGHT_IN_METERS, + new RideHeightColumn(DetailType.RACE_CURRENT_RIDE_HEIGHT_IN_METERS, + new RaceCurrentRideHeightInMeters(), LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, + LeaderboardPanel.this)); result.put(DetailType.RACE_DISTANCE_TO_COMPETITOR_FARTHEST_AHEAD_IN_METERS, - new FormattedDoubleDetailTypeColumn(DetailType.RACE_DISTANCE_TO_COMPETITOR_FARTHEST_AHEAD_IN_METERS, new RaceDistanceToCompetitorFarthestAheadInMeters(), - LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, LeaderboardPanel.this)); + new FormattedDoubleDetailTypeColumn(DetailType.RACE_DISTANCE_TO_COMPETITOR_FARTHEST_AHEAD_IN_METERS, + new RaceDistanceToCompetitorFarthestAheadInMeters(), LEG_COLUMN_HEADER_STYLE, + LEG_COLUMN_STYLE, LeaderboardPanel.this)); result.put(DetailType.RACE_AVERAGE_ABSOLUTE_CROSS_TRACK_ERROR_IN_METERS, - new FormattedDoubleDetailTypeColumn(DetailType.RACE_AVERAGE_ABSOLUTE_CROSS_TRACK_ERROR_IN_METERS, new RaceAverageAbsoluteCrossTrackErrorInMeters(), - LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, LeaderboardPanel.this)); + new FormattedDoubleDetailTypeColumn(DetailType.RACE_AVERAGE_ABSOLUTE_CROSS_TRACK_ERROR_IN_METERS, + new RaceAverageAbsoluteCrossTrackErrorInMeters(), LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, + LeaderboardPanel.this)); result.put(DetailType.RACE_AVERAGE_SIGNED_CROSS_TRACK_ERROR_IN_METERS, - new FormattedDoubleDetailTypeColumn(DetailType.RACE_AVERAGE_SIGNED_CROSS_TRACK_ERROR_IN_METERS, new RaceAverageSignedCrossTrackErrorInMeters(), - LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, LeaderboardPanel.this)); + new FormattedDoubleDetailTypeColumn(DetailType.RACE_AVERAGE_SIGNED_CROSS_TRACK_ERROR_IN_METERS, + new RaceAverageSignedCrossTrackErrorInMeters(), LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, + LeaderboardPanel.this)); result.put(DetailType.RACE_DISTANCE_TO_START_FIVE_SECONDS_BEFORE_RACE_START, - new FormattedDoubleDetailTypeColumn(DetailType.RACE_DISTANCE_TO_START_FIVE_SECONDS_BEFORE_RACE_START, new DistanceToStartFiveSecondsBeforeStartInMeters(), - LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, LeaderboardPanel.this)); + new FormattedDoubleDetailTypeColumn( + DetailType.RACE_DISTANCE_TO_START_FIVE_SECONDS_BEFORE_RACE_START, + new DistanceToStartFiveSecondsBeforeStartInMeters(), LEG_COLUMN_HEADER_STYLE, + LEG_COLUMN_STYLE, LeaderboardPanel.this)); result.put(DetailType.RACE_SPEED_OVER_GROUND_FIVE_SECONDS_BEFORE_START, - new FormattedDoubleDetailTypeColumn(DetailType.RACE_SPEED_OVER_GROUND_FIVE_SECONDS_BEFORE_START, new SpeedFiveSecondsBeforeStartInKnots(), - LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, LeaderboardPanel.this)); + new FormattedDoubleDetailTypeColumn(DetailType.RACE_SPEED_OVER_GROUND_FIVE_SECONDS_BEFORE_START, + new SpeedFiveSecondsBeforeStartInKnots(), LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, + LeaderboardPanel.this)); result.put(DetailType.DISTANCE_TO_START_AT_RACE_START, - new FormattedDoubleDetailTypeColumn(DetailType.DISTANCE_TO_START_AT_RACE_START, new DistanceToStartAtRaceStartInMeters(), - LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, LeaderboardPanel.this)); + new FormattedDoubleDetailTypeColumn(DetailType.DISTANCE_TO_START_AT_RACE_START, + new DistanceToStartAtRaceStartInMeters(), LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, + LeaderboardPanel.this)); result.put(DetailType.TIME_BETWEEN_RACE_START_AND_COMPETITOR_START, - new FormattedDoubleDetailTypeColumn(DetailType.TIME_BETWEEN_RACE_START_AND_COMPETITOR_START, new TimeBetweenRaceStartAndCompetitorStartInSeconds(), - LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, LeaderboardPanel.this)); + new FormattedDoubleDetailTypeColumn(DetailType.TIME_BETWEEN_RACE_START_AND_COMPETITOR_START, + new TimeBetweenRaceStartAndCompetitorStartInSeconds(), LEG_COLUMN_HEADER_STYLE, + LEG_COLUMN_STYLE, LeaderboardPanel.this)); result.put(DetailType.SPEED_OVER_GROUND_AT_RACE_START, - new FormattedDoubleDetailTypeColumn(DetailType.SPEED_OVER_GROUND_AT_RACE_START, new SpeedOverGroundAtRaceStartInKnots(), - LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, LeaderboardPanel.this)); + new FormattedDoubleDetailTypeColumn(DetailType.SPEED_OVER_GROUND_AT_RACE_START, + new SpeedOverGroundAtRaceStartInKnots(), LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, + LeaderboardPanel.this)); result.put(DetailType.SPEED_OVER_GROUND_WHEN_PASSING_START, - new FormattedDoubleDetailTypeColumn(DetailType.SPEED_OVER_GROUND_WHEN_PASSING_START, new SpeedOverGroundWhenPassingStartInKnots(), - LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, LeaderboardPanel.this)); + new FormattedDoubleDetailTypeColumn(DetailType.SPEED_OVER_GROUND_WHEN_PASSING_START, + new SpeedOverGroundWhenPassingStartInKnots(), LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, + LeaderboardPanel.this)); result.put(DetailType.DISTANCE_TO_STARBOARD_END_OF_STARTLINE_WHEN_PASSING_START_IN_METERS, - new FormattedDoubleDetailTypeColumn(DetailType.DISTANCE_TO_STARBOARD_END_OF_STARTLINE_WHEN_PASSING_START_IN_METERS, new DistanceToStarboardSideOfStartLineInMeters(), - LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, LeaderboardPanel.this)); - result.put(DetailType.START_TACK, new StartingTackColumn(new TackWhenStarting(), LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE)); - result.put(DetailType.NUMBER_OF_MANEUVERS, new ManeuverCountRaceColumn(getLeaderboardPanel(), this, stringMessages, - LeaderboardPanel.this.selectedManeuverDetails, LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, - LEG_DETAIL_COLUMN_HEADER_STYLE, LEG_DETAIL_COLUMN_STYLE, LeaderboardPanel.this)); - result.put(DetailType.CURRENT_LEG, - new FormattedDoubleDetailTypeColumn(DetailType.CURRENT_LEG, new CurrentLeg(), LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, LeaderboardPanel.this)); - result.put(DetailType.RACE_TIME_TRAVELED, new TimeTraveledRaceColumn(getLeaderboardPanel(), this, - stringMessages, LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, LEG_DETAIL_COLUMN_HEADER_STYLE, - LEG_DETAIL_COLUMN_STYLE)); + new FormattedDoubleDetailTypeColumn( + DetailType.DISTANCE_TO_STARBOARD_END_OF_STARTLINE_WHEN_PASSING_START_IN_METERS, + new DistanceToStarboardSideOfStartLineInMeters(), LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, + LeaderboardPanel.this)); + result.put(DetailType.START_TACK, + new StartingTackColumn(new TackWhenStarting(), LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE)); + result.put(DetailType.NUMBER_OF_MANEUVERS, + new ManeuverCountRaceColumn(getLeaderboardPanel(), this, stringMessages, + LeaderboardPanel.this.selectedManeuverDetails, LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, + LEG_DETAIL_COLUMN_HEADER_STYLE, LEG_DETAIL_COLUMN_STYLE, LeaderboardPanel.this)); + result.put(DetailType.CURRENT_LEG, new FormattedDoubleDetailTypeColumn(DetailType.CURRENT_LEG, + new CurrentLeg(), LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, LeaderboardPanel.this)); + result.put(DetailType.RACE_TIME_TRAVELED, + new TimeTraveledRaceColumn(getLeaderboardPanel(), this, stringMessages, LEG_COLUMN_HEADER_STYLE, + LEG_COLUMN_STYLE, LEG_DETAIL_COLUMN_HEADER_STYLE, LEG_DETAIL_COLUMN_STYLE)); result.put(DetailType.RACE_CALCULATED_TIME_TRAVELED, - new FormattedDoubleDetailTypeColumn(DetailType.RACE_CALCULATED_TIME_TRAVELED, new RaceCalculatedTimeTraveledInSeconds(), + new FormattedDoubleDetailTypeColumn(DetailType.RACE_CALCULATED_TIME_TRAVELED, + new RaceCalculatedTimeTraveledInSeconds(), LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, + LeaderboardPanel.this)); + result.put(DetailType.RACE_CALCULATED_TIME_AT_ESTIMATED_ARRIVAL_AT_COMPETITOR_FARTHEST_AHEAD, + new FormattedDoubleDetailTypeColumn( + DetailType.RACE_CALCULATED_TIME_AT_ESTIMATED_ARRIVAL_AT_COMPETITOR_FARTHEST_AHEAD, + new RaceCalculatedTimeAtEstimatedArrivalAtCompetitorFarthestAheadInSeconds(), LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, LeaderboardPanel.this)); - result.put(DetailType.RACE_CALCULATED_TIME_AT_ESTIMATED_ARRIVAL_AT_COMPETITOR_FARTHEST_AHEAD, new FormattedDoubleDetailTypeColumn( - DetailType.RACE_CALCULATED_TIME_AT_ESTIMATED_ARRIVAL_AT_COMPETITOR_FARTHEST_AHEAD, - new RaceCalculatedTimeAtEstimatedArrivalAtCompetitorFarthestAheadInSeconds(), - LEG_COLUMN_HEADER_STYLE, LEG_COLUMN_STYLE, LeaderboardPanel.this)); return result; } @@ -1078,21 +1087,24 @@ public class LeaderboardPanel extends SimplePanel implements Componentnull if there are no fixes in the track. + * Reports the ratio of the time that passed since the last position fix and the average sampling interval of + * the competitor's track. On a perfect track, this value will never exceed 1.0. Immediately when a fix is + * received, this value goes to 0.0. For a competitor whose tracker is lagging, this value can grow considerably + * greater than 1. The value goes to null if there are no fixes in the track. * * @author Axel Uhl (D043530) * */ - private class RaceRatioBetweenTimeSinceLastPositionFixAndAverageSamplingInterval implements LegDetailField { + private class RaceRatioBetweenTimeSinceLastPositionFixAndAverageSamplingInterval + implements LegDetailField { @Override public Double get(LeaderboardRowDTO row) { Double result = null; LeaderboardEntryDTO fieldsForRace = row.fieldsByRaceColumnName.get(getRaceColumnName()); - if (fieldsForRace != null && fieldsForRace.timeSinceLastPositionFixInSeconds != null && fieldsForRace.averageSamplingInterval != null) { - result = fieldsForRace.timeSinceLastPositionFixInSeconds / fieldsForRace.averageSamplingInterval.asSeconds(); + if (fieldsForRace != null && fieldsForRace.timeSinceLastPositionFixInSeconds != null + && fieldsForRace.averageSamplingInterval != null) { + result = fieldsForRace.timeSinceLastPositionFixInSeconds + / fieldsForRace.averageSamplingInterval.asSeconds(); } return result; } @@ -1119,7 +1131,8 @@ public class LeaderboardPanel extends SimplePanel implements Component { + private class RaceCalculatedTimeAtEstimatedArrivalAtCompetitorFarthestAheadInSeconds + implements LegDetailField { @Override public Double get(LeaderboardRowDTO row) { Double result = null; @@ -1390,7 +1405,8 @@ public class LeaderboardPanel extends SimplePanel implements Component> implements LegDetailField { @Override public final T get(LeaderboardRowDTO row) { @@ -1438,12 +1454,12 @@ public class LeaderboardPanel extends SimplePanel implements Component { @Override protected Double getBeforeLastLegFinished(LegEntryDTO currentLegDetail) { @@ -1455,7 +1471,7 @@ public class LeaderboardPanel extends SimplePanel implements Component { @Override protected Double getBeforeLastLegFinished(LegEntryDTO currentLegDetail) { @@ -1473,35 +1489,36 @@ public class LeaderboardPanel extends SimplePanel implements Component { private final String columnStyle; - private final MaxPointsReason[] MAX_POINTS_REASONS_THAT_IDENTIFY_NON_FINISHED_RACES = - new MaxPointsReason[] {MaxPointsReason.DNS, MaxPointsReason.DNF, MaxPointsReason.DNC}; + private final MaxPointsReason[] MAX_POINTS_REASONS_THAT_IDENTIFY_NON_FINISHED_RACES = new MaxPointsReason[] { + MaxPointsReason.DNS, MaxPointsReason.DNF, MaxPointsReason.DNC }; protected TotalRacesCompletedColumn(String columnStyle) { super(new TextCell(), SortingOrder.ASCENDING, LeaderboardPanel.this); this.columnStyle = columnStyle; setHorizontalAlignment(ALIGN_CENTER); } - + private int computeNumberOfRacesCompleted(LeaderboardRowDTO object) { int racesSailedInRow = 0; for (RaceColumnDTO raceColumn : getLeaderboard().getRaceList()) { LeaderboardEntryDTO entryBefore = object.fieldsByRaceColumnName.get(raceColumn.getName()); if (entryBefore.netPoints != null) { - if (entryBefore.reasonForMaxPoints.equals(MaxPointsReason.NONE) || - !Util.contains(Arrays.asList(MAX_POINTS_REASONS_THAT_IDENTIFY_NON_FINISHED_RACES), entryBefore.reasonForMaxPoints)) { + if (entryBefore.reasonForMaxPoints.equals(MaxPointsReason.NONE) + || !Util.contains(Arrays.asList(MAX_POINTS_REASONS_THAT_IDENTIFY_NON_FINISHED_RACES), + entryBefore.reasonForMaxPoints)) { racesSailedInRow++; } - } + } } return racesSailedInRow; } @@ -1513,8 +1530,8 @@ public class LeaderboardPanel extends SimplePanel implements Component"); sb.appendEscaped(getValue(object)); sb.appendHtmlConstant(""); @@ -1527,7 +1544,8 @@ public class LeaderboardPanel extends SimplePanel implements Component 0 ? 1 : result < 0 ? -1 : 0; } }; @@ -1540,7 +1558,8 @@ public class LeaderboardPanel extends SimplePanel implements Component"); sb.appendEscaped(getValue(object)); sb.appendHtmlConstant(""); @@ -1592,7 +1611,8 @@ public class LeaderboardPanel extends SimplePanel implements Component(new AbstractSafeHtmlRenderer() { @Override public SafeHtml render(LeaderboardRowDTO object) { - return new SafeHtmlBuilder().appendEscaped(object.carriedPoints == null ? "" : scoreFormat.format(object.carriedPoints)).toSafeHtml(); + return new SafeHtmlBuilder() + .appendEscaped(object.carriedPoints == null ? "" : scoreFormat.format(object.carriedPoints)) + .toSafeHtml(); } }) { @Override - protected void render(com.google.gwt.cell.client.Cell.Context context, SafeHtml data, SafeHtmlBuilder sb) { + protected void render(com.google.gwt.cell.client.Cell.Context context, SafeHtml data, + SafeHtmlBuilder sb) { sb.append(data); } }, SortingOrder.ASCENDING, LeaderboardPanel.this); @@ -1642,19 +1665,24 @@ public class LeaderboardPanel extends SimplePanel implements Component - implements CompetitorSelectionChangeListener { + private class LeaderboardSelectionCheckboxColumn + extends com.sap.sailing.gwt.ui.client.shared.controls.SelectionCheckboxColumn + implements CompetitorSelectionChangeListener { protected LeaderboardSelectionCheckboxColumn(final CompetitorSelectionProvider competitorSelectionProvider) { - super(tableResources.cellTableStyle().cellTableCheckboxSelected(), tableResources.cellTableStyle().cellTableCheckboxDeselected(), - tableResources.cellTableStyle().cellTableCheckboxColumnCell(), new EntityIdentityComparator() { + super(tableResources.cellTableStyle().cellTableCheckboxSelected(), + tableResources.cellTableStyle().cellTableCheckboxDeselected(), + tableResources.cellTableStyle().cellTableCheckboxColumnCell(), + new EntityIdentityComparator() { @Override public boolean representSameEntity(LeaderboardRowDTO dto1, LeaderboardRowDTO dto2) { return dto1.competitor.getIdAsString().equals(dto2.competitor.getIdAsString()); } + @Override public int hashCode(LeaderboardRowDTO t) { return t.competitor.getIdAsString().hashCode(); @@ -1662,15 +1690,24 @@ public class LeaderboardPanel extends SimplePanel implements Component competitors) {} - @Override public void filterChanged(FilterSet> oldFilterSet, FilterSet> newFilterSet) {} - @Override public void filteredCompetitorsListChanged(Iterable filteredCompetitors) {} + @Override + public void competitorsListChanged(Iterable competitors) { + } + + @Override + public void filterChanged(FilterSet> oldFilterSet, + FilterSet> newFilterSet) { + } + + @Override + public void filteredCompetitorsListChanged(Iterable filteredCompetitors) { + } /** * Ensure that the checkbox is redrawn when the competitor selection changes @@ -1695,9 +1732,10 @@ public class LeaderboardPanel extends SimplePanel implements Component { public TotalRankColumn() { super(new TextCell(), SortingOrder.ASCENDING, LeaderboardPanel.this); @@ -1725,7 +1763,8 @@ public class LeaderboardPanel extends SimplePanel implements Component( - /* pageSize */10000, tableResources); + leaderboardTable = new FlushableSortedCellTableWithStylableHeaders(/* pageSize */10000, + tableResources); leaderboardTable.addCellPreviewHandler(new CellPreviewEvent.Handler() { @Override public void onCellPreview(CellPreviewEvent event) { if (BrowserEvents.FOCUS.equals(event.getNativeEvent().getType())) { elementToBlur = event.getNativeEvent().getEventTarget().cast(); elementToBlur.blur(); - blurInOnSelectionChanged = 2; // blur a couple of times; doing it one time only doesn't seem to work reliably + blurInOnSelectionChanged = 2; // blur a couple of times; doing it one time only doesn't seem to work + // reliably blurFocusedElementAfterSelectionChange(); } } @@ -1851,7 +1896,8 @@ public class LeaderboardPanel extends SimplePanel implements Component(); - // remember handler registration so we can temporarily remove it and re-add it to suspend selection events while we're actively changing it + // remember handler registration so we can temporarily remove it and re-add it to suspend selection events while + // we're actively changing it selectionChangeHandler = new Handler() { @Override public void onSelectionChange(SelectionChangeEvent event) { @@ -1859,20 +1905,22 @@ public class LeaderboardPanel extends SimplePanel implements Component 0) { blurInOnSelectionChanged--; blurFocusedElementAfterSelectionChange(); } } }; - leaderboardAsTableSelectionModelRegistration = leaderboardSelectionModel.addSelectionChangeHandler(selectionChangeHandler); + leaderboardAsTableSelectionModelRegistration = leaderboardSelectionModel + .addSelectionChangeHandler(selectionChangeHandler); leaderboardTable.setSelectionModel(leaderboardSelectionModel, selectionCheckboxColumn.getSelectionManager()); setShowAddedScores(settings.isShowAddedScores()); setShowCompetitorSailId(settings.isShowCompetitorSailIdColumn()); setShowCompetitorFullName(settings.isShowCompetitorFullNameColumn()); - setShowOverallColumnWithNumberOfRacesCompletedPerCompetitor(settings.isShowOverallColumnWithNumberOfRacesCompletedPerCompetitor()); - + setShowOverallColumnWithNumberOfRacesCompletedPerCompetitor( + settings.isShowOverallColumnWithNumberOfRacesCompletedPerCompetitor()); SimplePanel mainPanel = new SimplePanel(); contentPanel = new FlowPanel(); leaderboardTable.getElement().getStyle().setMarginTop(10, Unit.PX); @@ -1880,7 +1928,6 @@ public class LeaderboardPanel extends SimplePanel implements Component(); - // the information panel if (!isEmbedded) { Widget toolbarPanel = createToolbarPanel(); @@ -1922,14 +1969,12 @@ public class LeaderboardPanel extends SimplePanel implements Component filter : competitorSelectionProvider.getCompetitorsFilterSet().getFilters()) { + for (Filter filter : competitorSelectionProvider.getCompetitorsFilterSet() + .getFilters()) { if (filter instanceof FilterWithUI) { - labelText += ((FilterWithUI)filter).getLocalizedDescription(stringMessages) + ", "; + labelText += ((FilterWithUI) filter).getLocalizedDescription(stringMessages) + + ", "; } else { labelText += filter.getName() + ", "; } } - filterStatusLabel.setText("Active Filter(s): " + labelText.substring(0, labelText.length()-2)); + filterStatusLabel.setText("Active Filter(s): " + labelText.substring(0, labelText.length() - 2)); filterClearButton.setVisible(true); filterControlPanel.setVisible(true); } else { @@ -2016,35 +2062,37 @@ public class LeaderboardPanel extends SimplePanel implements Component { @Override public Double get(LeaderboardRowDTO row) { return row.totalDistanceTraveledInMeters; } } - + private static class TimeOnTimeFactorColumn implements LegDetailField { @Override public Double get(LeaderboardRowDTO row) { return row.competitor.getTimeOnTimeFactor(); } } - + private static class TimeOnDistanceAllowanceInSecondsPerNauticalMileColumn implements LegDetailField { @Override public Double get(LeaderboardRowDTO row) { - return row.competitor.getTimeOnDistanceAllowancePerNauticalMile() == null ? null : - row.competitor.getTimeOnDistanceAllowancePerNauticalMile().asSeconds(); + return row.competitor.getTimeOnDistanceAllowancePerNauticalMile() == null ? null + : row.competitor.getTimeOnDistanceAllowancePerNauticalMile().asSeconds(); } } - + private static class TotalAverageSpeedOverGroundField implements LegDetailField { @Override public Double get(LeaderboardRowDTO row) { final Double result; - if (row.totalDistanceTraveledInMeters != null && row.totalTimeSailedInSeconds != null && row.totalTimeSailedInSeconds != 0.0) { - result = row.totalDistanceTraveledInMeters / row.totalTimeSailedInSeconds / Mile.METERS_PER_NAUTICAL_MILE * 3600; + if (row.totalDistanceTraveledInMeters != null && row.totalTimeSailedInSeconds != null + && row.totalTimeSailedInSeconds != 0.0) { + result = row.totalDistanceTraveledInMeters / row.totalTimeSailedInSeconds + / Mile.METERS_PER_NAUTICAL_MILE * 3600; } else { result = null; } @@ -2060,16 +2108,15 @@ public class LeaderboardPanel extends SimplePanel implements Componentcolumn to the right end of the {@link #getLeaderboardTable() leaderboard table} and sets - * the column style according to the {@link LeaderboardSortableColumnWithMinMax#getColumnStyle() column's style definition}. + * the column style according to the {@link LeaderboardSortableColumnWithMinMax#getColumnStyle() column's style + * definition}. */ protected void addColumn(AbstractSortableColumnWithMinMax column) { - leaderboardTable.addColumn(column, column.getHeader(), column.getComparator(), column - .getPreferredSortingOrder().isAscending()); + leaderboardTable.addColumn(column, column.getHeader(), column.getComparator(), + column.getPreferredSortingOrder().isAscending()); String columnStyle = column.getColumnStyle(); if (columnStyle != null) { getLeaderboardTable().addColumnStyleName(getLeaderboardTable().getColumnCount() - 1, columnStyle); @@ -2294,7 +2343,8 @@ public class LeaderboardPanel extends SimplePanel implements Component() { @@ -2308,15 +2358,15 @@ public class LeaderboardPanel extends SimplePanel implements Componentnull - * is used as time point. The condition for this is encapsulated in this method so others can find out. For example, when a time change - * is signaled due to local offset / delay adjustments, no additional call to {@link #loadCompleteLeaderboard(boolean)} would be required - * as null will be passed in any case, not being affected by local time offsets. + * In {@link PlayModes#Live live mode}, when {@link #loadCompleteLeaderboard(boolean) loading the leaderboard + * contents}, null is used as time point. The condition for this is encapsulated in this method so + * others can find out. For example, when a time change is signaled due to local offset / delay adjustments, no + * additional call to {@link #loadCompleteLeaderboard(boolean)} would be required as null will be + * passed in any case, not being affected by local time offsets. */ private boolean useNullAsTimePoint() { return timer.getPlayMode() == PlayModes.Live; @@ -2360,7 +2411,7 @@ public class LeaderboardPanel extends SimplePanel implements Component= 40) { @@ -2370,8 +2421,8 @@ public class LeaderboardPanel extends SimplePanel implements Component(BinaryOperator.Operators.LessThanEquals)); raceRankFilter.setValue(maxRaceRank); - FilterSet> activeFilterSet = - competitorSelectionProvider.getOrCreateCompetitorsFilterSet(stringMessages.topNCompetitorsByRaceRank(maxRaceRank)); + FilterSet> activeFilterSet = competitorSelectionProvider + .getOrCreateCompetitorsFilterSet(stringMessages.topNCompetitorsByRaceRank(maxRaceRank)); activeFilterSet.addFilter(raceRankFilter); competitorSelectionProvider.setCompetitorsFilterSet(activeFilterSet); } @@ -2383,7 +2434,8 @@ public class LeaderboardPanel extends SimplePanel implements Component> columnsToCollapseAndExpandAgain = getExpandedRaceColumnsWhoseDisplayedLegCountChanged(leaderboard); + Collection> columnsToCollapseAndExpandAgain = getExpandedRaceColumnsWhoseDisplayedLegCountChanged( + leaderboard); for (RaceColumn columnToCollapseAndExpandAgain : columnsToCollapseAndExpandAgain) { columnToCollapseAndExpandAgain.changeExpansionState(/* expand */ false); } @@ -2405,19 +2457,22 @@ public class LeaderboardPanel extends SimplePanel implements Component rowsToUpdate = new HashMap<>(); synchronized (getData().getList()) { int index = 0; - for (Iterator i = getData().getList().iterator(); i.hasNext(); ) { + for (Iterator i = getData().getList().iterator(); i.hasNext();) { LeaderboardRowDTO oldRow = i.next(); LeaderboardRowDTO newRow = rowsToDisplay.get(oldRow.competitor); if (newRow != null) { rowsToUpdate.put(index++, newRow); // update row in place, preserving its selection state rowsToAdd.remove(newRow); // no need to add this row when it was updated in-place } else { - i.remove(); // old row's competitor not found in new rows' competitors; remove old row from table + i.remove(); // old row's competitor not found in new rows' competitors; remove old row from + // table } } for (Entry updateEntry : rowsToUpdate.entrySet()) { - LeaderboardRowDTO oldElement = getData().getList().set(updateEntry.getKey(), updateEntry.getValue()); - leaderboardSelectionModel.setSelected(oldElement, false); // make sure the old element is no longer part of the selection + LeaderboardRowDTO oldElement = getData().getList().set(updateEntry.getKey(), + updateEntry.getValue()); + leaderboardSelectionModel.setSelected(oldElement, false); // make sure the old element is no longer + // part of the selection updateSelection(updateEntry.getValue()); } for (LeaderboardRowDTO rowToAdd : rowsToAdd) { @@ -2426,19 +2481,21 @@ public class LeaderboardPanel extends SimplePanel implements Component lastRaceColumn = null; - for (int i=getLeaderboardTable().getColumnCount()-1; i>=0; i--) { + for (int i = getLeaderboardTable().getColumnCount() - 1; i >= 0; i--) { if (getLeaderboardTable().getColumn(i) instanceof RaceColumn) { lastRaceColumn = (RaceColumn) getLeaderboardTable().getColumn(i); break; } } for (int i = 0; i < getLeaderboardTable().getColumnCount(); i++) { - AbstractSortableColumnWithMinMax c = (AbstractSortableColumnWithMinMax) getLeaderboardTable().getColumn(i); + AbstractSortableColumnWithMinMax c = (AbstractSortableColumnWithMinMax) getLeaderboardTable() + .getColumn(i); c.updateMinMax(); - // Toggle pre-selected race, if the setting is set and it isn't open yet, or the last race column if that was requested + // Toggle pre-selected race, if the setting is set and it isn't open yet, or the last race column if + // that was requested if ((!autoExpandPerformedOnce && isAutoExpandPreSelectedRace() && c instanceof RaceColumn - && ((RaceColumn) c).getRace().hasTrackedRace(preSelectedRace)) || - (isAutoExpandLastRaceColumn() && c == lastRaceColumn)) { + && ((RaceColumn) c).getRace().hasTrackedRace(preSelectedRace)) + || (isAutoExpandLastRaceColumn() && c == lastRaceColumn)) { ExpandableSortableColumn expandableSortableColumn = (ExpandableSortableColumn) c; if (!expandableSortableColumn.isExpanded()) { expandableSortableColumn.changeExpansionState(/* expand */ true); @@ -2456,7 +2513,6 @@ public class LeaderboardPanel extends SimplePanel implements Component columnToSortFor = getDefaultSortColumn(); leaderboardTable.sortColumn(columnToSortFor, columnToSortFor.getPreferredSortingOrder().isAscending()); } - if (!isEmbedded) { scoreCorrectionCommentLabel.setText(leaderboard.getComment() != null ? leaderboard.getComment() : ""); if (leaderboard.getTimePointOfLastCorrectionsValidity() != null) { @@ -2467,7 +2523,6 @@ public class LeaderboardPanel extends SimplePanel implements Component raceColumn = getRaceColumnByRaceColumnName(newRace.getName()); - if (raceColumn != null) { - raceColumn.setRace(newRace); - } - } + for (RaceColumnDTO newRace : leaderboard.getRaceList()) { + RaceColumn raceColumn = getRaceColumnByRaceColumnName(newRace.getName()); + if (raceColumn != null) { + raceColumn.setRace(newRace); + } + } } /** @@ -2518,15 +2576,18 @@ public class LeaderboardPanel extends SimplePanel implements Component> getExpandedRaceColumnsWhoseDisplayedLegCountChanged(LeaderboardDTO newLeaderboard) { + private Collection> getExpandedRaceColumnsWhoseDisplayedLegCountChanged( + LeaderboardDTO newLeaderboard) { Set> result = new HashSet>(); if (selectedRaceDetails.contains(DetailType.DISPLAY_LEGS)) { for (int i = 0; i < getLeaderboardTable().getColumnCount(); i++) { Column c = getLeaderboardTable().getColumn(i); if (c instanceof RaceColumn) { RaceColumn rc = (RaceColumn) c; - // If the new leaderboard no longer contains the column, getLegCount will return -1, causing the column - // to be collapsed if it was expanded. This is correct because otherwise, removing it would no longer + // If the new leaderboard no longer contains the column, getLegCount will return -1, causing the + // column + // to be collapsed if it was expanded. This is correct because otherwise, removing it would no + // longer // know the correct leg count. if (!rc.isTogglingInProcess() && rc.isExpanded()) { int oldLegCount = getLeaderboard().getLegCount(rc.getRaceColumnName(), preSelectedRace); @@ -2603,7 +2664,8 @@ public class LeaderboardPanel extends SimplePanel implements Component e : getLeaderboard().rows.entrySet()) { - LeaderboardEntryDTO entry = e.getValue().fieldsByRaceColumnName.get(raceColumn.getRaceColumnName()); + LeaderboardEntryDTO entry = e.getValue().fieldsByRaceColumnName + .get(raceColumn.getRaceColumnName()); if (entry != null && entry.race != null && entry.race.equals(race)) { result.add(e.getKey()); } @@ -2655,33 +2717,35 @@ public class LeaderboardPanel extends SimplePanel implements ComponentindexOfFirstOverallDetailsColumn and are in the order - * defined by {@link #getAvailableOverallDetailColumnTypes()}. + * Ensures that the columns requested by {@link #selectedOverallDetailColumns} are in the table. Assumes that if + * there are any existing overall details columns, they start at indexOfFirstOverallDetailsColumn and + * are in the order defined by {@link #getAvailableOverallDetailColumnTypes()}. * * @param indexOfFirstOverallDetailsColumn * tells the column index for the first overall details column */ private void adjustOverallDetailColumns(LeaderboardDTO leaderboard, int indexOfFirstOverallDetailsColumn) { - List> overallDetailColumnsToShow = new ArrayList>(); - // ensure the ordering in overallDetailColumnsToShow conforms to the ordering of getAvailableOverallDetailColumnTypes() + List> overallDetailColumnsToShow = new ArrayList>(); + // ensure the ordering in overallDetailColumnsToShow conforms to the ordering of + // getAvailableOverallDetailColumnTypes() for (DetailType overallDetailType : getAvailableOverallDetailColumnTypes()) { - if (selectedOverallDetailColumns.contains(overallDetailType) && overallDetailColumnMap.containsKey(overallDetailType)) { + if (selectedOverallDetailColumns.contains(overallDetailType) + && overallDetailColumnMap.containsKey(overallDetailType)) { overallDetailColumnsToShow.add(overallDetailColumnMap.get(overallDetailType)); } } int currentColumnIndex = indexOfFirstOverallDetailsColumn; int i = 0; // index into overallDetailColumnToShow - Column currentColumn = currentColumnIndex < getLeaderboardTable().getColumnCount() ? - getLeaderboardTable().getColumn(currentColumnIndex) : null; + Column currentColumn = currentColumnIndex < getLeaderboardTable().getColumnCount() + ? getLeaderboardTable().getColumn(currentColumnIndex) : null; // repeat until no more column to check for removal and no more column left to check for need to insert - while (i raceColumn, RaceColumnDTO race) { int columnIndex = getRaceColumnPosition(raceColumn); - if (raceColumn.isExpansionEnabled() != race.hasTrackedRaces() || race.isMedalRace() != raceColumn.isMedalRace()) { + if (raceColumn.isExpansionEnabled() != race.hasTrackedRaces() + || race.isMedalRace() != raceColumn.isMedalRace()) { if (raceColumn.isExpanded()) { raceColumn.changeExpansionState(/* expand */ false); // remove children from table } @@ -2723,7 +2788,8 @@ public class LeaderboardPanel extends SimplePanel implements Component c = getLeaderboardTable().getColumn(leaderboardposition); if (c instanceof RaceColumn) { RaceColumn raceColumn = (RaceColumn) c; @@ -2747,7 +2813,8 @@ public class LeaderboardPanel extends SimplePanel implements Component raceColumn) { - for (int leaderboardposition = 0; leaderboardposition < getLeaderboardTable().getColumnCount(); leaderboardposition++) { + for (int leaderboardposition = 0; leaderboardposition < getLeaderboardTable() + .getColumnCount(); leaderboardposition++) { Column c = getLeaderboardTable().getColumn(leaderboardposition); if (c instanceof RaceColumn) { RaceColumn rc = (RaceColumn) c; @@ -2807,9 +2874,8 @@ public class LeaderboardPanel extends SimplePanel implements Component> columnsToRemove = new ArrayList>(); for (int i = 0; i < getLeaderboardTable().getColumnCount(); i++) { Column c = getLeaderboardTable().getColumn(i); - if (c instanceof RaceColumn - && (leaderboard == null || !selectedRaceColumnNames.contains(((RaceColumn) c) - .getRaceColumnName()))) { + if (c instanceof RaceColumn && (leaderboard == null + || !selectedRaceColumnNames.contains(((RaceColumn) c).getRaceColumnName()))) { columnsToRemove.add(c); } } @@ -2824,9 +2890,11 @@ public class LeaderboardPanel extends SimplePanel implements Component correctedOrderSelectedRaces = raceColumnSelection.getSelectedRaceColumnsOrderedAsInLeaderboard(leaderboard); + Iterable correctedOrderSelectedRaces = raceColumnSelection + .getSelectedRaceColumnsOrderedAsInLeaderboard(leaderboard); removeRaceColumnsNotSelected(correctedOrderSelectedRaces); - for (int selectedRaceCount = 0; selectedRaceCount < Util.size(correctedOrderSelectedRaces); selectedRaceCount++) { + for (int selectedRaceCount = 0; selectedRaceCount < Util + .size(correctedOrderSelectedRaces); selectedRaceCount++) { RaceColumnDTO selectedRaceColumn = Util.get(correctedOrderSelectedRaces, selectedRaceCount); final RaceColumn raceColumn = selectedRaceColumn == null ? null : getRaceColumnByRaceColumnName(selectedRaceColumn.getName()); @@ -2867,8 +2935,8 @@ public class LeaderboardPanel extends SimplePanel implements Component> columnsToRemove = new ArrayList>(); for (int i = 0; i < getLeaderboardTable().getColumnCount(); i++) { Column c = getLeaderboardTable().getColumn(i); - if (c instanceof RaceColumn - && (leaderboard == null || !leaderboard.raceListContains(((RaceColumn) c).getRaceColumnName()))) { + if (c instanceof RaceColumn && (leaderboard == null + || !leaderboard.raceListContains(((RaceColumn) c).getRaceColumnName()))) { columnsToRemove.add(c); } } @@ -2884,21 +2952,22 @@ public class LeaderboardPanel extends SimplePanel implements Component raceColumn) { - if (getLeaderboardTable().getColumn(getLeaderboardTable().getColumnCount() - 1) instanceof TotalNetPointssColumn) { + if (getLeaderboardTable() + .getColumn(getLeaderboardTable().getColumnCount() - 1) instanceof TotalNetPointssColumn) { removeColumn(getLeaderboardTable().getColumnCount() - 1); } addColumn(raceColumn); } /** - * The regatta rank column shall be displayed if an only if the {@link DetailType#REGATTA_RANK} detail is selected in the - * {@link #selectedOverallDetailColumns}. It will then be displayed after the selection checkbox column (if any) and - * before the sail number / competitor name columns. + * The regatta rank column shall be displayed if an only if the {@link DetailType#REGATTA_RANK} detail is selected + * in the {@link #selectedOverallDetailColumns}. It will then be displayed after the selection checkbox column (if + * any) and before the sail number / competitor name columns. */ private boolean isShowRegattaRankColumn() { return selectedOverallDetailColumns.contains(DetailType.REGATTA_RANK); } - + /** * @param rankColumnIndex * the column index (0-based) where to put the rank column, if needed @@ -2958,30 +3027,33 @@ public class LeaderboardPanel extends SimplePanel implements Component)) { - insertColumn(columnIndexWhereToInsertTheNextColumn, new SailIDColumn(new CompetitorFetcher() { - @Override - public CompetitorDTO getCompetitor(LeaderboardRowDTO t) { - return t.competitor; - } - })); + || !(getLeaderboardTable() + .getColumn(columnIndexWhereToInsertTheNextColumn) instanceof SailIDColumn)) { + insertColumn(columnIndexWhereToInsertTheNextColumn, + new SailIDColumn(new CompetitorFetcher() { + @Override + public CompetitorDTO getCompetitor(LeaderboardRowDTO t) { + return t.competitor; + } + })); } columnIndexWhereToInsertTheNextColumn++; } else { - if (getLeaderboardTable().getColumnCount() > columnIndexWhereToInsertTheNextColumn - && getLeaderboardTable().getColumn(columnIndexWhereToInsertTheNextColumn) instanceof SailIDColumn) { + if (getLeaderboardTable().getColumnCount() > columnIndexWhereToInsertTheNextColumn && getLeaderboardTable() + .getColumn(columnIndexWhereToInsertTheNextColumn) instanceof SailIDColumn) { removeColumn(columnIndexWhereToInsertTheNextColumn); } } if (isShowCompetitorFullName()) { if (getLeaderboardTable().getColumnCount() <= columnIndexWhereToInsertTheNextColumn - || !(getLeaderboardTable().getColumn(columnIndexWhereToInsertTheNextColumn) instanceof CompetitorColumn)) { + || !(getLeaderboardTable() + .getColumn(columnIndexWhereToInsertTheNextColumn) instanceof CompetitorColumn)) { insertColumn(columnIndexWhereToInsertTheNextColumn, createCompetitorColumn()); } columnIndexWhereToInsertTheNextColumn++; } else { - if (getLeaderboardTable().getColumnCount() > columnIndexWhereToInsertTheNextColumn - && getLeaderboardTable().getColumn(columnIndexWhereToInsertTheNextColumn) instanceof CompetitorColumn) { + if (getLeaderboardTable().getColumnCount() > columnIndexWhereToInsertTheNextColumn && getLeaderboardTable() + .getColumn(columnIndexWhereToInsertTheNextColumn) instanceof CompetitorColumn) { removeColumn(columnIndexWhereToInsertTheNextColumn); } } @@ -2991,35 +3063,36 @@ public class LeaderboardPanel extends SimplePanel implements Component(this, getStringMessages(), new CompetitorFetcher() { - @Override - public CompetitorDTO getCompetitor(LeaderboardRowDTO t) { - return t.competitor; - } - })); + @Override + public CompetitorDTO getCompetitor(LeaderboardRowDTO t) { + return t.competitor; + } + })); } private void ensureTotalsColumn() { // add a totals column on the right - if (getLeaderboardTable().getColumnCount() == 0 - || !(getLeaderboardTable().getColumn(getLeaderboardTable().getColumnCount() - 1) instanceof TotalNetPointssColumn)) { + if (getLeaderboardTable().getColumnCount() == 0 || !(getLeaderboardTable() + .getColumn(getLeaderboardTable().getColumnCount() - 1) instanceof TotalNetPointssColumn)) { addColumn(new TotalNetPointssColumn(TOTAL_COLUMN_STYLE)); } } - + private void ensureTotalRacesSailedColumn() { - // add a totals column on the right - if (getLeaderboardTable().getColumnCount() == 0 - || !(getLeaderboardTable().getColumn(getLeaderboardTable().getColumnCount() - 2) instanceof TotalRacesCompletedColumn)) { + // add a totals column on the right + if (getLeaderboardTable().getColumnCount() == 0 || !(getLeaderboardTable() + .getColumn(getLeaderboardTable().getColumnCount() - 2) instanceof TotalRacesCompletedColumn)) { insertColumn(getLeaderboardTable().getColumnCount() - 1, new TotalRacesCompletedColumn(TOTAL_COLUMN_STYLE)); } } - + private void ensureNoTotalRacesSailedColumn() { - if ((getLeaderboardTable().getColumn(getLeaderboardTable().getColumnCount() - 2) instanceof TotalRacesCompletedColumn)) { + if ((getLeaderboardTable() + .getColumn(getLeaderboardTable().getColumnCount() - 2) instanceof TotalRacesCompletedColumn)) { removeColumn(getLeaderboardTable().getColumnCount() - 2); } } - + protected void updateTotalRacesSailedColumn() { final boolean showTotalRacesCompletedColumn = isShowOverallColumnWithNumberOfRacesCompletedPerCompetitor(); if (showTotalRacesCompletedColumn) { @@ -3047,7 +3120,7 @@ public class LeaderboardPanel extends SimplePanel implements Component selectedRaceColumns = raceColumnSelection.getSelectedRaceColumnsOrderedAsInLeaderboard(leaderboard); + Iterable selectedRaceColumns = raceColumnSelection + .getSelectedRaceColumnsOrderedAsInLeaderboard(leaderboard); List namesOfRaceColumnsToShow = new ArrayList<>(); for (RaceColumnDTO raceColumn : selectedRaceColumns) { namesOfRaceColumnsToShow.add(raceColumn.getName()); } return new LeaderboardSettings(Collections.unmodifiableList(selectedManeuverDetails), Collections.unmodifiableList(selectedLegDetails), Collections.unmodifiableList(selectedRaceDetails), - Collections.unmodifiableList(selectedOverallDetailColumns), namesOfRaceColumnsToShow, /*namesOfRacesToShow*/ null, - raceColumnSelection.getNumberOfLastRaceColumnsToShow(), - autoExpandPreSelectedRace, timer.getRefreshInterval(), /* nameOfRaceToSort*/ null, - /*sortAscending*/ true, /*updateUponPlayStateChange*/ true, raceColumnSelection.getType(), - isShowAddedScores(), isShowOverallColumnWithNumberOfRacesCompletedPerCompetitor(), + Collections.unmodifiableList(selectedOverallDetailColumns), namesOfRaceColumnsToShow, + /* namesOfRacesToShow */ null, raceColumnSelection.getNumberOfLastRaceColumnsToShow(), + autoExpandPreSelectedRace, timer.getRefreshInterval(), /* nameOfRaceToSort */ null, + /* sortAscending */ true, /* updateUponPlayStateChange */ true, raceColumnSelection.getType(), + isShowAddedScores(), isShowOverallColumnWithNumberOfRacesCompletedPerCompetitor(), isShowCompetitorSailId(), isShowCompetitorFullName()); } - + @Override public String getLocalizedShortName() { return stringMessages.leaderboard(); @@ -3209,7 +3285,7 @@ public class LeaderboardPanel extends SimplePanel implements Component getSelectedRows() { return leaderboardSelectionModel.getSelectedSet(); } @@ -3231,21 +3307,22 @@ public class LeaderboardPanel extends SimplePanel implements Component> oldFilterSet, FilterSet> newFilterSet) { - // nothing to do; if the list of filtered competitors has changed, a separate call to filteredCompetitorsListChanged will occur + // nothing to do; if the list of filtered competitors has changed, a separate call to + // filteredCompetitorsListChanged will occur setFilterControlStatus(); } public RaceColumnSelection getRaceColumnSelection() { return raceColumnSelection; } - + public void removeAllListeners() { if (raceTimesInfoProviderListener != null) { getRaceTimesInfoProvider().removeRaceTimesInfoProviderListener(raceTimesInfoProviderListener); } if (raceColumnSelection != null && raceColumnSelection.getType() == RaceColumnSelectionStrategies.LAST_N) { - getRaceTimesInfoProvider().removeRaceTimesInfoProviderListener( - (LastNRacesColumnSelection) raceColumnSelection); + getRaceTimesInfoProvider() + .removeRaceTimesInfoProviderListener((LastNRacesColumnSelection) raceColumnSelection); } if (timer != null) { timer.removeTimeListener(this); @@ -3277,7 +3354,7 @@ public class LeaderboardPanel extends SimplePanel implements Component liveRace, boolean isMeta) { String raceName = liveRace.getA().getRaceColumnName(), fleetName = liveRace.getB().getName(); boolean isDefaultFleet = LeaderboardNameConstants.DEFAULT_FLEET_NAME.equals(fleetName); - return raceName + ((isDefaultFleet || isMeta) ? "" : (" (" + liveRace.getB().getName() + ")")); + return raceName + ((isDefaultFleet || isMeta) ? "" : (" (" + liveRace.getB().getName() + ")")); } - + @Override public String getDependentCssClassName() { return "leaderboard"; @@ -3367,7 +3445,7 @@ public class LeaderboardPanel extends SimplePanel implements Component{0}

") - SafeHtml render(String value, String cssClass, String title, int percentage); - } protected static final String BACKGROUND_BAR_STYLE_BAD = "minMaxBackgroundBarBad"; protected static final String BACKGROUND_BAR_STYLE_OK = "minMaxBackgroundBar"; protected static final String BACKGROUND_BAR_STYLE_GOOD = "minMaxBackgroundBarGood"; - protected static final Templates TEMPLATES = GWT.create(Templates.class); private final HasStringAndDoubleValue valueProvider; private final Comparator comparator; private Double minimumValue; private Double maximumValue; + public static final Templates TEMPLATES = GWT.create(Templates.class); + + public static class Templates { + interface MyTemplate extends SafeHtmlTemplates { + @Template("
{0}
") + SafeHtml render(String value, String cssClass, String title, SafeStyles style); + } + protected static final MyTemplate T = GWT.create(Templates.class); + + SafeHtml render(String value, String cssClass, String title, int percentage) { + SafeStylesBuilder sb = new SafeStylesBuilder(); + sb.trustedNameAndValue("background-size", percentage + "% 25px"); + return T.render(value, cssClass, title, sb.toSafeStyles()); + } + } + /** * Renders the value and the percentage bar of the columns {@link DetailTypeColumn} and * {@link ManeuverCountRaceColumn}. From 6f09beb0d894b1cbd9f971306fd01584cd983f6d Mon Sep 17 00:00:00 2001 From: Kai Boernert Date: Tue, 7 Mar 2017 10:14:31 +0100 Subject: [PATCH 05/14] Fix for template error --- .../com/sap/sailing/gwt/ui/leaderboard/MinMaxRenderer.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/leaderboard/MinMaxRenderer.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/leaderboard/MinMaxRenderer.java index 5227de277af..b283b7c06da 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/leaderboard/MinMaxRenderer.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/leaderboard/MinMaxRenderer.java @@ -34,10 +34,11 @@ public class MinMaxRenderer { public static class Templates { interface MyTemplate extends SafeHtmlTemplates { - @Template("
{0}
") + @Template("
{0}
") SafeHtml render(String value, String cssClass, String title, SafeStyles style); } - protected static final MyTemplate T = GWT.create(Templates.class); + + protected static final MyTemplate T = GWT.create(MyTemplate.class); SafeHtml render(String value, String cssClass, String title, int percentage) { SafeStylesBuilder sb = new SafeStylesBuilder(); From 79ba9833c44bc67eb4c25929d6a41208d8f576e3 Mon Sep 17 00:00:00 2001 From: Kai Boernert Date: Tue, 14 Mar 2017 12:43:15 +0100 Subject: [PATCH 06/14] reduced compiler warnings --- .../domain/common/CompetitorDescriptor.java | 9 ++--- .../impl/NamedImpl_CustomFieldSerializer.java | 36 +++++++++++++++++++ .../RegattaHeaderLegendPopup.ui.xml | 5 ++- .../ui/adminconsole/EventListComposite.java | 6 ++-- 4 files changed, 44 insertions(+), 12 deletions(-) create mode 100644 java/com.sap.sailing.gwt.ui/src/main/java/com/google/gwt/user/client/rpc/core/com/sap/sse/common/impl/NamedImpl_CustomFieldSerializer.java diff --git a/java/com.sap.sailing.domain.common/src/com/sap/sailing/domain/common/CompetitorDescriptor.java b/java/com.sap.sailing.domain.common/src/com/sap/sailing/domain/common/CompetitorDescriptor.java index 70d8a742547..6246c034f48 100644 --- a/java/com.sap.sailing.domain.common/src/com/sap/sailing/domain/common/CompetitorDescriptor.java +++ b/java/com.sap.sailing.domain.common/src/com/sap/sailing/domain/common/CompetitorDescriptor.java @@ -22,7 +22,6 @@ public class CompetitorDescriptor extends NamedImpl implements Named { private final String raceName; private final String fleetName; private final String sailNumber; - private final String name; private final CountryCode countryCode; private final List persons; private final Double timeOnTimeFactor; @@ -39,7 +38,6 @@ public class CompetitorDescriptor extends NamedImpl implements Named { this.raceName = raceName; this.fleetName = fleetName; this.sailNumber = sailNumber; - this.name = name; this.teamName = teamName; this.countryCode = countryCode; this.persons = new ArrayList<>(); @@ -72,10 +70,6 @@ public class CompetitorDescriptor extends NamedImpl implements Named { return sailNumber; } - public String getName() { - return name; - } - public CountryCode getCountryCode() { return countryCode; } @@ -104,7 +98,8 @@ public class CompetitorDescriptor extends NamedImpl implements Named { public String toString() { return "CompetitorDescriptor [eventName=" + eventName + ", regattaName=" + regattaName + ", boatClassName=" + boatClassName + ", boatName=" + boatName + ", teamName=" + teamName + ", raceName=" + raceName - + ", fleetName=" + fleetName + ", sailNumber=" + sailNumber + ", name=" + name + ", countryCode=" + + ", fleetName=" + fleetName + ", sailNumber=" + sailNumber + ", name=" + super.getName() + + ", countryCode=" + countryCode + ", persons=" + persons + ", timeOnTimeFactor=" + timeOnTimeFactor + ", timeOnDistanceAllowancePerNauticalMile=" + timeOnDistanceAllowancePerNauticalMile + "]"; } diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/google/gwt/user/client/rpc/core/com/sap/sse/common/impl/NamedImpl_CustomFieldSerializer.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/google/gwt/user/client/rpc/core/com/sap/sse/common/impl/NamedImpl_CustomFieldSerializer.java new file mode 100644 index 00000000000..d9628a6d159 --- /dev/null +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/google/gwt/user/client/rpc/core/com/sap/sse/common/impl/NamedImpl_CustomFieldSerializer.java @@ -0,0 +1,36 @@ +package com.google.gwt.user.client.rpc.core.com.sap.sse.common.impl; + +import com.google.gwt.user.client.rpc.CustomFieldSerializer; +import com.google.gwt.user.client.rpc.SerializationException; +import com.google.gwt.user.client.rpc.SerializationStreamReader; +import com.google.gwt.user.client.rpc.SerializationStreamWriter; +import com.sap.sse.common.impl.NamedImpl; + +public class NamedImpl_CustomFieldSerializer extends CustomFieldSerializer { + public static void deserialize(SerializationStreamReader streamReader, com.sap.sse.common.impl.NamedImpl instance) + throws SerializationException { + } + + @Override + public boolean hasCustomInstantiateInstance() { + return true; + } + + @Override + public NamedImpl instantiateInstance(SerializationStreamReader streamReader) throws SerializationException { + return new NamedImpl(streamReader.readString()); + } + + @Override + public void deserializeInstance(SerializationStreamReader streamReader, NamedImpl instance) + throws SerializationException { + // done by instantiateInstance + } + + @Override + public void serializeInstance(SerializationStreamWriter streamWriter, NamedImpl instance) + throws SerializationException { + streamWriter.writeString(instance.getName()); + } + +} diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/partials/regattaheader/RegattaHeaderLegendPopup.ui.xml b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/partials/regattaheader/RegattaHeaderLegendPopup.ui.xml index 6f571d0af0e..9180d13e3c7 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/partials/regattaheader/RegattaHeaderLegendPopup.ui.xml +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/partials/regattaheader/RegattaHeaderLegendPopup.ui.xml @@ -2,8 +2,8 @@ - - + + .iconGPS, .iconWind, .iconVideo, .iconAudio{ line-height: 1.5em; position: relative; @@ -47,7 +47,6 @@ height: 0; width: 0; position: absolute; - // pointer-events: none; } .legend:after { diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/EventListComposite.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/EventListComposite.java index 326ea3fe590..fd70a3fc890 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/EventListComposite.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/EventListComposite.java @@ -20,6 +20,8 @@ import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.safehtml.client.SafeHtmlTemplates; import com.google.gwt.safehtml.shared.SafeHtml; import com.google.gwt.safehtml.shared.SafeHtmlBuilder; +import com.google.gwt.safehtml.shared.SafeUri; +import com.google.gwt.safehtml.shared.UriUtils; import com.google.gwt.user.cellview.client.CellTable; import com.google.gwt.user.cellview.client.Column; import com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler; @@ -94,7 +96,7 @@ public class EventListComposite extends Composite implements EventsRefresher, Le interface AnchorTemplates extends SafeHtmlTemplates { @SafeHtmlTemplates.Template("{1}") - SafeHtml cell(String url, String displayName); + SafeHtml cell(SafeUri safeUri, String displayName); } private static AnchorTemplates ANCHORTEMPLATE = GWT.create(AnchorTemplates.class); @@ -228,7 +230,7 @@ public class EventListComposite extends Composite implements EventsRefresher, Le if(event != null && event.id != null){ link = EntryPointLinkFactory.createEventPlaceLink(event.id.toString(), new HashMap()); } - return ANCHORTEMPLATE.cell(link, event.getName()); + return ANCHORTEMPLATE.cell(UriUtils.fromString(link), event.getName()); } }; From 9fed845f7d599768a80e335ccc1972ea331636cc Mon Sep 17 00:00:00 2001 From: Kai Boernert Date: Tue, 14 Mar 2017 15:10:00 +0100 Subject: [PATCH 07/14] fix for serializer --- .../impl/NamedImpl_CustomFieldSerializer.java | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/google/gwt/user/client/rpc/core/com/sap/sse/common/impl/NamedImpl_CustomFieldSerializer.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/google/gwt/user/client/rpc/core/com/sap/sse/common/impl/NamedImpl_CustomFieldSerializer.java index d9628a6d159..a4f10caeb3c 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/google/gwt/user/client/rpc/core/com/sap/sse/common/impl/NamedImpl_CustomFieldSerializer.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/google/gwt/user/client/rpc/core/com/sap/sse/common/impl/NamedImpl_CustomFieldSerializer.java @@ -7,8 +7,16 @@ import com.google.gwt.user.client.rpc.SerializationStreamWriter; import com.sap.sse.common.impl.NamedImpl; public class NamedImpl_CustomFieldSerializer extends CustomFieldSerializer { - public static void deserialize(SerializationStreamReader streamReader, com.sap.sse.common.impl.NamedImpl instance) + + @Override + public void serializeInstance(SerializationStreamWriter streamWriter, NamedImpl instance) throws SerializationException { + serialize(streamWriter, instance); + } + + public static void serialize(SerializationStreamWriter streamWriter, NamedImpl instance) + throws SerializationException { + streamWriter.writeString(instance.getName()); } @Override @@ -18,19 +26,21 @@ public class NamedImpl_CustomFieldSerializer extends CustomFieldSerializer Date: Mon, 20 Mar 2017 11:18:23 +0100 Subject: [PATCH 08/14] reduced style errors --- .../desktop/partials/footer/Footer.ui.xml | 2 +- .../RaceviewerLaunchPadCell.java | 7 ++- .../gwt/home/shared/app/PlaceNavigation.java | 6 +++ .../spectator/LeaderboardGroupFullTable.css | 2 - .../LeaderboardGroupOverviewPanel.java | 10 ++-- .../ui/spectator/LeaderboardGroupPanel.java | 49 ++++++++++++------- .../ui/registration/RegisterViewResources.css | 4 +- 7 files changed, 50 insertions(+), 30 deletions(-) diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/partials/footer/Footer.ui.xml b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/partials/footer/Footer.ui.xml index ff9a2c2a17a..a0bfd39be8e 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/partials/footer/Footer.ui.xml +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/partials/footer/Footer.ui.xml @@ -56,7 +56,7 @@ class="{local_res.css.sitefooter_links_link} {res.mediaCss.showonsmall} {res.mediaCss.hideonmedium} {res.mediaCss.hideonlarge}"> Mobile - +
diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/partials/raceviewerlaunchpad/RaceviewerLaunchPadCell.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/partials/raceviewerlaunchpad/RaceviewerLaunchPadCell.java index 5a7b0a390a4..3a0dc2e6660 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/partials/raceviewerlaunchpad/RaceviewerLaunchPadCell.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/desktop/partials/raceviewerlaunchpad/RaceviewerLaunchPadCell.java @@ -9,6 +9,8 @@ import com.google.gwt.dom.client.NativeEvent; import com.google.gwt.safehtml.client.SafeHtmlTemplates; import com.google.gwt.safehtml.shared.SafeHtml; import com.google.gwt.safehtml.shared.SafeHtmlBuilder; +import com.google.gwt.safehtml.shared.SafeUri; +import com.google.gwt.safehtml.shared.UriUtils; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.PopupPanel; import com.google.gwt.user.client.ui.PopupPanel.PositionCallback; @@ -30,7 +32,7 @@ public class RaceviewerLaunchPadCell> extends Abstr SafeHtml raceviewerLaunchPad(String styleNames, String iconStyleNames, String text); @Template("
{2}
") - SafeHtml standaloneButton(String styleNames, String iconStyleNames, String text, String icon, String link); + SafeHtml standaloneButton(String styleNames, String iconStyleNames, String text, String icon, SafeUri safeUri); } private static final CellTemplates TEMPLATE = GWT.create(CellTemplates.class); @@ -81,7 +83,8 @@ public class RaceviewerLaunchPadCell> extends Abstr if (data.hasValidTrackingData()) { if (renderAsDirectLinkButton(data)) { sb.append(TEMPLATE.standaloneButton(plannedStyleNames, iconStyleNames, I18N.watchLive(), - "launch-play", presenter.getRaceViewerURL(data, RaceBoardModes.PLAYER.name()))); + "launch-play", + UriUtils.fromString(presenter.getRaceViewerURL(data, RaceBoardModes.PLAYER.name())))); } else { String styleNames = data.isFinished() ? analyzeStyleNames : liveStyleNames; sb.append(TEMPLATE.raceviewerLaunchPad(styleNames, iconStyleNames, I18N.raceDetailsToShow())); diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/shared/app/PlaceNavigation.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/shared/app/PlaceNavigation.java index 6172cbe198e..830c76595dd 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/shared/app/PlaceNavigation.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/shared/app/PlaceNavigation.java @@ -4,6 +4,8 @@ import com.google.gwt.dom.client.AnchorElement; import com.google.gwt.http.client.UrlBuilder; import com.google.gwt.place.shared.Place; import com.google.gwt.place.shared.PlaceHistoryMapper; +import com.google.gwt.safehtml.shared.SafeUri; +import com.google.gwt.safehtml.shared.UriUtils; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Event; import com.google.gwt.user.client.EventListener; @@ -41,6 +43,10 @@ public class PlaceNavigation { return buildPlaceUrl(); } + public SafeUri getSafeTargetUrl() { + return UriUtils.fromString(getTargetUrl()); + } + public String getHistoryUrl() { String placeUrl = buildPlaceUrl(); if (placeUrl.startsWith("#")) { diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/spectator/LeaderboardGroupFullTable.css b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/spectator/LeaderboardGroupFullTable.css index 98e016904c3..767243b53c8 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/spectator/LeaderboardGroupFullTable.css +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/spectator/LeaderboardGroupFullTable.css @@ -1,5 +1,3 @@ -@CHARSET "ISO-8859-1"; - .cellTableWidget { margin: 0; table-layout: auto; diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/spectator/LeaderboardGroupOverviewPanel.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/spectator/LeaderboardGroupOverviewPanel.java index 484e4fc00dc..1f0c20884b1 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/spectator/LeaderboardGroupOverviewPanel.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/spectator/LeaderboardGroupOverviewPanel.java @@ -17,6 +17,8 @@ import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat; import com.google.gwt.safehtml.client.SafeHtmlTemplates; import com.google.gwt.safehtml.shared.SafeHtml; import com.google.gwt.safehtml.shared.SafeHtmlBuilder; +import com.google.gwt.safehtml.shared.SafeUri; +import com.google.gwt.safehtml.shared.UriUtils; import com.google.gwt.user.cellview.client.CellTable; import com.google.gwt.user.cellview.client.Column; import com.google.gwt.user.cellview.client.ColumnSortEvent; @@ -61,7 +63,7 @@ public class LeaderboardGroupOverviewPanel extends FormPanel { interface AnchorTemplates extends SafeHtmlTemplates { @SafeHtmlTemplates.Template("{1}") - SafeHtml anchor(String url, String displayName); + SafeHtml anchor(SafeUri url, String displayName); } public static final String STYLE_NAME_PREFIX = "groupOverviewPanel-"; @@ -233,7 +235,7 @@ public class LeaderboardGroupOverviewPanel extends FormPanel { (showRaceDetails ? "showRaceDetails=true&" : "") + "leaderboardGroupName=" + group.getName() + "&root=overview" + (debugParam != null && !debugParam.isEmpty() ? "&gwt.codesvr=" + debugParam : "")); - return ANCHORTEMPLATE.anchor(link, group.getName()); + return ANCHORTEMPLATE.anchor(UriUtils.fromString(link), group.getName()); } }; groupsNameColumn.setSortable(true); @@ -362,7 +364,7 @@ public class LeaderboardGroupOverviewPanel extends FormPanel { + (showRaceDetails ? "&showRaceDetails=true" : "") + "&leaderboardGroupName=" + selectedGroup.getName() + "&root=overview" + (debugParam != null && !debugParam.isEmpty() ? "&gwt.codesvr=" + debugParam : "")); - return ANCHORTEMPLATE.anchor(link, leaderboard.name); + return ANCHORTEMPLATE.anchor(UriUtils.fromString(link), leaderboard.name); } }; @@ -456,7 +458,7 @@ public class LeaderboardGroupOverviewPanel extends FormPanel { + raceId.getRegattaName() + "&leaderboardGroupName=" + selectedGroup.getName() + "&root=overview" + (debugParam != null && !debugParam.isEmpty() ? "&gwt.codesvr=" + debugParam : "")); - name = ANCHORTEMPLATE.anchor(link, raceDisplayName); + name = ANCHORTEMPLATE.anchor(UriUtils.fromString(link), raceDisplayName); } else { name = new SafeHtmlBuilder().appendHtmlConstant(raceDisplayName).toSafeHtml(); } diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/spectator/LeaderboardGroupPanel.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/spectator/LeaderboardGroupPanel.java index c20ec8fb25d..ad57cad5ed6 100755 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/spectator/LeaderboardGroupPanel.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/spectator/LeaderboardGroupPanel.java @@ -8,9 +8,13 @@ import java.util.Map; import com.google.gwt.cell.client.SafeHtmlCell; import com.google.gwt.core.client.GWT; import com.google.gwt.dom.client.Style.FontWeight; +import com.google.gwt.safecss.shared.SafeStyles; +import com.google.gwt.safecss.shared.SafeStylesUtils; import com.google.gwt.safehtml.client.SafeHtmlTemplates; import com.google.gwt.safehtml.shared.SafeHtml; import com.google.gwt.safehtml.shared.SafeHtmlBuilder; +import com.google.gwt.safehtml.shared.SafeUri; +import com.google.gwt.safehtml.shared.UriUtils; import com.google.gwt.user.cellview.client.CellTable; import com.google.gwt.user.cellview.client.Column; import com.google.gwt.user.client.rpc.AsyncCallback; @@ -54,26 +58,26 @@ public class LeaderboardGroupPanel extends SimplePanel implements HasWelcomeWidg interface AnchorTemplates extends SafeHtmlTemplates { @SafeHtmlTemplates.Template("{1}") - SafeHtml anchor(String url, String displayName, String styleClass); + SafeHtml anchor(SafeUri url, String displayName, SafeStyles styleClass); @SafeHtmlTemplates.Template("{1}") - SafeHtml anchorWithTarget(String url, String displayName, String styleClass, String target); + SafeHtml anchorWithTarget(SafeUri url, String displayName, SafeStyles styleClass, String target); } interface TextWithClassTemplate extends SafeHtmlTemplates { @SafeHtmlTemplates.Template("
{0}
") - SafeHtml textWithClass(String text, String styleClass); + SafeHtml textWithClass(String text, SafeStyles styleClass); @SafeHtmlTemplates.Template("
{0}
") - SafeHtml textWithClass(String text, int widthInPx, String styleClass); + SafeHtml textWithClass(String text, int widthInPx, SafeStyles styleClass); } interface ColorBoxTemplate extends SafeHtmlTemplates { @SafeHtmlTemplates.Template("
 
") - SafeHtml colorBox(String htmlColor, String styleClass); + SafeHtml colorBox(String htmlColor, SafeStyles styleClass); @SafeHtmlTemplates.Template("
 
") - SafeHtml nocolorBox(String styleClass); + SafeHtml nocolorBox(SafeStyles styleClass); } private static final AnchorTemplates ANCHORTEMPLATE = GWT.create(AnchorTemplates.class); @@ -221,7 +225,7 @@ public class LeaderboardGroupPanel extends SimplePanel implements HasWelcomeWidg public SafeHtml getValue(StrippedLeaderboardDTO strippedLeaderboardDTO) { String text = strippedLeaderboardDTO.displayName != null ? strippedLeaderboardDTO.displayName : strippedLeaderboardDTO.name; SafeHtmlBuilder b = new SafeHtmlBuilder(); - b.append(TEXTTEMPLATE.textWithClass(text, STYLE_BOATCLASS)); + b.append(TEXTTEMPLATE.textWithClass(text, SafeStylesUtils.fromTrustedString(STYLE_BOATCLASS))); return b.toSafeHtml(); } }; @@ -232,7 +236,8 @@ public class LeaderboardGroupPanel extends SimplePanel implements HasWelcomeWidg @Override public SafeHtml getValue(StrippedLeaderboardDTO leaderboard) { String link = EntryPointLinkFactory.createLeaderboardLink(createLeaderboardLinkParameters(leaderboard)); - return getAnchor(link, stringMessages.leaderboard(), STYLE_ACTIVE_LEADERBOARD); + return getAnchor(link, stringMessages.leaderboard(), + SafeStylesUtils.fromTrustedString(STYLE_ACTIVE_LEADERBOARD)); } }; @@ -331,7 +336,8 @@ public class LeaderboardGroupPanel extends SimplePanel implements HasWelcomeWidg for (SeriesDTO series : regatta.series) { // render the series name if (!LeaderboardNameConstants.DEFAULT_SERIES_NAME.equals(series.getName())) { - seriesGrid.setHTML(seriesRow, 0, TEXTTEMPLATE.textWithClass(series.getName(), 50, STYLE_TABLE_TEXT)); + seriesGrid.setHTML(seriesRow, 0, TEXTTEMPLATE.textWithClass(series.getName(), 50, + SafeStylesUtils.fromTrustedString(STYLE_TABLE_TEXT))); } seriesGridFormatter.setVerticalAlignment(seriesRow, 0, HasVerticalAlignment.ALIGN_MIDDLE); int numberOfFleets = series.getFleets().size(); @@ -343,10 +349,12 @@ public class LeaderboardGroupPanel extends SimplePanel implements HasWelcomeWidg for(FleetDTO fleet: series.getFleets()) { Color color = fleet.getColor(); if(color != null) { - fleetsGrid.setHTML(fleetRow, 0, COLORBOXTEMPLATE.colorBox(color.getAsHtml(), STYLE_COLORBOX)); + fleetsGrid.setHTML(fleetRow, 0, COLORBOXTEMPLATE.colorBox(color.getAsHtml(), + SafeStylesUtils.fromTrustedString(STYLE_COLORBOX))); fleetGridsFormatter.setVerticalAlignment(fleetRow, 0, HasVerticalAlignment.ALIGN_MIDDLE); } - fleetsGrid.setHTML(fleetRow, 1, TEXTTEMPLATE.textWithClass(fleet.getName(), 50, STYLE_TABLE_TEXT)); + fleetsGrid.setHTML(fleetRow, 1, TEXTTEMPLATE.textWithClass(fleet.getName(), 50, + SafeStylesUtils.fromTrustedString(STYLE_TABLE_TEXT))); fleetGridsFormatter.setVerticalAlignment(fleetRow, 1, HasVerticalAlignment.ALIGN_MIDDLE); List raceColumnsOfSeries = getRacesOfFleet(leaderboard, series, fleet); fleetsGrid.setHTML(fleetRow, 2, renderRacesToHTml(leaderboard.name, raceColumnsOfSeries, fleet)); @@ -361,7 +369,8 @@ public class LeaderboardGroupPanel extends SimplePanel implements HasWelcomeWidg if (!LeaderboardNameConstants.DEFAULT_FLEET_NAME.equals(fleet.getName())) { Grid fleetsGrid = new Grid(1, 2); CellFormatter fleetGridsFormatter = fleetsGrid.getCellFormatter(); - fleetsGrid.setHTML(0, 0, TEXTTEMPLATE.textWithClass(displayName, 50, STYLE_TABLE_TEXT)); + fleetsGrid.setHTML(0, 0, TEXTTEMPLATE.textWithClass(displayName, 50, + SafeStylesUtils.fromTrustedString(STYLE_TABLE_TEXT))); fleetGridsFormatter.setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE); fleetsGrid.setHTML(0, 1, renderRacesToHTml(leaderboard.name, raceColumnsOfSeries, fleet)); seriesGrid.setWidget(seriesRow, 1, fleetsGrid); @@ -409,14 +418,16 @@ public class LeaderboardGroupPanel extends SimplePanel implements HasWelcomeWidg RegattaAndRaceIdentifier raceIdentifier = race.getRaceIdentifier(); String link = EntryPointLinkFactory.createRaceBoardLink(createRaceBoardLinkParameters(leaderboardName, raceIdentifier)); if (isLive) { - b.append(getAnchor(link, raceColumnName, STYLE_LIVE_RACE)); + b.append(getAnchor(link, raceColumnName, SafeStylesUtils.fromTrustedString(STYLE_LIVE_RACE))); } else if (race.trackedRace.hasGPSData && race.trackedRace.hasWindData) { - b.append(getAnchor(link, raceColumnName, STYLE_ACTIVE_RACE)); + b.append(getAnchor(link, raceColumnName, SafeStylesUtils.fromTrustedString(STYLE_ACTIVE_RACE))); } else { - b.append(TEXTTEMPLATE.textWithClass(raceColumnName, STYLE_INACTIVE_RACE)); + b.append(TEXTTEMPLATE.textWithClass(raceColumnName, + SafeStylesUtils.fromTrustedString(STYLE_INACTIVE_RACE))); } } else { - b.append(TEXTTEMPLATE.textWithClass(raceColumnName, STYLE_INACTIVE_RACE)); + b.append( + TEXTTEMPLATE.textWithClass(raceColumnName, SafeStylesUtils.fromTrustedString(STYLE_INACTIVE_RACE))); } } @@ -440,11 +451,11 @@ public class LeaderboardGroupPanel extends SimplePanel implements HasWelcomeWidg return linkParams; } - private SafeHtml getAnchor(String link, String linkText, String style) { + private SafeHtml getAnchor(String link, String linkText, SafeStyles style) { if (isEmbedded) { - return ANCHORTEMPLATE.anchorWithTarget(link, linkText, style, "_blank"); + return ANCHORTEMPLATE.anchorWithTarget(UriUtils.fromString(link), linkText, style, "_blank"); } else { - return ANCHORTEMPLATE.anchor(link, linkText, style); + return ANCHORTEMPLATE.anchor(UriUtils.fromString(link), linkText, style); } } diff --git a/java/com.sap.sse.security.ui/src/main/java/com/sap/sse/security/ui/registration/RegisterViewResources.css b/java/com.sap.sse.security.ui/src/main/java/com/sap/sse/security/ui/registration/RegisterViewResources.css index 6c9fd0e7ed6..bec66391643 100644 --- a/java/com.sap.sse.security.ui/src/main/java/com/sap/sse/security/ui/registration/RegisterViewResources.css +++ b/java/com.sap.sse.security.ui/src/main/java/com/sap/sse/security/ui/registration/RegisterViewResources.css @@ -23,7 +23,7 @@ body { background-color: #333333; border-bottom: 4px solid #f0ab00; color: white; - position: relative + position: relative; } .registrationform_header_appname { @@ -32,7 +32,7 @@ body { margin: 0; position: absolute; top: 50%; - transform: translate(0, -50%) + transform: translate(0, -50%); } .registrationform_content { From 60e50b2fa4ea20a50877bf928d0a9e8075832eab Mon Sep 17 00:00:00 2001 From: Kai Boernert Date: Mon, 20 Mar 2017 11:24:03 +0100 Subject: [PATCH 09/14] added QuadTree to blacklist, as it cannot be serialized anyway, and is only pulled in by the client due to implementing a generic Collection interface --- .../main/resources/com/sap/sailing/gwt/ui/DataMining.gwt.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/java/com.sap.sailing.gwt.ui/src/main/resources/com/sap/sailing/gwt/ui/DataMining.gwt.xml b/java/com.sap.sailing.gwt.ui/src/main/resources/com/sap/sailing/gwt/ui/DataMining.gwt.xml index ace61d80e5d..1435cf7770d 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/resources/com/sap/sailing/gwt/ui/DataMining.gwt.xml +++ b/java/com.sap.sailing.gwt.ui/src/main/resources/com/sap/sailing/gwt/ui/DataMining.gwt.xml @@ -46,4 +46,6 @@ + + From 49b9efed470baabbb8aa6a71b798c4294c8c2cac Mon Sep 17 00:00:00 2001 From: Kai Boernert Date: Mon, 20 Mar 2017 11:24:13 +0100 Subject: [PATCH 10/14] style warnings cleanup --- .../rankingtable/StartAnalysisStartRankTableStyle.css | 2 -- 1 file changed, 2 deletions(-) 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 6fa2b7a3807..3bb7f161e2e 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,5 +1,3 @@ -@CHARSET "UTF-8"; - .cellTableHeader { padding: 7px; padding-left: 10px; From 7ab3f2655b8dbc3ec83a1616cf7f9d2dc5019728 Mon Sep 17 00:00:00 2001 From: Kai Boernert Date: Mon, 20 Mar 2017 12:27:57 +0100 Subject: [PATCH 11/14] further serialisation excludes, to reduce warnings --- .../src/com/sap/sailing/domain/SailingDomain.gwt.xml | 3 +++ .../main/resources/com/sap/sailing/gwt/ui/DataMining.gwt.xml | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/java/com.sap.sailing.domain.common/src/com/sap/sailing/domain/SailingDomain.gwt.xml b/java/com.sap.sailing.domain.common/src/com/sap/sailing/domain/SailingDomain.gwt.xml index 18f89610f3f..4f04a296836 100644 --- a/java/com.sap.sailing.domain.common/src/com/sap/sailing/domain/SailingDomain.gwt.xml +++ b/java/com.sap.sailing.domain.common/src/com/sap/sailing/domain/SailingDomain.gwt.xml @@ -9,4 +9,7 @@ + + + diff --git a/java/com.sap.sailing.gwt.ui/src/main/resources/com/sap/sailing/gwt/ui/DataMining.gwt.xml b/java/com.sap.sailing.gwt.ui/src/main/resources/com/sap/sailing/gwt/ui/DataMining.gwt.xml index 1435cf7770d..435d83a0f0d 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/resources/com/sap/sailing/gwt/ui/DataMining.gwt.xml +++ b/java/com.sap.sailing.gwt.ui/src/main/resources/com/sap/sailing/gwt/ui/DataMining.gwt.xml @@ -46,6 +46,5 @@ - From c170e2979309f19882139a7da163a7cbde0f37f9 Mon Sep 17 00:00:00 2001 From: Kai Boernert Date: Mon, 20 Mar 2017 13:32:18 +0100 Subject: [PATCH 12/14] fix for compile error due to changes --- .../ui/spectator/LeaderboardGroupPanel.java | 37 +++++++++---------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/spectator/LeaderboardGroupPanel.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/spectator/LeaderboardGroupPanel.java index ad57cad5ed6..76f1ddba7f6 100755 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/spectator/LeaderboardGroupPanel.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/spectator/LeaderboardGroupPanel.java @@ -8,11 +8,10 @@ import java.util.Map; import com.google.gwt.cell.client.SafeHtmlCell; import com.google.gwt.core.client.GWT; import com.google.gwt.dom.client.Style.FontWeight; -import com.google.gwt.safecss.shared.SafeStyles; -import com.google.gwt.safecss.shared.SafeStylesUtils; import com.google.gwt.safehtml.client.SafeHtmlTemplates; import com.google.gwt.safehtml.shared.SafeHtml; import com.google.gwt.safehtml.shared.SafeHtmlBuilder; +import com.google.gwt.safehtml.shared.SafeHtmlUtils; import com.google.gwt.safehtml.shared.SafeUri; import com.google.gwt.safehtml.shared.UriUtils; import com.google.gwt.user.cellview.client.CellTable; @@ -58,26 +57,26 @@ public class LeaderboardGroupPanel extends SimplePanel implements HasWelcomeWidg interface AnchorTemplates extends SafeHtmlTemplates { @SafeHtmlTemplates.Template("{1}") - SafeHtml anchor(SafeUri url, String displayName, SafeStyles styleClass); + SafeHtml anchor(SafeUri url, String displayName, SafeHtml styleClass); @SafeHtmlTemplates.Template("{1}") - SafeHtml anchorWithTarget(SafeUri url, String displayName, SafeStyles styleClass, String target); + SafeHtml anchorWithTarget(SafeUri url, String displayName, SafeHtml styleClass, String target); } interface TextWithClassTemplate extends SafeHtmlTemplates { @SafeHtmlTemplates.Template("
{0}
") - SafeHtml textWithClass(String text, SafeStyles styleClass); + SafeHtml textWithClass(String text, SafeHtml styleClass); @SafeHtmlTemplates.Template("
{0}
") - SafeHtml textWithClass(String text, int widthInPx, SafeStyles styleClass); + SafeHtml textWithClass(String text, int widthInPx, SafeHtml styleClass); } interface ColorBoxTemplate extends SafeHtmlTemplates { @SafeHtmlTemplates.Template("
 
") - SafeHtml colorBox(String htmlColor, SafeStyles styleClass); + SafeHtml colorBox(String htmlColor, SafeHtml styleClass); @SafeHtmlTemplates.Template("
 
") - SafeHtml nocolorBox(SafeStyles styleClass); + SafeHtml nocolorBox(SafeHtml styleClass); } private static final AnchorTemplates ANCHORTEMPLATE = GWT.create(AnchorTemplates.class); @@ -225,7 +224,7 @@ public class LeaderboardGroupPanel extends SimplePanel implements HasWelcomeWidg public SafeHtml getValue(StrippedLeaderboardDTO strippedLeaderboardDTO) { String text = strippedLeaderboardDTO.displayName != null ? strippedLeaderboardDTO.displayName : strippedLeaderboardDTO.name; SafeHtmlBuilder b = new SafeHtmlBuilder(); - b.append(TEXTTEMPLATE.textWithClass(text, SafeStylesUtils.fromTrustedString(STYLE_BOATCLASS))); + b.append(TEXTTEMPLATE.textWithClass(text, SafeHtmlUtils.fromTrustedString(STYLE_BOATCLASS))); return b.toSafeHtml(); } }; @@ -237,7 +236,7 @@ public class LeaderboardGroupPanel extends SimplePanel implements HasWelcomeWidg public SafeHtml getValue(StrippedLeaderboardDTO leaderboard) { String link = EntryPointLinkFactory.createLeaderboardLink(createLeaderboardLinkParameters(leaderboard)); return getAnchor(link, stringMessages.leaderboard(), - SafeStylesUtils.fromTrustedString(STYLE_ACTIVE_LEADERBOARD)); + SafeHtmlUtils.fromTrustedString(STYLE_ACTIVE_LEADERBOARD)); } }; @@ -337,7 +336,7 @@ public class LeaderboardGroupPanel extends SimplePanel implements HasWelcomeWidg // render the series name if (!LeaderboardNameConstants.DEFAULT_SERIES_NAME.equals(series.getName())) { seriesGrid.setHTML(seriesRow, 0, TEXTTEMPLATE.textWithClass(series.getName(), 50, - SafeStylesUtils.fromTrustedString(STYLE_TABLE_TEXT))); + SafeHtmlUtils.fromTrustedString(STYLE_TABLE_TEXT))); } seriesGridFormatter.setVerticalAlignment(seriesRow, 0, HasVerticalAlignment.ALIGN_MIDDLE); int numberOfFleets = series.getFleets().size(); @@ -350,11 +349,11 @@ public class LeaderboardGroupPanel extends SimplePanel implements HasWelcomeWidg Color color = fleet.getColor(); if(color != null) { fleetsGrid.setHTML(fleetRow, 0, COLORBOXTEMPLATE.colorBox(color.getAsHtml(), - SafeStylesUtils.fromTrustedString(STYLE_COLORBOX))); + SafeHtmlUtils.fromTrustedString(STYLE_COLORBOX))); fleetGridsFormatter.setVerticalAlignment(fleetRow, 0, HasVerticalAlignment.ALIGN_MIDDLE); } fleetsGrid.setHTML(fleetRow, 1, TEXTTEMPLATE.textWithClass(fleet.getName(), 50, - SafeStylesUtils.fromTrustedString(STYLE_TABLE_TEXT))); + SafeHtmlUtils.fromTrustedString(STYLE_TABLE_TEXT))); fleetGridsFormatter.setVerticalAlignment(fleetRow, 1, HasVerticalAlignment.ALIGN_MIDDLE); List raceColumnsOfSeries = getRacesOfFleet(leaderboard, series, fleet); fleetsGrid.setHTML(fleetRow, 2, renderRacesToHTml(leaderboard.name, raceColumnsOfSeries, fleet)); @@ -370,7 +369,7 @@ public class LeaderboardGroupPanel extends SimplePanel implements HasWelcomeWidg Grid fleetsGrid = new Grid(1, 2); CellFormatter fleetGridsFormatter = fleetsGrid.getCellFormatter(); fleetsGrid.setHTML(0, 0, TEXTTEMPLATE.textWithClass(displayName, 50, - SafeStylesUtils.fromTrustedString(STYLE_TABLE_TEXT))); + SafeHtmlUtils.fromTrustedString(STYLE_TABLE_TEXT))); fleetGridsFormatter.setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE); fleetsGrid.setHTML(0, 1, renderRacesToHTml(leaderboard.name, raceColumnsOfSeries, fleet)); seriesGrid.setWidget(seriesRow, 1, fleetsGrid); @@ -418,16 +417,16 @@ public class LeaderboardGroupPanel extends SimplePanel implements HasWelcomeWidg RegattaAndRaceIdentifier raceIdentifier = race.getRaceIdentifier(); String link = EntryPointLinkFactory.createRaceBoardLink(createRaceBoardLinkParameters(leaderboardName, raceIdentifier)); if (isLive) { - b.append(getAnchor(link, raceColumnName, SafeStylesUtils.fromTrustedString(STYLE_LIVE_RACE))); + b.append(getAnchor(link, raceColumnName, SafeHtmlUtils.fromTrustedString(STYLE_LIVE_RACE))); } else if (race.trackedRace.hasGPSData && race.trackedRace.hasWindData) { - b.append(getAnchor(link, raceColumnName, SafeStylesUtils.fromTrustedString(STYLE_ACTIVE_RACE))); + b.append(getAnchor(link, raceColumnName, SafeHtmlUtils.fromTrustedString(STYLE_ACTIVE_RACE))); } else { b.append(TEXTTEMPLATE.textWithClass(raceColumnName, - SafeStylesUtils.fromTrustedString(STYLE_INACTIVE_RACE))); + SafeHtmlUtils.fromTrustedString(STYLE_INACTIVE_RACE))); } } else { b.append( - TEXTTEMPLATE.textWithClass(raceColumnName, SafeStylesUtils.fromTrustedString(STYLE_INACTIVE_RACE))); + TEXTTEMPLATE.textWithClass(raceColumnName, SafeHtmlUtils.fromTrustedString(STYLE_INACTIVE_RACE))); } } @@ -451,7 +450,7 @@ public class LeaderboardGroupPanel extends SimplePanel implements HasWelcomeWidg return linkParams; } - private SafeHtml getAnchor(String link, String linkText, SafeStyles style) { + private SafeHtml getAnchor(String link, String linkText, SafeHtml style) { if (isEmbedded) { return ANCHORTEMPLATE.anchorWithTarget(UriUtils.fromString(link), linkText, style, "_blank"); } else { From 29f64cea1cb71a32d002d5d6e962ccb2a1769d4b Mon Sep 17 00:00:00 2001 From: Kai Boernert Date: Tue, 21 Mar 2017 08:15:18 +0100 Subject: [PATCH 13/14] fixed style errors --- .../ui/spectator/LeaderboardGroupPanel.java | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/spectator/LeaderboardGroupPanel.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/spectator/LeaderboardGroupPanel.java index 76f1ddba7f6..e30fe207628 100755 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/spectator/LeaderboardGroupPanel.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/spectator/LeaderboardGroupPanel.java @@ -8,10 +8,11 @@ import java.util.Map; import com.google.gwt.cell.client.SafeHtmlCell; import com.google.gwt.core.client.GWT; import com.google.gwt.dom.client.Style.FontWeight; +import com.google.gwt.safecss.shared.SafeStyles; +import com.google.gwt.safecss.shared.SafeStylesBuilder; import com.google.gwt.safehtml.client.SafeHtmlTemplates; import com.google.gwt.safehtml.shared.SafeHtml; import com.google.gwt.safehtml.shared.SafeHtmlBuilder; -import com.google.gwt.safehtml.shared.SafeHtmlUtils; import com.google.gwt.safehtml.shared.SafeUri; import com.google.gwt.safehtml.shared.UriUtils; import com.google.gwt.user.cellview.client.CellTable; @@ -57,23 +58,23 @@ public class LeaderboardGroupPanel extends SimplePanel implements HasWelcomeWidg interface AnchorTemplates extends SafeHtmlTemplates { @SafeHtmlTemplates.Template("{1}") - SafeHtml anchor(SafeUri url, String displayName, SafeHtml styleClass); + SafeHtml anchor(SafeUri url, String displayName, String styleClass); @SafeHtmlTemplates.Template("{1}") - SafeHtml anchorWithTarget(SafeUri url, String displayName, SafeHtml styleClass, String target); + SafeHtml anchorWithTarget(SafeUri url, String displayName, String styleClass, String target); } interface TextWithClassTemplate extends SafeHtmlTemplates { @SafeHtmlTemplates.Template("
{0}
") - SafeHtml textWithClass(String text, SafeHtml styleClass); + SafeHtml textWithClass(String text, String styleClass); @SafeHtmlTemplates.Template("
{0}
") - SafeHtml textWithClass(String text, int widthInPx, SafeHtml styleClass); + SafeHtml textWithClass(String text, int widthInPx, String styleClass); } interface ColorBoxTemplate extends SafeHtmlTemplates { - @SafeHtmlTemplates.Template("
 
") - SafeHtml colorBox(String htmlColor, SafeHtml styleClass); + @SafeHtmlTemplates.Template("
 
") + SafeHtml colorBox(SafeStyles htmlColor, String styleClass); @SafeHtmlTemplates.Template("
 
") SafeHtml nocolorBox(SafeHtml styleClass); @@ -224,7 +225,7 @@ public class LeaderboardGroupPanel extends SimplePanel implements HasWelcomeWidg public SafeHtml getValue(StrippedLeaderboardDTO strippedLeaderboardDTO) { String text = strippedLeaderboardDTO.displayName != null ? strippedLeaderboardDTO.displayName : strippedLeaderboardDTO.name; SafeHtmlBuilder b = new SafeHtmlBuilder(); - b.append(TEXTTEMPLATE.textWithClass(text, SafeHtmlUtils.fromTrustedString(STYLE_BOATCLASS))); + b.append(TEXTTEMPLATE.textWithClass(text, STYLE_BOATCLASS)); return b.toSafeHtml(); } }; @@ -236,7 +237,7 @@ public class LeaderboardGroupPanel extends SimplePanel implements HasWelcomeWidg public SafeHtml getValue(StrippedLeaderboardDTO leaderboard) { String link = EntryPointLinkFactory.createLeaderboardLink(createLeaderboardLinkParameters(leaderboard)); return getAnchor(link, stringMessages.leaderboard(), - SafeHtmlUtils.fromTrustedString(STYLE_ACTIVE_LEADERBOARD)); + STYLE_ACTIVE_LEADERBOARD); } }; @@ -336,7 +337,7 @@ public class LeaderboardGroupPanel extends SimplePanel implements HasWelcomeWidg // render the series name if (!LeaderboardNameConstants.DEFAULT_SERIES_NAME.equals(series.getName())) { seriesGrid.setHTML(seriesRow, 0, TEXTTEMPLATE.textWithClass(series.getName(), 50, - SafeHtmlUtils.fromTrustedString(STYLE_TABLE_TEXT))); + STYLE_TABLE_TEXT)); } seriesGridFormatter.setVerticalAlignment(seriesRow, 0, HasVerticalAlignment.ALIGN_MIDDLE); int numberOfFleets = series.getFleets().size(); @@ -348,12 +349,12 @@ public class LeaderboardGroupPanel extends SimplePanel implements HasWelcomeWidg for(FleetDTO fleet: series.getFleets()) { Color color = fleet.getColor(); if(color != null) { - fleetsGrid.setHTML(fleetRow, 0, COLORBOXTEMPLATE.colorBox(color.getAsHtml(), - SafeHtmlUtils.fromTrustedString(STYLE_COLORBOX))); + SafeStyles bgStyle = new SafeStylesBuilder().trustedBackgroundColor(color.getAsHtml()).toSafeStyles(); + fleetsGrid.setHTML(fleetRow, 0, COLORBOXTEMPLATE.colorBox(bgStyle, STYLE_COLORBOX)); fleetGridsFormatter.setVerticalAlignment(fleetRow, 0, HasVerticalAlignment.ALIGN_MIDDLE); } fleetsGrid.setHTML(fleetRow, 1, TEXTTEMPLATE.textWithClass(fleet.getName(), 50, - SafeHtmlUtils.fromTrustedString(STYLE_TABLE_TEXT))); + STYLE_TABLE_TEXT)); fleetGridsFormatter.setVerticalAlignment(fleetRow, 1, HasVerticalAlignment.ALIGN_MIDDLE); List raceColumnsOfSeries = getRacesOfFleet(leaderboard, series, fleet); fleetsGrid.setHTML(fleetRow, 2, renderRacesToHTml(leaderboard.name, raceColumnsOfSeries, fleet)); @@ -369,7 +370,7 @@ public class LeaderboardGroupPanel extends SimplePanel implements HasWelcomeWidg Grid fleetsGrid = new Grid(1, 2); CellFormatter fleetGridsFormatter = fleetsGrid.getCellFormatter(); fleetsGrid.setHTML(0, 0, TEXTTEMPLATE.textWithClass(displayName, 50, - SafeHtmlUtils.fromTrustedString(STYLE_TABLE_TEXT))); + STYLE_TABLE_TEXT)); fleetGridsFormatter.setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE); fleetsGrid.setHTML(0, 1, renderRacesToHTml(leaderboard.name, raceColumnsOfSeries, fleet)); seriesGrid.setWidget(seriesRow, 1, fleetsGrid); @@ -417,16 +418,16 @@ public class LeaderboardGroupPanel extends SimplePanel implements HasWelcomeWidg RegattaAndRaceIdentifier raceIdentifier = race.getRaceIdentifier(); String link = EntryPointLinkFactory.createRaceBoardLink(createRaceBoardLinkParameters(leaderboardName, raceIdentifier)); if (isLive) { - b.append(getAnchor(link, raceColumnName, SafeHtmlUtils.fromTrustedString(STYLE_LIVE_RACE))); + b.append(getAnchor(link, raceColumnName, STYLE_LIVE_RACE)); } else if (race.trackedRace.hasGPSData && race.trackedRace.hasWindData) { - b.append(getAnchor(link, raceColumnName, SafeHtmlUtils.fromTrustedString(STYLE_ACTIVE_RACE))); + b.append(getAnchor(link, raceColumnName, STYLE_ACTIVE_RACE)); } else { b.append(TEXTTEMPLATE.textWithClass(raceColumnName, - SafeHtmlUtils.fromTrustedString(STYLE_INACTIVE_RACE))); + STYLE_INACTIVE_RACE)); } } else { b.append( - TEXTTEMPLATE.textWithClass(raceColumnName, SafeHtmlUtils.fromTrustedString(STYLE_INACTIVE_RACE))); + TEXTTEMPLATE.textWithClass(raceColumnName, STYLE_INACTIVE_RACE)); } } @@ -450,7 +451,7 @@ public class LeaderboardGroupPanel extends SimplePanel implements HasWelcomeWidg return linkParams; } - private SafeHtml getAnchor(String link, String linkText, SafeHtml style) { + private SafeHtml getAnchor(String link, String linkText, String style) { if (isEmbedded) { return ANCHORTEMPLATE.anchorWithTarget(UriUtils.fromString(link), linkText, style, "_blank"); } else { From b23821893db814e2e4082e9d965f05c5247e2cbd Mon Sep 17 00:00:00 2001 From: Kai Boernert Date: Tue, 28 Mar 2017 08:20:49 +0200 Subject: [PATCH 14/14] changed object to ? extends Serializable, to reduce warning in gwt compiler --- .../sap/sailing/gwt/ui/datamining/DataMiningService.java | 7 +++++-- .../sailing/gwt/ui/datamining/DataMiningServiceAsync.java | 8 ++++++-- .../ui/datamining/developer/PredefinedQueryRunner.java | 6 ++++-- .../execution/ManagedDataMiningQueryCallback.java | 5 ++++- .../gwt/ui/datamining/execution/SimpleQueryRunner.java | 7 +++++-- .../sap/sailing/gwt/ui/server/DataMiningServiceImpl.java | 6 ++++-- .../sailing/gwt/ui/spectator/LeaderboardGroupPanel.java | 2 +- .../sse/datamining/shared/impl/dto/QueryResultDTO.java | 4 +++- .../sse/datamining/factories/DataMiningDTOFactory.java | 4 +++- 9 files changed, 35 insertions(+), 14 deletions(-) diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/datamining/DataMiningService.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/datamining/DataMiningService.java index 042c0b008f8..72577eb3e2e 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/datamining/DataMiningService.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/datamining/DataMiningService.java @@ -40,10 +40,13 @@ public interface DataMiningService extends RemoteService { HashSet dimensionDTOs, HashMap retrieverSettings, HashMap>> filterSelectionDTO, String localeInfoName); - QueryResultDTO runQuery(DataMiningSession session, StatisticQueryDefinitionDTO queryDefinition); + QueryResultDTO runQuery(DataMiningSession session, + StatisticQueryDefinitionDTO queryDefinition); HashSet getPredefinedQueryIdentifiers(); - QueryResultDTO runPredefinedQuery(DataMiningSession session, PredefinedQueryIdentifier identifier, String localeInfoName); + + QueryResultDTO runPredefinedQuery(DataMiningSession session, + PredefinedQueryIdentifier identifier, String localeInfoName); SerializationDummy pseudoMethodSoThatSomeClassesAreAddedToTheGWTSerializationPolicy(); diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/datamining/DataMiningServiceAsync.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/datamining/DataMiningServiceAsync.java index 7c224567816..b8f1f30e2c8 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/datamining/DataMiningServiceAsync.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/datamining/DataMiningServiceAsync.java @@ -45,10 +45,14 @@ public interface DataMiningServiceAsync { HashMap>> filterSelectionDTO, String localeInfoName, AsyncCallback>> callback); - void runQuery(DataMiningSession session, StatisticQueryDefinitionDTO queryDefinition, AsyncCallback> callback); + void runQuery(DataMiningSession session, + StatisticQueryDefinitionDTO queryDefinition, AsyncCallback> callback); void getPredefinedQueryIdentifiers(AsyncCallback> callback); - void runPredefinedQuery(DataMiningSession session, PredefinedQueryIdentifier identifier, String localeInfoName, AsyncCallback> callback); + + void runPredefinedQuery(DataMiningSession session, + PredefinedQueryIdentifier identifier, String localeInfoName, + AsyncCallback> callback); /** * This method does nothing, but is needed to ensure, that some classes for the data mining diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/datamining/developer/PredefinedQueryRunner.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/datamining/developer/PredefinedQueryRunner.java index 68a315a00d1..ac1b16705eb 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/datamining/developer/PredefinedQueryRunner.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/datamining/developer/PredefinedQueryRunner.java @@ -1,5 +1,6 @@ package com.sap.sailing.gwt.ui.datamining.developer; +import java.io.Serializable; import java.util.ArrayList; import java.util.HashSet; import java.util.List; @@ -136,14 +137,15 @@ public class PredefinedQueryRunner extends ComponentWithoutSettings { protected void runSelectedPredefinedQuery() { PredefinedQueryIdentifier predefinedQueryIdentifier = selectionListBox.getValue(); resultsPresenter.showBusyIndicator(); - dataMiningService.runPredefinedQuery(session, predefinedQueryIdentifier, LocaleInfo.getCurrentLocale().getLocaleName(), new AsyncCallback>() { + dataMiningService.runPredefinedQuery(session, predefinedQueryIdentifier, + LocaleInfo.getCurrentLocale().getLocaleName(), new AsyncCallback>() { @Override public void onFailure(Throwable caught) { errorReporter.reportError("Error running the query: " + caught.getMessage()); resultsPresenter.showError(stringMessages.errorRunningDataMiningQuery() + "."); } @Override - public void onSuccess(QueryResultDTO result) { + public void onSuccess(QueryResultDTO result) { resultsPresenter.showResult(result); } }); diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/datamining/execution/ManagedDataMiningQueryCallback.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/datamining/execution/ManagedDataMiningQueryCallback.java index 9d6caa19952..adccaaef9c5 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/datamining/execution/ManagedDataMiningQueryCallback.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/datamining/execution/ManagedDataMiningQueryCallback.java @@ -1,11 +1,14 @@ package com.sap.sailing.gwt.ui.datamining.execution; +import java.io.Serializable; + import com.google.gwt.user.client.rpc.AsyncCallback; import com.sap.sailing.gwt.ui.datamining.ManagedDataMiningQueriesCounter; import com.sap.sse.datamining.shared.data.QueryResultState; import com.sap.sse.datamining.shared.impl.dto.QueryResultDTO; -public abstract class ManagedDataMiningQueryCallback implements AsyncCallback> { +public abstract class ManagedDataMiningQueryCallback + implements AsyncCallback> { private final ManagedDataMiningQueriesCounter counter; diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/datamining/execution/SimpleQueryRunner.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/datamining/execution/SimpleQueryRunner.java index 3b2feebf074..affa4587a23 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/datamining/execution/SimpleQueryRunner.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/datamining/execution/SimpleQueryRunner.java @@ -1,5 +1,7 @@ package com.sap.sailing.gwt.ui.datamining.execution; +import java.io.Serializable; + import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.user.client.Timer; @@ -89,14 +91,15 @@ public class SimpleQueryRunner extends AbstractComponent im if (errorMessages == null || !errorMessages.iterator().hasNext()) { counter.increase(); resultsPresenter.showBusyIndicator(); - dataMiningService.runQuery(session, queryDefinition, new ManagedDataMiningQueryCallback(counter) { + dataMiningService.runQuery(session, queryDefinition, + new ManagedDataMiningQueryCallback(counter) { @Override protected void handleFailure(Throwable caught) { errorReporter.reportError("Error running the query: " + caught.getMessage()); resultsPresenter.showError(stringMessages.errorRunningDataMiningQuery() + "."); } @Override - protected void handleSuccess(QueryResultDTO result) { + protected void handleSuccess(QueryResultDTO result) { resultsPresenter.showResult(result); } }); diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/server/DataMiningServiceImpl.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/server/DataMiningServiceImpl.java index a899b1b9927..ad35e2d4f16 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/server/DataMiningServiceImpl.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/server/DataMiningServiceImpl.java @@ -294,7 +294,8 @@ public class DataMiningServiceImpl extends RemoteServiceServlet implements DataM } @Override - public QueryResultDTO runQuery(DataMiningSession session, StatisticQueryDefinitionDTO queryDefinitionDTO) { + public QueryResultDTO runQuery(DataMiningSession session, + StatisticQueryDefinitionDTO queryDefinitionDTO) { SecurityUtils.getSubject().checkPermission(Permission.DATA_MINING.getStringPermissionForObjects(Mode.READ, queryDefinitionDTO.getDataRetrieverChainDefinition().getName())); DataMiningServer dataMiningServer = getDataMiningServer(); StatisticQueryDefinition queryDefinition = dataMiningServer.getQueryDefinitionForDTO(queryDefinitionDTO); @@ -314,7 +315,8 @@ public class DataMiningServiceImpl extends RemoteServiceServlet implements DataM } @Override - public QueryResultDTO runPredefinedQuery(DataMiningSession session, PredefinedQueryIdentifier identifier, String localeInfoName) { + public QueryResultDTO runPredefinedQuery(DataMiningSession session, + PredefinedQueryIdentifier identifier, String localeInfoName) { SecurityUtils.getSubject().checkPermission(Permission.DATA_MINING.getStringPermissionForObjects(Mode.READ, identifier.getIdentifier())); DataMiningServer dataMiningServer = getDataMiningServer(); ModifiableStatisticQueryDefinitionDTO queryDefinitionDTO = dataMiningServer.getPredefinedQueryDefinitionDTO(identifier); diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/spectator/LeaderboardGroupPanel.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/spectator/LeaderboardGroupPanel.java index e30fe207628..0879fca5291 100755 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/spectator/LeaderboardGroupPanel.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/spectator/LeaderboardGroupPanel.java @@ -77,7 +77,7 @@ public class LeaderboardGroupPanel extends SimplePanel implements HasWelcomeWidg SafeHtml colorBox(SafeStyles htmlColor, String styleClass); @SafeHtmlTemplates.Template("
 
") - SafeHtml nocolorBox(SafeHtml styleClass); + SafeHtml nocolorBox(String styleClass); } private static final AnchorTemplates ANCHORTEMPLATE = GWT.create(AnchorTemplates.class); diff --git a/java/com.sap.sse.datamining.shared/src/com/sap/sse/datamining/shared/impl/dto/QueryResultDTO.java b/java/com.sap.sse.datamining.shared/src/com/sap/sse/datamining/shared/impl/dto/QueryResultDTO.java index adc26fc99c4..1306ac89ade 100644 --- a/java/com.sap.sse.datamining.shared/src/com/sap/sse/datamining/shared/impl/dto/QueryResultDTO.java +++ b/java/com.sap.sse.datamining.shared/src/com/sap/sse/datamining/shared/impl/dto/QueryResultDTO.java @@ -1,5 +1,6 @@ package com.sap.sse.datamining.shared.impl.dto; +import java.io.Serializable; import java.util.Map; import com.sap.sse.datamining.shared.AdditionalResultData; @@ -9,7 +10,8 @@ import com.sap.sse.datamining.shared.data.QueryResultState; import com.sap.sse.datamining.shared.impl.NullAdditionalResultData; import com.sap.sse.datamining.shared.impl.QueryResultBaseImpl; -public class QueryResultDTO extends QueryResultBaseImpl implements QueryResultBase { +public class QueryResultDTO extends QueryResultBaseImpl + implements QueryResultBase { private static final long serialVersionUID = 3639302996859873603L; private String resultTypeName; diff --git a/java/com.sap.sse.datamining/src/com/sap/sse/datamining/factories/DataMiningDTOFactory.java b/java/com.sap.sse.datamining/src/com/sap/sse/datamining/factories/DataMiningDTOFactory.java index d8ba465974f..0e2f36bd1a7 100644 --- a/java/com.sap.sse.datamining/src/com/sap/sse/datamining/factories/DataMiningDTOFactory.java +++ b/java/com.sap.sse.datamining/src/com/sap/sse/datamining/factories/DataMiningDTOFactory.java @@ -1,5 +1,6 @@ package com.sap.sse.datamining.factories; +import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.Locale; @@ -102,7 +103,8 @@ public class DataMiningDTOFactory { localizedRetrievedDataType, retrieverLevel.getDefaultSettings()); } - public QueryResultDTO createResultDTO(QueryResult result) { + public QueryResultDTO createResultDTO( + QueryResult result) { return new QueryResultDTO(result.getState(), result.getResultType(), result.getResults(), result.getAdditionalData()); }