made LeaderboardGroupOverviewPanel fleet aware

This commit is contained in:
Axel Uhl committed 2012-05-16 11:33:12 +02:00
1 parent b61445ac7d
commit c552a7bab0
6 files changed
+41 -76

No files matched your search

@@ -239,6 +239,7 @@ public interface StringMessages extends Messages {
String noLeaderboardGroupWithNameFound(String groupName);
String overview();
String welcomeToSailingAnalytics();
String welcomeToSailingAnalyticsBody();
String home();
String clickAndDragToZoomIn();
String windSpeed();
@@ -234,6 +234,7 @@ abort=Abort
noLeaderboardGroupWithNameFound=No leaderboard group with the name {0} found
overview=Overview
welcomeToSailingAnalytics=Welcome to SAP Sailing Analytics
welcomeToSailingAnalyticsBody=Understanding what happens out on the race course isn't always easy. To help solve this challenge and bring the excitement of sailing to the fans, we have developed a leader board based on SAP analytics.\nThrough analyzing GPS data together with integrated wind measurements from sensors out on the race course, the leader board displays information such as in-race ranking, average speeds, distance travelled, ETA (estimated time of arrival at the next mark rounding), gaps to leader, gains and losses per leg.\n\nCheck out the results for yourself to see who triumphed - and how they did it.
home=Home
clickAndDragToZoomIn=Click and drag in the plot area to zoom in
windSpeed=Wind speed (kts)
@@ -235,6 +235,7 @@ abort=Abbrechen
noLeaderboardGroupWithNameFound=Keine Ranglisten-Gruppe mit dem Namen {0} gefunden
overview=Übersicht
welcomeToSailingAnalytics=Willkommen bei SAP Sailing Analytics
welcomeToSailingAnalyticsBody=Understanding what happens out on the race course isn't always easy. To help solve this challenge and bring the excitement of sailing to the fans, we have developed a leader board based on SAP analytics.\nThrough analyzing GPS data together with integrated wind measurements from sensors out on the race course, the leader board displays information such as in-race ranking, average speeds, distance travelled, ETA (estimated time of arrival at the next mark rounding), gaps to leader, gains and losses per leg.\n\nCheck out the results for yourself to see who triumphed - and how they did it.
home=Startseite
clickAndDragToZoomIn=Anklicken und ziehen zum Hineinzoomen
windSpeed=Wind speed (sm/h)
@@ -1,54 +0,0 @@
package com.sap.sailing.gwt.ui.shared.panels;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Button;
import com.sap.sailing.gwt.ui.client.StringMessages;
public class ClosableWelcomeWidget extends SimpleWelcomeWidget {
private StringMessages stringConstants;
private boolean closable;
private Button closeButton;
/**
* Creates a new closable welcome widget. It has the same components as the {@link SimpleWelcomeWidget} and a Button
* at the top right corner to close the welcome widget (it sets the whole component visible = <code>false</code>).
*
* @param closable Sets the visibility of the close Button
* @param headerText The text of the header component
* @param welcomeText The text of the component under the header (welcome component)
*/
public ClosableWelcomeWidget(boolean closable, String headerText, String welcomeText, StringMessages stringConstants) {
super(headerText, welcomeText);
this.stringConstants = stringConstants;
this.closable = closable;
closeButton = new Button(this.stringConstants.close());
closeButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
ClosableWelcomeWidget.this.setVisible(false);
}
});
closeButton.setVisible(this.closable);
closeButton.setStyleName(STYLE_NAME_PREFIX + "CloseButton");
mainPanel.insert(closeButton, 0);
}
/**
* @return <code>true</code> if the welcome widget is closable (close button is visible) right now, else returns <code>false</code>
*/
public boolean isClosable() {
return closable;
}
/**
* Sets the visibility of the close button and consequently the ability of the welcome widget to close itself.
*/
public void setIsClosable(boolean isClosable) {
closable = isClosable;
closeButton.setVisible(closable);
}
}
@@ -35,6 +35,7 @@ import com.google.gwt.view.client.NoSelectionModel;
import com.google.gwt.view.client.SelectionChangeEvent;
import com.google.gwt.view.client.SingleSelectionModel;
import com.sap.sailing.domain.common.RegattaNameAndRaceName;
import com.sap.sailing.domain.common.impl.Util;
import com.sap.sailing.gwt.ui.adminconsole.LeaderboardConfigPanel.AnchorCell;
import com.sap.sailing.gwt.ui.client.ErrorReporter;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
@@ -423,17 +424,29 @@ public class LeaderboardGroupOverviewPanel extends FormPanel {
@Override
public SafeHtml getValue(RaceColumnDTO race) {
SafeHtml name = null;
if (race.getRaceIdentifier(fleetName) != null) {
LeaderboardGroupDTO selectedGroup = groupsSelectionModel.getSelectedObject();
LeaderboardDTO selectedLeaderboard = leaderboardsSelectionModel.getSelectedObject();
RegattaNameAndRaceName raceId = (RegattaNameAndRaceName) race.getRaceIdentifier(fleetName);
String debugParam = Window.Location.getParameter("gwt.codesvr");
String link = URLFactory.INSTANCE.encode("/gwt/RaceBoard.html?leaderboardName=" + selectedLeaderboard.name + "&raceName=" + raceId.getRaceName()
+ "&regattaName=" + raceId.getRegattaName() + "&leaderboardGroupName=" + selectedGroup.name + "&root=overview"
+ (debugParam != null && !debugParam.isEmpty() ? "&gwt.codesvr=" + debugParam : ""));
name = ANCHORTEMPLATE.anchor(link, raceId.getRaceName());
} else {
name = new SafeHtmlBuilder().appendHtmlConstant(race.getRaceColumnName()).toSafeHtml();
Iterable<String> fleetNames = race.getFleetNames();
boolean singleFleet = Util.size(fleetNames) < 2;
for (String fleetName : fleetNames) {
String raceDisplayName;
if (singleFleet) {
raceDisplayName = race.getRaceColumnName();
} else {
raceDisplayName = race.getRaceColumnName() + "("+fleetName+")";
}
if (race.getRaceIdentifier(fleetName) != null) {
LeaderboardGroupDTO selectedGroup = groupsSelectionModel.getSelectedObject();
LeaderboardDTO selectedLeaderboard = leaderboardsSelectionModel.getSelectedObject();
RegattaNameAndRaceName raceId = (RegattaNameAndRaceName) race.getRaceIdentifier(fleetName);
String debugParam = Window.Location.getParameter("gwt.codesvr");
String link = URLFactory.INSTANCE.encode("/gwt/RaceBoard.html?leaderboardName="
+ selectedLeaderboard.name + "&raceName=" + raceId.getRaceName() + "&regattaName="
+ raceId.getRegattaName() + "&leaderboardGroupName=" + selectedGroup.name
+ "&root=overview"
+ (debugParam != null && !debugParam.isEmpty() ? "&gwt.codesvr=" + debugParam : ""));
name = ANCHORTEMPLATE.anchor(link, raceDisplayName);
} else {
name = new SafeHtmlBuilder().appendHtmlConstant(raceDisplayName).toSafeHtml();
}
}
return name;
}
@@ -442,9 +455,19 @@ public class LeaderboardGroupOverviewPanel extends FormPanel {
TextColumn<RaceColumnDTO> racesStartDateColumn = new TextColumn<RaceColumnDTO>() {
@Override
public String getValue(RaceColumnDTO race) {
Date raceStart = race.getStartDate(fleetName);
return raceStart == null ? LeaderboardGroupOverviewPanel.this.stringMessages.untracked()
: DateTimeFormat.getFormat(PredefinedFormat.DATE_SHORT).format(raceStart);
StringBuilder result = new StringBuilder();
boolean first = true;
for (String fleetName : race.getFleetNames()) {
Date raceStart = race.getStartDate(fleetName);
if (first) {
first = false;
} else {
result.append(", ");
}
result.append(raceStart == null ? LeaderboardGroupOverviewPanel.this.stringMessages.untracked()
: DateTimeFormat.getFormat(PredefinedFormat.DATE_SHORT).format(raceStart));
}
return result.toString();
}
};
@@ -62,14 +62,7 @@ public class SpectatorEntryPoint extends AbstractEntryPoint implements RegattaRe
} else {
LeaderboardGroupPanel groupPanel = new LeaderboardGroupPanel(sailingService, stringMessages, this, groupName, root, viewModeParamValue);
groupPanel.getElement().getStyle().setFloat(Style.Float.LEFT);
groupPanel.setWelcomeWidget(new SimpleWelcomeWidget( stringMessages.welcomeToSailingAnalytics(),
"Understanding what happens out on the race course isn't always easy. To help solve this challenge and" +
" bring the excitement of sailing to the fans, we have developed a leader board based on SAP analytics.\n" +
" Through analyzing GPS data together with integrated wind measurements from sensors out on the race course," +
" the leader board displays information such as in-race ranking, average speeds, distance travelled, ETA" +
" (estimated time of arrival at the next mark rounding), gaps to leader, gains and losses per leg.\n\n" +
"Check out the results for yourself to see who triumphed - and how they did it."));
groupPanel.setWelcomeWidget(new SimpleWelcomeWidget( stringMessages.welcomeToSailingAnalytics(), stringMessages.welcomeToSailingAnalyticsBody()));
SimplePanel feedbackPanel = new SimplePanel();
feedbackPanel.getElement().getStyle().setProperty("clear", "right");
feedbackPanel.addStyleName("feedbackPanel");