mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-30 17:36:40 +00:00
commented out COMBINED wind track retrieval for performance reasons for now; added COmpositeSettings stuff
This commit is contained in:
1 parent
d9dcba2506
commit
63642ff6e0
13 files changed
+225
-12
No files matched your search
+1
-1
@@ -43,7 +43,7 @@ public class RaceMapSettingsDialogComponent implements SettingsDialogComponent<R
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget getAdditionalWidget(DataEntryDialog<RaceMapSettings> dialog) {
|
||||
public Widget getAdditionalWidget(DataEntryDialog<?> dialog) {
|
||||
VerticalPanel vp = new VerticalPanel();
|
||||
HorizontalPanel labelAndTailLengthBoxPanel = new HorizontalPanel();
|
||||
labelAndTailLengthBoxPanel.add(new Label(stringMessages.tailLength()));
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ public class WindChartSettingsDialogComponent implements SettingsDialogComponent
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget getAdditionalWidget(DataEntryDialog<WindChartSettings> dialog) {
|
||||
public Widget getAdditionalWidget(DataEntryDialog<?> dialog) {
|
||||
VerticalPanel vp = new VerticalPanel();
|
||||
for (WindSourceType windSourceType : WindSourceType.values()) {
|
||||
CheckBox checkbox = dialog.createCheckbox(windSourceType.name());
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ public class RaceTimePanelSettingsDialogComponent extends TimePanelSettingsDialo
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget getAdditionalWidget(DataEntryDialog<RaceTimePanelSettings> dialog) {
|
||||
public Widget getAdditionalWidget(DataEntryDialog<?> dialog) {
|
||||
Widget widget = super.getAdditionalWidget(dialog);
|
||||
HorizontalPanel labelAndTDelayForLiveBoxPanel = new HorizontalPanel();
|
||||
labelAndTDelayForLiveBoxPanel.setSpacing(5);
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public class TimePanelSettingsDialogComponent<T extends TimePanelSettings> imple
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget getAdditionalWidget(DataEntryDialog<T> dialog) {
|
||||
public Widget getAdditionalWidget(DataEntryDialog<?> dialog) {
|
||||
mainContentPanel = new VerticalPanel();
|
||||
|
||||
HorizontalPanel labelAndRefreshIntervalBoxPanel = new HorizontalPanel();
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ public abstract class AbstractChartSettingsComponent<SettingsType extends ChartS
|
||||
}
|
||||
|
||||
@Override
|
||||
public VerticalPanel getAdditionalWidget(DataEntryDialog<SettingsType> dialog) {
|
||||
public VerticalPanel getAdditionalWidget(DataEntryDialog<?> dialog) {
|
||||
VerticalPanel panel = new VerticalPanel();
|
||||
panel.add(new Label(getStringMessages().stepSizeInSeconds()));
|
||||
stepSizeBox = dialog.createDoubleBox(((double) settings.getStepSize()) / 1000, 5);
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ public class LeaderboardSettingsDialogComponent implements SettingsDialogCompone
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget getAdditionalWidget(DataEntryDialog<LeaderboardSettings> dialog) {
|
||||
public Widget getAdditionalWidget(DataEntryDialog<?> dialog) {
|
||||
delayBetweenAutoAdvancesInSecondsBox = dialog.createLongBox(delayBetweenAutoAdvancesInMilliseconds/1000l, 4);
|
||||
delayInSecondsBox = dialog.createLongBox(delayInMilliseconds/1000l, 4);
|
||||
HorizontalPanel hp = new HorizontalPanel();
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ public class MultiChartSettingsComponent extends AbstractChartSettingsComponent<
|
||||
}
|
||||
|
||||
@Override
|
||||
public VerticalPanel getAdditionalWidget(DataEntryDialog<MultiChartSettings> dialog) {
|
||||
public VerticalPanel getAdditionalWidget(DataEntryDialog<?> dialog) {
|
||||
VerticalPanel configPanel = super.getAdditionalWidget(dialog);
|
||||
configPanel.setSpacing(5);
|
||||
Label lblChart = new Label(getStringMessages().chooseChart());
|
||||
|
||||
+4
-3
@@ -73,7 +73,6 @@ import com.sap.sailing.domain.common.impl.KilometersPerHourSpeedImpl;
|
||||
import com.sap.sailing.domain.common.impl.Util;
|
||||
import com.sap.sailing.domain.common.impl.Util.Pair;
|
||||
import com.sap.sailing.domain.common.impl.Util.Triple;
|
||||
import com.sap.sailing.domain.common.impl.WindSourceImpl;
|
||||
import com.sap.sailing.domain.leaderboard.Leaderboard;
|
||||
import com.sap.sailing.domain.leaderboard.Leaderboard.Entry;
|
||||
import com.sap.sailing.domain.leaderboard.LeaderboardGroup;
|
||||
@@ -550,7 +549,8 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
windSourcesToDeliver.addAll(Arrays.asList(windSources));
|
||||
} else {
|
||||
Util.addAll(trackedRace.getWindSources(), windSourcesToDeliver);
|
||||
windSourcesToDeliver.add(new WindSourceImpl(WindSourceType.COMBINED));
|
||||
// TODO bug #375: add the combined wind; currently, CombinedWindTrackImpl just takes too long to return results...
|
||||
// windSourcesToDeliver.add(new WindSourceImpl(WindSourceType.COMBINED));
|
||||
}
|
||||
for (WindSource windSource : windSourcesToDeliver) {
|
||||
WindTrackInfoDTO windTrackInfoDTO = new WindTrackInfoDTO();
|
||||
@@ -611,7 +611,8 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
result.windTrackInfoByWindSource = windTrackInfoDTOs;
|
||||
List<WindSource> windSourcesToDeliver = new ArrayList<WindSource>();
|
||||
Util.addAll(trackedRace.getWindSources(), windSourcesToDeliver);
|
||||
windSourcesToDeliver.add(new WindSourceImpl(WindSourceType.COMBINED));
|
||||
// TODO bug #375: add the combined wind; currently, CombinedWindTrackImpl just takes too long to return results...
|
||||
// windSourcesToDeliver.add(new WindSourceImpl(WindSourceType.COMBINED));
|
||||
for (WindSource windSource : windSourcesToDeliver) {
|
||||
if (windSourceTypeNames == null || windSourceTypeNames.contains(windSource.getType().name())) {
|
||||
TimePoint fromTimePoint = new MillisecondsTimePoint(from);
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.sap.sailing.gwt.ui.shared.components;
|
||||
|
||||
import com.sap.sailing.domain.common.impl.Util.Pair;
|
||||
|
||||
public class CompositeSettings {
|
||||
public static class ComponentAndSettingsPair<SettingsType> extends Pair<Component<SettingsType>, SettingsType> {
|
||||
private static final long serialVersionUID = -569811233041583043L;
|
||||
|
||||
public ComponentAndSettingsPair(Component<SettingsType> a, SettingsType b) {
|
||||
super(a, b);
|
||||
}
|
||||
}
|
||||
|
||||
private final Iterable<ComponentAndSettingsPair<?>> settingsPerComponent;
|
||||
|
||||
public CompositeSettings(Iterable<ComponentAndSettingsPair<?>> settingsPerComponent) {
|
||||
this.settingsPerComponent = settingsPerComponent;
|
||||
}
|
||||
|
||||
public Iterable<ComponentAndSettingsPair<?>> getSettingsPerComponent() {
|
||||
return settingsPerComponent;
|
||||
}
|
||||
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
package com.sap.sailing.gwt.ui.shared.components;
|
||||
|
||||
import com.google.gwt.user.client.ui.FocusWidget;
|
||||
import com.google.gwt.user.client.ui.TabPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.gwt.ui.client.DataEntryDialog;
|
||||
import com.sap.sailing.gwt.ui.client.DataEntryDialog.Validator;
|
||||
|
||||
public class CompositeSettingsDialogComponent implements SettingsDialogComponent<CompositeSettings> {
|
||||
|
||||
private final Component<?>[] components;
|
||||
|
||||
public CompositeSettingsDialogComponent(Component<?>... components) {
|
||||
this.components = components;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget getAdditionalWidget(DataEntryDialog<?> dialog) {
|
||||
TabPanel result = new TabPanel();
|
||||
for (Component<?> component : components) {
|
||||
Widget w = component.getSettingsDialogComponent().getAdditionalWidget((DataEntryDialog<?>) dialog);
|
||||
result.add(w, component.getLocalizedShortName());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompositeSettings getResult() {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Validator<CompositeSettings> getValidator() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FocusWidget getFocusWidget() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
package com.sap.sailing.gwt.ui.shared.components;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.components.CompositeSettings.ComponentAndSettingsPair;
|
||||
|
||||
/**
|
||||
* A composite settings dialog that combines the settings of several {@link Component}s, providing a tab
|
||||
* for each component.
|
||||
*
|
||||
* @author Axel Uhl (d043530)
|
||||
*
|
||||
*/
|
||||
public class CompositeTabbedSettingsDialog extends SettingsDialog<CompositeSettings> {
|
||||
private final Map<Component<?>, SettingsDialogComponent<?>> settingsDialogComponents;
|
||||
|
||||
public CompositeTabbedSettingsDialog(StringMessages stringConstants, final Component<?>... components) {
|
||||
super(new Component<CompositeSettings>() {
|
||||
@Override
|
||||
public boolean hasSettings() {
|
||||
for (Component<?> component : components) {
|
||||
if (component.hasSettings()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SettingsDialogComponent<CompositeSettings> getSettingsDialogComponent() {
|
||||
return new CompositeSettingsDialogComponent(components);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSettings(CompositeSettings newSettings) {
|
||||
for (CompositeSettings.ComponentAndSettingsPair<?> componentAndSettings : newSettings.getSettingsPerComponent()) {
|
||||
updateSettings(componentAndSettings);
|
||||
}
|
||||
}
|
||||
|
||||
private <SettingsType> void updateSettings(ComponentAndSettingsPair<SettingsType> componentAndSettings) {
|
||||
componentAndSettings.getA().updateSettings(componentAndSettings.getB());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalizedShortName() {
|
||||
StringBuilder result = new StringBuilder();
|
||||
boolean first = true;
|
||||
for (Component<?> component : components) {
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
result.append(" / ");
|
||||
}
|
||||
result.append(component.getLocalizedShortName());
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget getEntryWidget() {
|
||||
throw new NoSuchMethodError("Virtual composite component doesn't have a widget of its own");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVisible(boolean visibility) {
|
||||
throw new NoSuchMethodError("Virtual composite component doesn't know how to make itself visible");
|
||||
}
|
||||
}, stringConstants);
|
||||
settingsDialogComponents = new HashMap<Component<?>, SettingsDialogComponent<?>>();
|
||||
for (Component<?> component : components) {
|
||||
if (component.hasSettings()) {
|
||||
settingsDialogComponents.put(component, component.getSettingsDialogComponent());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
package com.sap.sailing.gwt.ui.shared.components;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.sap.sailing.domain.common.impl.Util.Pair;
|
||||
import com.sap.sailing.gwt.ui.client.DataEntryDialog.Validator;
|
||||
import com.sap.sailing.gwt.ui.shared.components.CompositeSettings.ComponentAndSettingsPair;
|
||||
|
||||
public class CompositeValidator implements Validator<CompositeSettings> {
|
||||
private static class ComponentAndValidator<SettingsType> extends Pair<Component<SettingsType>, Validator<SettingsType>> {
|
||||
private static final long serialVersionUID = -4190322565836849861L;
|
||||
|
||||
public ComponentAndValidator(Component<SettingsType> a, Validator<SettingsType> b) {
|
||||
super(a, b);
|
||||
}
|
||||
}
|
||||
|
||||
private final Iterable<ComponentAndValidator<?>> validators;
|
||||
|
||||
public CompositeValidator(Component<?>[] components) {
|
||||
ArrayList<ComponentAndValidator<?>> v = new ArrayList<ComponentAndValidator<?>>();
|
||||
for (Component<?> component : components) {
|
||||
v.add(getComponentAndValidator(component));
|
||||
}
|
||||
validators = v;
|
||||
}
|
||||
|
||||
private <SettingsType> ComponentAndValidator<SettingsType> getComponentAndValidator(Component<SettingsType> component) {
|
||||
return new ComponentAndValidator<SettingsType>(component, component.getSettingsDialogComponent().getValidator());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorMessage(CompositeSettings valueToValidate) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
for (ComponentAndSettingsPair<?> componentAndSettings : valueToValidate.getSettingsPerComponent()) {
|
||||
final String errorMessage = getErrorMessage(componentAndSettings);
|
||||
if (errorMessage != null) {
|
||||
result.append(errorMessage);
|
||||
result.append("; ");
|
||||
}
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
private <SettingsType> String getErrorMessage(ComponentAndSettingsPair<SettingsType> componentAndSettings) {
|
||||
for (ComponentAndValidator<?> componentAndValidator : validators) {
|
||||
if (componentAndValidator.getA() == componentAndSettings.getA()) {
|
||||
@SuppressWarnings("unchecked")
|
||||
final Validator<SettingsType> validator = (Validator<SettingsType>) componentAndValidator.getB();
|
||||
return validator.getErrorMessage(componentAndSettings.getB());
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
+3
-2
@@ -14,11 +14,12 @@ public interface SettingsDialogComponent<SettingsType> {
|
||||
* @param dialog
|
||||
* can be used to {@link DataEntryDialog#createCheckbox(String) produce a checkbox}, a
|
||||
* {@link DataEntryDialog#createTextBox(String)} or other data entry elements that participate in key
|
||||
* handling for validation triggering and for canceling and confirming the dialog
|
||||
* handling for validation triggering and for canceling and confirming the dialog. The type argument
|
||||
* is therefore not propagated. It's not needed to create a simple UI control.
|
||||
* @return <code>null</code> in case this component doesn't make any special contribution to the settings dialog, or
|
||||
* a valid widget that will be displayed in the settings dialog
|
||||
*/
|
||||
Widget getAdditionalWidget(DataEntryDialog<SettingsType> dialog);
|
||||
Widget getAdditionalWidget(DataEntryDialog<?> dialog);
|
||||
|
||||
/**
|
||||
* Obtains the result from this settings dialog component; usually, the result object is contructed by reading data
|
||||
|
||||
Reference in new issue
Block a user