mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-04 19:33:52 +00:00
Moved all chart related UI stuff to new package com.sap.sailing.get.ui.shared.charts II
This commit is contained in:
1 parent
846e923b32
commit
f22ee3c150
12 files changed
+1742
-1742
No files matched your search
+683
-683
File diff suppressed because it is too large.
Load diff
+65
-65
@@ -1,65 +1,65 @@
|
||||
package com.sap.sailing.gwt.ui.shared.charts;
|
||||
|
||||
import com.google.gwt.user.client.ui.DoubleBox;
|
||||
import com.google.gwt.user.client.ui.FocusWidget;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.sap.sailing.gwt.ui.client.DataEntryDialog;
|
||||
import com.sap.sailing.gwt.ui.client.DataEntryDialog.Validator;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.components.SettingsDialogComponent;
|
||||
|
||||
public abstract class AbstractChartSettingsComponent<SettingsType extends ChartSettings> implements SettingsDialogComponent<SettingsType> {
|
||||
|
||||
private DoubleBox stepSizeBox;
|
||||
private final ChartSettings settings;
|
||||
private final StringMessages stringMessages;
|
||||
|
||||
public AbstractChartSettingsComponent(ChartSettings settings, StringMessages stringMessages) {
|
||||
this.settings = settings;
|
||||
this.stringMessages = stringMessages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VerticalPanel getAdditionalWidget(DataEntryDialog<?> dialog) {
|
||||
VerticalPanel panel = new VerticalPanel();
|
||||
panel.add(new Label(getStringMessages().stepSizeInSeconds()));
|
||||
stepSizeBox = dialog.createDoubleBox(((double) settings.getStepSize()) / 1000, 5);
|
||||
panel.add(stepSizeBox);
|
||||
return panel;
|
||||
}
|
||||
|
||||
protected DoubleBox getStepSizeBox() {
|
||||
return stepSizeBox;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Validator<SettingsType> getValidator() {
|
||||
return new Validator<SettingsType>() {
|
||||
@Override
|
||||
public String getErrorMessage(SettingsType valueToValidate) {
|
||||
String errorMessage = null;
|
||||
if (valueToValidate.getStepSize() < 1) {
|
||||
errorMessage = getStringMessages().stepSizeMustBeGreaterThanNull();
|
||||
}
|
||||
return errorMessage;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FocusWidget getFocusWidget() {
|
||||
return stepSizeBox;
|
||||
}
|
||||
|
||||
protected StringMessages getStringMessages() {
|
||||
return stringMessages;
|
||||
}
|
||||
|
||||
public ChartSettings getAbstractResult() {
|
||||
Double valueInSeconds = getStepSizeBox().getValue();
|
||||
Long value = valueInSeconds == null ? 0 : (long) (getStepSizeBox().getValue() * 1000);
|
||||
return new ChartSettings(value);
|
||||
}
|
||||
|
||||
}
|
||||
package com.sap.sailing.gwt.ui.shared.charts;
|
||||
|
||||
import com.google.gwt.user.client.ui.DoubleBox;
|
||||
import com.google.gwt.user.client.ui.FocusWidget;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.sap.sailing.gwt.ui.client.DataEntryDialog;
|
||||
import com.sap.sailing.gwt.ui.client.DataEntryDialog.Validator;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.components.SettingsDialogComponent;
|
||||
|
||||
public abstract class AbstractChartSettingsComponent<SettingsType extends ChartSettings> implements SettingsDialogComponent<SettingsType> {
|
||||
|
||||
private DoubleBox stepSizeBox;
|
||||
private final ChartSettings settings;
|
||||
private final StringMessages stringMessages;
|
||||
|
||||
public AbstractChartSettingsComponent(ChartSettings settings, StringMessages stringMessages) {
|
||||
this.settings = settings;
|
||||
this.stringMessages = stringMessages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VerticalPanel getAdditionalWidget(DataEntryDialog<?> dialog) {
|
||||
VerticalPanel panel = new VerticalPanel();
|
||||
panel.add(new Label(getStringMessages().stepSizeInSeconds()));
|
||||
stepSizeBox = dialog.createDoubleBox(((double) settings.getStepSize()) / 1000, 5);
|
||||
panel.add(stepSizeBox);
|
||||
return panel;
|
||||
}
|
||||
|
||||
protected DoubleBox getStepSizeBox() {
|
||||
return stepSizeBox;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Validator<SettingsType> getValidator() {
|
||||
return new Validator<SettingsType>() {
|
||||
@Override
|
||||
public String getErrorMessage(SettingsType valueToValidate) {
|
||||
String errorMessage = null;
|
||||
if (valueToValidate.getStepSize() < 1) {
|
||||
errorMessage = getStringMessages().stepSizeMustBeGreaterThanNull();
|
||||
}
|
||||
return errorMessage;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FocusWidget getFocusWidget() {
|
||||
return stepSizeBox;
|
||||
}
|
||||
|
||||
protected StringMessages getStringMessages() {
|
||||
return stringMessages;
|
||||
}
|
||||
|
||||
public ChartSettings getAbstractResult() {
|
||||
Double valueInSeconds = getStepSizeBox().getValue();
|
||||
Long value = valueInSeconds == null ? 0 : (long) (getStepSizeBox().getValue() * 1000);
|
||||
return new ChartSettings(value);
|
||||
}
|
||||
|
||||
}
|
||||
Regular → Executable
+56
-56
@@ -1,56 +1,56 @@
|
||||
package com.sap.sailing.gwt.ui.shared.charts;
|
||||
|
||||
import com.sap.sailing.domain.common.DetailType;
|
||||
import com.sap.sailing.gwt.ui.actions.AsyncActionsExecutor;
|
||||
import com.sap.sailing.gwt.ui.client.CompetitorSelectionProvider;
|
||||
import com.sap.sailing.gwt.ui.client.ErrorReporter;
|
||||
import com.sap.sailing.gwt.ui.client.RaceSelectionProvider;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.client.Timer;
|
||||
import com.sap.sailing.gwt.ui.shared.components.Component;
|
||||
import com.sap.sailing.gwt.ui.shared.components.SettingsDialogComponent;
|
||||
|
||||
/**
|
||||
* ChartPanel is a GWT panel that can show one sort of competitor data (e.g. current speed over ground, windward distance to
|
||||
* leader) for different races in a chart.
|
||||
*
|
||||
* When calling the constructor a chart is created that creates a final amount of series (so the maximum number of
|
||||
* competitors cannot be changed in one chart) which are connected to competitors, when the sailing service returns the
|
||||
* data. So {@code seriesID, competitorID and markSeriesID} are linked with the index. So if u know for example the
|
||||
* seriesID-index, you can get the competitor by calling competitorID.get(index).
|
||||
*
|
||||
* @author D056866 Benjamin Ebling
|
||||
*
|
||||
*/
|
||||
public class ChartPanel extends AbstractChartPanel<ChartSettings> implements Component<ChartSettings> {
|
||||
|
||||
public ChartPanel(SailingServiceAsync sailingService, AsyncActionsExecutor asyncActionsExecutor, CompetitorSelectionProvider competitorSelectionProvider,
|
||||
RaceSelectionProvider raceSelectionProvider, Timer timer, DetailType dataToShow, StringMessages stringMessages,
|
||||
ErrorReporter errorReporter, boolean compactChart, boolean allowTimeAdjust) {
|
||||
super(sailingService, asyncActionsExecutor, competitorSelectionProvider, raceSelectionProvider, timer, stringMessages, errorReporter,
|
||||
dataToShow, compactChart, allowTimeAdjust);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Component<ChartSettings> getComponent() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SettingsDialogComponent<ChartSettings> getSettingsDialogComponent() {
|
||||
return new ChartSettingsComponent(getAbstractSettings(), getStringMessages());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSettings(ChartSettings newSettings) {
|
||||
updateSettingsOnly(newSettings);
|
||||
clearChart();
|
||||
loadData(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalizedShortName() {
|
||||
return stringMessages.competitorCharts();
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.gwt.ui.shared.charts;
|
||||
|
||||
import com.sap.sailing.domain.common.DetailType;
|
||||
import com.sap.sailing.gwt.ui.actions.AsyncActionsExecutor;
|
||||
import com.sap.sailing.gwt.ui.client.CompetitorSelectionProvider;
|
||||
import com.sap.sailing.gwt.ui.client.ErrorReporter;
|
||||
import com.sap.sailing.gwt.ui.client.RaceSelectionProvider;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.client.Timer;
|
||||
import com.sap.sailing.gwt.ui.shared.components.Component;
|
||||
import com.sap.sailing.gwt.ui.shared.components.SettingsDialogComponent;
|
||||
|
||||
/**
|
||||
* ChartPanel is a GWT panel that can show one sort of competitor data (e.g. current speed over ground, windward distance to
|
||||
* leader) for different races in a chart.
|
||||
*
|
||||
* When calling the constructor a chart is created that creates a final amount of series (so the maximum number of
|
||||
* competitors cannot be changed in one chart) which are connected to competitors, when the sailing service returns the
|
||||
* data. So {@code seriesID, competitorID and markSeriesID} are linked with the index. So if u know for example the
|
||||
* seriesID-index, you can get the competitor by calling competitorID.get(index).
|
||||
*
|
||||
* @author D056866 Benjamin Ebling
|
||||
*
|
||||
*/
|
||||
public class ChartPanel extends AbstractChartPanel<ChartSettings> implements Component<ChartSettings> {
|
||||
|
||||
public ChartPanel(SailingServiceAsync sailingService, AsyncActionsExecutor asyncActionsExecutor, CompetitorSelectionProvider competitorSelectionProvider,
|
||||
RaceSelectionProvider raceSelectionProvider, Timer timer, DetailType dataToShow, StringMessages stringMessages,
|
||||
ErrorReporter errorReporter, boolean compactChart, boolean allowTimeAdjust) {
|
||||
super(sailingService, asyncActionsExecutor, competitorSelectionProvider, raceSelectionProvider, timer, stringMessages, errorReporter,
|
||||
dataToShow, compactChart, allowTimeAdjust);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Component<ChartSettings> getComponent() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SettingsDialogComponent<ChartSettings> getSettingsDialogComponent() {
|
||||
return new ChartSettingsComponent(getAbstractSettings(), getStringMessages());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSettings(ChartSettings newSettings) {
|
||||
updateSettingsOnly(newSettings);
|
||||
clearChart();
|
||||
loadData(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalizedShortName() {
|
||||
return stringMessages.competitorCharts();
|
||||
}
|
||||
}
|
||||
Regular → Executable
+20
-20
@@ -1,20 +1,20 @@
|
||||
package com.sap.sailing.gwt.ui.shared.charts;
|
||||
|
||||
public class ChartSettings {
|
||||
private final long stepSize;
|
||||
|
||||
public ChartSettings(long stepSize) {
|
||||
this.stepSize = stepSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy-constructor
|
||||
*/
|
||||
public ChartSettings(ChartSettings superResult) {
|
||||
this(superResult.getStepSize());
|
||||
}
|
||||
|
||||
public long getStepSize() {
|
||||
return stepSize;
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.gwt.ui.shared.charts;
|
||||
|
||||
public class ChartSettings {
|
||||
private final long stepSize;
|
||||
|
||||
public ChartSettings(long stepSize) {
|
||||
this.stepSize = stepSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy-constructor
|
||||
*/
|
||||
public ChartSettings(ChartSettings superResult) {
|
||||
this(superResult.getStepSize());
|
||||
}
|
||||
|
||||
public long getStepSize() {
|
||||
return stepSize;
|
||||
}
|
||||
}
|
||||
Regular → Executable
+15
-15
@@ -1,15 +1,15 @@
|
||||
package com.sap.sailing.gwt.ui.shared.charts;
|
||||
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
|
||||
public class ChartSettingsComponent extends AbstractChartSettingsComponent<ChartSettings> {
|
||||
|
||||
public ChartSettingsComponent(ChartSettings settings, StringMessages stringMessages) {
|
||||
super(settings, stringMessages);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChartSettings getResult() {
|
||||
return getAbstractResult();
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.gwt.ui.shared.charts;
|
||||
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
|
||||
public class ChartSettingsComponent extends AbstractChartSettingsComponent<ChartSettings> {
|
||||
|
||||
public ChartSettingsComponent(ChartSettings settings, StringMessages stringMessages) {
|
||||
super(settings, stringMessages);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChartSettings getResult() {
|
||||
return getAbstractResult();
|
||||
}
|
||||
}
|
||||
Regular → Executable
+59
-59
@@ -1,59 +1,59 @@
|
||||
package com.sap.sailing.gwt.ui.shared.charts;
|
||||
|
||||
import com.sap.sailing.domain.common.DetailType;
|
||||
import com.sap.sailing.gwt.ui.actions.AsyncActionsExecutor;
|
||||
import com.sap.sailing.gwt.ui.client.CompetitorSelectionProvider;
|
||||
import com.sap.sailing.gwt.ui.client.ErrorReporter;
|
||||
import com.sap.sailing.gwt.ui.client.RaceSelectionProvider;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.client.Timer;
|
||||
import com.sap.sailing.gwt.ui.shared.components.Component;
|
||||
import com.sap.sailing.gwt.ui.shared.components.SettingsDialogComponent;
|
||||
|
||||
/**
|
||||
* MultiChartPanel is a GWT panel that can show competitor data (e.g. current speed over ground, windward distance to
|
||||
* leader) for different races in a chart. The chart type can be selected from the settings.
|
||||
*
|
||||
* When calling the constructor a chart is created that creates a final amount of series (so the maximum number of
|
||||
* competitors cannot be changed in one chart) which are connected to competitors, when the sailing service returns the
|
||||
* data. So {@code seriesID, competitorID and markSeriesID} are linked with the index. So if u know for example the
|
||||
* seriesID-index, you can get the competitor by calling competitorID.get(index).
|
||||
*
|
||||
* @author Benjamin Ebling (D056866), Axel Uhl (d043530)
|
||||
*
|
||||
*/
|
||||
public class MultiChartPanel extends AbstractChartPanel<MultiChartSettings> implements Component<MultiChartSettings> {
|
||||
public MultiChartPanel(SailingServiceAsync sailingService, AsyncActionsExecutor asyncActionsExecutor,
|
||||
CompetitorSelectionProvider competitorSelectionProvider, RaceSelectionProvider raceSelectionProvider,
|
||||
Timer timer, final StringMessages stringMessages, ErrorReporter errorReporter, boolean compactChart,
|
||||
boolean allowTimeAdjust) {
|
||||
super(sailingService, asyncActionsExecutor, competitorSelectionProvider, raceSelectionProvider, timer, stringMessages, errorReporter,
|
||||
/*show initially*/ DetailType.WINDWARD_DISTANCE_TO_OVERALL_LEADER, compactChart, allowTimeAdjust);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SettingsDialogComponent<MultiChartSettings> getSettingsDialogComponent() {
|
||||
return new MultiChartSettingsComponent(new MultiChartSettings(getAbstractSettings(), getDataToShow()), getStringMessages());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSettings(MultiChartSettings newSettings) {
|
||||
boolean settingsChanged = updateSettingsOnly(newSettings);
|
||||
boolean dataToShowChanged = setDataToShow(newSettings.getDataToShow());
|
||||
if (dataToShowChanged || settingsChanged) {
|
||||
clearChart();
|
||||
loadData(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Component<MultiChartSettings> getComponent() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalizedShortName() {
|
||||
return stringMessages.competitorCharts();
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.gwt.ui.shared.charts;
|
||||
|
||||
import com.sap.sailing.domain.common.DetailType;
|
||||
import com.sap.sailing.gwt.ui.actions.AsyncActionsExecutor;
|
||||
import com.sap.sailing.gwt.ui.client.CompetitorSelectionProvider;
|
||||
import com.sap.sailing.gwt.ui.client.ErrorReporter;
|
||||
import com.sap.sailing.gwt.ui.client.RaceSelectionProvider;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.client.Timer;
|
||||
import com.sap.sailing.gwt.ui.shared.components.Component;
|
||||
import com.sap.sailing.gwt.ui.shared.components.SettingsDialogComponent;
|
||||
|
||||
/**
|
||||
* MultiChartPanel is a GWT panel that can show competitor data (e.g. current speed over ground, windward distance to
|
||||
* leader) for different races in a chart. The chart type can be selected from the settings.
|
||||
*
|
||||
* When calling the constructor a chart is created that creates a final amount of series (so the maximum number of
|
||||
* competitors cannot be changed in one chart) which are connected to competitors, when the sailing service returns the
|
||||
* data. So {@code seriesID, competitorID and markSeriesID} are linked with the index. So if u know for example the
|
||||
* seriesID-index, you can get the competitor by calling competitorID.get(index).
|
||||
*
|
||||
* @author Benjamin Ebling (D056866), Axel Uhl (d043530)
|
||||
*
|
||||
*/
|
||||
public class MultiChartPanel extends AbstractChartPanel<MultiChartSettings> implements Component<MultiChartSettings> {
|
||||
public MultiChartPanel(SailingServiceAsync sailingService, AsyncActionsExecutor asyncActionsExecutor,
|
||||
CompetitorSelectionProvider competitorSelectionProvider, RaceSelectionProvider raceSelectionProvider,
|
||||
Timer timer, final StringMessages stringMessages, ErrorReporter errorReporter, boolean compactChart,
|
||||
boolean allowTimeAdjust) {
|
||||
super(sailingService, asyncActionsExecutor, competitorSelectionProvider, raceSelectionProvider, timer, stringMessages, errorReporter,
|
||||
/*show initially*/ DetailType.WINDWARD_DISTANCE_TO_OVERALL_LEADER, compactChart, allowTimeAdjust);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SettingsDialogComponent<MultiChartSettings> getSettingsDialogComponent() {
|
||||
return new MultiChartSettingsComponent(new MultiChartSettings(getAbstractSettings(), getDataToShow()), getStringMessages());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSettings(MultiChartSettings newSettings) {
|
||||
boolean settingsChanged = updateSettingsOnly(newSettings);
|
||||
boolean dataToShowChanged = setDataToShow(newSettings.getDataToShow());
|
||||
if (dataToShowChanged || settingsChanged) {
|
||||
clearChart();
|
||||
loadData(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Component<MultiChartSettings> getComponent() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalizedShortName() {
|
||||
return stringMessages.competitorCharts();
|
||||
}
|
||||
}
|
||||
Regular → Executable
+16
-16
@@ -1,16 +1,16 @@
|
||||
package com.sap.sailing.gwt.ui.shared.charts;
|
||||
|
||||
import com.sap.sailing.domain.common.DetailType;
|
||||
|
||||
public class MultiChartSettings extends ChartSettings {
|
||||
private final DetailType dataToShow;
|
||||
|
||||
public MultiChartSettings(ChartSettings superResult, DetailType dataToShow) {
|
||||
super(superResult);
|
||||
this.dataToShow = dataToShow;
|
||||
}
|
||||
|
||||
public DetailType getDataToShow() {
|
||||
return dataToShow;
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.gwt.ui.shared.charts;
|
||||
|
||||
import com.sap.sailing.domain.common.DetailType;
|
||||
|
||||
public class MultiChartSettings extends ChartSettings {
|
||||
private final DetailType dataToShow;
|
||||
|
||||
public MultiChartSettings(ChartSettings superResult, DetailType dataToShow) {
|
||||
super(superResult);
|
||||
this.dataToShow = dataToShow;
|
||||
}
|
||||
|
||||
public DetailType getDataToShow() {
|
||||
return dataToShow;
|
||||
}
|
||||
}
|
||||
Regular → Executable
+54
-54
@@ -1,54 +1,54 @@
|
||||
package com.sap.sailing.gwt.ui.shared.charts;
|
||||
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.ListBox;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.sap.sailing.domain.common.DetailType;
|
||||
import com.sap.sailing.gwt.ui.client.DataEntryDialog;
|
||||
import com.sap.sailing.gwt.ui.client.DetailTypeFormatter;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.components.SettingsDialogComponent;
|
||||
|
||||
public class MultiChartSettingsComponent extends AbstractChartSettingsComponent<MultiChartSettings> implements
|
||||
SettingsDialogComponent<MultiChartSettings> {
|
||||
private ListBox dataSelection;
|
||||
private final DetailType initialDataToShow;
|
||||
|
||||
public MultiChartSettingsComponent(MultiChartSettings settings, StringMessages stringMessages) {
|
||||
super(settings, stringMessages);
|
||||
this.initialDataToShow = settings.getDataToShow();
|
||||
}
|
||||
|
||||
@Override
|
||||
public VerticalPanel getAdditionalWidget(DataEntryDialog<?> dialog) {
|
||||
VerticalPanel configPanel = super.getAdditionalWidget(dialog);
|
||||
configPanel.setSpacing(5);
|
||||
Label lblChart = new Label(getStringMessages().chooseChart());
|
||||
configPanel.add(lblChart);
|
||||
dataSelection = dialog.createListBox(/* isMultiSelect */ false);
|
||||
int i=0;
|
||||
for (DetailType detailType : new DetailType[] { DetailType.WINDWARD_DISTANCE_TO_OVERALL_LEADER, DetailType.DISTANCE_TRAVELED,
|
||||
DetailType.VELOCITY_MADE_GOOD_IN_KNOTS, DetailType.GAP_TO_LEADER_IN_SECONDS, DetailType.CURRENT_SPEED_OVER_GROUND_IN_KNOTS,
|
||||
DetailType.RACE_RANK }) {
|
||||
dataSelection.addItem(DetailTypeFormatter.format(detailType, getStringMessages()), detailType.toString());
|
||||
if (detailType == initialDataToShow) {
|
||||
dataSelection.setSelectedIndex(i);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
configPanel.add(dataSelection);
|
||||
return configPanel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MultiChartSettings getResult() {
|
||||
DetailType dataToShow = null;
|
||||
for (DetailType dt : DetailType.values()){
|
||||
if (dt.toString().equals(dataSelection.getValue(dataSelection.getSelectedIndex()))){
|
||||
dataToShow = dt;
|
||||
}
|
||||
}
|
||||
return new MultiChartSettings(getAbstractResult(), dataToShow);
|
||||
}
|
||||
|
||||
}
|
||||
package com.sap.sailing.gwt.ui.shared.charts;
|
||||
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.ListBox;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.sap.sailing.domain.common.DetailType;
|
||||
import com.sap.sailing.gwt.ui.client.DataEntryDialog;
|
||||
import com.sap.sailing.gwt.ui.client.DetailTypeFormatter;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.components.SettingsDialogComponent;
|
||||
|
||||
public class MultiChartSettingsComponent extends AbstractChartSettingsComponent<MultiChartSettings> implements
|
||||
SettingsDialogComponent<MultiChartSettings> {
|
||||
private ListBox dataSelection;
|
||||
private final DetailType initialDataToShow;
|
||||
|
||||
public MultiChartSettingsComponent(MultiChartSettings settings, StringMessages stringMessages) {
|
||||
super(settings, stringMessages);
|
||||
this.initialDataToShow = settings.getDataToShow();
|
||||
}
|
||||
|
||||
@Override
|
||||
public VerticalPanel getAdditionalWidget(DataEntryDialog<?> dialog) {
|
||||
VerticalPanel configPanel = super.getAdditionalWidget(dialog);
|
||||
configPanel.setSpacing(5);
|
||||
Label lblChart = new Label(getStringMessages().chooseChart());
|
||||
configPanel.add(lblChart);
|
||||
dataSelection = dialog.createListBox(/* isMultiSelect */ false);
|
||||
int i=0;
|
||||
for (DetailType detailType : new DetailType[] { DetailType.WINDWARD_DISTANCE_TO_OVERALL_LEADER, DetailType.DISTANCE_TRAVELED,
|
||||
DetailType.VELOCITY_MADE_GOOD_IN_KNOTS, DetailType.GAP_TO_LEADER_IN_SECONDS, DetailType.CURRENT_SPEED_OVER_GROUND_IN_KNOTS,
|
||||
DetailType.RACE_RANK }) {
|
||||
dataSelection.addItem(DetailTypeFormatter.format(detailType, getStringMessages()), detailType.toString());
|
||||
if (detailType == initialDataToShow) {
|
||||
dataSelection.setSelectedIndex(i);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
configPanel.add(dataSelection);
|
||||
return configPanel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MultiChartSettings getResult() {
|
||||
DetailType dataToShow = null;
|
||||
for (DetailType dt : DetailType.values()){
|
||||
if (dt.toString().equals(dataSelection.getValue(dataSelection.getSelectedIndex()))){
|
||||
dataToShow = dt;
|
||||
}
|
||||
}
|
||||
return new MultiChartSettings(getAbstractResult(), dataToShow);
|
||||
}
|
||||
|
||||
}
|
||||
java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/shared/charts/SimpleChartPanel.java
Regular → Executable
+50
-50
@@ -1,50 +1,50 @@
|
||||
package com.sap.sailing.gwt.ui.shared.charts;
|
||||
|
||||
import org.moxieapps.gwt.highcharts.client.Chart;
|
||||
import org.moxieapps.gwt.highcharts.client.Legend;
|
||||
import org.moxieapps.gwt.highcharts.client.events.SeriesCheckboxClickEvent;
|
||||
import org.moxieapps.gwt.highcharts.client.events.SeriesCheckboxClickEventHandler;
|
||||
import org.moxieapps.gwt.highcharts.client.events.SeriesLegendItemClickEvent;
|
||||
import org.moxieapps.gwt.highcharts.client.events.SeriesLegendItemClickEventHandler;
|
||||
import org.moxieapps.gwt.highcharts.client.plotOptions.PlotOptions;
|
||||
import org.moxieapps.gwt.highcharts.client.plotOptions.SeriesPlotOptions;
|
||||
|
||||
import com.google.gwt.user.client.ui.SimplePanel;
|
||||
import com.sap.sailing.gwt.ui.client.Timer;
|
||||
|
||||
public abstract class SimpleChartPanel extends SimplePanel {
|
||||
|
||||
protected final Timer timer;
|
||||
|
||||
public SimpleChartPanel(Timer timer) {
|
||||
this.timer = timer;
|
||||
}
|
||||
|
||||
/**
|
||||
* When using this method to enable the use of checkboxes only for hiding / showing a series, callers need to ensure
|
||||
* that all series have {@link PlotOptions#setSelected(boolean)} set to <code>true</code> for all series that are
|
||||
* added to the chart and hence visible. Otherwise, the checkbox won't initially be in sync with the series'
|
||||
* visibility state.
|
||||
*/
|
||||
protected void useCheckboxesToShowAndHide(final Chart chart) {
|
||||
chart.setLegend(new Legend().setEnabled(true).setBorderWidth(0).setSymbolPadding(20)); // make room for checkbox
|
||||
chart.setSeriesPlotOptions(new SeriesPlotOptions().setSeriesCheckboxClickEventHandler(new SeriesCheckboxClickEventHandler() {
|
||||
@Override
|
||||
public boolean onClick(SeriesCheckboxClickEvent seriesCheckboxClickEvent) {
|
||||
if (seriesCheckboxClickEvent.isChecked()) {
|
||||
chart.getSeries(seriesCheckboxClickEvent.getSeriesId()).show();
|
||||
} else {
|
||||
chart.getSeries(seriesCheckboxClickEvent.getSeriesId()).hide();
|
||||
}
|
||||
return false; // don't toggle the select state of the series
|
||||
}
|
||||
}).setShowCheckbox(true).
|
||||
setSeriesLegendItemClickEventHandler(new SeriesLegendItemClickEventHandler() {
|
||||
@Override
|
||||
public boolean onClick(SeriesLegendItemClickEvent seriesLegendItemClickEvent) {
|
||||
// disable toggling visibility by clicking the legend item; force user to use checkbox instead
|
||||
return false;
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.gwt.ui.shared.charts;
|
||||
|
||||
import org.moxieapps.gwt.highcharts.client.Chart;
|
||||
import org.moxieapps.gwt.highcharts.client.Legend;
|
||||
import org.moxieapps.gwt.highcharts.client.events.SeriesCheckboxClickEvent;
|
||||
import org.moxieapps.gwt.highcharts.client.events.SeriesCheckboxClickEventHandler;
|
||||
import org.moxieapps.gwt.highcharts.client.events.SeriesLegendItemClickEvent;
|
||||
import org.moxieapps.gwt.highcharts.client.events.SeriesLegendItemClickEventHandler;
|
||||
import org.moxieapps.gwt.highcharts.client.plotOptions.PlotOptions;
|
||||
import org.moxieapps.gwt.highcharts.client.plotOptions.SeriesPlotOptions;
|
||||
|
||||
import com.google.gwt.user.client.ui.SimplePanel;
|
||||
import com.sap.sailing.gwt.ui.client.Timer;
|
||||
|
||||
public abstract class SimpleChartPanel extends SimplePanel {
|
||||
|
||||
protected final Timer timer;
|
||||
|
||||
public SimpleChartPanel(Timer timer) {
|
||||
this.timer = timer;
|
||||
}
|
||||
|
||||
/**
|
||||
* When using this method to enable the use of checkboxes only for hiding / showing a series, callers need to ensure
|
||||
* that all series have {@link PlotOptions#setSelected(boolean)} set to <code>true</code> for all series that are
|
||||
* added to the chart and hence visible. Otherwise, the checkbox won't initially be in sync with the series'
|
||||
* visibility state.
|
||||
*/
|
||||
protected void useCheckboxesToShowAndHide(final Chart chart) {
|
||||
chart.setLegend(new Legend().setEnabled(true).setBorderWidth(0).setSymbolPadding(20)); // make room for checkbox
|
||||
chart.setSeriesPlotOptions(new SeriesPlotOptions().setSeriesCheckboxClickEventHandler(new SeriesCheckboxClickEventHandler() {
|
||||
@Override
|
||||
public boolean onClick(SeriesCheckboxClickEvent seriesCheckboxClickEvent) {
|
||||
if (seriesCheckboxClickEvent.isChecked()) {
|
||||
chart.getSeries(seriesCheckboxClickEvent.getSeriesId()).show();
|
||||
} else {
|
||||
chart.getSeries(seriesCheckboxClickEvent.getSeriesId()).hide();
|
||||
}
|
||||
return false; // don't toggle the select state of the series
|
||||
}
|
||||
}).setShowCheckbox(true).
|
||||
setSeriesLegendItemClickEventHandler(new SeriesLegendItemClickEventHandler() {
|
||||
@Override
|
||||
public boolean onClick(SeriesLegendItemClickEvent seriesLegendItemClickEvent) {
|
||||
// disable toggling visibility by clicking the legend item; force user to use checkbox instead
|
||||
return false;
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
Regular → Executable
+581
-581
File diff suppressed because it is too large.
Load diff
Regular → Executable
+45
-45
@@ -1,45 +1,45 @@
|
||||
package com.sap.sailing.gwt.ui.shared.charts;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import com.sap.sailing.domain.common.WindSourceType;
|
||||
|
||||
public class WindChartSettings {
|
||||
private final Set<WindSourceType> windSourceTypesToDisplay;
|
||||
|
||||
private final long resolutionInMilliseconds;
|
||||
|
||||
private final boolean showWindSpeedSeries;
|
||||
private final boolean showWindDirectionsSeries;
|
||||
|
||||
public WindChartSettings(boolean showWindSpeedSeries, boolean showWindDirectionsSeries, Set<WindSourceType> windSourceTypesToDisplay, long resolutionInMilliseconds) {
|
||||
this.windSourceTypesToDisplay = windSourceTypesToDisplay;
|
||||
this.resolutionInMilliseconds = resolutionInMilliseconds;
|
||||
this.showWindDirectionsSeries = showWindDirectionsSeries;
|
||||
this.showWindSpeedSeries = showWindSpeedSeries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses {@link WindChart#DEFAULT_RESOLUTION_IN_MILLISECONDS} as resolution
|
||||
*/
|
||||
public WindChartSettings(boolean showWindSpeedSeries, boolean showWindDirectionsSeries, Set<WindSourceType> windSourceTypesToDisplay) {
|
||||
this(showWindSpeedSeries, showWindDirectionsSeries, windSourceTypesToDisplay, WindChart.DEFAULT_RESOLUTION_IN_MILLISECONDS);
|
||||
}
|
||||
|
||||
public Set<WindSourceType> getWindSourceTypesToDisplay() {
|
||||
return windSourceTypesToDisplay;
|
||||
}
|
||||
|
||||
public long getResolutionInMilliseconds() {
|
||||
return resolutionInMilliseconds;
|
||||
}
|
||||
|
||||
public boolean isShowWindSpeedSeries() {
|
||||
return showWindSpeedSeries;
|
||||
}
|
||||
|
||||
public boolean isShowWindDirectionsSeries() {
|
||||
return showWindDirectionsSeries;
|
||||
}
|
||||
|
||||
}
|
||||
package com.sap.sailing.gwt.ui.shared.charts;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import com.sap.sailing.domain.common.WindSourceType;
|
||||
|
||||
public class WindChartSettings {
|
||||
private final Set<WindSourceType> windSourceTypesToDisplay;
|
||||
|
||||
private final long resolutionInMilliseconds;
|
||||
|
||||
private final boolean showWindSpeedSeries;
|
||||
private final boolean showWindDirectionsSeries;
|
||||
|
||||
public WindChartSettings(boolean showWindSpeedSeries, boolean showWindDirectionsSeries, Set<WindSourceType> windSourceTypesToDisplay, long resolutionInMilliseconds) {
|
||||
this.windSourceTypesToDisplay = windSourceTypesToDisplay;
|
||||
this.resolutionInMilliseconds = resolutionInMilliseconds;
|
||||
this.showWindDirectionsSeries = showWindDirectionsSeries;
|
||||
this.showWindSpeedSeries = showWindSpeedSeries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses {@link WindChart#DEFAULT_RESOLUTION_IN_MILLISECONDS} as resolution
|
||||
*/
|
||||
public WindChartSettings(boolean showWindSpeedSeries, boolean showWindDirectionsSeries, Set<WindSourceType> windSourceTypesToDisplay) {
|
||||
this(showWindSpeedSeries, showWindDirectionsSeries, windSourceTypesToDisplay, WindChart.DEFAULT_RESOLUTION_IN_MILLISECONDS);
|
||||
}
|
||||
|
||||
public Set<WindSourceType> getWindSourceTypesToDisplay() {
|
||||
return windSourceTypesToDisplay;
|
||||
}
|
||||
|
||||
public long getResolutionInMilliseconds() {
|
||||
return resolutionInMilliseconds;
|
||||
}
|
||||
|
||||
public boolean isShowWindSpeedSeries() {
|
||||
return showWindSpeedSeries;
|
||||
}
|
||||
|
||||
public boolean isShowWindDirectionsSeries() {
|
||||
return showWindDirectionsSeries;
|
||||
}
|
||||
|
||||
}
|
||||
Regular → Executable
+98
-98
@@ -1,98 +1,98 @@
|
||||
package com.sap.sailing.gwt.ui.shared.charts;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.gwt.user.client.ui.CheckBox;
|
||||
import com.google.gwt.user.client.ui.FocusWidget;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.IntegerBox;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.domain.common.WindSourceType;
|
||||
import com.sap.sailing.gwt.ui.client.DataEntryDialog;
|
||||
import com.sap.sailing.gwt.ui.client.DataEntryDialog.Validator;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.client.WindSourceTypeFormatter;
|
||||
import com.sap.sailing.gwt.ui.shared.components.SettingsDialogComponent;
|
||||
|
||||
public class WindChartSettingsDialogComponent implements SettingsDialogComponent<WindChartSettings> {
|
||||
private final WindChartSettings initialSettings;
|
||||
private IntegerBox resolutionInSecondsBox;
|
||||
private final Map<WindSourceType, CheckBox> checkboxes;
|
||||
private CheckBox showWindSpeedSeriesCheckbox;
|
||||
private CheckBox showWindDirectionsSeriesCheckbox;
|
||||
|
||||
private final StringMessages stringMessages;
|
||||
|
||||
public WindChartSettingsDialogComponent(WindChartSettings initialSettings, StringMessages stringMessages) {
|
||||
super();
|
||||
this.stringMessages = stringMessages;
|
||||
this.initialSettings = initialSettings;
|
||||
checkboxes = new LinkedHashMap<WindSourceType, CheckBox>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget getAdditionalWidget(DataEntryDialog<?> dialog) {
|
||||
VerticalPanel vp = new VerticalPanel();
|
||||
resolutionInSecondsBox = dialog.createIntegerBox((int) (initialSettings.getResolutionInMilliseconds()/1000), /* visibleLength */ 5);
|
||||
|
||||
HorizontalPanel hp = new HorizontalPanel();
|
||||
hp.add(new Label(stringMessages.stepSizeInSeconds()));
|
||||
hp.add(resolutionInSecondsBox);
|
||||
vp.add(hp);
|
||||
|
||||
showWindSpeedSeriesCheckbox = dialog.createCheckbox(stringMessages.showWindSpeedSeries());
|
||||
showWindSpeedSeriesCheckbox.setValue(initialSettings.isShowWindSpeedSeries());
|
||||
vp.add(showWindSpeedSeriesCheckbox);
|
||||
|
||||
showWindDirectionsSeriesCheckbox = dialog.createCheckbox(stringMessages.showWindDirectionSeries());
|
||||
showWindDirectionsSeriesCheckbox.setValue(initialSettings.isShowWindDirectionsSeries());
|
||||
vp.add(showWindDirectionsSeriesCheckbox);
|
||||
|
||||
Label createHeadlineLabel = dialog.createHeadlineLabel(stringMessages.windSourcesUsed());
|
||||
vp.add(createHeadlineLabel);
|
||||
for (WindSourceType windSourceType : WindSourceType.values()) {
|
||||
CheckBox checkbox = dialog.createCheckbox(WindSourceTypeFormatter.format(windSourceType, stringMessages));
|
||||
checkboxes.put(windSourceType, checkbox);
|
||||
checkbox.setValue(initialSettings.getWindSourceTypesToDisplay().contains(windSourceType));
|
||||
vp.add(checkbox);
|
||||
}
|
||||
return vp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WindChartSettings getResult() {
|
||||
Set<WindSourceType> windSourceTypesToDisplay = new HashSet<WindSourceType>();
|
||||
for (Map.Entry<WindSourceType, CheckBox> e : checkboxes.entrySet()) {
|
||||
if (e.getValue().getValue()) {
|
||||
windSourceTypesToDisplay.add(e.getKey());
|
||||
}
|
||||
}
|
||||
return new WindChartSettings(showWindSpeedSeriesCheckbox.getValue(), showWindDirectionsSeriesCheckbox.getValue(),
|
||||
windSourceTypesToDisplay, resolutionInSecondsBox.getValue() == null ? -1 : resolutionInSecondsBox.getValue()*1000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Validator<WindChartSettings> getValidator() {
|
||||
return new Validator<WindChartSettings>() {
|
||||
@Override
|
||||
public String getErrorMessage(WindChartSettings valueToValidate) {
|
||||
String errorMessage = null;
|
||||
if (valueToValidate.getResolutionInMilliseconds() < 1) {
|
||||
errorMessage = stringMessages.stepSizeMustBeGreaterThanNull();
|
||||
}
|
||||
return errorMessage;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FocusWidget getFocusWidget() {
|
||||
return resolutionInSecondsBox;
|
||||
}
|
||||
|
||||
}
|
||||
package com.sap.sailing.gwt.ui.shared.charts;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.gwt.user.client.ui.CheckBox;
|
||||
import com.google.gwt.user.client.ui.FocusWidget;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.IntegerBox;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.domain.common.WindSourceType;
|
||||
import com.sap.sailing.gwt.ui.client.DataEntryDialog;
|
||||
import com.sap.sailing.gwt.ui.client.DataEntryDialog.Validator;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.client.WindSourceTypeFormatter;
|
||||
import com.sap.sailing.gwt.ui.shared.components.SettingsDialogComponent;
|
||||
|
||||
public class WindChartSettingsDialogComponent implements SettingsDialogComponent<WindChartSettings> {
|
||||
private final WindChartSettings initialSettings;
|
||||
private IntegerBox resolutionInSecondsBox;
|
||||
private final Map<WindSourceType, CheckBox> checkboxes;
|
||||
private CheckBox showWindSpeedSeriesCheckbox;
|
||||
private CheckBox showWindDirectionsSeriesCheckbox;
|
||||
|
||||
private final StringMessages stringMessages;
|
||||
|
||||
public WindChartSettingsDialogComponent(WindChartSettings initialSettings, StringMessages stringMessages) {
|
||||
super();
|
||||
this.stringMessages = stringMessages;
|
||||
this.initialSettings = initialSettings;
|
||||
checkboxes = new LinkedHashMap<WindSourceType, CheckBox>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget getAdditionalWidget(DataEntryDialog<?> dialog) {
|
||||
VerticalPanel vp = new VerticalPanel();
|
||||
resolutionInSecondsBox = dialog.createIntegerBox((int) (initialSettings.getResolutionInMilliseconds()/1000), /* visibleLength */ 5);
|
||||
|
||||
HorizontalPanel hp = new HorizontalPanel();
|
||||
hp.add(new Label(stringMessages.stepSizeInSeconds()));
|
||||
hp.add(resolutionInSecondsBox);
|
||||
vp.add(hp);
|
||||
|
||||
showWindSpeedSeriesCheckbox = dialog.createCheckbox(stringMessages.showWindSpeedSeries());
|
||||
showWindSpeedSeriesCheckbox.setValue(initialSettings.isShowWindSpeedSeries());
|
||||
vp.add(showWindSpeedSeriesCheckbox);
|
||||
|
||||
showWindDirectionsSeriesCheckbox = dialog.createCheckbox(stringMessages.showWindDirectionSeries());
|
||||
showWindDirectionsSeriesCheckbox.setValue(initialSettings.isShowWindDirectionsSeries());
|
||||
vp.add(showWindDirectionsSeriesCheckbox);
|
||||
|
||||
Label createHeadlineLabel = dialog.createHeadlineLabel(stringMessages.windSourcesUsed());
|
||||
vp.add(createHeadlineLabel);
|
||||
for (WindSourceType windSourceType : WindSourceType.values()) {
|
||||
CheckBox checkbox = dialog.createCheckbox(WindSourceTypeFormatter.format(windSourceType, stringMessages));
|
||||
checkboxes.put(windSourceType, checkbox);
|
||||
checkbox.setValue(initialSettings.getWindSourceTypesToDisplay().contains(windSourceType));
|
||||
vp.add(checkbox);
|
||||
}
|
||||
return vp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WindChartSettings getResult() {
|
||||
Set<WindSourceType> windSourceTypesToDisplay = new HashSet<WindSourceType>();
|
||||
for (Map.Entry<WindSourceType, CheckBox> e : checkboxes.entrySet()) {
|
||||
if (e.getValue().getValue()) {
|
||||
windSourceTypesToDisplay.add(e.getKey());
|
||||
}
|
||||
}
|
||||
return new WindChartSettings(showWindSpeedSeriesCheckbox.getValue(), showWindDirectionsSeriesCheckbox.getValue(),
|
||||
windSourceTypesToDisplay, resolutionInSecondsBox.getValue() == null ? -1 : resolutionInSecondsBox.getValue()*1000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Validator<WindChartSettings> getValidator() {
|
||||
return new Validator<WindChartSettings>() {
|
||||
@Override
|
||||
public String getErrorMessage(WindChartSettings valueToValidate) {
|
||||
String errorMessage = null;
|
||||
if (valueToValidate.getResolutionInMilliseconds() < 1) {
|
||||
errorMessage = stringMessages.stepSizeMustBeGreaterThanNull();
|
||||
}
|
||||
return errorMessage;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FocusWidget getFocusWidget() {
|
||||
return resolutionInSecondsBox;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user