mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-02 18:33:54 +00:00
finished basic creation of regattas with series and fleets etc.
This commit is contained in:
1 parent
c21ea5dae2
commit
7975291d48
17 files changed
+271
-136
No files matched your search
+9
-1
@@ -35,6 +35,14 @@ public class RGBColor implements Color {
|
||||
|
||||
@Override
|
||||
public String getAsHtml() {
|
||||
return "#" + Integer.toHexString(red) + Integer.toHexString(green) + Integer.toHexString(blue);
|
||||
return "#" + toBrowserHexValue(red) + toBrowserHexValue(green) + toBrowserHexValue(blue);
|
||||
}
|
||||
|
||||
private static String toBrowserHexValue(int number) {
|
||||
StringBuilder builder = new StringBuilder(Integer.toHexString(number & 0xff));
|
||||
while (builder.length() < 2) {
|
||||
builder.append("0");
|
||||
}
|
||||
return builder.toString().toUpperCase();
|
||||
}
|
||||
}
|
||||
+15
-6
@@ -35,6 +35,7 @@ import com.sap.sailing.domain.base.impl.MillisecondsTimePoint;
|
||||
import com.sap.sailing.domain.base.impl.RegattaImpl;
|
||||
import com.sap.sailing.domain.base.impl.SeriesImpl;
|
||||
import com.sap.sailing.domain.base.impl.VenueImpl;
|
||||
import com.sap.sailing.domain.common.Color;
|
||||
import com.sap.sailing.domain.common.MaxPointsReason;
|
||||
import com.sap.sailing.domain.common.Position;
|
||||
import com.sap.sailing.domain.common.RaceIdentifier;
|
||||
@@ -44,6 +45,7 @@ import com.sap.sailing.domain.common.WindSource;
|
||||
import com.sap.sailing.domain.common.WindSourceType;
|
||||
import com.sap.sailing.domain.common.impl.DegreeBearingImpl;
|
||||
import com.sap.sailing.domain.common.impl.DegreePosition;
|
||||
import com.sap.sailing.domain.common.impl.RGBColor;
|
||||
import com.sap.sailing.domain.common.impl.WindSourceImpl;
|
||||
import com.sap.sailing.domain.common.impl.WindSourceWithAdditionalID;
|
||||
import com.sap.sailing.domain.leaderboard.Leaderboard;
|
||||
@@ -533,15 +535,22 @@ public class DomainObjectFactoryImpl implements DomainObjectFactory {
|
||||
}
|
||||
|
||||
private Fleet loadFleet(DBObject dbFleet) {
|
||||
Fleet result;
|
||||
String name = (String) dbFleet.get(FieldNames.FLEET_NAME.name());
|
||||
Integer ordering = (Integer) dbFleet.get(FieldNames.FLEET_ORDERING.name());
|
||||
Fleet result;
|
||||
if (ordering != null) {
|
||||
result = new FleetImpl(name, ordering);
|
||||
} else {
|
||||
result = new FleetImpl(name);
|
||||
if (ordering == null) {
|
||||
ordering = 0;
|
||||
}
|
||||
Integer colorAsInt = (Integer) dbFleet.get(FieldNames.FLEET_COLOR.name());
|
||||
Color color = null;
|
||||
if(colorAsInt != null) {
|
||||
int r = colorAsInt % 256;
|
||||
int g = (colorAsInt / 256 ) % 256;
|
||||
int b = (colorAsInt / 256 / 256) % 256;
|
||||
color = new RGBColor(r, g, b);
|
||||
}
|
||||
result = new FleetImpl(name, ordering, color);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
+1
@@ -20,6 +20,7 @@ public enum FieldNames {
|
||||
SERIES_RACE_COLUMNS,
|
||||
FLEET_NAME,
|
||||
FLEET_ORDERING,
|
||||
FLEET_COLOR,
|
||||
|
||||
RACE_NAME,
|
||||
|
||||
|
||||
+9
@@ -26,6 +26,7 @@ import com.sap.sailing.domain.common.MaxPointsReason;
|
||||
import com.sap.sailing.domain.common.RaceIdentifier;
|
||||
import com.sap.sailing.domain.common.Speed;
|
||||
import com.sap.sailing.domain.common.WindSource;
|
||||
import com.sap.sailing.domain.common.impl.Util.Triple;
|
||||
import com.sap.sailing.domain.leaderboard.FlexibleLeaderboard;
|
||||
import com.sap.sailing.domain.leaderboard.Leaderboard;
|
||||
import com.sap.sailing.domain.leaderboard.LeaderboardGroup;
|
||||
@@ -359,6 +360,14 @@ public class MongoObjectFactoryImpl implements MongoObjectFactory {
|
||||
DBObject dbFleet = new BasicDBObject(FieldNames.FLEET_NAME.name(), fleet.getName());
|
||||
if (fleet instanceof FleetImpl) {
|
||||
dbFleet.put(FieldNames.FLEET_ORDERING.name(), ((FleetImpl) fleet).getOrdering());
|
||||
if(fleet.getColor() != null) {
|
||||
Triple<Integer, Integer, Integer> colorAsRGB = fleet.getColor().getAsRGB();
|
||||
// we save the color as a integer value representing the RGB values
|
||||
int colorAsInt = (256 * 256 * colorAsRGB.getC()) + colorAsRGB.getB() * 256 + colorAsRGB.getA();
|
||||
dbFleet.put(FieldNames.FLEET_COLOR.name(), colorAsInt);
|
||||
} else {
|
||||
dbFleet.put(FieldNames.FLEET_COLOR.name(), null);
|
||||
}
|
||||
}
|
||||
return dbFleet;
|
||||
}
|
||||
|
||||
+90
-21
@@ -6,12 +6,16 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.gwt.cell.client.SafeHtmlCell;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.dom.client.ChangeEvent;
|
||||
import com.google.gwt.event.dom.client.ChangeHandler;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.safehtml.shared.SafeHtml;
|
||||
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||
import com.google.gwt.user.cellview.client.CellTable;
|
||||
import com.google.gwt.user.cellview.client.Column;
|
||||
import com.google.gwt.user.cellview.client.TextColumn;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Button;
|
||||
@@ -22,9 +26,11 @@ import com.google.gwt.user.client.ui.ListBox;
|
||||
import com.google.gwt.user.client.ui.SimplePanel;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.view.client.ListDataProvider;
|
||||
import com.google.gwt.view.client.MultiSelectionModel;
|
||||
import com.google.gwt.view.client.SelectionChangeEvent;
|
||||
import com.google.gwt.view.client.SingleSelectionModel;
|
||||
import com.sap.sailing.domain.common.Color;
|
||||
import com.sap.sailing.domain.common.impl.Util.Pair;
|
||||
import com.sap.sailing.domain.common.impl.Util.Triple;
|
||||
import com.sap.sailing.gwt.ui.client.ErrorReporter;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
@@ -53,7 +59,7 @@ public class EventStructureManagementPanel extends SimplePanel {
|
||||
|
||||
private Label eventVenueLabel;
|
||||
private CellTable<RegattaDTO> regattaTable;
|
||||
private MultiSelectionModel<RegattaDTO> regattaSelectionModel;
|
||||
private SingleSelectionModel<RegattaDTO> regattaSelectionModel;
|
||||
private ListDataProvider<RegattaDTO> regattaProvider;
|
||||
|
||||
private final AdminConsoleTableResources tableRes = GWT.create(AdminConsoleTableResources.class);
|
||||
@@ -123,28 +129,75 @@ public class EventStructureManagementPanel extends SimplePanel {
|
||||
}
|
||||
};
|
||||
|
||||
TextColumn<RegattaDTO> regattaSeriesColumn = new TextColumn<RegattaDTO>() {
|
||||
TextColumn<RegattaDTO> regattaBoatClassColumn = new TextColumn<RegattaDTO>() {
|
||||
@Override
|
||||
public String getValue(RegattaDTO regatta) {
|
||||
String result = "";
|
||||
boolean first = true;
|
||||
return regatta.boatClass.name;
|
||||
}
|
||||
};
|
||||
|
||||
final SafeHtmlCell seriesCell = new SafeHtmlCell();
|
||||
Column<RegattaDTO, SafeHtml> regattaSeriesColumn = new Column<RegattaDTO, SafeHtml>(seriesCell) {
|
||||
@Override
|
||||
public SafeHtml getValue(RegattaDTO regatta) {
|
||||
SafeHtmlBuilder builder = new SafeHtmlBuilder();
|
||||
|
||||
int seriesCount = regatta.series.size();
|
||||
int i = 1;
|
||||
for (SeriesDTO serie : regatta.series) {
|
||||
if (!first) {
|
||||
result += "; ";
|
||||
builder.appendEscaped(i + ". " + serie.name);
|
||||
if(serie.isMedal()) {
|
||||
builder.appendEscaped(" (" + stringMessages.medalSeries() + ")");
|
||||
}
|
||||
result += serie.name;
|
||||
first = false;
|
||||
if(i < seriesCount) {
|
||||
builder.appendHtmlConstant("<br>");
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return result;
|
||||
return builder.toSafeHtml();
|
||||
}
|
||||
};
|
||||
|
||||
final SafeHtmlCell fleetsCell = new SafeHtmlCell();
|
||||
Column<RegattaDTO, SafeHtml> regattaFleetsColumn = new Column<RegattaDTO, SafeHtml>(fleetsCell) {
|
||||
@Override
|
||||
public SafeHtml getValue(RegattaDTO regatta) {
|
||||
SafeHtmlBuilder builder = new SafeHtmlBuilder();
|
||||
|
||||
int seriesCount = regatta.series.size();
|
||||
int i = 1;
|
||||
for (SeriesDTO serie : regatta.series) {
|
||||
int fleetsCount = serie.getFleets().size();
|
||||
int j = 1;
|
||||
for(FleetDTO fleet: serie.getFleets()) {
|
||||
builder.appendEscaped(j + ". " + fleet.name);
|
||||
builder.appendEscaped(" (" + fleet.getOrderNo() + ") ");
|
||||
if(fleet.getColor() != null) {
|
||||
builder.appendEscaped(" color: " + fleet.getColor().getAsHtml());
|
||||
} else {
|
||||
}
|
||||
if(j < fleetsCount) {
|
||||
builder.appendEscaped(", ");
|
||||
}
|
||||
j++;
|
||||
}
|
||||
if(i < seriesCount) {
|
||||
builder.appendHtmlConstant("<br>");
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return builder.toSafeHtml();
|
||||
}
|
||||
};
|
||||
|
||||
regattaTable = new CellTable<RegattaDTO>(200, tableRes);
|
||||
regattaTable.setWidth("100%");
|
||||
regattaTable.addColumn(regattaNameColumn, stringMessages.regattaName());
|
||||
regattaTable.addColumn(regattaSeriesColumn, stringMessages.name());
|
||||
|
||||
regattaSelectionModel = new MultiSelectionModel<RegattaDTO>();
|
||||
regattaTable.addColumn(regattaBoatClassColumn, stringMessages.boatClass());
|
||||
regattaTable.addColumn(regattaSeriesColumn, stringMessages.series());
|
||||
regattaTable.addColumn(regattaFleetsColumn, stringMessages.fleets());
|
||||
|
||||
regattaSelectionModel = new SingleSelectionModel<RegattaDTO>();
|
||||
regattaSelectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
|
||||
@Override
|
||||
public void onSelectionChange(SelectionChangeEvent event) {
|
||||
@@ -197,7 +250,7 @@ public class EventStructureManagementPanel extends SimplePanel {
|
||||
}
|
||||
|
||||
private void openCreateRegattaDialog() {
|
||||
RegattaWithSeriesAndGroupsCreateDialog dialog = new RegattaWithSeriesAndGroupsCreateDialog(Collections.unmodifiableCollection(selectedEvent.regattas), stringMessages,
|
||||
RegattaWithSeriesAndFleetsCreateDialog dialog = new RegattaWithSeriesAndFleetsCreateDialog(Collections.unmodifiableCollection(selectedEvent.regattas), stringMessages,
|
||||
new AsyncCallback<RegattaDTO>() {
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
@@ -215,6 +268,21 @@ public class EventStructureManagementPanel extends SimplePanel {
|
||||
if (selectedEvent != null) {
|
||||
eventDetailsCaptionPanel.setCaptionText(selectedEvent.name);
|
||||
eventVenueLabel.setText(stringMessages.venue() + ": " + selectedEvent.venue.name);
|
||||
|
||||
// load the regattas for this event
|
||||
sailingService.getRegattas(new AsyncCallback<List<RegattaDTO>>() {
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
errorReporter.reportError("Error trying to read regattas of event " + selectedEvent.name + ": " + t.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<RegattaDTO> regattas) {
|
||||
regattaProvider.getList().clear();
|
||||
regattaProvider.getList().addAll(regattas);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,24 +304,25 @@ public class EventStructureManagementPanel extends SimplePanel {
|
||||
}
|
||||
|
||||
private void createNewRegatta(final RegattaDTO newRegatta) {
|
||||
Map<String, Pair<List<Pair<String, Integer>>, Boolean>> seriesStructure = new HashMap<String, Pair<List<Pair<String, Integer>>, Boolean>>();
|
||||
Map<String, Pair<List<Triple<String, Integer, Color>>, Boolean>> seriesStructure = new HashMap<String, Pair<List<Triple<String, Integer, Color>>, Boolean>>();
|
||||
for(SeriesDTO seriesDTO : newRegatta.series) {
|
||||
List<Pair<String, Integer>> fleets = new ArrayList<Pair<String, Integer>>();
|
||||
List<Triple<String, Integer, Color>> fleets = new ArrayList<Triple<String, Integer, Color>>();
|
||||
for(FleetDTO fleetDTO : seriesDTO.getFleets()) {
|
||||
Pair<String, Integer> fleetPair = new Pair<String, Integer>(fleetDTO.name, fleetDTO.getOrderNo());
|
||||
fleets.add(fleetPair);
|
||||
Triple<String, Integer, Color> fleetTriple = new Triple<String, Integer, Color>(fleetDTO.name, fleetDTO.getOrderNo(), fleetDTO.getColor());
|
||||
fleets.add(fleetTriple);
|
||||
}
|
||||
Pair<List<Pair<String, Integer>>, Boolean> seriesPair = new Pair<List<Pair<String, Integer>>, Boolean>(fleets, seriesDTO.isMedal());
|
||||
Pair<List<Triple<String, Integer, Color>>, Boolean> seriesPair = new Pair<List<Triple<String, Integer, Color>>, Boolean>(fleets, seriesDTO.isMedal());
|
||||
seriesStructure.put(seriesDTO.name, seriesPair);
|
||||
}
|
||||
sailingService.createRegatta(newRegatta.name, newRegatta.boatClass.name, seriesStructure, true, new AsyncCallback<Void>() {
|
||||
sailingService.createRegatta(newRegatta.name, newRegatta.boatClass.name, seriesStructure, true, new AsyncCallback<RegattaDTO>() {
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
errorReporter.reportError("Error trying to create new regatta" + newRegatta.name + ": " + t.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void nothing) {
|
||||
public void onSuccess(RegattaDTO regatta) {
|
||||
regattaProvider.getList().add(regatta);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ package com.sap.sailing.gwt.ui.adminconsole;
|
||||
import com.sap.sailing.domain.common.Color;
|
||||
import com.sap.sailing.domain.common.impl.RGBColor;
|
||||
|
||||
public enum GroupColors {
|
||||
public enum FleetColors {
|
||||
GOLD (255, 215, 0),
|
||||
SILVER (201, 192, 187),
|
||||
BRONZE (205, 127, 50),
|
||||
@@ -15,7 +15,7 @@ public enum GroupColors {
|
||||
|
||||
private Color color;
|
||||
|
||||
GroupColors(int red, int green, int blue) {
|
||||
FleetColors(int red, int green, int blue) {
|
||||
color = new RGBColor(red, green, blue);
|
||||
}
|
||||
|
||||
+5
-5
@@ -22,7 +22,7 @@ import com.sap.sailing.gwt.ui.shared.BoatClassDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.SeriesDTO;
|
||||
|
||||
public class RegattaWithSeriesAndGroupsCreateDialog extends DataEntryDialog<RegattaDTO> {
|
||||
public class RegattaWithSeriesAndFleetsCreateDialog extends DataEntryDialog<RegattaDTO> {
|
||||
|
||||
private StringMessages stringConstants;
|
||||
private RegattaDTO regatta;
|
||||
@@ -104,7 +104,7 @@ public class RegattaWithSeriesAndGroupsCreateDialog extends DataEntryDialog<Rega
|
||||
|
||||
}
|
||||
|
||||
public RegattaWithSeriesAndGroupsCreateDialog(Collection<RegattaDTO> existingRegattas, StringMessages stringConstants,
|
||||
public RegattaWithSeriesAndFleetsCreateDialog(Collection<RegattaDTO> existingRegattas, StringMessages stringConstants,
|
||||
AsyncCallback<RegattaDTO> callback) {
|
||||
super(stringConstants.regatta(), null, stringConstants.ok(), stringConstants.cancel(),
|
||||
new RegattaParameterValidator(stringConstants, existingRegattas), callback);
|
||||
@@ -156,7 +156,7 @@ public class RegattaWithSeriesAndGroupsCreateDialog extends DataEntryDialog<Rega
|
||||
public void onClick(ClickEvent event) {
|
||||
RegattaDTO result = getResult();
|
||||
|
||||
SeriesWithGroupsCreateDialog dialog = new SeriesWithGroupsCreateDialog(Collections.unmodifiableCollection(result.series), stringConstants,
|
||||
SeriesWithFleetsCreateDialog dialog = new SeriesWithFleetsCreateDialog(Collections.unmodifiableCollection(result.series), stringConstants,
|
||||
new AsyncCallback<SeriesDTO>() {
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
@@ -192,9 +192,9 @@ public class RegattaWithSeriesAndGroupsCreateDialog extends DataEntryDialog<Rega
|
||||
seriesGrid.setWidget(i*2, 0, seriesLabel);
|
||||
seriesGrid.setHTML(i*2, 1, seriesDTO.name);
|
||||
if(seriesDTO.getFleets() != null && seriesDTO.getFleets().size() > 0) {
|
||||
seriesGrid.setHTML(i*2+1, 1, seriesDTO.getFleets().size() + " groups: " + seriesDTO.getFleets().toString());
|
||||
seriesGrid.setHTML(i*2+1, 1, seriesDTO.getFleets().size() + " fleets: " + seriesDTO.getFleets().toString());
|
||||
} else {
|
||||
seriesGrid.setHTML(i*2+1, 1, seriesDTO.getFleets().size() + " No groups defined.");
|
||||
seriesGrid.setHTML(i*2+1, 1, seriesDTO.getFleets().size() + " No fleets defined.");
|
||||
}
|
||||
}
|
||||
|
||||
+85
-63
@@ -5,11 +5,11 @@ import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gwt.dom.client.Style.FontWeight;
|
||||
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.CheckBox;
|
||||
import com.google.gwt.user.client.ui.Grid;
|
||||
import com.google.gwt.user.client.ui.IntegerBox;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
@@ -18,24 +18,24 @@ import com.google.gwt.user.client.ui.TextBox;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.domain.common.Color;
|
||||
import com.sap.sailing.domain.common.impl.RGBColor;
|
||||
import com.sap.sailing.gwt.ui.client.DataEntryDialog;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.FleetDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.SeriesDTO;
|
||||
|
||||
public class SeriesWithGroupsCreateDialog extends DataEntryDialog<SeriesDTO> {
|
||||
public class SeriesWithFleetsCreateDialog extends DataEntryDialog<SeriesDTO> {
|
||||
|
||||
private StringMessages stringConstants;
|
||||
private SeriesDTO series;
|
||||
|
||||
private TextBox nameEntryField;
|
||||
private CheckBox isMedalSeriesCheckbox;
|
||||
|
||||
private List<TextBox> groupNameEntryFields;
|
||||
private List<ListBox> groupColorEntryFields;
|
||||
private List<IntegerBox> groupOrderNoEntryFields;
|
||||
private List<TextBox> fleetNameEntryFields;
|
||||
private List<ListBox> fleetColorEntryFields;
|
||||
private List<IntegerBox> fleetOrderNoEntryFields;
|
||||
|
||||
private Grid groupsGrid;
|
||||
private Grid fleetsGrid;
|
||||
|
||||
protected static class SeriesParameterValidator implements Validator<SeriesDTO> {
|
||||
|
||||
@@ -67,34 +67,34 @@ public class SeriesWithGroupsCreateDialog extends DataEntryDialog<SeriesDTO> {
|
||||
}
|
||||
|
||||
if(errorMessage == null) {
|
||||
List<FleetDTO> groupsToValidate = seriesToValidate.getFleets();
|
||||
List<FleetDTO> fleetsToValidate = seriesToValidate.getFleets();
|
||||
int index = 0;
|
||||
boolean groupNameNotEmpty = true;
|
||||
boolean fleetNameNotEmpty = true;
|
||||
|
||||
for (FleetDTO group : groupsToValidate) {
|
||||
groupNameNotEmpty = group.name != null && group.name.length() > 0;
|
||||
if(!groupNameNotEmpty) {
|
||||
for (FleetDTO fleet : fleetsToValidate) {
|
||||
fleetNameNotEmpty = fleet.name != null && fleet.name.length() > 0;
|
||||
if(!fleetNameNotEmpty) {
|
||||
break;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
int index2 = 0;
|
||||
boolean groupUnique = true;
|
||||
boolean fleetUnique = true;
|
||||
|
||||
HashSet<String> setToFindDuplicates = new HashSet<String>();
|
||||
for (FleetDTO group: groupsToValidate) {
|
||||
if(!setToFindDuplicates.add(group.name)) {
|
||||
groupUnique = false;
|
||||
for (FleetDTO fleet: fleetsToValidate) {
|
||||
if(!setToFindDuplicates.add(fleet.name)) {
|
||||
fleetUnique = false;
|
||||
break;
|
||||
}
|
||||
index2++;
|
||||
}
|
||||
|
||||
if (!groupNameNotEmpty) {
|
||||
errorMessage = stringConstants.group() + " " + (index + 1) + ": " + stringConstants.pleaseEnterNonEmptyName();
|
||||
} else if (!groupUnique) {
|
||||
errorMessage = stringConstants.group() + " " + (index2 + 1) + ": " + stringConstants.groupWithThisNameAlreadyExists();
|
||||
if (!fleetNameNotEmpty) {
|
||||
errorMessage = stringConstants.fleet() + " " + (index + 1) + ": " + stringConstants.pleaseEnterNonEmptyName();
|
||||
} else if (!fleetUnique) {
|
||||
errorMessage = stringConstants.fleet() + " " + (index2 + 1) + ": " + stringConstants.fleetWithThisNameAlreadyExists();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -104,7 +104,7 @@ public class SeriesWithGroupsCreateDialog extends DataEntryDialog<SeriesDTO> {
|
||||
|
||||
}
|
||||
|
||||
public SeriesWithGroupsCreateDialog(Collection<SeriesDTO> existingSeries, StringMessages stringConstants,
|
||||
public SeriesWithFleetsCreateDialog(Collection<SeriesDTO> existingSeries, StringMessages stringConstants,
|
||||
AsyncCallback<SeriesDTO> callback) {
|
||||
super(stringConstants.series(), null, stringConstants.ok(), stringConstants.cancel(),
|
||||
new SeriesParameterValidator(stringConstants, existingSeries), callback);
|
||||
@@ -114,46 +114,53 @@ public class SeriesWithGroupsCreateDialog extends DataEntryDialog<SeriesDTO> {
|
||||
nameEntryField = createTextBox(null);
|
||||
nameEntryField.setWidth("200px");
|
||||
|
||||
groupNameEntryFields = new ArrayList<TextBox>();
|
||||
groupColorEntryFields = new ArrayList<ListBox>();
|
||||
groupOrderNoEntryFields = new ArrayList<IntegerBox>();
|
||||
isMedalSeriesCheckbox = createCheckbox(stringConstants.medalSeries());
|
||||
|
||||
fleetNameEntryFields = new ArrayList<TextBox>();
|
||||
fleetColorEntryFields = new ArrayList<ListBox>();
|
||||
fleetOrderNoEntryFields = new ArrayList<IntegerBox>();
|
||||
|
||||
groupsGrid = new Grid(0, 0);
|
||||
fleetsGrid = new Grid(0, 0);
|
||||
|
||||
// create at least one fleet
|
||||
createFleetNameWidget("Default");
|
||||
createFleetOrderNoWidget(0);
|
||||
createFleetColorWidget(null);
|
||||
}
|
||||
|
||||
private Widget createGroupNameWidget(String defaultName) {
|
||||
private Widget createFleetNameWidget(String defaultName) {
|
||||
TextBox textBox = createTextBox(defaultName);
|
||||
textBox.setWidth("200px");
|
||||
groupNameEntryFields.add(textBox);
|
||||
textBox.setWidth("175px");
|
||||
fleetNameEntryFields.add(textBox);
|
||||
return textBox;
|
||||
}
|
||||
|
||||
private Widget createGroupColorWidget(Color defaultColor) {
|
||||
private Widget createFleetColorWidget(Color defaultColor) {
|
||||
ListBox listBox = createListBox(false);
|
||||
for(GroupColors value: GroupColors.values())
|
||||
for(FleetColors value: FleetColors.values())
|
||||
listBox.addItem(value.name());
|
||||
groupColorEntryFields.add(listBox);
|
||||
fleetColorEntryFields.add(listBox);
|
||||
return listBox;
|
||||
}
|
||||
|
||||
private Widget createGroupOrderNoWidget(int defaultValue) {
|
||||
private Widget createFleetOrderNoWidget(int defaultValue) {
|
||||
IntegerBox intBox = createIntegerBox(defaultValue, 3);
|
||||
groupOrderNoEntryFields.add(intBox);
|
||||
fleetOrderNoEntryFields.add(intBox);
|
||||
return intBox;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SeriesDTO getResult() {
|
||||
series.name = nameEntryField.getText();
|
||||
series.setMedal(isMedalSeriesCheckbox.getValue());
|
||||
|
||||
List<FleetDTO> fleets = new ArrayList<FleetDTO>();
|
||||
int groupsCount = groupNameEntryFields.size();
|
||||
int groupsCount = fleetNameEntryFields.size();
|
||||
for(int i = 0; i < groupsCount; i++) {
|
||||
FleetDTO fleetDTO = new FleetDTO();
|
||||
fleetDTO.name = groupNameEntryFields.get(i).getValue();
|
||||
Color color = new RGBColor(0, 0, 0);
|
||||
fleetDTO.setColor(color);
|
||||
fleetDTO.setOrderNo(groupOrderNoEntryFields.get(i).getValue());
|
||||
fleetDTO.name = fleetNameEntryFields.get(i).getValue();
|
||||
fleetDTO.setColor(getSelectedColor(fleetColorEntryFields.get(i)));
|
||||
fleetDTO.setOrderNo(fleetOrderNoEntryFields.get(i).getValue());
|
||||
fleets.add(fleetDTO);
|
||||
}
|
||||
|
||||
@@ -162,6 +169,22 @@ public class SeriesWithGroupsCreateDialog extends DataEntryDialog<SeriesDTO> {
|
||||
return series;
|
||||
}
|
||||
|
||||
private Color getSelectedColor(ListBox colorListBox) {
|
||||
Color result = null;
|
||||
int selIndex = colorListBox.getSelectedIndex();
|
||||
if(selIndex >= 0) {
|
||||
String value = colorListBox.getValue(selIndex);
|
||||
for(FleetColors color: FleetColors.values()) {
|
||||
if(color.name().equals(value)) {
|
||||
result = color.getColor();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Widget getAdditionalWidget() {
|
||||
final VerticalPanel panel = new VerticalPanel();
|
||||
@@ -174,49 +197,48 @@ public class SeriesWithGroupsCreateDialog extends DataEntryDialog<SeriesDTO> {
|
||||
|
||||
formGrid.setWidget(0, 0, new Label(stringConstants.name() + ":"));
|
||||
formGrid.setWidget(0, 1, nameEntryField);
|
||||
formGrid.setWidget(1, 1, isMedalSeriesCheckbox);
|
||||
|
||||
panel.add(createHeadlineLabel(stringConstants.groups()));
|
||||
panel.add(groupsGrid);
|
||||
panel.add(createHeadlineLabel(stringConstants.fleets()));
|
||||
panel.add(fleetsGrid);
|
||||
|
||||
Button addGroupButton = new Button("Add group");
|
||||
Button addGroupButton = new Button("Add fleet");
|
||||
addGroupButton.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
createGroupNameWidget(null);
|
||||
createGroupOrderNoWidget(0);
|
||||
createGroupColorWidget(null);
|
||||
updateGroupsGrid(panel);
|
||||
createFleetNameWidget(null);
|
||||
createFleetOrderNoWidget(0);
|
||||
createFleetColorWidget(null);
|
||||
updateFleetsGrid(panel);
|
||||
}
|
||||
});
|
||||
panel.add(addGroupButton);
|
||||
|
||||
updateFleetsGrid(panel);
|
||||
|
||||
return panel;
|
||||
}
|
||||
|
||||
private void updateGroupsGrid(VerticalPanel parentPanel) {
|
||||
int widgetIndex = parentPanel.getWidgetIndex(groupsGrid);
|
||||
parentPanel.remove(groupsGrid);
|
||||
private void updateFleetsGrid(VerticalPanel parentPanel) {
|
||||
int widgetIndex = parentPanel.getWidgetIndex(fleetsGrid);
|
||||
parentPanel.remove(fleetsGrid);
|
||||
|
||||
int groupsCount = groupNameEntryFields.size();
|
||||
groupsGrid = new Grid(groupsCount + 1, 4);
|
||||
groupsGrid.setCellSpacing(3);
|
||||
int fleetCount = fleetNameEntryFields.size();
|
||||
fleetsGrid = new Grid(fleetCount + 1, 3);
|
||||
fleetsGrid.setCellSpacing(4);
|
||||
|
||||
groupsGrid.setHTML(0, 1, stringConstants.name());
|
||||
groupsGrid.setHTML(0, 2, stringConstants.no());
|
||||
groupsGrid.setHTML(0, 3, stringConstants.color());
|
||||
fleetsGrid.setHTML(0, 0, stringConstants.name());
|
||||
fleetsGrid.setHTML(0, 1, stringConstants.no());
|
||||
fleetsGrid.setHTML(0, 2, stringConstants.color());
|
||||
|
||||
for(int i = 0; i < groupsCount; i++) {
|
||||
Label groupLabel = new Label((i+1) + ". " + stringConstants.group() + ":");
|
||||
groupLabel.getElement().getStyle().setFontWeight(FontWeight.BOLD);
|
||||
groupLabel.setWordWrap(false);
|
||||
groupsGrid.setWidget(i+1, 0, groupLabel);
|
||||
groupsGrid.setWidget(i+1, 1, groupNameEntryFields.get(i));
|
||||
groupsGrid.setWidget(i+1, 2, groupOrderNoEntryFields.get(i));
|
||||
groupsGrid.setWidget(i+1, 3, groupColorEntryFields.get(i));
|
||||
for(int i = 0; i < fleetCount; i++) {
|
||||
fleetsGrid.setWidget(i+1, 0, fleetNameEntryFields.get(i));
|
||||
fleetsGrid.setWidget(i+1, 1, fleetOrderNoEntryFields.get(i));
|
||||
fleetsGrid.setWidget(i+1, 2, fleetColorEntryFields.get(i));
|
||||
}
|
||||
|
||||
parentPanel.insert(groupsGrid, widgetIndex);
|
||||
parentPanel.insert(fleetsGrid, widgetIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
+3
-2
@@ -7,6 +7,7 @@ import java.util.Map;
|
||||
|
||||
import com.google.gwt.user.client.rpc.RemoteService;
|
||||
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
||||
import com.sap.sailing.domain.common.Color;
|
||||
import com.sap.sailing.domain.common.DetailType;
|
||||
import com.sap.sailing.domain.common.MaxPointsReason;
|
||||
import com.sap.sailing.domain.common.NoWindException;
|
||||
@@ -124,8 +125,8 @@ public interface SailingService extends RemoteService {
|
||||
|
||||
void moveLeaderboardColumnDown(String leaderboardName, String columnName);
|
||||
|
||||
void createRegatta(String regattaName, String boatClassName,
|
||||
Map<String, Pair<List<Pair<String, Integer>>, Boolean>> seriesNamesWithFleetNamesAndFleetOrderingAndMedal,
|
||||
RegattaDTO createRegatta(String regattaName, String boatClassName,
|
||||
Map<String, Pair<List<Triple<String, Integer, Color>>, Boolean>> seriesNamesWithFleetNamesAndFleetOrderingAndMedal,
|
||||
boolean persistent);
|
||||
|
||||
void removeRegatta(RegattaIdentifier regattaIdentifier);
|
||||
|
||||
+3
-2
@@ -6,6 +6,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.sap.sailing.domain.common.Color;
|
||||
import com.sap.sailing.domain.common.DetailType;
|
||||
import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
|
||||
import com.sap.sailing.domain.common.RegattaIdentifier;
|
||||
@@ -382,6 +383,6 @@ public interface SailingServiceAsync {
|
||||
AsyncCallback<Void> callback);
|
||||
|
||||
void createRegatta(String regattaName, String boatClassName,
|
||||
Map<String, Pair<List<Pair<String, Integer>>, Boolean>> seriesNamesWithFleetNamesAndFleetOrderingAndMedal,
|
||||
boolean persistent, AsyncCallback<Void> callback);
|
||||
Map<String, Pair<List<Triple<String, Integer, Color>>, Boolean>> seriesNamesWithFleetNamesAndFleetOrderingAndMedal,
|
||||
boolean persistent, AsyncCallback<RegattaDTO> callback);
|
||||
}
|
||||
+3
-2
@@ -310,9 +310,10 @@ public interface StringMessages extends Messages {
|
||||
String pleaseSelectABoatClass();
|
||||
String regattaWithThisNameAlreadyExists();
|
||||
String seriesWithThisNameAlreadyExists();
|
||||
String fleetWithThisNameAlreadyExists();
|
||||
String fleets();
|
||||
String series();
|
||||
String splitFleet();
|
||||
String group();
|
||||
String groups();
|
||||
String color();
|
||||
String medalSeries();
|
||||
}
|
||||
+3
-2
@@ -308,8 +308,9 @@ venue=Venue
|
||||
pleaseSelectABoatClass=Please select a boat class.
|
||||
regattaWithThisNameAlreadyExists=A regatta with this name already exists.
|
||||
seriesWithThisNameAlreadyExists=A series with this name already exists.
|
||||
fleetWithThisNameAlreadyExists=A fleet with this name already exists.
|
||||
fleets=Fleets
|
||||
series=Series
|
||||
splitFleet=Split fleet
|
||||
group=Group
|
||||
groups=Groups
|
||||
color=Color
|
||||
medalSeries=Medal Series
|
||||
+4
-3
@@ -310,7 +310,8 @@ pleaseSelectABoatClass=Bitte wählen Sie eine Bootsklasse aus.
|
||||
regattaWithThisNameAlreadyExists=Eine Regatta mit diesem Namen existiert bereits.
|
||||
seriesWithThisNameAlreadyExists=Eine Serie mit diesem Namen existiert bereits.
|
||||
series=Serie
|
||||
fleetWithThisNameAlreadyExists=Eine Flotte mit diesem Namen existiert bereits.
|
||||
fleets=Flotten
|
||||
splitFleet=Aufteilung in Gruppen
|
||||
group=Gruppe
|
||||
groups=Gruppen
|
||||
color=Farbe
|
||||
color=Farbe
|
||||
medalSeries=Medal Series
|
||||
+24
-16
@@ -55,6 +55,7 @@ import com.sap.sailing.domain.base.impl.KnotSpeedWithBearingImpl;
|
||||
import com.sap.sailing.domain.base.impl.MeterDistance;
|
||||
import com.sap.sailing.domain.base.impl.MillisecondsTimePoint;
|
||||
import com.sap.sailing.domain.common.Bearing;
|
||||
import com.sap.sailing.domain.common.Color;
|
||||
import com.sap.sailing.domain.common.CountryCode;
|
||||
import com.sap.sailing.domain.common.DetailType;
|
||||
import com.sap.sailing.domain.common.Distance;
|
||||
@@ -457,24 +458,30 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
public List<RegattaDTO> getRegattas() throws IllegalArgumentException {
|
||||
List<RegattaDTO> result = new ArrayList<RegattaDTO>();
|
||||
for (Regatta regatta : getService().getAllRegattas()) {
|
||||
List<CompetitorDTO> competitorList = getCompetitorDTOs(regatta.getCompetitors());
|
||||
RegattaDTO regattaDTO = new RegattaDTO(regatta.getName(), competitorList);
|
||||
regattaDTO.races = getRaceDTOs(regatta);
|
||||
regattaDTO.series = getSeriesDTOs(regatta);
|
||||
BoatClass boatClass = regatta.getBoatClass();
|
||||
if (boatClass != null) {
|
||||
regattaDTO.boatClass = new BoatClassDTO(boatClass.getName(), boatClass.getHullLength().getMeters());
|
||||
}
|
||||
if (!regattaDTO.races.isEmpty()) {
|
||||
for (RaceDTO race : regattaDTO.races) {
|
||||
race.setRegatta(regattaDTO);
|
||||
}
|
||||
result.add(regattaDTO);
|
||||
}
|
||||
// if(Util.size(regatta.getAllRaces()) > 0) {
|
||||
result.add(getRegattaDTO(regatta));
|
||||
// }
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private RegattaDTO getRegattaDTO(Regatta regatta) {
|
||||
List<CompetitorDTO> competitorList = getCompetitorDTOs(regatta.getCompetitors());
|
||||
RegattaDTO regattaDTO = new RegattaDTO(regatta.getName(), competitorList);
|
||||
regattaDTO.races = getRaceDTOs(regatta);
|
||||
regattaDTO.series = getSeriesDTOs(regatta);
|
||||
BoatClass boatClass = regatta.getBoatClass();
|
||||
if (boatClass != null) {
|
||||
regattaDTO.boatClass = new BoatClassDTO(boatClass.getName(), boatClass.getHullLength().getMeters());
|
||||
}
|
||||
if (!regattaDTO.races.isEmpty()) {
|
||||
for (RaceDTO race : regattaDTO.races) {
|
||||
race.setRegatta(regattaDTO);
|
||||
}
|
||||
}
|
||||
return regattaDTO;
|
||||
}
|
||||
|
||||
private List<SeriesDTO> getSeriesDTOs(Regatta regatta) {
|
||||
List<SeriesDTO> result = new ArrayList<SeriesDTO>();
|
||||
for (Series series : regatta.getSeries()) {
|
||||
@@ -1964,9 +1971,10 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createRegatta(String regattaName, String boatClassName, Map<String, Pair<List<Pair<String, Integer>>, Boolean>> seriesNamesWithFleetNamesAndFleetOrderingAndMedal, boolean persistent) {
|
||||
getService().apply(
|
||||
public RegattaDTO createRegatta(String regattaName, String boatClassName, Map<String, Pair<List<Triple<String, Integer, Color>>, Boolean>> seriesNamesWithFleetNamesAndFleetOrderingAndMedal, boolean persistent) {
|
||||
Regatta regatta = getService().apply(
|
||||
new AddSpecificRegatta(regattaName, boatClassName, seriesNamesWithFleetNamesAndFleetOrderingAndMedal, persistent));
|
||||
return getRegattaDTO(regatta);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,6 +15,7 @@ public class SeriesDTO extends NamedDTO implements IsSerializable {
|
||||
super(name);
|
||||
this.fleets = fleets;
|
||||
this.raceColumnNames = raceColumnNames;
|
||||
this.isMedal = isMedal;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+6
-5
@@ -40,6 +40,7 @@ import com.sap.sailing.domain.base.Series;
|
||||
import com.sap.sailing.domain.base.Waypoint;
|
||||
import com.sap.sailing.domain.base.impl.EventImpl;
|
||||
import com.sap.sailing.domain.base.impl.RegattaImpl;
|
||||
import com.sap.sailing.domain.common.Color;
|
||||
import com.sap.sailing.domain.common.DefaultLeaderboardName;
|
||||
import com.sap.sailing.domain.common.RaceIdentifier;
|
||||
import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
|
||||
@@ -645,15 +646,15 @@ public class RacingEventServiceImpl implements RacingEventService, RegattaListen
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, Pair<List<Pair<String, Integer>>, Boolean>> getSeriesWithoutRaceColumnsConstructionParametersAsMap(Regatta regatta) {
|
||||
Map<String, Pair<List<Pair<String, Integer>>, Boolean>> result = new HashMap<String, Pair<List<Pair<String, Integer>>, Boolean>>();
|
||||
private Map<String, Pair<List<Triple<String, Integer, Color>>, Boolean>> getSeriesWithoutRaceColumnsConstructionParametersAsMap(Regatta regatta) {
|
||||
Map<String, Pair<List<Triple<String, Integer, Color>>, Boolean>> result = new HashMap<String, Pair<List<Triple<String, Integer, Color>>, Boolean>>();
|
||||
for (Series s : regatta.getSeries()) {
|
||||
assert Util.isEmpty(s.getRaceColumns());
|
||||
List<Pair<String, Integer>> fleetNamesAndOrdering = new ArrayList<Pair<String, Integer>>();
|
||||
List<Triple<String, Integer, Color>> fleetNamesAndOrdering = new ArrayList<Triple<String, Integer, Color>>();
|
||||
for (Fleet f : s.getFleets()) {
|
||||
fleetNamesAndOrdering.add(new Pair<String, Integer>(f.getName(), f.getOrdering()));
|
||||
fleetNamesAndOrdering.add(new Triple<String, Integer, Color>(f.getName(), f.getOrdering(), f.getColor()));
|
||||
}
|
||||
result.put(s.getName(), new Pair<List<Pair<String, Integer>>, Boolean>(fleetNamesAndOrdering, s.isMedal()));
|
||||
result.put(s.getName(), new Pair<List<Triple<String, Integer, Color>>, Boolean>(fleetNamesAndOrdering, s.isMedal()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
+8
-6
@@ -10,17 +10,19 @@ import com.sap.sailing.domain.base.Regatta;
|
||||
import com.sap.sailing.domain.base.Series;
|
||||
import com.sap.sailing.domain.base.impl.FleetImpl;
|
||||
import com.sap.sailing.domain.base.impl.SeriesImpl;
|
||||
import com.sap.sailing.domain.common.Color;
|
||||
import com.sap.sailing.domain.common.impl.Util.Pair;
|
||||
import com.sap.sailing.domain.common.impl.Util.Triple;
|
||||
import com.sap.sailing.domain.tracking.TrackedRegattaRegistry;
|
||||
import com.sap.sailing.server.RacingEventService;
|
||||
import com.sap.sailing.server.RacingEventServiceOperation;
|
||||
|
||||
public class AddSpecificRegatta extends AbstractAddRegattaOperation {
|
||||
private static final long serialVersionUID = -8018855620167669352L;
|
||||
private final Map<String, Pair<List<Pair<String, Integer>>, Boolean>> seriesNamesWithFleetNamesAndFleetOrderingAndMedal;
|
||||
private final Map<String, Pair<List<Triple<String, Integer, Color>>, Boolean>> seriesNamesWithFleetNamesAndFleetOrderingAndMedal;
|
||||
private final boolean persistent;
|
||||
|
||||
public AddSpecificRegatta(String regattaName, String boatClassName, Map<String, Pair<List<Pair<String, Integer>>, Boolean>> seriesNamesWithFleetNamesAndFleetOrdering, boolean persistent) {
|
||||
public AddSpecificRegatta(String regattaName, String boatClassName, Map<String, Pair<List<Triple<String, Integer, Color>>, Boolean>> seriesNamesWithFleetNamesAndFleetOrdering, boolean persistent) {
|
||||
super(regattaName, boatClassName);
|
||||
this.seriesNamesWithFleetNamesAndFleetOrderingAndMedal = seriesNamesWithFleetNamesAndFleetOrdering;
|
||||
this.persistent = persistent;
|
||||
@@ -33,7 +35,7 @@ public class AddSpecificRegatta extends AbstractAddRegattaOperation {
|
||||
|
||||
private Iterable<? extends Series> createSeries(TrackedRegattaRegistry trackedRegattaRegistry) {
|
||||
List<Series> result = new ArrayList<Series>();
|
||||
for (Map.Entry<String, Pair<List<Pair<String, Integer>>, Boolean>> e : seriesNamesWithFleetNamesAndFleetOrderingAndMedal.entrySet()) {
|
||||
for (Map.Entry<String, Pair<List<Triple<String, Integer, Color>>, Boolean>> e : seriesNamesWithFleetNamesAndFleetOrderingAndMedal.entrySet()) {
|
||||
final List<String> emptyRaceColumnNamesList = Collections.emptyList();
|
||||
Series s = new SeriesImpl(e.getKey(), /* isMedal */ e.getValue().getB(), createFleets(e.getValue().getA()), emptyRaceColumnNamesList, trackedRegattaRegistry);
|
||||
result.add(s);
|
||||
@@ -41,10 +43,10 @@ public class AddSpecificRegatta extends AbstractAddRegattaOperation {
|
||||
return result;
|
||||
}
|
||||
|
||||
private Iterable<? extends Fleet> createFleets(List<Pair<String, Integer>> fleetNamesAndOrdering) {
|
||||
private Iterable<? extends Fleet> createFleets(List<Triple<String, Integer, Color>> fleetNamesAndOrderingAndColor) {
|
||||
List<Fleet> result = new ArrayList<Fleet>();
|
||||
for (Pair<String, Integer> fleetNameAndOrdering : fleetNamesAndOrdering) {
|
||||
Fleet fleet = new FleetImpl(fleetNameAndOrdering.getA(), fleetNameAndOrdering.getB());
|
||||
for (Triple<String, Integer, Color> fleetNameAndOrderingAndColor : fleetNamesAndOrderingAndColor) {
|
||||
Fleet fleet = new FleetImpl(fleetNameAndOrderingAndColor.getA(), fleetNameAndOrderingAndColor.getB(), fleetNameAndOrderingAndColor.getC());
|
||||
result.add(fleet);
|
||||
}
|
||||
return result;
|
||||
|
||||
Reference in new issue
Block a user