mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-30 17:36:40 +00:00
Merge remote-tracking branch 'server/gwt' into gwt
This commit is contained in:
commit
b60681f1d9
5 files changed
+73
-12
No files matched your search
Binary file not shown.
|
After Width: | Height: | Size: 47 KiB |
+4
-3
@@ -1040,7 +1040,6 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
* Also updates the min/max values on the columns
|
||||
*/
|
||||
protected void updateLeaderboard(LeaderboardDTO leaderboard) {
|
||||
Set<LeaderboardRowDTO> selectedRows = leaderboardSelectionModel.getSelectedSet();
|
||||
competitorSelectionProvider.setCompetitors(leaderboard.competitors);
|
||||
selectedRaceColumns.addAll(getRaceColumnsToAddImplicitly(leaderboard));
|
||||
setLeaderboard(leaderboard);
|
||||
@@ -1063,8 +1062,10 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
}
|
||||
//Reselect the selected rows
|
||||
leaderboardSelectionModel.clear();
|
||||
for (LeaderboardRowDTO row : selectedRows) {
|
||||
leaderboardSelectionModel.setSelected(row, true);
|
||||
for (LeaderboardRowDTO row : data.getList()) {
|
||||
if (competitorSelectionProvider.isSelected(row.competitor)) {
|
||||
leaderboardSelectionModel.setSelected(row, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package com.sap.sailing.gwt.ui.shared.panels;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Style;
|
||||
import com.google.gwt.safehtml.client.SafeHtmlTemplates;
|
||||
import com.google.gwt.safehtml.shared.SafeHtml;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.sap.sailing.domain.common.impl.Util.Pair;
|
||||
|
||||
public class BreadcrumbPanel extends FlowPanel {
|
||||
|
||||
interface AnchorTemplates extends SafeHtmlTemplates {
|
||||
@SafeHtmlTemplates.Template("<a href=\"{0}\">{1}</a>")
|
||||
SafeHtml anchor(String url, String displayName);
|
||||
}
|
||||
|
||||
public static final AnchorTemplates ANCHORTEMPLATE = GWT.create(AnchorTemplates.class);
|
||||
public static final String STYLE_NAME_PREFIX = "breadcrumbPanel-";
|
||||
|
||||
/**
|
||||
* Creates a new BreadcrumbPanel with the <code>breadcrumbLinks</code> as active links and <code>actualBreadcrumb</code> as Label
|
||||
* @param breadcrumbLinksData The data of the breadcrumbs which will be displayed as links. Part A of the pair is the URL and part B the displayed text.
|
||||
* @param actualBreadcrumbName The text as Label. Should be the name of the component in which the BreadcrumbPanel is displayed.
|
||||
*/
|
||||
public BreadcrumbPanel(Iterable<Pair<String, String>> breadcrumbLinksData, String actualBreadcrumbName) {
|
||||
super();
|
||||
//Adding the active breadcrumbs
|
||||
for (Pair<String, String> breadcrumbData : breadcrumbLinksData) {
|
||||
HTML breadcrumb = new HTML(ANCHORTEMPLATE.anchor(breadcrumbData.getA(), breadcrumbData.getB()));
|
||||
breadcrumb.addStyleName(STYLE_NAME_PREFIX + "ActiveBreadcrumb");
|
||||
breadcrumb.getElement().getStyle().setFloat(Style.Float.LEFT);
|
||||
breadcrumb.getElement().getStyle().setPadding(5, Style.Unit.PX);
|
||||
add(breadcrumb);
|
||||
|
||||
Label nextArrow = new Label(">");
|
||||
nextArrow.setStyleName(STYLE_NAME_PREFIX + "NextArrow");
|
||||
nextArrow.getElement().getStyle().setFloat(Style.Float.LEFT);
|
||||
nextArrow.getElement().getStyle().setPadding(5, Style.Unit.PX);
|
||||
add(nextArrow);
|
||||
}
|
||||
//Adding the actual breadcrumb
|
||||
Label actualBreadcrumb = new Label(actualBreadcrumbName);
|
||||
actualBreadcrumb.addStyleName(STYLE_NAME_PREFIX + "InactiveBreadcrumb");
|
||||
actualBreadcrumb.getElement().getStyle().setFloat(Style.Float.LEFT);
|
||||
actualBreadcrumb.getElement().getStyle().setPadding(5, Style.Unit.PX);
|
||||
add(actualBreadcrumb);
|
||||
}
|
||||
|
||||
}
|
||||
+12
-6
@@ -51,16 +51,21 @@ public class LeaderboardGroupPanel extends FormPanel implements HasWelcomeWidget
|
||||
private StringMessages stringConstants;
|
||||
private ErrorReporter errorReporter;
|
||||
private LeaderboardGroupDTO group;
|
||||
private String root;
|
||||
|
||||
private FlowPanel mainPanel;
|
||||
private Widget welcomeWidget = null;
|
||||
|
||||
public LeaderboardGroupPanel(SailingServiceAsync sailingService, StringMessages stringConstants,
|
||||
ErrorReporter errorReporter, final String groupName) {
|
||||
ErrorReporter errorReporter, final String groupName, String root) {
|
||||
super();
|
||||
this.sailingService = sailingService;
|
||||
this.stringConstants = stringConstants;
|
||||
this.errorReporter = errorReporter;
|
||||
this.root = root;
|
||||
if (this.root == null || this.root.length() == 0) {
|
||||
this.root = "leaderboardGroupPanel";
|
||||
}
|
||||
|
||||
mainPanel = new FlowPanel();
|
||||
mainPanel.setWidth("95%");
|
||||
@@ -151,7 +156,7 @@ public class LeaderboardGroupPanel extends FormPanel implements HasWelcomeWidget
|
||||
public SafeHtml getValue(LeaderboardDTO leaderboard) {
|
||||
String debugParam = Window.Location.getParameter("gwt.codesvr");
|
||||
return ANCHORTEMPLATE.anchor("/gwt/Leaderboard.html?name=" + leaderboard.name
|
||||
+ "&leaderboardGroupName=" + group.name
|
||||
+ "&leaderboardGroupName=" + group.name + "&root=" + root
|
||||
+ (debugParam != null && !debugParam.isEmpty() ? "&gwt.codesvr=" + debugParam : ""),
|
||||
leaderboard.name, STYLE_NAME_PREFIX + "ActiveLeaderboard");
|
||||
}
|
||||
@@ -185,14 +190,15 @@ public class LeaderboardGroupPanel extends FormPanel implements HasWelcomeWidget
|
||||
SafeHtmlBuilder b = new SafeHtmlBuilder();
|
||||
String displayName = race.getRaceColumnName();
|
||||
if (race.getRaceColumnName().equals(stringConstants.overview())) {
|
||||
String link = "/gwt/Leaderboard.html?name=" + leaderboard.name + "&leaderboardGroupName=" + group.name +
|
||||
(debugParam != null && !debugParam.isEmpty() ? "&gwt.codesvr="+debugParam : "");
|
||||
String link = "/gwt/Leaderboard.html?name=" + leaderboard.name + "&leaderboardGroupName=" + group.name
|
||||
+ "&root=" + root
|
||||
+ (debugParam != null && !debugParam.isEmpty() ? "&gwt.codesvr=" + debugParam : "");
|
||||
b.append(ANCHORTEMPLATE.anchor(link, displayName, STYLE_NAME_PREFIX + "ActiveLeaderboard"));
|
||||
} else {
|
||||
if (race.getRaceIdentifier() != null) {
|
||||
EventNameAndRaceName raceId = (EventNameAndRaceName) race.getRaceIdentifier();
|
||||
String link = "/gwt/RaceBoard.html?leaderboardName=" + leaderboard.name + "&raceName=" + raceId.getRaceName()
|
||||
+ "&eventName=" + raceId.getEventName() + "&leaderboardGroupName=" + group.name
|
||||
+ "&eventName=" + raceId.getEventName() + "&leaderboardGroupName=" + group.name + "&root=" + root
|
||||
+ (debugParam != null && !debugParam.isEmpty() ? "&gwt.codesvr=" + debugParam : "");
|
||||
b.append(ANCHORTEMPLATE.anchor(link, displayName, STYLE_NAME_PREFIX + "ActiveRace"));
|
||||
} else {
|
||||
@@ -212,7 +218,7 @@ public class LeaderboardGroupPanel extends FormPanel implements HasWelcomeWidget
|
||||
}
|
||||
if (race.getRaceIdentifier() != null) {
|
||||
EventNameAndRaceName raceId = (EventNameAndRaceName) race.getRaceIdentifier();
|
||||
String link = "/gwt/RaceBoard.html?leaderboardName=" + leaderboard.name + "&raceName="
|
||||
String link = "/gwt/RaceBoard.html?leaderboardName=" + leaderboard.name + "&raceName=" + "&root=" + root
|
||||
+ raceId.getRaceName() + "&eventName=" + raceId.getEventName() + "&leaderboardGroupName="
|
||||
+ group.name + (debugParam != null && !debugParam.isEmpty() ? "&gwt.codesvr=" + debugParam : "");
|
||||
b.append(ANCHORTEMPLATE.anchor(link, race.getRaceColumnName(), STYLE_NAME_PREFIX + "ActiveRace"));
|
||||
|
||||
+6
-3
@@ -21,9 +21,7 @@ public class SpectatorEntryPoint extends AbstractEntryPoint implements EventRefr
|
||||
public void onModuleLoad() {
|
||||
super.onModuleLoad();
|
||||
|
||||
//Fill fixed leaderboard selection
|
||||
String groupParamValue = Window.Location.getParameter("leaderboardGroupName");
|
||||
|
||||
final String groupName;
|
||||
if(groupParamValue == null || groupParamValue.isEmpty()) {
|
||||
groupName = null;
|
||||
@@ -39,6 +37,11 @@ public class SpectatorEntryPoint extends AbstractEntryPoint implements EventRefr
|
||||
});
|
||||
}
|
||||
|
||||
String root = Window.Location.getParameter("root");
|
||||
//Check if the root contains an allowed value
|
||||
if (root != null) {
|
||||
root = (root.equals("leaderboardGroupPanel") || root.equals("overview")) ? root : null;
|
||||
}
|
||||
RootPanel rootPanel = RootPanel.get();
|
||||
rootPanel.setSize("100%", "100%");
|
||||
|
||||
@@ -51,7 +54,7 @@ public class SpectatorEntryPoint extends AbstractEntryPoint implements EventRefr
|
||||
if (groupName == null) {
|
||||
panelToDisplay = new OverviewEventPanel(sailingService, this, this, stringMessages);
|
||||
} else {
|
||||
panelToDisplay = new LeaderboardGroupPanel(sailingService, stringMessages, this, groupName);
|
||||
panelToDisplay = new LeaderboardGroupPanel(sailingService, stringMessages, this, groupName, root);
|
||||
LeaderboardGroupPanel groupPanel = (LeaderboardGroupPanel) panelToDisplay;
|
||||
groupPanel.setWelcomeWidget(new ClosableWelcomeWidget(true, stringMessages.welcomeToSailingAnalytics(),
|
||||
"Ipsum lorum\nHello World!", stringMessages));
|
||||
|
||||
Reference in new issue
Block a user