mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-01 08:40:52 +00:00
show the regatta structure in ui. prepared to edit them
This commit is contained in:
1 parent
17f02f0a6d
commit
7c888ecd93
17 files changed
+672
-681
No files matched your search
+6
@@ -14,10 +14,12 @@ import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.domain.common.ScoringSchemeType;
|
||||
import com.sap.sailing.domain.common.dto.BoatClassDTO;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.client.shared.controls.listedit.ListEditorComposite;
|
||||
import com.sap.sailing.gwt.ui.leaderboard.ScoringSchemeTypeFormatter;
|
||||
import com.sap.sailing.gwt.ui.shared.CourseAreaDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.SeriesDTO;
|
||||
import com.sap.sse.gwt.client.dialog.DataEntryDialog;
|
||||
|
||||
public abstract class AbstractRegattaWithSeriesAndFleetsDialog<T> extends DataEntryDialog<T> {
|
||||
@@ -29,6 +31,7 @@ public abstract class AbstractRegattaWithSeriesAndFleetsDialog<T> extends DataEn
|
||||
protected ListBox courseAreaListBox;
|
||||
protected ListBox sailingEventsListBox;
|
||||
protected CheckBox useStartTimeInferenceCheckBox;
|
||||
protected ListEditorComposite<SeriesDTO> seriesEditor;
|
||||
|
||||
protected List<EventDTO> existingEvents;
|
||||
|
||||
@@ -110,6 +113,8 @@ public abstract class AbstractRegattaWithSeriesAndFleetsDialog<T> extends DataEn
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected abstract void setSeriesEditor();
|
||||
|
||||
private void setupEventAndCourseAreaListBoxes(StringMessages stringMessages) {
|
||||
sailingEventsListBox.addItem(stringMessages.selectSailingEvent());
|
||||
@@ -189,6 +194,7 @@ public abstract class AbstractRegattaWithSeriesAndFleetsDialog<T> extends DataEn
|
||||
regatta.scoringScheme = getSelectedScoringSchemeType();
|
||||
regatta.useStartTimeInference = useStartTimeInferenceCheckBox.getValue();
|
||||
setCourseAreaInRegatta(regatta);
|
||||
regatta.series = seriesEditor.getValue();
|
||||
return regatta;
|
||||
}
|
||||
|
||||
|
||||
+21
-9
@@ -2,13 +2,16 @@ package com.sap.sailing.gwt.ui.adminconsole;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Button;
|
||||
import com.google.gwt.user.client.ui.Grid;
|
||||
import com.google.gwt.user.client.ui.TabPanel;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.sap.sailing.gwt.ui.client.ErrorReporter;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
@@ -17,9 +20,12 @@ import com.sap.sailing.gwt.ui.shared.CourseAreaDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.EventAndRegattaDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.SeriesDTO;
|
||||
|
||||
public class DefaultRegattaCreateDialog extends
|
||||
AbstractRegattaWithSeriesAndFleetsDialog<EventAndRegattaDTO> {
|
||||
|
||||
private static AdminConsoleResources resources = GWT.create(AdminConsoleResources.class);
|
||||
|
||||
private SailingServiceAsync sailingService;
|
||||
private ErrorReporter errorReporter;
|
||||
@@ -31,21 +37,21 @@ public class DefaultRegattaCreateDialog extends
|
||||
ErrorReporter errorReporter,
|
||||
StringMessages stringConstants,
|
||||
com.sap.sse.gwt.client.dialog.DataEntryDialog.DialogCallback<EventAndRegattaDTO> callback) {
|
||||
super(new RegattaDTO(), existingEvents, stringConstants.addRegatta(),
|
||||
stringConstants.ok(), stringConstants,
|
||||
super(new RegattaDTO(), existingEvents,
|
||||
"Create default settings for all regattas...", stringConstants
|
||||
.ok(), stringConstants,
|
||||
null /* RegattaParameterValidator */, callback);
|
||||
this.sailingService = sailingService;
|
||||
this.errorReporter = errorReporter;
|
||||
setCourseAreaSelection();
|
||||
|
||||
setSeriesEditor();
|
||||
}
|
||||
|
||||
// protected void setSeriesEditor() {
|
||||
// this.seriesEditor = new
|
||||
// SeriesWithFleetsDefaultListEditor(Collections.<SeriesDTO> emptyList(),
|
||||
// stringMessages,
|
||||
// resources.removeIcon(), /* enableFleetRemoval */true);
|
||||
// }
|
||||
protected void setSeriesEditor() {
|
||||
seriesEditor = new SeriesWithFleetsDefaultListEditor(
|
||||
Collections.<SeriesDTO> emptyList(), stringMessages,
|
||||
resources.removeIcon(), /* enableFleetRemoval */true);
|
||||
}
|
||||
|
||||
protected void setupAdditionalWidgetsOnPanel(final VerticalPanel panel) {
|
||||
Button newEventBtn = new Button("Create New Event");
|
||||
@@ -68,6 +74,12 @@ public class DefaultRegattaCreateDialog extends
|
||||
newGrid.setWidget(3, 2, newEventBtn);
|
||||
panel.remove(0);
|
||||
panel.add(newGrid);
|
||||
|
||||
TabPanel tabPanel = new TabPanel();
|
||||
tabPanel.setWidth("100%");
|
||||
tabPanel.add(seriesEditor, stringMessages.series());
|
||||
tabPanel.selectTab(0);
|
||||
panel.add(tabPanel);
|
||||
}
|
||||
|
||||
private void openEventCreateDialog() {
|
||||
|
||||
-23
@@ -111,29 +111,6 @@ public class RegattaStructureManagementPanel extends SimplePanel implements Rega
|
||||
regattaDetailsComposite.setVisible(false);
|
||||
grid.setWidget(0, 1, regattaDetailsComposite);
|
||||
}
|
||||
|
||||
// private void showRegattaStructure(RegattaStructure regattaStructure){
|
||||
// Grid grid = new Grid();
|
||||
//
|
||||
// Button editBtn = new Button("Edit Series");
|
||||
// editBtn.addClickHandler(new ClickHandler() {
|
||||
//
|
||||
// @Override
|
||||
// public void onClick(ClickEvent event) {
|
||||
// //TODO: open Dialog to edit default series
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// Iterable<String> structure = regattaStructure.getStructure();
|
||||
// int i = 0;
|
||||
// for (String string : structure) {
|
||||
// grid.setWidget(i, 0, new Label(string));
|
||||
// grid.setWidget(i, 0, editBtn);
|
||||
// i++;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// }
|
||||
|
||||
protected void removeRegattas(Collection<RegattaIdentifier> regattas) {
|
||||
if (!regattas.isEmpty()) {
|
||||
|
||||
+1
-3
@@ -10,7 +10,6 @@ import com.google.gwt.core.shared.GWT;
|
||||
import com.google.gwt.user.client.ui.TabPanel;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.client.shared.controls.listedit.ListEditorComposite;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.SeriesDTO;
|
||||
@@ -19,8 +18,6 @@ public class RegattaWithSeriesAndFleetsCreateDialog extends RegattaWithSeriesAnd
|
||||
|
||||
protected static AdminConsoleResources resources = GWT.create(AdminConsoleResources.class);
|
||||
|
||||
protected ListEditorComposite<SeriesDTO> seriesEditor;
|
||||
|
||||
protected static class RegattaParameterValidator implements Validator<RegattaDTO> {
|
||||
|
||||
private StringMessages stringMessages;
|
||||
@@ -101,6 +98,7 @@ public class RegattaWithSeriesAndFleetsCreateDialog extends RegattaWithSeriesAnd
|
||||
setSeriesEditor();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setSeriesEditor() {
|
||||
this.seriesEditor = new SeriesWithFleetsListEditor(Collections.<SeriesDTO> emptyList(), stringMessages,
|
||||
resources.removeIcon(), /* enableFleetRemoval */true);
|
||||
|
||||
+7
-6
@@ -14,12 +14,10 @@ import com.google.gwt.user.client.ui.Grid;
|
||||
import com.google.gwt.user.client.ui.TabPanel;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.client.shared.controls.listedit.ListEditorComposite;
|
||||
import com.sap.sailing.gwt.ui.shared.DeviceConfigurationDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.DeviceConfigurationDTO.RegattaConfigurationDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.SeriesDTO;
|
||||
|
||||
public class RegattaWithSeriesAndFleetsEditDialog extends RegattaWithSeriesAndFleetsDialog {
|
||||
|
||||
@@ -28,7 +26,6 @@ public class RegattaWithSeriesAndFleetsEditDialog extends RegattaWithSeriesAndFl
|
||||
protected Button regattaConfigurationButton;
|
||||
|
||||
private RegattaConfigurationDTO currentRegattaConfiguration;
|
||||
private ListEditorComposite<SeriesDTO> seriesEditor;
|
||||
|
||||
public RegattaWithSeriesAndFleetsEditDialog(RegattaDTO regatta, Collection<RegattaDTO> existingRegattas,
|
||||
List<EventDTO> existingEvents, final StringMessages stringMessages, DialogCallback<RegattaDTO> callback) {
|
||||
@@ -72,10 +69,14 @@ public class RegattaWithSeriesAndFleetsEditDialog extends RegattaWithSeriesAndFl
|
||||
});
|
||||
regattaConfigurationCheckbox.setValue(regatta.configuration != null);
|
||||
regattaConfigurationButton.setEnabled(regatta.configuration != null);
|
||||
|
||||
this.seriesEditor = new SeriesWithFleetsListEditor(regatta.series, stringMessages, resources.removeIcon(), /* enableFleetRemoval */
|
||||
false);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void setSeriesEditor() {
|
||||
seriesEditor = new SeriesWithFleetsListEditor(regatta.series, stringMessages, resources.removeIcon(), /* enableFleetRemoval */
|
||||
false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ public class SeriesWithFleetsCreateDialog extends DataEntryDialog<SeriesDTO> {
|
||||
private SeriesDTO series;
|
||||
|
||||
protected TextBox nameEntryField;
|
||||
private CheckBox isMedalSeriesCheckbox;
|
||||
protected CheckBox isMedalSeriesCheckbox;
|
||||
private CheckBox startsWithZeroScoreCheckbox;
|
||||
private CheckBox hasSplitFleetContiguousScoringCheckbox;
|
||||
private CheckBox firstColumnIsNonDiscardableCarryForwardCheckbox;
|
||||
|
||||
+12
-7
@@ -2,8 +2,10 @@ package com.sap.sailing.gwt.ui.adminconsole;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import com.google.gwt.user.client.ui.Grid;
|
||||
import com.google.gwt.user.client.ui.TabPanel;
|
||||
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.sailing.gwt.ui.shared.SeriesDTO;
|
||||
|
||||
@@ -15,19 +17,22 @@ public class SeriesWithFleetsDefaultCreateDialog extends
|
||||
StringMessages stringMessages,
|
||||
com.sap.sse.gwt.client.dialog.DataEntryDialog.DialogCallback<SeriesDTO> callback) {
|
||||
super(existingSeries, stringMessages, callback);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
protected void setNameEntryField() {
|
||||
super.setNameEntryField();
|
||||
nameEntryField.setReadOnly(true);
|
||||
nameEntryField.setText("Default");
|
||||
nameEntryField.setText("default");//Otherwise an errorMessage will pop up
|
||||
}
|
||||
|
||||
protected void addFleetListComposite(final VerticalPanel panel,
|
||||
TabPanel tabPanel) {
|
||||
//don't add the tabPanel with the FleetListComposite to the panel
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Widget getAdditionalWidget() {
|
||||
VerticalPanel panel = (VerticalPanel) super.getAdditionalWidget();
|
||||
Grid formGrid = (Grid) panel.getWidget(0);
|
||||
formGrid.removeRow(0);
|
||||
formGrid.removeRow(0);
|
||||
return panel;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+47
-46
@@ -14,54 +14,55 @@ import com.sap.sailing.gwt.ui.shared.SeriesDTO;
|
||||
import com.sap.sse.gwt.client.dialog.DataEntryDialog.DialogCallback;
|
||||
|
||||
public class SeriesWithFleetsDefaultListEditor extends
|
||||
SeriesWithFleetsListEditor {
|
||||
SeriesWithFleetsListEditor {
|
||||
|
||||
public SeriesWithFleetsDefaultListEditor(List<SeriesDTO> initialValues,
|
||||
StringMessages stringMessages, ImageResource removeImage,
|
||||
boolean enableFleetRemoval) {
|
||||
super(initialValues, stringMessages, removeImage, enableFleetRemoval);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
protected ListEditorUiStrategy<SeriesDTO> createExpandedUi(StringMessages stringMessages, ImageResource removeImage, boolean enableFleetRemoval){
|
||||
return new ExpandedUiDefault(stringMessages, removeImage, enableFleetRemoval);
|
||||
}
|
||||
|
||||
private static class ExpandedUiDefault extends ExpandedUi{
|
||||
public SeriesWithFleetsDefaultListEditor(List<SeriesDTO> initialValues,
|
||||
StringMessages stringMessages, ImageResource removeImage,
|
||||
boolean enableFleetRemoval) {
|
||||
super(initialValues, stringMessages, removeImage, enableFleetRemoval);
|
||||
}
|
||||
|
||||
public ExpandedUiDefault(StringMessages stringMessages,
|
||||
ImageResource removeImage, boolean canRemoveItems) {
|
||||
super(stringMessages, removeImage, canRemoveItems);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
protected Widget createAddWidget() {
|
||||
Button addSeriesButton = new Button(stringMessages.setDefaultSeries());
|
||||
addSeriesButton.ensureDebugId("SetDefaultSeriesButton");
|
||||
addSeriesButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
SeriesWithFleetsDefaultCreateDialog dialog = new SeriesWithFleetsDefaultCreateDialog(Collections
|
||||
.unmodifiableCollection(context.getValue()), stringMessages, new DialogCallback<SeriesDTO>() {
|
||||
@Override
|
||||
public void cancel() {
|
||||
}
|
||||
protected ListEditorUiStrategy<SeriesDTO> createExpandedUi(
|
||||
StringMessages stringMessages, ImageResource removeImage,
|
||||
boolean enableFleetRemoval) {
|
||||
return new ExpandedUiDefault(stringMessages, removeImage,
|
||||
enableFleetRemoval);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ok(SeriesDTO newSeries) {
|
||||
addValue(newSeries);
|
||||
}
|
||||
});
|
||||
dialog.ensureDebugId("DefaultSeriesCreateDialog");
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
return addSeriesButton;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static class ExpandedUiDefault extends ExpandedUi {
|
||||
|
||||
public ExpandedUiDefault(StringMessages stringMessages,
|
||||
ImageResource removeImage, boolean canRemoveItems) {
|
||||
super(stringMessages, removeImage, canRemoveItems);
|
||||
}
|
||||
|
||||
protected Widget createAddWidget() {
|
||||
Button addSeriesButton = new Button(
|
||||
stringMessages.setDefaultSeries());
|
||||
addSeriesButton.ensureDebugId("SetDefaultSeriesButton");
|
||||
addSeriesButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
SeriesWithFleetsDefaultCreateDialog dialog = new SeriesWithFleetsDefaultCreateDialog(
|
||||
Collections.unmodifiableCollection(context
|
||||
.getValue()), stringMessages,
|
||||
new DialogCallback<SeriesDTO>() {
|
||||
@Override
|
||||
public void cancel() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ok(SeriesDTO newSeries) {
|
||||
addValue(newSeries);
|
||||
}
|
||||
});
|
||||
dialog.ensureDebugId("DefaultSeriesCreateDialog");
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
return addSeriesButton;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+279
-202
@@ -2,13 +2,14 @@ package com.sap.sailing.gwt.ui.adminconsole;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.base.ProgressBarBase.Style;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.user.client.Timer;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Button;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
@@ -22,239 +23,315 @@ import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.sap.sailing.gwt.ui.client.ErrorReporter;
|
||||
import com.sap.sailing.gwt.ui.client.RegattaRefresher;
|
||||
import com.sap.sailing.gwt.ui.client.RegattaSelectionModel;
|
||||
import com.sap.sailing.gwt.ui.client.RegattaSelectionProvider;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.EventAndRegattaDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.SeriesDTO;
|
||||
import com.sap.sse.gwt.client.dialog.DataEntryDialog.DialogCallback;
|
||||
|
||||
public class StructureImportManagementPanel extends FlowPanel {
|
||||
private final SailingServiceAsync sailingService;
|
||||
private final ErrorReporter errorReporter;
|
||||
private final StringMessages stringMessages;
|
||||
private final RegattaRefresher regattaRefresher;
|
||||
private final EventManagementPanel eventManagementPanel;
|
||||
private final StructureImportListComposite regattaListComposite;
|
||||
private RegattaSelectionProvider regattaSelectionProvider;
|
||||
private Panel progressPanel;
|
||||
private TextBox jsonURLTextBox;
|
||||
private TextBox eventIDTextBox;
|
||||
private Iterable<RegattaDTO> addSpecificRegattas;
|
||||
private final SailingServiceAsync sailingService;
|
||||
private final ErrorReporter errorReporter;
|
||||
private final StringMessages stringMessages;
|
||||
private final RegattaRefresher regattaRefresher;
|
||||
private final EventManagementPanel eventManagementPanel;
|
||||
private final StructureImportListComposite regattaListComposite;
|
||||
private Panel progressPanel;
|
||||
private TextBox jsonURLTextBox;
|
||||
private TextBox eventIDTextBox;
|
||||
|
||||
private Button listRegattasButton;
|
||||
private Button importDetailsButton;
|
||||
private Button listRegattasButton;
|
||||
private Button importDetailsButton;
|
||||
private VerticalPanel editSeriesPanel;
|
||||
|
||||
private StructureImportProgressBar progressBar;
|
||||
private Label overallName;
|
||||
private int parsed;
|
||||
public StructureImportManagementPanel(SailingServiceAsync sailingService,
|
||||
ErrorReporter errorReporter, StringMessages stringMessages,
|
||||
RegattaRefresher regattaRefresher,
|
||||
EventManagementPanel eventManagementPanel) {
|
||||
this.eventManagementPanel = eventManagementPanel;
|
||||
this.sailingService = sailingService;
|
||||
this.errorReporter = errorReporter;
|
||||
this.stringMessages = stringMessages;
|
||||
this.regattaRefresher = regattaRefresher;
|
||||
this.regattaListComposite = new StructureImportListComposite(
|
||||
this.sailingService, new RegattaSelectionModel(true),
|
||||
this.regattaRefresher, this.errorReporter, this.stringMessages);
|
||||
regattaListComposite.ensureDebugId("RegattaListComposite");
|
||||
createUI();
|
||||
}
|
||||
|
||||
public StructureImportManagementPanel(SailingServiceAsync sailingService, ErrorReporter errorReporter,
|
||||
StringMessages stringMessages, RegattaRefresher regattaRefresher, EventManagementPanel eventManagementPanel) {
|
||||
this.eventManagementPanel = eventManagementPanel;
|
||||
this.sailingService = sailingService;
|
||||
this.errorReporter = errorReporter;
|
||||
this.stringMessages = stringMessages;
|
||||
this.regattaRefresher = regattaRefresher;
|
||||
this.regattaListComposite = new StructureImportListComposite(this.sailingService,
|
||||
new RegattaSelectionModel(true), this.regattaRefresher, this.errorReporter, this.stringMessages);
|
||||
regattaListComposite.ensureDebugId("RegattaListComposite");
|
||||
createUI();
|
||||
private void createUI() {
|
||||
progressPanel = new FlowPanel();
|
||||
Grid URLgrid = new Grid(2, 2);
|
||||
Label eventIDLabel = new Label(stringMessages.event() + ":");
|
||||
Label jsonURLLabel = new Label(stringMessages.jsonUrl() + ":");
|
||||
eventIDTextBox = new TextBox();
|
||||
eventIDTextBox.ensureDebugId("eventIDTextBox");
|
||||
eventIDTextBox.setVisibleLength(50);
|
||||
jsonURLTextBox = new TextBox();
|
||||
jsonURLTextBox.ensureDebugId("JsonURLTextBox");
|
||||
jsonURLTextBox.setVisibleLength(100);
|
||||
listRegattasButton = new Button(this.stringMessages.listRegattas());
|
||||
importDetailsButton = new Button(this.stringMessages.importRegatta());
|
||||
importDetailsButton.setEnabled(false);
|
||||
importDetailsButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
List<RegattaDTO> selectedRegattas = regattaListComposite
|
||||
.getSelectedRegattas();
|
||||
createEventDetails(selectedRegattas);
|
||||
}
|
||||
});
|
||||
listRegattasButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
addUrl();
|
||||
}
|
||||
});
|
||||
VerticalPanel vp = new VerticalPanel();
|
||||
|
||||
}
|
||||
HorizontalPanel buttonPanel = new HorizontalPanel();
|
||||
URLgrid.setWidget(0, 0, eventIDLabel);
|
||||
URLgrid.setWidget(0, 1, eventIDTextBox);
|
||||
URLgrid.setWidget(1, 0, jsonURLLabel);
|
||||
URLgrid.setWidget(1, 1, jsonURLTextBox);
|
||||
vp.add(URLgrid);
|
||||
vp.add(buttonPanel);
|
||||
buttonPanel.add(listRegattasButton);
|
||||
buttonPanel.add(importDetailsButton);
|
||||
Grid grid = new Grid(1, 1);
|
||||
vp.add(grid);
|
||||
|
||||
private void createUI() {
|
||||
progressPanel = new FlowPanel();
|
||||
Grid URLgrid = new Grid(2, 2);
|
||||
Label eventIDLabel = new Label(stringMessages.event() + ":");
|
||||
Label jsonURLLabel = new Label(stringMessages.jsonUrl() + ":");
|
||||
eventIDTextBox = new TextBox();
|
||||
eventIDTextBox.ensureDebugId("eventIDTextBox");
|
||||
eventIDTextBox.setVisibleLength(50);
|
||||
jsonURLTextBox = new TextBox();
|
||||
jsonURLTextBox.ensureDebugId("JsonURLTextBox");
|
||||
jsonURLTextBox.setVisibleLength(100);
|
||||
listRegattasButton = new Button(this.stringMessages.listRegattas());
|
||||
importDetailsButton = new Button(this.stringMessages.importRegatta());
|
||||
importDetailsButton.setEnabled(false);
|
||||
importDetailsButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
List<RegattaDTO> selectedRegattas = regattaListComposite.getSelectedRegattas();
|
||||
createEventDetails(selectedRegattas);
|
||||
}
|
||||
});
|
||||
listRegattasButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
addUrl();
|
||||
}
|
||||
});
|
||||
VerticalPanel vp = new VerticalPanel();
|
||||
grid.setWidget(0, 0, regattaListComposite);
|
||||
grid.getRowFormatter().setVerticalAlign(0,
|
||||
HasVerticalAlignment.ALIGN_TOP);
|
||||
grid.getColumnFormatter().getElement(0/** 1 */
|
||||
).getStyle().setPaddingTop(2.0, Unit.EM);
|
||||
|
||||
HorizontalPanel buttonPanel = new HorizontalPanel();
|
||||
URLgrid.setWidget(0, 0, eventIDLabel);
|
||||
URLgrid.setWidget(0, 1, eventIDTextBox);
|
||||
URLgrid.setWidget(1, 0, jsonURLLabel);
|
||||
URLgrid.setWidget(1, 1, jsonURLTextBox);
|
||||
vp.add(URLgrid);
|
||||
vp.add(buttonPanel);
|
||||
buttonPanel.add(listRegattasButton);
|
||||
buttonPanel.add(importDetailsButton);
|
||||
Grid grid = new Grid(1, 1);
|
||||
vp.add(grid);
|
||||
editSeriesPanel = new VerticalPanel();
|
||||
|
||||
regattaSelectionProvider = new RegattaSelectionModel(true);
|
||||
add(progressPanel);
|
||||
add(vp);
|
||||
add(editSeriesPanel);
|
||||
}
|
||||
|
||||
grid.setWidget(0, 0, regattaListComposite);
|
||||
grid.getRowFormatter().setVerticalAlign(0, HasVerticalAlignment.ALIGN_TOP);
|
||||
grid.getColumnFormatter().getElement(0/** 1 */
|
||||
).getStyle().setPaddingTop(2.0, Unit.EM);
|
||||
private void createEventDetails(final Iterable<RegattaDTO> regattas) {
|
||||
sailingService.getEvents(new AsyncCallback<List<EventDTO>>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError("Error trying to get events");
|
||||
}
|
||||
|
||||
add(progressPanel);
|
||||
add(vp);
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(List<EventDTO> events) {
|
||||
setDefaultRegatta(regattas, events);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void createEventDetails(final Iterable<RegattaDTO> regattas) {
|
||||
sailingService.getEvents(new AsyncCallback<List<EventDTO>>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError("Error trying to get events");
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(List<EventDTO> events) {
|
||||
setDefaultRegatta(regattas, events);
|
||||
}
|
||||
});
|
||||
}
|
||||
private void addUrl() {
|
||||
String valueToValidate = "";
|
||||
if (eventIDTextBox.getValue() == null
|
||||
|| eventIDTextBox.getValue().length() == 0) {
|
||||
valueToValidate = jsonURLTextBox.getValue();
|
||||
} else {
|
||||
valueToValidate = "http://manage2sail.com/api/public/links/event/"
|
||||
+ eventIDTextBox.getValue()
|
||||
+ "?accesstoken=bDAv8CwsTM94ujZ&mediaType=json";
|
||||
}
|
||||
|
||||
private void addUrl() {
|
||||
String valueToValidate = "";
|
||||
if (eventIDTextBox.getValue() == null || eventIDTextBox.getValue().length() == 0) {
|
||||
valueToValidate = jsonURLTextBox.getValue();
|
||||
} else {
|
||||
valueToValidate = "http://manage2sail.com/api/public/links/event/" + eventIDTextBox.getValue()
|
||||
+ "?accesstoken=bDAv8CwsTM94ujZ&mediaType=json";
|
||||
}
|
||||
if (valueToValidate == null || valueToValidate.length() == 0) {
|
||||
errorReporter.reportError(stringMessages.pleaseEnterNonEmptyUrl());
|
||||
}
|
||||
|
||||
if (valueToValidate == null || valueToValidate.length() == 0) {
|
||||
errorReporter.reportError(stringMessages.pleaseEnterNonEmptyUrl());
|
||||
}
|
||||
else {
|
||||
sailingService.getRegattas(valueToValidate,
|
||||
new AsyncCallback<Iterable<RegattaDTO>>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter
|
||||
.reportError("Error trying to load regattas");
|
||||
}
|
||||
|
||||
else {
|
||||
sailingService.getRegattas(valueToValidate, new AsyncCallback<Iterable<RegattaDTO>>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError("Error trying to load regattas");
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(Iterable<RegattaDTO> regattas) {
|
||||
addSpecificRegattas = regattas;
|
||||
fillRegattas(regattas);
|
||||
importDetailsButton.setEnabled(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(Iterable<RegattaDTO> regattas) {
|
||||
fillRegattas(regattas);
|
||||
importDetailsButton.setEnabled(true);
|
||||
LinkedHashMap<Set<String>, Set<RegattaDTO>> structure = getRegattaStructure(regattas);
|
||||
showRegattaStructure(structure);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void fillRegattas(Iterable<RegattaDTO> regattas) {
|
||||
regattaListComposite.fillRegattas((List<RegattaDTO>)regattas);
|
||||
}
|
||||
private LinkedHashMap<Set<String>, Set<RegattaDTO>> getRegattaStructure(
|
||||
Iterable<RegattaDTO> regattas) {
|
||||
final LinkedHashMap<Set<String>, Set<RegattaDTO>> structure = new LinkedHashMap<Set<String>, Set<RegattaDTO>>();
|
||||
|
||||
private void createProgressBarAndLabel(int amountOfRegattas) {
|
||||
overallName = new Label(stringMessages.overallProgress() + ":");
|
||||
progressPanel.add(overallName);
|
||||
progressBar = new StructureImportProgressBar(amountOfRegattas + 1, Style.ANIMATED);
|
||||
progressPanel.add(progressBar);
|
||||
}
|
||||
// TODO change to enum
|
||||
Set<Set<String>> staticStructures = new HashSet<Set<String>>();
|
||||
Set<String> OPENINGMEDAL = new HashSet<String>();
|
||||
OPENINGMEDAL.add("Opening Series");
|
||||
OPENINGMEDAL.add("Medal");
|
||||
staticStructures.add(OPENINGMEDAL);
|
||||
Set<String> QUALIFICATIONFINALSMEDAL = new HashSet<String>();
|
||||
QUALIFICATIONFINALSMEDAL.add("Qualification");
|
||||
QUALIFICATIONFINALSMEDAL.add("Finals");
|
||||
QUALIFICATIONFINALSMEDAL.add("Medal");
|
||||
staticStructures.add(QUALIFICATIONFINALSMEDAL);
|
||||
Set<String> QUALIFICATIONFINALS = new HashSet<String>();
|
||||
QUALIFICATIONFINALS.add("Qualification");
|
||||
QUALIFICATIONFINALS.add("Finals");
|
||||
staticStructures.add(QUALIFICATIONFINALS);
|
||||
Set<String> ONESERIES = new HashSet<String>();
|
||||
ONESERIES.add("Default");
|
||||
staticStructures.add(ONESERIES);
|
||||
Set<String> UNDEFINED = new HashSet<String>();
|
||||
UNDEFINED.add("Undefined");
|
||||
staticStructures.add(UNDEFINED);
|
||||
|
||||
private void setProgressBar(final int amountOfRegattas) {
|
||||
createProgressBarAndLabel(amountOfRegattas);
|
||||
for (Set<String> struct : staticStructures) {
|
||||
structure.put(struct, new HashSet<RegattaDTO>());
|
||||
}
|
||||
|
||||
final Timer timer = new Timer() {
|
||||
@Override
|
||||
public void run() {
|
||||
sailingService.getStructureImportOperationProgress(new AsyncCallback<Integer>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError(stringMessages.errorAddingResultImportUrl(caught.getMessage()));
|
||||
}
|
||||
for (RegattaDTO regatta : regattas) {
|
||||
Set<String> temp = new HashSet<String>();
|
||||
for (SeriesDTO series : regatta.series) {
|
||||
temp.add(series.getName());
|
||||
}
|
||||
if (temp.isEmpty()) {
|
||||
structure.get(UNDEFINED).add(regatta);
|
||||
} else {
|
||||
for (Set<String> struct : staticStructures) {
|
||||
if (struct.equals(temp)) {
|
||||
structure.get(struct).add(regatta);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return structure;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Integer result) {
|
||||
parsed = result;
|
||||
progressBar.setPercent(result);
|
||||
}
|
||||
private void fillRegattas(Iterable<RegattaDTO> regattas) {
|
||||
regattaListComposite.fillRegattas((List<RegattaDTO>) regattas);
|
||||
}
|
||||
|
||||
});
|
||||
if (parsed >= amountOfRegattas) { /* finished */
|
||||
regattaRefresher.fillRegattas();
|
||||
progressBar.removeFromParent();
|
||||
overallName.removeFromParent();
|
||||
this.cancel();
|
||||
}
|
||||
}
|
||||
};
|
||||
timer.scheduleRepeating(2000);
|
||||
}
|
||||
private void showRegattaStructure(
|
||||
final LinkedHashMap<Set<String>, Set<RegattaDTO>> structure) {
|
||||
Grid grid = new Grid(structure.size(), 2);
|
||||
|
||||
private void setDefaultRegatta(final Iterable<RegattaDTO> selectedRegattas, final List<EventDTO> newEvent) {
|
||||
sailingService.getEvents(new AsyncCallback<List<EventDTO>>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError(stringMessages.errorAddingResultImportUrl(caught.getMessage()));
|
||||
}
|
||||
int i = 0;
|
||||
for (final Set<String> struct : structure.keySet()) {
|
||||
Button editBtn = new Button("Edit Series");
|
||||
editBtn.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<EventDTO> result) {
|
||||
Collection<RegattaDTO> existingRegattas = Collections.emptyList();
|
||||
DefaultRegattaCreateDialog dialog = new DefaultRegattaCreateDialog(existingRegattas, result,
|
||||
sailingService, errorReporter, stringMessages, new DialogCallback<EventAndRegattaDTO>() {
|
||||
@Override
|
||||
public void cancel() {
|
||||
}
|
||||
@Override
|
||||
public void ok(final EventAndRegattaDTO newRegatta) {
|
||||
// sailingService.getRegattaStructure(selectedRegattas,
|
||||
// new AsyncCallback<Set<RegattaStructureDTO>>() {
|
||||
// @Override
|
||||
// public void onFailure(Throwable caught) {
|
||||
// // errorReporter.reportError(stringMessages.errorAddingResultImportUrl(caught
|
||||
// // .getMessage()));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onSuccess(Set<RegattaStructureDTO> result) {
|
||||
// // TODO UI aufbauen
|
||||
createRegattas(selectedRegattas, newRegatta.getEvent(),
|
||||
newRegatta.getRegatta());
|
||||
// }
|
||||
// });
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
// TODO open dialog to edit series parameters for each
|
||||
// series with a dropdown and return
|
||||
// those. I suggest using a LinkedHashMap<String, SeriesDTO>
|
||||
|
||||
}
|
||||
});
|
||||
dialog.ensureDebugId("DefaultRegattaCreateDialog");
|
||||
dialog.show();
|
||||
/*
|
||||
* only for testing. parameters will be received from the
|
||||
* dialog
|
||||
*/
|
||||
LinkedHashMap<String, SeriesDTO> parameters = new LinkedHashMap<String, SeriesDTO>();
|
||||
Set<RegattaDTO> regattasTest = structure.get(struct);
|
||||
for (RegattaDTO regatta : regattasTest) {
|
||||
for (SeriesDTO series : regatta.series) {
|
||||
parameters.put(series.getName(), new SeriesDTO("",
|
||||
null, null, false, null, false, false,
|
||||
false));
|
||||
}
|
||||
}
|
||||
/* only for testing */
|
||||
|
||||
}
|
||||
});
|
||||
Set<RegattaDTO> regattas = structure.get(struct);
|
||||
for (RegattaDTO regatta : regattas) {
|
||||
for (SeriesDTO series : regatta.series) {
|
||||
SeriesDTO seriesParameters = parameters.get(series
|
||||
.getName());
|
||||
series.setDiscardThresholds(seriesParameters
|
||||
.getDiscardThresholds());
|
||||
series.setSplitFleetContiguousScoring(seriesParameters
|
||||
.hasSplitFleetContiguousScoring());
|
||||
series.setStartsWithZeroScore(seriesParameters
|
||||
.isStartsWithZeroScore());
|
||||
series.setFirstColumnIsNonDiscardableCarryForward(seriesParameters
|
||||
.isFirstColumnIsNonDiscardableCarryForward());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
String text = "";
|
||||
for (String string : struct) {
|
||||
text += string + ", ";
|
||||
}
|
||||
text += "(" + structure.get(struct).size() + ")";
|
||||
grid.setWidget(i, 0, new Label(text));
|
||||
grid.setWidget(i, 1, editBtn);
|
||||
i++;
|
||||
}
|
||||
editSeriesPanel.clear();
|
||||
editSeriesPanel.add(grid);
|
||||
}
|
||||
|
||||
private void createRegattas(final Iterable<RegattaDTO> regattaNames, EventDTO newEvent, RegattaDTO defaultRegatta) {
|
||||
eventManagementPanel.fillEvents();
|
||||
sailingService.createRegattaStructure(regattaNames, newEvent, defaultRegatta, new AsyncCallback<Void>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError(stringMessages.errorAddingResultImportUrl(caught.getMessage()));
|
||||
}
|
||||
private void setDefaultRegatta(final Iterable<RegattaDTO> selectedRegattas,
|
||||
final List<EventDTO> newEvent) {
|
||||
sailingService.getEvents(new AsyncCallback<List<EventDTO>>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError(stringMessages
|
||||
.errorAddingResultImportUrl(caught.getMessage()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
// setProgressBar(regattaNames.size());
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(List<EventDTO> result) {
|
||||
Collection<RegattaDTO> existingRegattas = Collections
|
||||
.emptyList();
|
||||
DefaultRegattaCreateDialog dialog = new DefaultRegattaCreateDialog(
|
||||
existingRegattas, result, sailingService,
|
||||
errorReporter, stringMessages,
|
||||
new DialogCallback<EventAndRegattaDTO>() {
|
||||
@Override
|
||||
public void cancel() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ok(final EventAndRegattaDTO newRegatta) {
|
||||
createRegattas(selectedRegattas,
|
||||
newRegatta.getEvent(),
|
||||
newRegatta.getRegatta());
|
||||
}
|
||||
});
|
||||
dialog.ensureDebugId("DefaultRegattaCreateDialog");
|
||||
dialog.show();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void createRegattas(final Iterable<RegattaDTO> regattaNames,
|
||||
EventDTO newEvent, RegattaDTO defaultRegatta) {
|
||||
eventManagementPanel.fillEvents();
|
||||
sailingService.createRegattaStructure(regattaNames, newEvent,
|
||||
defaultRegatta, new AsyncCallback<Void>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError(stringMessages
|
||||
.errorAddingResultImportUrl(caught.getMessage()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
regattaRefresher.fillRegattas();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
-5
@@ -10,7 +10,6 @@ import java.util.UUID;
|
||||
|
||||
import com.google.gwt.user.client.rpc.RemoteService;
|
||||
import com.sap.sailing.domain.base.RaceDefinition;
|
||||
import com.sap.sailing.domain.base.Regatta;
|
||||
import com.sap.sailing.domain.base.RemoteSailingServerReference;
|
||||
import com.sap.sailing.domain.common.DataImportProgress;
|
||||
import com.sap.sailing.domain.common.DetailType;
|
||||
@@ -70,7 +69,6 @@ import com.sap.sailing.gwt.ui.shared.RaceTimesInfoDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaOverviewEntryDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaScoreCorrectionDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaStructureDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RemoteSailingServerReferenceDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.ReplicationStateDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.ScoreCorrectionProviderDTO;
|
||||
@@ -86,7 +84,6 @@ import com.sap.sailing.gwt.ui.shared.TrackFileImportDeviceIdentifierDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.VenueDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindInfoForRaceDTO;
|
||||
import com.sap.sailing.server.operationaltransformation.AddSpecificRegatta;
|
||||
import com.sap.sse.common.Util;
|
||||
import com.sap.sse.common.Util.Pair;
|
||||
import com.sap.sse.common.search.KeywordQuery;
|
||||
@@ -562,8 +559,6 @@ public interface SailingService extends RemoteService {
|
||||
*/
|
||||
RaceDTO setStartTimeReceivedForRace(RaceIdentifier raceIdentifier, Date newStartTimeReceived);
|
||||
|
||||
Set<RegattaStructureDTO> getRegattaStructure(List<String> regattaNames);
|
||||
|
||||
void createRegattaStructure(Iterable<RegattaDTO> regattas,
|
||||
EventDTO newEvent, RegattaDTO defaultRegatta);
|
||||
|
||||
|
||||
+1
-6
@@ -9,7 +9,6 @@ import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.sap.sailing.domain.base.Regatta;
|
||||
import com.sap.sailing.domain.base.RemoteSailingServerReference;
|
||||
import com.sap.sailing.domain.common.DataImportProgress;
|
||||
import com.sap.sailing.domain.common.DetailType;
|
||||
@@ -60,7 +59,6 @@ import com.sap.sailing.gwt.ui.shared.RaceTimesInfoDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaOverviewEntryDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaScoreCorrectionDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaStructureDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RemoteSailingServerReferenceDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.ReplicationStateDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.ScoreCorrectionProviderDTO;
|
||||
@@ -76,7 +74,6 @@ import com.sap.sailing.gwt.ui.shared.TrackFileImportDeviceIdentifierDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.VenueDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindInfoForRaceDTO;
|
||||
import com.sap.sailing.server.operationaltransformation.AddSpecificRegatta;
|
||||
import com.sap.sse.common.Util;
|
||||
import com.sap.sse.common.search.KeywordQuery;
|
||||
|
||||
@@ -647,8 +644,6 @@ public interface SailingServiceAsync {
|
||||
|
||||
void createRegattaStructure(Iterable<RegattaDTO> regattaNames,
|
||||
EventDTO newEvent, RegattaDTO defaultRegatta,
|
||||
AsyncCallback<Void> asyncCallback);
|
||||
|
||||
void getRegattaStructure(List<String> regattaNames, AsyncCallback<Set<RegattaStructureDTO>> asyncCallback);
|
||||
AsyncCallback<Void> asyncCallback);
|
||||
|
||||
}
|
||||
+52
-48
@@ -303,7 +303,6 @@ import com.sap.sailing.gwt.ui.shared.RegattaDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaOverviewEntryDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaScoreCorrectionDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaScoreCorrectionDTO.ScoreCorrectionEntryDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaStructureDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RemoteSailingServerReferenceDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.ReplicaDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.ReplicationMasterDTO;
|
||||
@@ -3723,22 +3722,33 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
}
|
||||
|
||||
private void createRegattaFromRegattaDTO(RegattaDTO regatta){
|
||||
this.createRegatta(regatta.getName(), regatta.boatClass.getName(),null, false, regatta.scoringScheme, regatta.defaultCourseAreaUuid, regatta.useStartTimeInference);
|
||||
this.createRegatta(regatta.getName(), regatta.boatClass.getName(),
|
||||
new RegattaCreationParametersDTO(getSeriesCreationParameters(regatta)),
|
||||
true, regatta.scoringScheme, regatta.defaultCourseAreaUuid, regatta.useStartTimeInference);
|
||||
}
|
||||
|
||||
private SeriesParameters getDefaultSeries(RegattaDTO defaultRegatta) {
|
||||
SeriesParameters defaultSeries = new SeriesParameters(false, false, false, null);
|
||||
if (defaultRegatta.series != null && !defaultRegatta.series.isEmpty()) {
|
||||
SeriesDTO series = defaultRegatta.series.get(0);
|
||||
defaultSeries
|
||||
.setFirstColumnIsNonDiscardableCarryForward(series.isFirstColumnIsNonDiscardableCarryForward());
|
||||
defaultSeries.setHasSplitFleetContiguousScoring(series.hasSplitFleetContiguousScoring());
|
||||
defaultSeries.setStartswithZeroScore(series.isStartsWithZeroScore());
|
||||
defaultSeries.setDiscardingThresholds(series.getDiscardThresholds());
|
||||
}
|
||||
return defaultSeries;
|
||||
|
||||
private SeriesParameters getSeriesParameters(SeriesDTO seriesDTO) {
|
||||
SeriesParameters series = new SeriesParameters(false, false, false, null);
|
||||
series
|
||||
.setFirstColumnIsNonDiscardableCarryForward(seriesDTO.isFirstColumnIsNonDiscardableCarryForward());
|
||||
series.setHasSplitFleetContiguousScoring(seriesDTO.hasSplitFleetContiguousScoring());
|
||||
series.setStartswithZeroScore(seriesDTO.isStartsWithZeroScore());
|
||||
series.setDiscardingThresholds(seriesDTO.getDiscardThresholds());
|
||||
return series;
|
||||
}
|
||||
|
||||
private LinkedHashMap<String, SeriesCreationParametersDTO> getSeriesCreationParameters(RegattaDTO regattaDTO) {
|
||||
LinkedHashMap<String, SeriesCreationParametersDTO> seriesCreationParams = new LinkedHashMap<String, SeriesCreationParametersDTO>();
|
||||
for (SeriesDTO series : regattaDTO.series){
|
||||
SeriesParameters seriesParameters = getSeriesParameters(series);
|
||||
seriesCreationParams.put(series.getName(), new SeriesCreationParametersDTO(series.getFleets(),
|
||||
false, seriesParameters.isStartswithZeroScore(), seriesParameters.isFirstColumnIsNonDiscardableCarryForward(),
|
||||
seriesParameters.getDiscardingThresholds(), seriesParameters.isHasSplitFleetContiguousScoring()));
|
||||
}
|
||||
return seriesCreationParams;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<RegattaDTO> getRegattas(String url) {
|
||||
StructureImporter structureImporter = new StructureImporter(new SetRacenumberFromSeries(), baseDomainFactory);
|
||||
Iterable<RegattaJSON> parsedEvent = structureImporter.parseEvent(url);
|
||||
@@ -3750,15 +3760,11 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
return regattaDTOs;
|
||||
}
|
||||
|
||||
private List<String> createRegattasWithRaces(Iterable<AddSpecificRegatta> regattas, String eventName) {
|
||||
private List<String> createRegattasWithRaces(RegattaDTO regatta, String eventName) {
|
||||
List<String> leaderboardNames = new ArrayList<String>();
|
||||
for (AddSpecificRegatta addSpecificRegatta : regattas) {
|
||||
Regatta regatta = getService().apply(addSpecificRegatta);
|
||||
|
||||
// create RaceColumns
|
||||
for (Series series : regatta.getSeries()) {
|
||||
for (SeriesDTO series : regatta.series) {
|
||||
List<String> raceNames = new ArrayList<String>();
|
||||
for (RaceColumnInSeries raceColumnInSeries : series.getRaceColumns()) {
|
||||
for (RaceColumnDTO raceColumnInSeries : series.getRaceColumns()) {
|
||||
raceNames.add(raceColumnInSeries.getName());
|
||||
}
|
||||
addRaceColumnsToSeries(regatta.getRegattaIdentifier(), series.getName(), raceNames);
|
||||
@@ -3766,43 +3772,41 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
|
||||
if (getLeaderboard(regatta.getName()) == null) {
|
||||
leaderboardNames.add(regatta.getName());
|
||||
createRegattaLeaderboard(regatta.getRegattaIdentifier(), regatta.getBoatClass().toString(), new int[0]);
|
||||
createRegattaLeaderboard(regatta.getRegattaIdentifier(), regatta.boatClass.toString(), new int[0]);
|
||||
}
|
||||
}
|
||||
return leaderboardNames;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<RegattaStructureDTO> getRegattaStructure(final List<String> regattaNames) {
|
||||
// Set<RegattaStructureKey> regattaStructureKeys = regattaStructures.keySet();
|
||||
Set<RegattaStructureDTO> regattaStructureDTOs = new HashSet<RegattaStructureDTO>();
|
||||
// for(RegattaStructureKey regattaStructureKey: regattaStructureKeys){
|
||||
// RegattaStructureDTO regattaStructureDTO = new RegattaStructureDTO(regattaStructureKey,
|
||||
// regattaStructures.get(regattaStructureKey));
|
||||
// regattaStructureDTOs.add(regattaStructureDTO);
|
||||
// }
|
||||
return regattaStructureDTOs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createRegattaStructure(final Iterable<RegattaDTO> regattas, final EventDTO newEvent,
|
||||
final RegattaDTO defaultRegatta) {
|
||||
final Set<AddSpecificRegatta> addSpecificRegattas = new HashSet<AddSpecificRegatta>();
|
||||
final List<String> leaderboardNames = new ArrayList<String>();
|
||||
for(RegattaDTO regatta: regattas){
|
||||
regatta.defaultCourseAreaUuid = defaultRegatta.defaultCourseAreaUuid;
|
||||
regatta.defaultCourseAreaName = defaultRegatta.defaultCourseAreaName;
|
||||
regatta.scoringScheme = defaultRegatta.scoringScheme;
|
||||
regatta.useStartTimeInference = defaultRegatta.useStartTimeInference;
|
||||
for (SeriesDTO series : regatta.series) {
|
||||
if(!defaultRegatta.series.isEmpty()){
|
||||
SeriesDTO defaultSeries = defaultRegatta.series.get(0);
|
||||
series.setDiscardThresholds(defaultSeries.getDiscardThresholds());
|
||||
series.setSplitFleetContiguousScoring(defaultSeries.hasSplitFleetContiguousScoring());
|
||||
series.setStartsWithZeroScore(defaultSeries.isStartsWithZeroScore());
|
||||
series.setFirstColumnIsNonDiscardableCarryForward(defaultSeries.isFirstColumnIsNonDiscardableCarryForward());
|
||||
}else{
|
||||
series.setDiscardThresholds(null);
|
||||
series.setSplitFleetContiguousScoring(false);
|
||||
series.setStartsWithZeroScore(false);
|
||||
series.setFirstColumnIsNonDiscardableCarryForward(false);
|
||||
}
|
||||
}
|
||||
createRegattaFromRegattaDTO(regatta);
|
||||
leaderboardNames.addAll(createRegattasWithRaces(regatta, newEvent.getName()));
|
||||
}
|
||||
Runnable structureImportTask = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final StructureImporter structureImporter = new StructureImporter();
|
||||
final List<String> leaderboardNames = createRegattasWithRaces(addSpecificRegattas, newEvent.getName());
|
||||
createAndAddLeaderboardGroup(newEvent, leaderboardNames);
|
||||
// structureImporter.setCompetitors(regattas, "");
|
||||
structureImporter.setFinished(true);
|
||||
|
||||
}
|
||||
};
|
||||
executor.execute(structureImportTask);
|
||||
createAndAddLeaderboardGroup(newEvent, leaderboardNames);
|
||||
|
||||
//TODO find a way to import the competitors for the selected regattas. You'll need the regattas as Iterable<RegattaResults>
|
||||
// structureImporter.setCompetitors(regattas, "");
|
||||
}
|
||||
|
||||
private void createAndAddLeaderboardGroup(final EventDTO newEvent, List<String> leaderboardNames) {
|
||||
|
||||
+4
-2
@@ -1,5 +1,7 @@
|
||||
package com.sap.sailing.gwt.ui.shared;
|
||||
|
||||
import com.sap.sailing.xrr.structureimport.SeriesParameters;
|
||||
|
||||
|
||||
public class RegattaStructureDTO {
|
||||
// private final RegattaStructureKey regattaStructure;
|
||||
@@ -20,10 +22,10 @@ public class RegattaStructureDTO {
|
||||
// }
|
||||
// return regattaStructureString.substring(1);
|
||||
// }
|
||||
|
||||
//
|
||||
// public void setDefaultSeries(RegattaDTO defaultRegatta) {
|
||||
// SeriesParameters defaultSeries = new SeriesParameters(false, false, false, null);
|
||||
// if (defaultRegatta.series.size() > 0) { // null abfangen
|
||||
// if (!defaultRegatta.series.isEmpty()) {
|
||||
// SeriesDTO series = defaultRegatta.series.get(0);
|
||||
// defaultSeries
|
||||
// .setFirstColumnIsNonDiscardableCarryForward(series.isFirstColumnIsNonDiscardableCarryForward());
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
// Generated on: 2013.03.15 at 04:56:46 PM CET
|
||||
//
|
||||
|
||||
|
||||
package com.sap.sailing.xrr.schema;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
@@ -16,15 +16,17 @@ import javax.xml.bind.annotation.XmlSchemaType;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import javax.xml.datatype.XMLGregorianCalendar;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* very preliminary, info about a single race within a regatta
|
||||
*
|
||||
* very preliminary, info about a single race within a regatta
|
||||
*
|
||||
* <p>Java class for Race complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
* <p>
|
||||
* Java class for Race complex type.
|
||||
*
|
||||
* <p>
|
||||
* The following schema fragment specifies the expected content contained within
|
||||
* this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="Race">
|
||||
@@ -48,247 +50,234 @@ import javax.xml.datatype.XMLGregorianCalendar;
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "Race")
|
||||
public class Race {
|
||||
public class Race implements Comparable<Race> {
|
||||
|
||||
@XmlAttribute(name = "RaceID", required = true)
|
||||
protected String raceID;
|
||||
@XmlAttribute(name = "RaceNumber", required = true)
|
||||
protected BigInteger raceNumber;
|
||||
@XmlAttribute(name = "RaceName")
|
||||
protected String raceName;
|
||||
@XmlAttribute(name = "RaceStartDate")
|
||||
@XmlSchemaType(name = "date")
|
||||
protected XMLGregorianCalendar raceStartDate;
|
||||
@XmlAttribute(name = "RaceStartTime")
|
||||
@XmlSchemaType(name = "time")
|
||||
protected XMLGregorianCalendar raceStartTime;
|
||||
@XmlAttribute(name = "RaceStatus")
|
||||
protected IFRaceStatus raceStatus;
|
||||
@XmlAttribute(name = "Stage")
|
||||
protected String stage;
|
||||
@XmlAttribute(name = "Flight")
|
||||
protected String flight;
|
||||
@XmlAttribute(name = "Match")
|
||||
protected String match;
|
||||
@XmlAttribute(name = "RaceID", required = true)
|
||||
protected String raceID;
|
||||
@XmlAttribute(name = "RaceNumber", required = true)
|
||||
protected BigInteger raceNumber;
|
||||
@XmlAttribute(name = "RaceName")
|
||||
protected String raceName;
|
||||
@XmlAttribute(name = "RaceStartDate")
|
||||
@XmlSchemaType(name = "date")
|
||||
protected XMLGregorianCalendar raceStartDate;
|
||||
@XmlAttribute(name = "RaceStartTime")
|
||||
@XmlSchemaType(name = "time")
|
||||
protected XMLGregorianCalendar raceStartTime;
|
||||
@XmlAttribute(name = "RaceStatus")
|
||||
protected IFRaceStatus raceStatus;
|
||||
@XmlAttribute(name = "Stage")
|
||||
protected String stage;
|
||||
@XmlAttribute(name = "Flight")
|
||||
protected String flight;
|
||||
@XmlAttribute(name = "Match")
|
||||
protected String match;
|
||||
|
||||
/**
|
||||
* Gets the value of the raceID property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getRaceID() {
|
||||
return raceID;
|
||||
}
|
||||
/**
|
||||
* Gets the value of the raceID property.
|
||||
*
|
||||
* @return possible object is {@link String }
|
||||
*
|
||||
*/
|
||||
public String getRaceID() {
|
||||
return raceID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the raceID property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setRaceID(String value) {
|
||||
this.raceID = value;
|
||||
}
|
||||
/**
|
||||
* Sets the value of the raceID property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link String }
|
||||
*
|
||||
*/
|
||||
public void setRaceID(String value) {
|
||||
this.raceID = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the raceNumber property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link BigInteger }
|
||||
*
|
||||
*/
|
||||
public BigInteger getRaceNumber() {
|
||||
return raceNumber;
|
||||
}
|
||||
/**
|
||||
* Gets the value of the raceNumber property.
|
||||
*
|
||||
* @return possible object is {@link BigInteger }
|
||||
*
|
||||
*/
|
||||
public BigInteger getRaceNumber() {
|
||||
return raceNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the raceNumber property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link BigInteger }
|
||||
*
|
||||
*/
|
||||
public void setRaceNumber(BigInteger value) {
|
||||
this.raceNumber = value;
|
||||
}
|
||||
/**
|
||||
* Sets the value of the raceNumber property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link BigInteger }
|
||||
*
|
||||
*/
|
||||
public void setRaceNumber(BigInteger value) {
|
||||
this.raceNumber = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the raceName property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getRaceName() {
|
||||
return raceName;
|
||||
}
|
||||
/**
|
||||
* Gets the value of the raceName property.
|
||||
*
|
||||
* @return possible object is {@link String }
|
||||
*
|
||||
*/
|
||||
public String getRaceName() {
|
||||
return raceName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the raceName property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setRaceName(String value) {
|
||||
this.raceName = value;
|
||||
}
|
||||
/**
|
||||
* Sets the value of the raceName property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link String }
|
||||
*
|
||||
*/
|
||||
public void setRaceName(String value) {
|
||||
this.raceName = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the raceStartDate property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link XMLGregorianCalendar }
|
||||
*
|
||||
*/
|
||||
public XMLGregorianCalendar getRaceStartDate() {
|
||||
return raceStartDate;
|
||||
}
|
||||
/**
|
||||
* Gets the value of the raceStartDate property.
|
||||
*
|
||||
* @return possible object is {@link XMLGregorianCalendar }
|
||||
*
|
||||
*/
|
||||
public XMLGregorianCalendar getRaceStartDate() {
|
||||
return raceStartDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the raceStartDate property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link XMLGregorianCalendar }
|
||||
*
|
||||
*/
|
||||
public void setRaceStartDate(XMLGregorianCalendar value) {
|
||||
this.raceStartDate = value;
|
||||
}
|
||||
/**
|
||||
* Sets the value of the raceStartDate property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link XMLGregorianCalendar }
|
||||
*
|
||||
*/
|
||||
public void setRaceStartDate(XMLGregorianCalendar value) {
|
||||
this.raceStartDate = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the raceStartTime property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link XMLGregorianCalendar }
|
||||
*
|
||||
*/
|
||||
public XMLGregorianCalendar getRaceStartTime() {
|
||||
return raceStartTime;
|
||||
}
|
||||
/**
|
||||
* Gets the value of the raceStartTime property.
|
||||
*
|
||||
* @return possible object is {@link XMLGregorianCalendar }
|
||||
*
|
||||
*/
|
||||
public XMLGregorianCalendar getRaceStartTime() {
|
||||
return raceStartTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the raceStartTime property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link XMLGregorianCalendar }
|
||||
*
|
||||
*/
|
||||
public void setRaceStartTime(XMLGregorianCalendar value) {
|
||||
this.raceStartTime = value;
|
||||
}
|
||||
/**
|
||||
* Sets the value of the raceStartTime property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link XMLGregorianCalendar }
|
||||
*
|
||||
*/
|
||||
public void setRaceStartTime(XMLGregorianCalendar value) {
|
||||
this.raceStartTime = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the raceStatus property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link IFRaceStatus }
|
||||
*
|
||||
*/
|
||||
public IFRaceStatus getRaceStatus() {
|
||||
return raceStatus;
|
||||
}
|
||||
/**
|
||||
* Gets the value of the raceStatus property.
|
||||
*
|
||||
* @return possible object is {@link IFRaceStatus }
|
||||
*
|
||||
*/
|
||||
public IFRaceStatus getRaceStatus() {
|
||||
return raceStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the raceStatus property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link IFRaceStatus }
|
||||
*
|
||||
*/
|
||||
public void setRaceStatus(IFRaceStatus value) {
|
||||
this.raceStatus = value;
|
||||
}
|
||||
/**
|
||||
* Sets the value of the raceStatus property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link IFRaceStatus }
|
||||
*
|
||||
*/
|
||||
public void setRaceStatus(IFRaceStatus value) {
|
||||
this.raceStatus = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the stage property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getStage() {
|
||||
return stage;
|
||||
}
|
||||
/**
|
||||
* Gets the value of the stage property.
|
||||
*
|
||||
* @return possible object is {@link String }
|
||||
*
|
||||
*/
|
||||
public String getStage() {
|
||||
return stage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the stage property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setStage(String value) {
|
||||
this.stage = value;
|
||||
}
|
||||
/**
|
||||
* Sets the value of the stage property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link String }
|
||||
*
|
||||
*/
|
||||
public void setStage(String value) {
|
||||
this.stage = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the flight property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getFlight() {
|
||||
return flight;
|
||||
}
|
||||
/**
|
||||
* Gets the value of the flight property.
|
||||
*
|
||||
* @return possible object is {@link String }
|
||||
*
|
||||
*/
|
||||
public String getFlight() {
|
||||
return flight;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the flight property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setFlight(String value) {
|
||||
this.flight = value;
|
||||
}
|
||||
/**
|
||||
* Sets the value of the flight property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link String }
|
||||
*
|
||||
*/
|
||||
public void setFlight(String value) {
|
||||
this.flight = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the match property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getMatch() {
|
||||
return match;
|
||||
}
|
||||
/**
|
||||
* Gets the value of the match property.
|
||||
*
|
||||
* @return possible object is {@link String }
|
||||
*
|
||||
*/
|
||||
public String getMatch() {
|
||||
return match;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the match property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setMatch(String value) {
|
||||
this.match = value;
|
||||
}
|
||||
/**
|
||||
* Sets the value of the match property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is {@link String }
|
||||
*
|
||||
*/
|
||||
public void setMatch(String value) {
|
||||
this.match = value;
|
||||
}
|
||||
|
||||
public char getFirstChar() {
|
||||
return raceName.charAt(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Race arg0) {
|
||||
int a = Integer.parseInt(this.getRaceNumber() + "");
|
||||
int b = Integer.parseInt(arg0.getRaceNumber() + "");
|
||||
|
||||
int result = 0;
|
||||
if (a < b) {
|
||||
result = -1;
|
||||
} else if (a > b) {
|
||||
result = 1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package buildstructure;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import com.sap.sailing.xrr.schema.Race;
|
||||
|
||||
@@ -8,7 +10,8 @@ public class Fleet implements Comparable {
|
||||
private final int NUMBEROFRACES = 10;
|
||||
|
||||
private String color = "";
|
||||
private Race[] races = new Race[NUMBEROFRACES];
|
||||
private Race[] racesOld = new Race[NUMBEROFRACES];
|
||||
private Set<Race> races = new TreeSet<Race>();
|
||||
private int numRaces = 0;
|
||||
|
||||
public Fleet(String color) {
|
||||
@@ -26,22 +29,23 @@ public class Fleet implements Comparable {
|
||||
race.setRaceName(raceName);
|
||||
|
||||
int raceNumber = Integer.parseInt(race.getRaceNumber() + "");
|
||||
if (races.length > raceNumber) {
|
||||
races[raceNumber - 1] = race;
|
||||
if (racesOld.length > raceNumber) {
|
||||
racesOld[raceNumber - 1] = race;
|
||||
numRaces++;
|
||||
} else {
|
||||
Race[] temp = races;
|
||||
races = new Race[temp.length + NUMBEROFRACES];
|
||||
Race[] temp = racesOld;
|
||||
racesOld = new Race[temp.length + NUMBEROFRACES];
|
||||
for (int i = 0; i < temp.length; i++) {
|
||||
races[i] = temp[i];
|
||||
racesOld[i] = temp[i];
|
||||
}
|
||||
races[raceNumber - 1] = race;
|
||||
racesOld[raceNumber - 1] = race;
|
||||
numRaces++;
|
||||
}
|
||||
races.add(race);
|
||||
|
||||
}
|
||||
|
||||
public Race[] getRaces() {
|
||||
public Iterable<Race> getRaces() {
|
||||
return races;
|
||||
}
|
||||
|
||||
|
||||
+5
-2
@@ -9,7 +9,11 @@ public class SetRacenumberFromSeries implements SetRacenumberStrategy {
|
||||
|
||||
@Override
|
||||
public void setRacenumber(Race race, Series series, int i) {
|
||||
List<String> raceNames = new ArrayList<String>();
|
||||
List<String> raceNames = series.getRaceNames();
|
||||
if(raceNames == null){
|
||||
raceNames = new ArrayList<String>();
|
||||
series.setRaceNames(raceNames);
|
||||
}
|
||||
if (race != null) {
|
||||
char beginOfSeries = series.getFirstChar();
|
||||
if (beginOfSeries == 'D' && race.getFirstChar() != 'R') {
|
||||
@@ -19,6 +23,5 @@ public class SetRacenumberFromSeries implements SetRacenumberStrategy {
|
||||
raceNames.add(race.getRaceName());
|
||||
}
|
||||
}
|
||||
series.setRaceNames(raceNames);
|
||||
}
|
||||
}
|
||||
+10
-88
@@ -41,6 +41,8 @@ import com.sap.sailing.domain.base.impl.TeamImpl;
|
||||
import com.sap.sailing.domain.common.Color;
|
||||
import com.sap.sailing.domain.common.FleetColors;
|
||||
import com.sap.sailing.domain.common.ScoringSchemeType;
|
||||
import com.sap.sailing.domain.common.dto.FleetDTO;
|
||||
import com.sap.sailing.domain.common.dto.SeriesCreationParametersDTO;
|
||||
import com.sap.sailing.xrr.resultimport.ParserFactory;
|
||||
import com.sap.sailing.xrr.schema.Boat;
|
||||
import com.sap.sailing.xrr.schema.Crew;
|
||||
@@ -57,13 +59,9 @@ import eventimport.RegattaJSON;
|
||||
public class StructureImporter {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(StructureImporter.class.getName());
|
||||
private Map<RegattaStructureKey, Set<BuildStructure>> seriesStructuresWithFrequency = new HashMap<RegattaStructureKey, Set<BuildStructure>>(); // TODO
|
||||
// rename
|
||||
private LinkedHashMap<String, Boat> boatForPerson;
|
||||
private final DomainFactory baseDomainFactory;
|
||||
private final SetRacenumberStrategy setRacenumberStrategy;
|
||||
private int parsedDocuments = 0;
|
||||
private boolean finished = false;
|
||||
|
||||
public StructureImporter(SetRacenumberStrategy setRacenumber, DomainFactory baseDomainFactory) {
|
||||
this.setRacenumberStrategy = setRacenumber;
|
||||
@@ -96,11 +94,11 @@ public class StructureImporter {
|
||||
}
|
||||
}
|
||||
BuildStructure buildStructure = new BuildStructure(races);
|
||||
// analyseStructure(structure);
|
||||
addSpecificRegattas.add(new RegattaImpl(RegattaImpl.getDefaultName(event.getTitle(),
|
||||
RegattaImpl regatta = new RegattaImpl(RegattaImpl.getDefaultName(event.getTitle(),
|
||||
((Division) event.getRaceOrDivisionOrRegattaSeriesResult().get(0)).getTitle()), new BoatClassImpl(((Division) event
|
||||
.getRaceOrDivisionOrRegattaSeriesResult().get(0)).getTitle(),true), setSeries(buildStructure), false, this.baseDomainFactory
|
||||
.createScoringScheme(ScoringSchemeType.LOW_POINT), event.getEventID(), null));
|
||||
.createScoringScheme(ScoringSchemeType.LOW_POINT), event.getEventID(), null);
|
||||
addSpecificRegattas.add(regatta);
|
||||
}
|
||||
return addSpecificRegattas;
|
||||
}
|
||||
@@ -117,7 +115,6 @@ public class StructureImporter {
|
||||
} catch (JAXBException | IOException e) {
|
||||
logger.info("Parse error during XRR import. Ignoring document " + selectedRegatta.getName());
|
||||
}
|
||||
parsedDocuments++;
|
||||
}
|
||||
};
|
||||
thread.start();
|
||||
@@ -130,56 +127,11 @@ public class StructureImporter {
|
||||
}
|
||||
break;
|
||||
} catch (InterruptedException e) {
|
||||
// not all Regattas have been parsed
|
||||
// waiting for the other threads
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public Map<RegattaStructureKey, Set<BuildStructure>> getRegattaStructures(List<String> regattaNames) {
|
||||
return seriesStructuresWithFrequency;
|
||||
}
|
||||
|
||||
// public void analyseStructure(BuildStructure structure) {
|
||||
// Map<String,String> seriesAndFleets = new HashMap<String,String>();
|
||||
// for (Series series : structure.getRegattaStructure().getSeries()) {
|
||||
// seriesAndFleets.add(series.getSeries());
|
||||
// for (Fleet fleet : series.getFleets()) {
|
||||
// seriesAndFleets.add(fleet.getColor());
|
||||
// }
|
||||
// }
|
||||
// RegattaStructureKey regattaStructureKey = new RegattaStructureKey(seriesAndFleets);
|
||||
//
|
||||
// if (!seriesAndFleets.isEmpty()) {
|
||||
// if (seriesStructuresWithFrequency.containsKey(regattaStructureKey)) {
|
||||
// seriesStructuresWithFrequency.get(regattaStructureKey).add(structure);
|
||||
// } else {
|
||||
// Set<BuildStructure> buildStructures = new HashSet<BuildStructure>();
|
||||
// buildStructures.add(structure);
|
||||
// seriesStructuresWithFrequency.put(regattaStructureKey, buildStructures);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
// private LinkedHashMap<String, SeriesCreationParametersDTO> setSeriesCreationParameters(BuildStructure structure,
|
||||
// boolean firstColumnIsNonDiscardableCarryForward, boolean hasSplitFleetContiguousScoring,
|
||||
// boolean startswithZeroScore, int[] discardingThresholds) {
|
||||
// LinkedHashMap<String, SeriesCreationParametersDTO> seriesCreationParams = new LinkedHashMap<String, SeriesCreationParametersDTO>();
|
||||
// RegattaStructure regattaStructure = structure.getRegattaStructure();
|
||||
// if (regattaStructure != null) {
|
||||
// int index = 0;
|
||||
// for (Series raceType : regattaStructure.getSeries()) {
|
||||
// List<FleetDTO> fleets = getFleets(raceType.getFleets());
|
||||
// setRaceNames(index, raceType, raceType.getFleets());
|
||||
// seriesCreationParams.put(raceType.getSeries(), new SeriesCreationParametersDTO(fleets,
|
||||
// /* medal */raceType.isMedal(), startswithZeroScore, firstColumnIsNonDiscardableCarryForward,
|
||||
// discardingThresholds, hasSplitFleetContiguousScoring));
|
||||
// index++;
|
||||
// }
|
||||
// }
|
||||
// return seriesCreationParams;
|
||||
// }
|
||||
|
||||
private Iterable<SeriesImpl> setSeries(BuildStructure structure) {
|
||||
Set<SeriesImpl> series = new HashSet<SeriesImpl>();
|
||||
@@ -187,7 +139,7 @@ public class StructureImporter {
|
||||
if (regattaStructure != null) {
|
||||
int index = 0;
|
||||
for (Series raceType : regattaStructure.getSeries()) {
|
||||
List<FleetImpl> fleets = getFleets(raceType.getFleets());
|
||||
List<com.sap.sailing.domain.base.Fleet> fleets = getFleets(raceType.getFleets());
|
||||
setRaceNames(index, raceType, raceType.getFleets());
|
||||
series.add(new SeriesImpl(raceType.getSeries(), raceType.isMedal(), fleets, raceType.getRaceNames(), null));
|
||||
}
|
||||
@@ -196,32 +148,14 @@ public class StructureImporter {
|
||||
}
|
||||
|
||||
private void setRaceNames(int i, Series raceType, List<Fleet> fleets) {
|
||||
// set Racenumbers for each series
|
||||
Race[] races = fleets.get(raceType.getMaxIndex()).getRaces();
|
||||
Iterable<Race> races = fleets.get(raceType.getMaxIndex()).getRaces();
|
||||
for (Race race : races) {
|
||||
setRacenumberStrategy.setRacenumber(race, raceType, i);
|
||||
}
|
||||
}
|
||||
|
||||
// private List<FleetDTO> getFleets(List<Fleet> fleets) {
|
||||
// List<FleetDTO> fleetsDTO = new ArrayList<FleetDTO>();
|
||||
// String fleetColor = "";
|
||||
// if (fleets.size() <= 1) {
|
||||
// fleetColor = "Default";
|
||||
// } else {
|
||||
// int index = 0;
|
||||
// for (Fleet fleet : fleets) {
|
||||
// fleetColor = fleet.getColor();
|
||||
// FleetDTO fleetDTO = new FleetDTO(fleetColor, index, getColorFromString(fleetColor));
|
||||
// fleetsDTO.add(fleetDTO);
|
||||
// index++;
|
||||
// }
|
||||
// }
|
||||
// return fleetsDTO;
|
||||
// }
|
||||
|
||||
private List<FleetImpl> getFleets(List<Fleet> fleets) {
|
||||
List<FleetImpl> fleetsImpl = new ArrayList<FleetImpl>();
|
||||
private List<com.sap.sailing.domain.base.Fleet> getFleets(List<Fleet> fleets) {
|
||||
List<com.sap.sailing.domain.base.Fleet> fleetsImpl = new ArrayList<com.sap.sailing.domain.base.Fleet>();
|
||||
String fleetColor = "";
|
||||
if (fleets.size() <= 1) {
|
||||
fleetColor = "Default";
|
||||
@@ -349,16 +283,4 @@ public class StructureImporter {
|
||||
URLConnection connection = new URL(url).openConnection();
|
||||
return connection.getInputStream();
|
||||
}
|
||||
|
||||
public int getProgress() {
|
||||
return parsedDocuments;
|
||||
}
|
||||
|
||||
public boolean isFinished() {
|
||||
return finished;
|
||||
}
|
||||
|
||||
public void setFinished(boolean finished) {
|
||||
this.finished = finished;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user