mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-28 14:57:12 +00:00
Implemented a simple settings dialog for the RaceBoard perspective
This commit is contained in:
1 parent
ca90df7372
commit
7f8ac5ec4f
5 files changed
+123
-31
No files matched your search
+35
-13
@@ -7,7 +7,6 @@ import java.util.Map;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.DivElement;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.dom.client.Style.Visibility;
|
||||
import com.google.gwt.event.dom.client.ChangeEvent;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
@@ -20,8 +19,10 @@ import com.google.gwt.user.client.ui.Button;
|
||||
import com.google.gwt.user.client.ui.CheckBox;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.ListBox;
|
||||
import com.google.gwt.user.client.ui.TextBox;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.sap.sailing.domain.common.dto.AbstractLeaderboardDTO;
|
||||
@@ -33,16 +34,18 @@ import com.sap.sailing.gwt.common.client.SharedResources;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.client.shared.perspective.Perspective;
|
||||
import com.sap.sailing.gwt.ui.client.shared.perspective.TabbedPerspectiveConfigurationDialog;
|
||||
import com.sap.sailing.gwt.ui.leaderboard.ProxyLeaderboardPerspective;
|
||||
import com.sap.sailing.gwt.ui.leaderboard.LeaderboardSettings;
|
||||
import com.sap.sailing.gwt.ui.leaderboard.LeaderboardSettingsFactory;
|
||||
import com.sap.sailing.gwt.ui.leaderboard.ProxyLeaderboardPerspective;
|
||||
import com.sap.sailing.gwt.ui.raceboard.ProxyRaceBoardPerspective;
|
||||
import com.sap.sailing.gwt.ui.raceboard.RaceBoardPerspectiveSettings;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardGroupDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.StrippedLeaderboardDTO;
|
||||
import com.sap.sse.gwt.client.dialog.DataEntryDialog.DialogCallback;
|
||||
import com.sap.sse.gwt.client.event.LocaleChangeEvent;
|
||||
import com.sap.sse.gwt.client.shared.components.CompositeSettings;
|
||||
import com.sap.sse.gwt.client.shared.components.SettingsDialog;
|
||||
|
||||
public class DesktopStartView extends Composite implements StartView {
|
||||
private static StartPageViewUiBinder uiBinder = GWT.create(StartPageViewUiBinder.class);
|
||||
@@ -56,14 +59,13 @@ public class DesktopStartView extends Composite implements StartView {
|
||||
@UiField(provided=true) ListBox leaderboardSelectionBox;
|
||||
@UiField CheckBox leaderboardAutoZoomBox;
|
||||
@UiField CheckBox startInFullscreenModeBox;
|
||||
@UiField CheckBox autoSelectMediaBox;
|
||||
@UiField TextBox leaderboardZoomBox;
|
||||
@UiField Button startAutoPlayButton;
|
||||
@UiField DivElement leaderboardSelectionUi;
|
||||
@UiField DivElement leaderboardZoomDiv;
|
||||
@UiField DivElement leaderboardAutoZoomDiv;
|
||||
@UiField DivElement screenConfiguraionUi;
|
||||
@UiField HorizontalPanel perspectiveConfigurationPanel;
|
||||
@UiField VerticalPanel perspectiveConfigurationPanel;
|
||||
|
||||
@UiField CheckBox autoSwitchToRaceboard;
|
||||
@UiField TextBox timeToRaceStartInSeconds;
|
||||
@@ -135,7 +137,7 @@ public class DesktopStartView extends Composite implements StartView {
|
||||
|
||||
private void updatePerspectives(AbstractLeaderboardDTO leaderboard) {
|
||||
leaderboardPerspective = new ProxyLeaderboardPerspective(leaderboard, createDefaultLeaderboardSettings(leaderboard));
|
||||
raceViewerPerspective = new ProxyRaceBoardPerspective(leaderboard, createDefaultLeaderboardSettings(leaderboard));
|
||||
raceViewerPerspective = new ProxyRaceBoardPerspective(new RaceBoardPerspectiveSettings(), leaderboard, createDefaultLeaderboardSettings(leaderboard));
|
||||
|
||||
perspectiveSettings.clear();
|
||||
supportedPerspectives.clear();
|
||||
@@ -143,7 +145,12 @@ public class DesktopStartView extends Composite implements StartView {
|
||||
supportedPerspectives.add(raceViewerPerspective);
|
||||
}
|
||||
|
||||
private void openPerspectiveConfigurationDialog(final Perspective<?> perspective) {
|
||||
private void openPerspectiveSettingsDialog(final Perspective<?> perspective) {
|
||||
SettingsDialog<?> dialog = new SettingsDialog<>(perspective, StringMessages.INSTANCE);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
private void openPerspectiveComponentSettingsDialog(final Perspective<?> perspective) {
|
||||
TabbedPerspectiveConfigurationDialog dialog = new TabbedPerspectiveConfigurationDialog(StringMessages.INSTANCE,
|
||||
perspective, new DialogCallback<CompositeSettings>() {
|
||||
@Override
|
||||
@@ -196,15 +203,31 @@ public class DesktopStartView extends Composite implements StartView {
|
||||
|
||||
perspectiveConfigurationPanel.clear();
|
||||
for(final Perspective<?> perspective: supportedPerspectives) {
|
||||
Button perspectiveConfigButton = new Button(perspective.getPerspectiveName());
|
||||
perspectiveConfigButton.getElement().getStyle().setMargin(5, Unit.PX);
|
||||
perspectiveConfigurationPanel.add(perspectiveConfigButton);
|
||||
perspectiveConfigButton.addClickHandler(new ClickHandler() {
|
||||
HorizontalPanel hPanel = new HorizontalPanel();
|
||||
perspectiveConfigurationPanel.add(hPanel);
|
||||
hPanel.add(new Label(perspective.getPerspectiveName() + ":"));
|
||||
hPanel.setSpacing(5);
|
||||
|
||||
Button perspectiveComponentSettingsButton = new Button("Component settings");
|
||||
hPanel.add(perspectiveComponentSettingsButton);
|
||||
perspectiveComponentSettingsButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
openPerspectiveConfigurationDialog(perspective);
|
||||
openPerspectiveComponentSettingsDialog(perspective);
|
||||
}
|
||||
});
|
||||
|
||||
if(perspective.hasSettings()) {
|
||||
Button perspectiveSettingsButton = new Button("Settings");
|
||||
hPanel.add(perspectiveSettingsButton);
|
||||
perspectiveSettingsButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
openPerspectiveSettingsDialog(perspective);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
startAutoPlayButton.setEnabled(false);
|
||||
@@ -226,12 +249,11 @@ public class DesktopStartView extends Composite implements StartView {
|
||||
EventDTO selectedEvent = getSelectedEvent();
|
||||
String selectedLeaderboardName = getSelectedLeaderboardName();
|
||||
String leaderboardZoom = getLeaderboardZoom();
|
||||
Boolean isAutoSelectMedia = autoSelectMediaBox.getValue();
|
||||
|
||||
if(selectedEvent != null && selectedLeaderboardName != null) {
|
||||
leaderboardParameters.put(PlayerPlace.PARAM_LEADEROARD_ZOOM, leaderboardZoom);
|
||||
leaderboardParameters.put(PlayerPlace.PARAM_LEADEROARD_NAME, selectedLeaderboardName);
|
||||
raceboardParameters.put(PlayerPlace.PARAM_RACEBOARD_AUTOSELECT_MEDIA, String.valueOf(isAutoSelectMedia));
|
||||
// raceboardParameters.put(PlayerPlace.PARAM_RACEBOARD_AUTOSELECT_MEDIA, String.valueOf(isAutoSelectMedia));
|
||||
|
||||
navigator.goToPlayer(selectedEvent.id.toString(), startInFullscreenModeBox.getValue(),
|
||||
leaderboardParameters, raceboardParameters);
|
||||
|
||||
+2
-2
@@ -105,8 +105,8 @@
|
||||
<span>Settings:</span>
|
||||
</div>
|
||||
<div class="{res.mediaCss.small12} {res.mediaCss.medium6} {res.mediaCss.large9} {res.mediaCss.columns}">
|
||||
<g:HorizontalPanel ui:field="perspectiveConfigurationPanel" styleName="{res.mediaCss.grid} {style.row}">
|
||||
</g:HorizontalPanel>
|
||||
<g:VerticalPanel ui:field="perspectiveConfigurationPanel" styleName="{res.mediaCss.grid} {style.row}">
|
||||
</g:VerticalPanel>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+1
-1
@@ -18,6 +18,6 @@ public class ProxyLeaderboardPerspective extends AbstractPerspectiveWithoutSetti
|
||||
|
||||
@Override
|
||||
public String getPerspectiveName() {
|
||||
return StringMessages.INSTANCE.leaderboard();
|
||||
return StringMessages.INSTANCE.leaderboard() + " Viewer";
|
||||
}
|
||||
}
|
||||
+11
-15
@@ -18,8 +18,13 @@ import com.sap.sse.gwt.client.shared.components.SettingsDialogComponent;
|
||||
*
|
||||
*/
|
||||
public class ProxyRaceBoardPerspective extends AbstractPerspective<RaceBoardPerspectiveSettings> {
|
||||
public ProxyRaceBoardPerspective(AbstractLeaderboardDTO leaderboard, LeaderboardSettings defaultLeaderboardSettings) {
|
||||
private RaceBoardPerspectiveSettings perspectiveSettings;
|
||||
|
||||
public ProxyRaceBoardPerspective(RaceBoardPerspectiveSettings perspectiveSettings, AbstractLeaderboardDTO leaderboard, LeaderboardSettings defaultLeaderboardSettings) {
|
||||
super();
|
||||
|
||||
this.perspectiveSettings = perspectiveSettings;
|
||||
|
||||
components.add(new ProxyRaceMapComponent(new RaceMapSettings(), StringMessages.INSTANCE));
|
||||
components.add(new ProxyWindChartComponent(new WindChartSettings(), StringMessages.INSTANCE));
|
||||
components.add(new ProxyLeaderboardComponent(defaultLeaderboardSettings, leaderboard, StringMessages.INSTANCE));
|
||||
@@ -32,49 +37,40 @@ public class ProxyRaceBoardPerspective extends AbstractPerspective<RaceBoardPers
|
||||
|
||||
@Override
|
||||
public String getLocalizedShortName() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
return getPerspectiveName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget getEntryWidget() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVisible(boolean visibility) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSettings() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SettingsDialogComponent<RaceBoardPerspectiveSettings> getSettingsDialogComponent() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
return new RaceBoardPerspectiveSettingsDialogComponent(perspectiveSettings, StringMessages.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSettings(RaceBoardPerspectiveSettings newSettings) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
this.perspectiveSettings = newSettings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDependentCssClassName() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
return "";
|
||||
}
|
||||
}
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
package com.sap.sailing.gwt.ui.raceboard;
|
||||
|
||||
import com.google.gwt.user.client.ui.CheckBox;
|
||||
import com.google.gwt.user.client.ui.FocusWidget;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sse.gwt.client.dialog.DataEntryDialog;
|
||||
import com.sap.sse.gwt.client.dialog.DataEntryDialog.Validator;
|
||||
import com.sap.sse.gwt.client.shared.components.SettingsDialogComponent;
|
||||
|
||||
public class RaceBoardPerspectiveSettingsDialogComponent implements SettingsDialogComponent<RaceBoardPerspectiveSettings> {
|
||||
private CheckBox showLeaderboardCheckBox;
|
||||
private CheckBox showWindChartCheckBox;
|
||||
private CheckBox showCompetitorsChartCheckBox;
|
||||
private CheckBox autoSelectMediaCheckBox;
|
||||
|
||||
private final StringMessages stringMessages;
|
||||
private final RaceBoardPerspectiveSettings initialSettings;
|
||||
|
||||
public RaceBoardPerspectiveSettingsDialogComponent(RaceBoardPerspectiveSettings settings, StringMessages stringMessages) {
|
||||
this.initialSettings = settings;
|
||||
this.stringMessages = stringMessages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget getAdditionalWidget(DataEntryDialog<?> dialog) {
|
||||
VerticalPanel vp = new VerticalPanel();
|
||||
|
||||
showLeaderboardCheckBox = dialog.createCheckbox(stringMessages.show() + " " + stringMessages.leaderboard());
|
||||
showLeaderboardCheckBox.setValue(initialSettings.isShowLeaderboard());
|
||||
vp.add(showLeaderboardCheckBox);
|
||||
|
||||
showWindChartCheckBox = dialog.createCheckbox(stringMessages.show() + " " + stringMessages.windChart());
|
||||
showWindChartCheckBox.setValue(initialSettings.isShowWindChart());
|
||||
vp.add(showWindChartCheckBox);
|
||||
|
||||
showCompetitorsChartCheckBox = dialog.createCheckbox(stringMessages.show() + " " + stringMessages.competitorCharts());
|
||||
showCompetitorsChartCheckBox.setValue(initialSettings.isShowCompetitorsChart());
|
||||
vp.add(showCompetitorsChartCheckBox);
|
||||
|
||||
autoSelectMediaCheckBox = dialog.createCheckbox("Auto select media");
|
||||
autoSelectMediaCheckBox.setValue(initialSettings.isAutoSelectMedia());
|
||||
vp.add(autoSelectMediaCheckBox);
|
||||
|
||||
return vp;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public RaceBoardPerspectiveSettings getResult() {
|
||||
RaceBoardPerspectiveSettings result = new RaceBoardPerspectiveSettings(/*activeCompetitorsFilterSetName*/ null,
|
||||
showLeaderboardCheckBox.getValue(), showWindChartCheckBox.getValue(), showCompetitorsChartCheckBox.getValue(),
|
||||
/*showViewStreamlets */ false, /*showViewStreamletColors*/ false, /*showViewSimulation*/ false,
|
||||
/*canReplayDuringLiveRaces*/ false, autoSelectMediaCheckBox.getValue(), /*defaultMedia*/ null);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Validator<RaceBoardPerspectiveSettings> getValidator() {
|
||||
return new Validator<RaceBoardPerspectiveSettings>() {
|
||||
@Override
|
||||
public String getErrorMessage(RaceBoardPerspectiveSettings valueToValidate) {
|
||||
String errorMessage = null;
|
||||
return errorMessage;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FocusWidget getFocusWidget() {
|
||||
return showLeaderboardCheckBox;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user