mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-04 11:23:50 +00:00
Refactored *DAOs to *DTOs
This commit is contained in:
1 parent
83632deee5
commit
ec3dc3f3c0
78 files changed
+1396
-1396
No files matched your search
+15
-15
@@ -11,9 +11,9 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.sap.sailing.domain.common.impl.Util.Pair;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.leaderboard.ExpandableSortableColumn;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardRowDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.TracTracRaceRecordDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardRowDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.TracTracRaceRecordDTO;
|
||||
import com.sap.sailing.server.api.EventNameAndRaceName;
|
||||
|
||||
public class GwtTestCaseColumnToggling extends GWTTestCase {
|
||||
@@ -33,9 +33,9 @@ public class GwtTestCaseColumnToggling extends GWTTestCase {
|
||||
private final String TRACKED_RACE = "schwerttest";
|
||||
|
||||
|
||||
private LeaderboardDAO leaderboard;
|
||||
private TracTracRaceRecordDAO rrDao;
|
||||
private ExpandableSortableColumn<LeaderboardRowDAO> rc;
|
||||
private LeaderboardDTO leaderboard;
|
||||
private TracTracRaceRecordDTO rrDao;
|
||||
private ExpandableSortableColumn<LeaderboardRowDTO> rc;
|
||||
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public class GwtTestCaseColumnToggling extends GWTTestCase {
|
||||
}
|
||||
|
||||
private void listRacesInEvent(){
|
||||
service.listTracTracRacesInEvent(JSON_URL, new AsyncCallback<Pair<String,List<TracTracRaceRecordDAO>>>() {
|
||||
service.listTracTracRacesInEvent(JSON_URL, new AsyncCallback<Pair<String,List<TracTracRaceRecordDTO>>>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
@@ -62,9 +62,9 @@ public class GwtTestCaseColumnToggling extends GWTTestCase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Pair<String, List<TracTracRaceRecordDAO>> result) {
|
||||
public void onSuccess(Pair<String, List<TracTracRaceRecordDTO>> result) {
|
||||
System.out.println("Listed races.");
|
||||
for (TracTracRaceRecordDAO rr : result.getB()){
|
||||
for (TracTracRaceRecordDTO rr : result.getB()){
|
||||
if (rr.name.equals(TRACKED_RACE)){
|
||||
rrDao = rr;
|
||||
}
|
||||
@@ -95,9 +95,9 @@ public class GwtTestCaseColumnToggling extends GWTTestCase {
|
||||
|
||||
private void createLeaderboard(){
|
||||
service.createLeaderboard(LEADERBOARD_NAME, new int[] { 1, 2 },
|
||||
new AsyncCallback<LeaderboardDAO>() {
|
||||
new AsyncCallback<LeaderboardDTO>() {
|
||||
@Override
|
||||
public void onSuccess(LeaderboardDAO result) {
|
||||
public void onSuccess(LeaderboardDTO result) {
|
||||
System.out.println("Created Leaderboard "+result.name);
|
||||
addColumnToLeaderboard();
|
||||
}
|
||||
@@ -152,7 +152,7 @@ public class GwtTestCaseColumnToggling extends GWTTestCase {
|
||||
ArrayList<String> al = new ArrayList<String>();
|
||||
al.add(COLUMN1_NAME);
|
||||
service.getLeaderboardByName(LEADERBOARD_NAME, new Date(), al,
|
||||
new AsyncCallback<LeaderboardDAO>() {
|
||||
new AsyncCallback<LeaderboardDTO>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
@@ -161,17 +161,17 @@ public class GwtTestCaseColumnToggling extends GWTTestCase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(LeaderboardDAO result) {
|
||||
public void onSuccess(LeaderboardDTO result) {
|
||||
System.out.println("Got leaderboard.");
|
||||
|
||||
leaderboard = result;
|
||||
leaderboardPanel.updateLeaderboard(leaderboard);
|
||||
for (int i = 0; i < leaderboardPanel.getLeaderboardTable()
|
||||
.getColumnCount(); i++) {
|
||||
Column<LeaderboardRowDAO, ?> c = leaderboardPanel.getLeaderboardTable().getColumn(i);
|
||||
Column<LeaderboardRowDTO, ?> c = leaderboardPanel.getLeaderboardTable().getColumn(i);
|
||||
if (c instanceof ExpandableSortableColumn<?>) {
|
||||
@SuppressWarnings("unchecked")
|
||||
ExpandableSortableColumn<LeaderboardRowDAO> myRc = (ExpandableSortableColumn<LeaderboardRowDAO>) c;
|
||||
ExpandableSortableColumn<LeaderboardRowDTO> myRc = (ExpandableSortableColumn<LeaderboardRowDTO>) c;
|
||||
rc = myRc;
|
||||
rc.setEnableLegDrillDown(true);
|
||||
}
|
||||
|
||||
+5
-5
@@ -7,8 +7,8 @@ import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.leaderboard.LeaderboardPanel;
|
||||
import com.sap.sailing.gwt.ui.leaderboard.SortableColumn;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardRowDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardRowDTO;
|
||||
|
||||
public class LeaderboardPanelMock extends LeaderboardPanel {
|
||||
|
||||
@@ -20,7 +20,7 @@ public class LeaderboardPanelMock extends LeaderboardPanel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addColumn(SortableColumn<LeaderboardRowDAO, ?> column) {
|
||||
public void addColumn(SortableColumn<LeaderboardRowDTO, ?> column) {
|
||||
// TODO Auto-generated method stub
|
||||
super.addColumn(column);
|
||||
}
|
||||
@@ -39,13 +39,13 @@ public class LeaderboardPanelMock extends LeaderboardPanel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLeaderboard(LeaderboardDAO leaderboard) {
|
||||
public void updateLeaderboard(LeaderboardDTO leaderboard) {
|
||||
// TODO Auto-generated method stub
|
||||
super.updateLeaderboard(leaderboard);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CellTable<LeaderboardRowDAO> getLeaderboardTable() {
|
||||
public CellTable<LeaderboardRowDTO> getLeaderboardTable() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getLeaderboardTable();
|
||||
}
|
||||
|
||||
+6
-6
@@ -14,15 +14,15 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.sap.sailing.gwt.ui.server.SailingServiceImpl;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardDTO;
|
||||
|
||||
public class TestColumnSwapping {
|
||||
|
||||
private LeaderboardDAO lb = null;
|
||||
private LeaderboardDTO lb = null;
|
||||
private static final String LEADERBOARDNAME = "test";
|
||||
private SailingServiceImpl service;
|
||||
private LeaderboardDAO leaderboardOriginalDAO;
|
||||
private LeaderboardDAO leaderboardDAO;
|
||||
private LeaderboardDTO leaderboardOriginalDAO;
|
||||
private LeaderboardDTO leaderboardDAO;
|
||||
private Collection<String> leglist;
|
||||
private Date leaderboardCreationDate;
|
||||
private SailingServiceImpl sailingService = null;
|
||||
@@ -47,7 +47,7 @@ public class TestColumnSwapping {
|
||||
leaderboardCreationDate = new Date();
|
||||
try {
|
||||
// get Leaderboard with name and current date
|
||||
leaderboardOriginalDAO = new LeaderboardDAO();
|
||||
leaderboardOriginalDAO = new LeaderboardDTO();
|
||||
leaderboardOriginalDAO.addRace("Race1", true, false);
|
||||
leaderboardOriginalDAO.addRace("Race3", true, false);
|
||||
leaderboardOriginalDAO.addRace("Race2", true, false);
|
||||
@@ -97,7 +97,7 @@ public class TestColumnSwapping {
|
||||
|
||||
@Test
|
||||
public void testLeaderBoardDAOMethods() {
|
||||
lb = new LeaderboardDAO();
|
||||
lb = new LeaderboardDTO();
|
||||
assertNotNull("Leaderboard != NULL", lb);
|
||||
lb.addRace("1", false, false);
|
||||
lb.addRace("2", false, false);
|
||||
|
||||
+3
-3
@@ -14,7 +14,7 @@ import com.sap.sailing.gwt.ui.client.CompetitorSelectionModel;
|
||||
import com.sap.sailing.gwt.ui.client.EventDisplayer;
|
||||
import com.sap.sailing.gwt.ui.client.EventRefresher;
|
||||
import com.sap.sailing.gwt.ui.leaderboard.LeaderboardPanel;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDTO;
|
||||
import com.sap.sailing.server.api.DefaultLeaderboardName;
|
||||
|
||||
public class AdminConsole extends AbstractEntryPoint implements EventRefresher {
|
||||
@@ -75,9 +75,9 @@ public class AdminConsole extends AbstractEntryPoint implements EventRefresher {
|
||||
|
||||
@Override
|
||||
public void fillEvents() {
|
||||
sailingService.listEvents(false, new AsyncCallback<List<EventDAO>>() {
|
||||
sailingService.listEvents(false, new AsyncCallback<List<EventDTO>>() {
|
||||
@Override
|
||||
public void onSuccess(List<EventDAO> result) {
|
||||
public void onSuccess(List<EventDTO> result) {
|
||||
for (EventDisplayer eventDisplayer : eventDisplayers) {
|
||||
eventDisplayer.fillEvents(result);
|
||||
}
|
||||
|
||||
+79
-79
@@ -48,11 +48,11 @@ import com.sap.sailing.gwt.ui.client.EventDisplayer;
|
||||
import com.sap.sailing.gwt.ui.client.RaceSelectionChangeListener;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceInLeaderboardDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceInLeaderboardDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaDTO;
|
||||
import com.sap.sailing.server.api.EventNameAndRaceName;
|
||||
|
||||
public class LeaderboardConfigPanel extends FormPanel implements EventDisplayer, RaceSelectionChangeListener,
|
||||
@@ -64,19 +64,19 @@ public class LeaderboardConfigPanel extends FormPanel implements EventDisplayer,
|
||||
|
||||
private final SailingServiceAsync sailingService;
|
||||
|
||||
private final ListDataProvider<LeaderboardDAO> leaderboardList;
|
||||
private final ListDataProvider<LeaderboardDTO> leaderboardList;
|
||||
|
||||
private final ListDataProvider<RaceInLeaderboardDAO> raceColumnList;
|
||||
private final ListDataProvider<RaceInLeaderboardDTO> raceColumnList;
|
||||
|
||||
private final ErrorReporter errorReporter;
|
||||
|
||||
private final CellTable<LeaderboardDAO> leaderboardTable;
|
||||
private final CellTable<LeaderboardDTO> leaderboardTable;
|
||||
|
||||
private final CellTable<RaceInLeaderboardDAO> raceColumnTable;
|
||||
private final CellTable<RaceInLeaderboardDTO> raceColumnTable;
|
||||
|
||||
private LeaderboardDAO selectedLeaderboard;
|
||||
private LeaderboardDTO selectedLeaderboard;
|
||||
|
||||
private RaceInLeaderboardDAO selectedRaceInLeaderboard;
|
||||
private RaceInLeaderboardDTO selectedRaceInLeaderboard;
|
||||
|
||||
private final Button addColumnButton;
|
||||
|
||||
@@ -89,11 +89,11 @@ public class LeaderboardConfigPanel extends FormPanel implements EventDisplayer,
|
||||
|
||||
private TextBox filterLeaderboardTextbox;
|
||||
|
||||
final SingleSelectionModel<RaceInLeaderboardDAO> raceTableSelectionModel;
|
||||
final SingleSelectionModel<RaceInLeaderboardDTO> raceTableSelectionModel;
|
||||
|
||||
private List<LeaderboardDAO> availableLeaderboardList;
|
||||
private List<LeaderboardDTO> availableLeaderboardList;
|
||||
|
||||
private final SingleSelectionModel<LeaderboardDAO> tableSelectionModel;
|
||||
private final SingleSelectionModel<LeaderboardDTO> tableSelectionModel;
|
||||
|
||||
public static class AnchorCell extends AbstractCell<SafeHtml> {
|
||||
|
||||
@@ -114,10 +114,10 @@ public class LeaderboardConfigPanel extends FormPanel implements EventDisplayer,
|
||||
final ErrorReporter errorReporter, StringMessages theStringConstants) {
|
||||
this.stringConstants = theStringConstants;
|
||||
this.sailingService = sailingService;
|
||||
leaderboardList = new ListDataProvider<LeaderboardDAO>();
|
||||
raceColumnList = new ListDataProvider<RaceInLeaderboardDAO>();
|
||||
leaderboardList = new ListDataProvider<LeaderboardDTO>();
|
||||
raceColumnList = new ListDataProvider<RaceInLeaderboardDTO>();
|
||||
this.errorReporter = errorReporter;
|
||||
this.availableLeaderboardList = new ArrayList<LeaderboardDAO>();
|
||||
this.availableLeaderboardList = new ArrayList<LeaderboardDTO>();
|
||||
readAllLeaderbords();
|
||||
VerticalPanel mainPanel = new VerticalPanel();
|
||||
this.setWidget(mainPanel);
|
||||
@@ -142,23 +142,23 @@ public class LeaderboardConfigPanel extends FormPanel implements EventDisplayer,
|
||||
mainPanel.add(filterPanel);
|
||||
|
||||
AdminConsoleTableResources tableRes = GWT.create(AdminConsoleTableResources.class);
|
||||
leaderboardTable = new CellTable<LeaderboardDAO>(/* pageSize */200, tableRes);
|
||||
ListHandler<LeaderboardDAO> leaderboardColumnListHandler = new ListHandler<LeaderboardDAO>(
|
||||
leaderboardTable = new CellTable<LeaderboardDTO>(/* pageSize */200, tableRes);
|
||||
ListHandler<LeaderboardDTO> leaderboardColumnListHandler = new ListHandler<LeaderboardDTO>(
|
||||
leaderboardList.getList());
|
||||
|
||||
AnchorCell anchorCell = new AnchorCell();
|
||||
Column<LeaderboardDAO, SafeHtml> linkColumn = new Column<LeaderboardDAO, SafeHtml>(anchorCell) {
|
||||
Column<LeaderboardDTO, SafeHtml> linkColumn = new Column<LeaderboardDTO, SafeHtml>(anchorCell) {
|
||||
@Override
|
||||
public SafeHtml getValue(LeaderboardDAO object) {
|
||||
public SafeHtml getValue(LeaderboardDTO object) {
|
||||
return ANCHORTEMPLATE.cell("/gwt/Leaderboard.html?name=" + object.name, object.name);
|
||||
}
|
||||
|
||||
};
|
||||
linkColumn.setSortable(true);
|
||||
leaderboardColumnListHandler.setComparator(linkColumn, new Comparator<LeaderboardDAO>() {
|
||||
leaderboardColumnListHandler.setComparator(linkColumn, new Comparator<LeaderboardDTO>() {
|
||||
|
||||
@Override
|
||||
public int compare(LeaderboardDAO o1, LeaderboardDAO o2) {
|
||||
public int compare(LeaderboardDTO o1, LeaderboardDTO o2) {
|
||||
boolean ascending = isSortedAscending();
|
||||
if (o1.name.equals(o2.name)) {
|
||||
return 0;
|
||||
@@ -174,9 +174,9 @@ public class LeaderboardConfigPanel extends FormPanel implements EventDisplayer,
|
||||
return sortList.size() > 0 & sortList.get(0).isAscending();
|
||||
}
|
||||
});
|
||||
TextColumn<LeaderboardDAO> discardingOptionsColumn = new TextColumn<LeaderboardDAO>() {
|
||||
TextColumn<LeaderboardDTO> discardingOptionsColumn = new TextColumn<LeaderboardDTO>() {
|
||||
@Override
|
||||
public String getValue(LeaderboardDAO leaderboard) {
|
||||
public String getValue(LeaderboardDTO leaderboard) {
|
||||
String result = "";
|
||||
if (leaderboard.discardThresholds != null) {
|
||||
for (int discardThreshold : leaderboard.discardThresholds) {
|
||||
@@ -186,29 +186,29 @@ public class LeaderboardConfigPanel extends FormPanel implements EventDisplayer,
|
||||
return result;
|
||||
}
|
||||
};
|
||||
ImagesBarColumn<LeaderboardDAO, LeaderboardConfigImagesBarCell> leaderboardActionColumn = new ImagesBarColumn<LeaderboardDAO, LeaderboardConfigImagesBarCell>(
|
||||
ImagesBarColumn<LeaderboardDTO, LeaderboardConfigImagesBarCell> leaderboardActionColumn = new ImagesBarColumn<LeaderboardDTO, LeaderboardConfigImagesBarCell>(
|
||||
new LeaderboardConfigImagesBarCell(stringConstants));
|
||||
leaderboardActionColumn.setFieldUpdater(new FieldUpdater<LeaderboardDAO, String>() {
|
||||
leaderboardActionColumn.setFieldUpdater(new FieldUpdater<LeaderboardDTO, String>() {
|
||||
@Override
|
||||
public void update(int index, LeaderboardDAO object, String value) {
|
||||
public void update(int index, LeaderboardDTO object, String value) {
|
||||
if ("ACTION_REMOVE".equals(value)) {
|
||||
if (Window.confirm("Do you really want to remove the leaderboard: '" + object.name + "' ?")) {
|
||||
removeLeaderboard(object);
|
||||
}
|
||||
} else if ("ACTION_EDIT".equals(value)) {
|
||||
final String oldLeaderboardName = object.name;
|
||||
List<LeaderboardDAO> otherExistingLeaderboard = new ArrayList<LeaderboardDAO>();
|
||||
List<LeaderboardDTO> otherExistingLeaderboard = new ArrayList<LeaderboardDTO>();
|
||||
otherExistingLeaderboard.addAll(leaderboardList.getList());
|
||||
otherExistingLeaderboard.remove(object);
|
||||
LeaderboardEditDialog dialog = new LeaderboardEditDialog(Collections
|
||||
.unmodifiableCollection(otherExistingLeaderboard), object, stringConstants, errorReporter,
|
||||
new AsyncCallback<LeaderboardDAO>() {
|
||||
new AsyncCallback<LeaderboardDTO>() {
|
||||
@Override
|
||||
public void onFailure(Throwable arg0) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(LeaderboardDAO result) {
|
||||
public void onSuccess(LeaderboardDTO result) {
|
||||
updateLeaderboard(oldLeaderboardName, result);
|
||||
}
|
||||
});
|
||||
@@ -223,7 +223,7 @@ public class LeaderboardConfigPanel extends FormPanel implements EventDisplayer,
|
||||
leaderboardTable.addColumn(leaderboardActionColumn, "Actions");
|
||||
leaderboardTable.addColumnSortHandler(leaderboardColumnListHandler);
|
||||
leaderboardTable.setWidth("500px");
|
||||
tableSelectionModel = new SingleSelectionModel<LeaderboardDAO>();
|
||||
tableSelectionModel = new SingleSelectionModel<LeaderboardDTO>();
|
||||
leaderboardTable.setSelectionModel(tableSelectionModel);
|
||||
tableSelectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
|
||||
public void onSelectionChange(SelectionChangeEvent event) {
|
||||
@@ -288,42 +288,42 @@ public class LeaderboardConfigPanel extends FormPanel implements EventDisplayer,
|
||||
});
|
||||
|
||||
// ------------ races of the selected leaderboard ----------------
|
||||
TextColumn<RaceInLeaderboardDAO> raceNameColumn = new TextColumn<RaceInLeaderboardDAO>() {
|
||||
TextColumn<RaceInLeaderboardDTO> raceNameColumn = new TextColumn<RaceInLeaderboardDTO>() {
|
||||
@Override
|
||||
public String getValue(RaceInLeaderboardDAO object) {
|
||||
public String getValue(RaceInLeaderboardDTO object) {
|
||||
return object.getRaceColumnName();
|
||||
}
|
||||
};
|
||||
|
||||
Column<RaceInLeaderboardDAO, Boolean> isMedalRaceCheckboxColumn = new Column<RaceInLeaderboardDAO, Boolean>(
|
||||
Column<RaceInLeaderboardDTO, Boolean> isMedalRaceCheckboxColumn = new Column<RaceInLeaderboardDTO, Boolean>(
|
||||
new CheckboxCell()) {
|
||||
@Override
|
||||
public Boolean getValue(RaceInLeaderboardDAO race) {
|
||||
public Boolean getValue(RaceInLeaderboardDTO race) {
|
||||
return race.isMedalRace();
|
||||
}
|
||||
};
|
||||
isMedalRaceCheckboxColumn.setFieldUpdater(new FieldUpdater<RaceInLeaderboardDAO, Boolean>() {
|
||||
isMedalRaceCheckboxColumn.setFieldUpdater(new FieldUpdater<RaceInLeaderboardDTO, Boolean>() {
|
||||
@Override
|
||||
public void update(int index, RaceInLeaderboardDAO object, Boolean value) {
|
||||
public void update(int index, RaceInLeaderboardDTO object, Boolean value) {
|
||||
setIsMedalRace(selectedLeaderboard.name, object, value);
|
||||
}
|
||||
});
|
||||
isMedalRaceCheckboxColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
|
||||
|
||||
TextColumn<RaceInLeaderboardDAO> isLinkedRaceColumn = new TextColumn<RaceInLeaderboardDAO>() {
|
||||
TextColumn<RaceInLeaderboardDTO> isLinkedRaceColumn = new TextColumn<RaceInLeaderboardDTO>() {
|
||||
@Override
|
||||
public String getValue(RaceInLeaderboardDAO race) {
|
||||
public String getValue(RaceInLeaderboardDTO race) {
|
||||
boolean isTrackedRace = race.isTrackedRace();
|
||||
return isTrackedRace ? stringConstants.yes() : stringConstants.no();
|
||||
}
|
||||
};
|
||||
|
||||
ImagesBarColumn<RaceInLeaderboardDAO, LeaderboardRaceConfigImagesBarCell> raceActionColumn = new ImagesBarColumn<RaceInLeaderboardDAO, LeaderboardRaceConfigImagesBarCell>(
|
||||
ImagesBarColumn<RaceInLeaderboardDTO, LeaderboardRaceConfigImagesBarCell> raceActionColumn = new ImagesBarColumn<RaceInLeaderboardDTO, LeaderboardRaceConfigImagesBarCell>(
|
||||
new LeaderboardRaceConfigImagesBarCell(stringConstants));
|
||||
|
||||
raceActionColumn.setFieldUpdater(new FieldUpdater<RaceInLeaderboardDAO, String>() {
|
||||
raceActionColumn.setFieldUpdater(new FieldUpdater<RaceInLeaderboardDTO, String>() {
|
||||
@Override
|
||||
public void update(int index, RaceInLeaderboardDAO object, String value) {
|
||||
public void update(int index, RaceInLeaderboardDTO object, String value) {
|
||||
if ("ACTION_REMOVE".equals(value)) {
|
||||
if (Window.confirm("Do you really want to remove the race: '" + object + "' ?")) {
|
||||
removeRaceColumn(object);
|
||||
@@ -339,14 +339,14 @@ public class LeaderboardConfigPanel extends FormPanel implements EventDisplayer,
|
||||
Label lblRaceNamesIn = new Label(stringConstants.races());
|
||||
vPanel.add(lblRaceNamesIn);
|
||||
|
||||
raceColumnTable = new CellTable<RaceInLeaderboardDAO>(/* pageSize */200, tableRes);
|
||||
raceColumnTable = new CellTable<RaceInLeaderboardDTO>(/* pageSize */200, tableRes);
|
||||
raceColumnTable.addColumn(raceNameColumn, stringConstants.name());
|
||||
raceColumnTable.addColumn(isMedalRaceCheckboxColumn, stringConstants.medalRace());
|
||||
raceColumnTable.addColumn(isLinkedRaceColumn, stringConstants.islinked());
|
||||
raceColumnTable.addColumn(raceActionColumn, stringConstants.actions());
|
||||
raceColumnList.addDataDisplay(raceColumnTable);
|
||||
raceColumnTable.setWidth("500px");
|
||||
raceTableSelectionModel = new SingleSelectionModel<RaceInLeaderboardDAO>();
|
||||
raceTableSelectionModel = new SingleSelectionModel<RaceInLeaderboardDTO>();
|
||||
|
||||
raceColumnTable.setSelectionModel(raceTableSelectionModel);
|
||||
|
||||
@@ -393,9 +393,9 @@ public class LeaderboardConfigPanel extends FormPanel implements EventDisplayer,
|
||||
}
|
||||
|
||||
private void readAllLeaderbords() {
|
||||
sailingService.getLeaderboards(new AsyncCallback<List<LeaderboardDAO>>() {
|
||||
sailingService.getLeaderboards(new AsyncCallback<List<LeaderboardDTO>>() {
|
||||
@Override
|
||||
public void onSuccess(List<LeaderboardDAO> leaderboards) {
|
||||
public void onSuccess(List<LeaderboardDTO> leaderboards) {
|
||||
leaderboardList.getList().clear();
|
||||
availableLeaderboardList.clear();
|
||||
leaderboardList.getList().addAll(leaderboards);
|
||||
@@ -447,7 +447,7 @@ public class LeaderboardConfigPanel extends FormPanel implements EventDisplayer,
|
||||
});
|
||||
}
|
||||
|
||||
private void removeRaceColumn(final RaceInLeaderboardDAO raceColumn) {
|
||||
private void removeRaceColumn(final RaceInLeaderboardDTO raceColumn) {
|
||||
final String raceColumnString = raceColumn.getRaceColumnName();
|
||||
sailingService.removeLeaderboardColumn(getSelectedLeaderboardName(), raceColumnString,
|
||||
new AsyncCallback<Void>() {
|
||||
@@ -491,7 +491,7 @@ public class LeaderboardConfigPanel extends FormPanel implements EventDisplayer,
|
||||
}
|
||||
|
||||
private int getRowIndexOfSelectedRaceColumn() {
|
||||
final RaceInLeaderboardDAO selectedRaceColumnName = raceTableSelectionModel.getSelectedObject();
|
||||
final RaceInLeaderboardDTO selectedRaceColumnName = raceTableSelectionModel.getSelectedObject();
|
||||
int rowIndex = -1;
|
||||
|
||||
if (selectedRaceColumnName != null) {
|
||||
@@ -570,24 +570,24 @@ public class LeaderboardConfigPanel extends FormPanel implements EventDisplayer,
|
||||
trackedEventsComposite.selectRaceByName(eventName, raceName);
|
||||
}
|
||||
|
||||
private RaceInLeaderboardDAO getSelectedRaceInLeaderboard() {
|
||||
RaceInLeaderboardDAO raceInLeaderboard = raceTableSelectionModel.getSelectedObject();
|
||||
private RaceInLeaderboardDTO getSelectedRaceInLeaderboard() {
|
||||
RaceInLeaderboardDTO raceInLeaderboard = raceTableSelectionModel.getSelectedObject();
|
||||
return raceInLeaderboard;
|
||||
}
|
||||
|
||||
private void editRaceColumnOfLeaderboard(final RaceInLeaderboardDAO raceInLeaderboard) {
|
||||
private void editRaceColumnOfLeaderboard(final RaceInLeaderboardDTO raceInLeaderboard) {
|
||||
final String oldRaceName = raceInLeaderboard.getRaceColumnName();
|
||||
List<RaceInLeaderboardDAO> existingRacesWithoutThisRace = new ArrayList<RaceInLeaderboardDAO>();
|
||||
List<RaceInLeaderboardDTO> existingRacesWithoutThisRace = new ArrayList<RaceInLeaderboardDTO>();
|
||||
existingRacesWithoutThisRace.addAll(raceColumnList.getList());
|
||||
existingRacesWithoutThisRace.remove(raceInLeaderboard);
|
||||
final RaceInLeaderboardDialog raceDialog = new RaceInLeaderboardDialog(existingRacesWithoutThisRace,
|
||||
raceInLeaderboard, stringConstants, new AsyncCallback<RaceInLeaderboardDAO>() {
|
||||
raceInLeaderboard, stringConstants, new AsyncCallback<RaceInLeaderboardDTO>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(final RaceInLeaderboardDAO result) {
|
||||
public void onSuccess(final RaceInLeaderboardDTO result) {
|
||||
sailingService.renameLeaderboardColumn(getSelectedLeaderboardName(), oldRaceName,
|
||||
result.getRaceColumnName(), new AsyncCallback<Void>() {
|
||||
|
||||
@@ -619,10 +619,10 @@ public class LeaderboardConfigPanel extends FormPanel implements EventDisplayer,
|
||||
raceDialog.show();
|
||||
}
|
||||
|
||||
private void reloadRaceInLeaderboardRow(String oldRaceName, RaceInLeaderboardDAO raceInLeaderboard) {
|
||||
private void reloadRaceInLeaderboardRow(String oldRaceName, RaceInLeaderboardDTO raceInLeaderboard) {
|
||||
int index = -1;
|
||||
for (int i = 0; i < raceColumnList.getList().size(); i++) {
|
||||
RaceInLeaderboardDAO race = raceColumnList.getList().get(i);
|
||||
RaceInLeaderboardDTO race = raceColumnList.getList().get(i);
|
||||
if (race.getRaceColumnName().equals(oldRaceName)) {
|
||||
index = i;
|
||||
break;
|
||||
@@ -634,7 +634,7 @@ public class LeaderboardConfigPanel extends FormPanel implements EventDisplayer,
|
||||
raceColumnList.refresh();
|
||||
}
|
||||
|
||||
private void setIsMedalRace(String leaderboardName, final RaceInLeaderboardDAO raceInLeaderboard,
|
||||
private void setIsMedalRace(String leaderboardName, final RaceInLeaderboardDTO raceInLeaderboard,
|
||||
final boolean isMedalRace) {
|
||||
sailingService.updateIsMedalRace(leaderboardName, raceInLeaderboard.getRaceColumnName(), isMedalRace,
|
||||
new AsyncCallback<Void>() {
|
||||
@@ -651,17 +651,17 @@ public class LeaderboardConfigPanel extends FormPanel implements EventDisplayer,
|
||||
}
|
||||
|
||||
private void addRaceColumnToLeaderboard() {
|
||||
final RaceInLeaderboardDAO raceInLeaderboard = new RaceInLeaderboardDAO();
|
||||
final RaceInLeaderboardDTO raceInLeaderboard = new RaceInLeaderboardDTO();
|
||||
final String leaderboardName = getSelectedLeaderboardName();
|
||||
final RaceInLeaderboardDialog raceDialog = new RaceInLeaderboardDialog(raceColumnList.getList(),
|
||||
raceInLeaderboard, stringConstants, new AsyncCallback<RaceInLeaderboardDAO>() {
|
||||
raceInLeaderboard, stringConstants, new AsyncCallback<RaceInLeaderboardDTO>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(final RaceInLeaderboardDAO result) {
|
||||
public void onSuccess(final RaceInLeaderboardDTO result) {
|
||||
sailingService.addColumnToLeaderboard(result.getRaceColumnName(), leaderboardName,
|
||||
result.isMedalRace(), new AsyncCallback<Void>() {
|
||||
|
||||
@@ -710,7 +710,7 @@ public class LeaderboardConfigPanel extends FormPanel implements EventDisplayer,
|
||||
if (leaderboardName != null) {
|
||||
// TODO wouldn't the stripped-down version of the LeaderboardDAO do here? See bug #146
|
||||
sailingService.getLeaderboardByName(leaderboardName, new Date(),
|
||||
/* namesOfRacesForWhichToLoadLegDetails */null, new AsyncCallback<LeaderboardDAO>() {
|
||||
/* namesOfRacesForWhichToLoadLegDetails */null, new AsyncCallback<LeaderboardDTO>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError("Error trying to fetch leaderboard " + leaderboardName
|
||||
@@ -718,7 +718,7 @@ public class LeaderboardConfigPanel extends FormPanel implements EventDisplayer,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(LeaderboardDAO result) {
|
||||
public void onSuccess(LeaderboardDTO result) {
|
||||
selectedLeaderboard = result;
|
||||
raceColumnList.getList().clear();
|
||||
raceColumnList.getList().addAll(result.getRaceInLeaderboardList());
|
||||
@@ -738,13 +738,13 @@ public class LeaderboardConfigPanel extends FormPanel implements EventDisplayer,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillEvents(List<EventDAO> result) {
|
||||
public void fillEvents(List<EventDTO> result) {
|
||||
trackedEventsComposite.fillEvents(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeTrackingRace(EventNameAndRaceName eventNameAndRaceName, boolean isTracked) {
|
||||
for (RaceInLeaderboardDAO race : raceColumnList.getList()) {
|
||||
for (RaceInLeaderboardDTO race : raceColumnList.getList()) {
|
||||
if (race.getRaceColumnName().equals(eventNameAndRaceName.getRaceName())) {
|
||||
race.setTrackedRace(isTracked);
|
||||
}
|
||||
@@ -754,25 +754,25 @@ public class LeaderboardConfigPanel extends FormPanel implements EventDisplayer,
|
||||
|
||||
private void addNewLeaderboard() {
|
||||
List<String> leaderboardNames = new ArrayList<String>();
|
||||
for (LeaderboardDAO dao : leaderboardList.getList())
|
||||
for (LeaderboardDTO dao : leaderboardList.getList())
|
||||
leaderboardNames.add(dao.name);
|
||||
LeaderboardCreateDialog dialog = new LeaderboardCreateDialog(Collections.unmodifiableCollection(leaderboardList
|
||||
.getList()), stringConstants, errorReporter, new AsyncCallback<LeaderboardDAO>() {
|
||||
.getList()), stringConstants, errorReporter, new AsyncCallback<LeaderboardDTO>() {
|
||||
@Override
|
||||
public void onFailure(Throwable arg0) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(LeaderboardDAO result) {
|
||||
public void onSuccess(LeaderboardDTO result) {
|
||||
createNewLeaderboard(result);
|
||||
}
|
||||
});
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
private void createNewLeaderboard(final LeaderboardDAO newLeaderboard) {
|
||||
private void createNewLeaderboard(final LeaderboardDTO newLeaderboard) {
|
||||
sailingService.createLeaderboard(newLeaderboard.name, newLeaderboard.discardThresholds,
|
||||
new AsyncCallback<LeaderboardDAO>() {
|
||||
new AsyncCallback<LeaderboardDTO>() {
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
errorReporter.reportError("Error trying to create new leaderboard " + newLeaderboard.name
|
||||
@@ -780,7 +780,7 @@ public class LeaderboardConfigPanel extends FormPanel implements EventDisplayer,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(LeaderboardDAO result) {
|
||||
public void onSuccess(LeaderboardDTO result) {
|
||||
leaderboardList.getList().add(result);
|
||||
availableLeaderboardList.add(result);
|
||||
selectedLeaderboard = result;
|
||||
@@ -789,7 +789,7 @@ public class LeaderboardConfigPanel extends FormPanel implements EventDisplayer,
|
||||
});
|
||||
}
|
||||
|
||||
private void updateLeaderboard(final String oldLeaderboardName, final LeaderboardDAO leaderboardToUdate) {
|
||||
private void updateLeaderboard(final String oldLeaderboardName, final LeaderboardDTO leaderboardToUdate) {
|
||||
sailingService.updateLeaderboard(oldLeaderboardName, leaderboardToUdate.name,
|
||||
leaderboardToUdate.discardThresholds, new AsyncCallback<Void>() {
|
||||
@Override
|
||||
@@ -801,7 +801,7 @@ public class LeaderboardConfigPanel extends FormPanel implements EventDisplayer,
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
for (int i = 0; i < leaderboardList.getList().size(); i++) {
|
||||
LeaderboardDAO dao = leaderboardList.getList().get(i);
|
||||
LeaderboardDTO dao = leaderboardList.getList().get(i);
|
||||
if (dao.name.equals(oldLeaderboardName)) {
|
||||
leaderboardList.getList().set(i, leaderboardToUdate);
|
||||
availableLeaderboardList.set(i, leaderboardToUdate);
|
||||
@@ -812,7 +812,7 @@ public class LeaderboardConfigPanel extends FormPanel implements EventDisplayer,
|
||||
});
|
||||
}
|
||||
|
||||
private void removeLeaderboard(final LeaderboardDAO leaderBoard) {
|
||||
private void removeLeaderboard(final LeaderboardDTO leaderBoard) {
|
||||
sailingService.removeLeaderboard(leaderBoard.name, new AsyncCallback<Void>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
@@ -835,9 +835,9 @@ public class LeaderboardConfigPanel extends FormPanel implements EventDisplayer,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRaceSelectionChange(List<Triple<EventDAO, RegattaDAO, RaceDAO>> selectedRaces) {
|
||||
public void onRaceSelectionChange(List<Triple<EventDTO, RegattaDTO, RaceDTO>> selectedRaces) {
|
||||
// if no leaderboard column is selected, ignore the race selection change
|
||||
RaceInLeaderboardDAO selectedRaceInLeaderboard = getSelectedRaceInLeaderboard();
|
||||
RaceInLeaderboardDTO selectedRaceInLeaderboard = getSelectedRaceInLeaderboard();
|
||||
if (selectedRaceInLeaderboard != null) {
|
||||
if (selectedRaces.isEmpty()) {
|
||||
unlinkRaceColumnFromTrackedRace(selectedRaceInLeaderboard.getRaceColumnName());
|
||||
@@ -847,8 +847,8 @@ public class LeaderboardConfigPanel extends FormPanel implements EventDisplayer,
|
||||
}
|
||||
}
|
||||
|
||||
private void linkTrackedRaceToSelectedRaceColumn(final RaceInLeaderboardDAO selectedRaceInLeaderboard,
|
||||
final Triple<EventDAO, RegattaDAO, RaceDAO> selectedRace) {
|
||||
private void linkTrackedRaceToSelectedRaceColumn(final RaceInLeaderboardDTO selectedRaceInLeaderboard,
|
||||
final Triple<EventDTO, RegattaDTO, RaceDTO> selectedRace) {
|
||||
sailingService.connectTrackedRaceToLeaderboardColumn(getSelectedLeaderboardName(), selectedRaceInLeaderboard
|
||||
.getRaceColumnName(), new EventNameAndRaceName(selectedRace.getA().name, selectedRace.getC().name),
|
||||
new AsyncCallback<Boolean>() {
|
||||
@@ -877,7 +877,7 @@ public class LeaderboardConfigPanel extends FormPanel implements EventDisplayer,
|
||||
List<String> wordsToFilter = Arrays.asList(text.split(" "));
|
||||
leaderboardList.getList().clear();
|
||||
if (text != null && !text.isEmpty()) {
|
||||
for (LeaderboardDAO dao : availableLeaderboardList) {
|
||||
for (LeaderboardDTO dao : availableLeaderboardList) {
|
||||
boolean failed = false;
|
||||
for (String word : wordsToFilter) {
|
||||
String textAsUppercase = word.toUpperCase().trim();
|
||||
|
||||
+4
-4
@@ -6,13 +6,13 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.LongBox;
|
||||
import com.sap.sailing.gwt.ui.client.ErrorReporter;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardDTO;
|
||||
|
||||
public class LeaderboardCreateDialog extends LeaderboardDialog{
|
||||
|
||||
public LeaderboardCreateDialog(Collection<LeaderboardDAO> existingLeaderboards, StringMessages stringConstants,
|
||||
ErrorReporter errorReporter, AsyncCallback<LeaderboardDAO> callback) {
|
||||
super(new LeaderboardDAO(), stringConstants, errorReporter, new LeaderboardDialog.LeaderboardParameterValidator(stringConstants, existingLeaderboards), callback);
|
||||
public LeaderboardCreateDialog(Collection<LeaderboardDTO> existingLeaderboards, StringMessages stringConstants,
|
||||
ErrorReporter errorReporter, AsyncCallback<LeaderboardDTO> callback) {
|
||||
super(new LeaderboardDTO(), stringConstants, errorReporter, new LeaderboardDialog.LeaderboardParameterValidator(stringConstants, existingLeaderboards), callback);
|
||||
|
||||
entryField = createTextBox(null);
|
||||
|
||||
|
||||
+11
-11
@@ -14,29 +14,29 @@ import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.gwt.ui.client.DataEntryDialog;
|
||||
import com.sap.sailing.gwt.ui.client.ErrorReporter;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardDTO;
|
||||
|
||||
|
||||
public abstract class LeaderboardDialog extends DataEntryDialog<LeaderboardDAO> {
|
||||
public abstract class LeaderboardDialog extends DataEntryDialog<LeaderboardDTO> {
|
||||
protected final StringMessages stringConstants;
|
||||
protected TextBox entryField;
|
||||
protected LeaderboardDAO leaderboard;
|
||||
protected LeaderboardDTO leaderboard;
|
||||
|
||||
protected LongBox[] discardThresholdBoxes;
|
||||
protected static final int MAX_NUMBER_OF_DISCARDED_RESULTS = 4;
|
||||
|
||||
protected static class LeaderboardParameterValidator implements Validator<LeaderboardDAO> {
|
||||
protected static class LeaderboardParameterValidator implements Validator<LeaderboardDTO> {
|
||||
protected final StringMessages stringConstants;
|
||||
protected final Collection<LeaderboardDAO> existingLeaderboards;
|
||||
protected final Collection<LeaderboardDTO> existingLeaderboards;
|
||||
|
||||
public LeaderboardParameterValidator(StringMessages stringConstants, Collection<LeaderboardDAO> existingLeaderboards){
|
||||
public LeaderboardParameterValidator(StringMessages stringConstants, Collection<LeaderboardDTO> existingLeaderboards){
|
||||
super();
|
||||
this.stringConstants = stringConstants;
|
||||
this.existingLeaderboards = existingLeaderboards;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorMessage(LeaderboardDAO leaderboardToValidate) {
|
||||
public String getErrorMessage(LeaderboardDTO leaderboardToValidate) {
|
||||
String errorMessage;
|
||||
boolean nonEmpty = leaderboardToValidate.name != null && leaderboardToValidate.name.length() > 0;
|
||||
|
||||
@@ -50,7 +50,7 @@ public abstract class LeaderboardDialog extends DataEntryDialog<LeaderboardDAO>
|
||||
}
|
||||
|
||||
boolean unique = true;
|
||||
for (LeaderboardDAO dao : existingLeaderboards) {
|
||||
for (LeaderboardDTO dao : existingLeaderboards) {
|
||||
if(dao.name.equals(leaderboardToValidate.name)){
|
||||
unique = false;
|
||||
}
|
||||
@@ -69,8 +69,8 @@ public abstract class LeaderboardDialog extends DataEntryDialog<LeaderboardDAO>
|
||||
}
|
||||
}
|
||||
|
||||
public LeaderboardDialog(LeaderboardDAO leaderboardDAO, StringMessages stringConstants,
|
||||
ErrorReporter errorReporter, LeaderboardParameterValidator validator, AsyncCallback<LeaderboardDAO> callback) {
|
||||
public LeaderboardDialog(LeaderboardDTO leaderboardDAO, StringMessages stringConstants,
|
||||
ErrorReporter errorReporter, LeaderboardParameterValidator validator, AsyncCallback<LeaderboardDTO> callback) {
|
||||
super(stringConstants.leaderboardName(), stringConstants.leaderboardName(), stringConstants.ok(),
|
||||
stringConstants.cancel(), validator, callback);
|
||||
this.stringConstants = stringConstants;
|
||||
@@ -78,7 +78,7 @@ public abstract class LeaderboardDialog extends DataEntryDialog<LeaderboardDAO>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LeaderboardDAO getResult() {
|
||||
protected LeaderboardDTO getResult() {
|
||||
List<Integer> discardThresholds = new ArrayList<Integer>();
|
||||
for (int i = 0; i < discardThresholdBoxes.length; i++) {
|
||||
if (discardThresholdBoxes[i].getValue() != null
|
||||
|
||||
+3
-3
@@ -6,12 +6,12 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.LongBox;
|
||||
import com.sap.sailing.gwt.ui.client.ErrorReporter;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardDTO;
|
||||
|
||||
public class LeaderboardEditDialog extends LeaderboardDialog {
|
||||
|
||||
public LeaderboardEditDialog(Collection<LeaderboardDAO> otherExistingLeaderboards, LeaderboardDAO leaderboard, StringMessages stringConstants,
|
||||
ErrorReporter errorReporter, AsyncCallback<LeaderboardDAO> callback) {
|
||||
public LeaderboardEditDialog(Collection<LeaderboardDTO> otherExistingLeaderboards, LeaderboardDTO leaderboard, StringMessages stringConstants,
|
||||
ErrorReporter errorReporter, AsyncCallback<LeaderboardDTO> callback) {
|
||||
super(leaderboard, stringConstants, errorReporter, new LeaderboardDialog.LeaderboardParameterValidator(
|
||||
stringConstants, otherExistingLeaderboards), callback);
|
||||
|
||||
|
||||
+14
-14
@@ -12,8 +12,8 @@ import com.google.gwt.user.client.ui.ListBox;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.sap.sailing.gwt.ui.client.CompetitorSelectionChangeListener;
|
||||
import com.sap.sailing.gwt.ui.client.CompetitorSelectionProvider;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.QuickRankDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.QuickRankDTO;
|
||||
|
||||
/**
|
||||
* Shows a lean view of a race's competitors' ranks in a list. The list shows a subset of the race's competitors because
|
||||
@@ -28,8 +28,8 @@ import com.sap.sailing.gwt.ui.shared.QuickRankDAO;
|
||||
*/
|
||||
public class QuickRanksListBoxComposite extends Composite implements CompetitorSelectionChangeListener {
|
||||
private final CompetitorSelectionProvider competitorSelectionProvider;
|
||||
private final List<QuickRankDAO> quickRankList;
|
||||
private final List<CompetitorDAO> competitorList;
|
||||
private final List<QuickRankDTO> quickRankList;
|
||||
private final List<CompetitorDTO> competitorList;
|
||||
private final ListBox quickRankListBox;
|
||||
|
||||
public QuickRanksListBoxComposite(CompetitorSelectionProvider competitorSelectionProvider) {
|
||||
@@ -48,8 +48,8 @@ public class QuickRanksListBoxComposite extends Composite implements CompetitorS
|
||||
onLocalSelectionChanged();
|
||||
}
|
||||
});
|
||||
quickRankList = new ArrayList<QuickRankDAO>();
|
||||
competitorList = new ArrayList<CompetitorDAO>();
|
||||
quickRankList = new ArrayList<QuickRankDTO>();
|
||||
competitorList = new ArrayList<CompetitorDTO>();
|
||||
VerticalPanel vp = new VerticalPanel();
|
||||
vp.add(quickRankListBox);
|
||||
// All composites must call initWidget() in their constructors.
|
||||
@@ -66,16 +66,16 @@ public class QuickRanksListBoxComposite extends Composite implements CompetitorS
|
||||
/**
|
||||
* @param quickRanks list of quick ranks, ordered by ascending rank
|
||||
*/
|
||||
public void fillQuickRanks(List<QuickRankDAO> quickRanks) {
|
||||
public void fillQuickRanks(List<QuickRankDTO> quickRanks) {
|
||||
quickRankList.clear();
|
||||
competitorList.clear();
|
||||
quickRankListBox.clear();
|
||||
for (QuickRankDAO quickRank: quickRanks) {
|
||||
for (QuickRankDTO quickRank: quickRanks) {
|
||||
quickRankList.add(quickRank);
|
||||
competitorList.add(quickRank.competitor);
|
||||
}
|
||||
int index = 0;
|
||||
for (QuickRankDAO quickRank : quickRankList) {
|
||||
for (QuickRankDTO quickRank : quickRankList) {
|
||||
quickRankListBox.addItem(toString(quickRank));
|
||||
if (competitorSelectionProvider.isSelected(quickRank.competitor)) {
|
||||
quickRankListBox.setItemSelected(index, true);
|
||||
@@ -84,8 +84,8 @@ public class QuickRanksListBoxComposite extends Composite implements CompetitorS
|
||||
}
|
||||
}
|
||||
|
||||
private Iterable<CompetitorDAO> getSelectedCompetitors() {
|
||||
List<CompetitorDAO> result = new ArrayList<CompetitorDAO>();
|
||||
private Iterable<CompetitorDTO> getSelectedCompetitors() {
|
||||
List<CompetitorDTO> result = new ArrayList<CompetitorDTO>();
|
||||
for (int i=0; i<quickRankListBox.getItemCount(); i++) {
|
||||
if (quickRankListBox.isItemSelected(i)) {
|
||||
result.add(quickRankList.get(i).competitor);
|
||||
@@ -94,7 +94,7 @@ public class QuickRanksListBoxComposite extends Composite implements CompetitorS
|
||||
return result;
|
||||
}
|
||||
|
||||
protected String toString(QuickRankDAO quickRank) {
|
||||
protected String toString(QuickRankDTO quickRank) {
|
||||
return quickRank.rank + ". " + quickRank.competitor.name + " ("
|
||||
+ quickRank.competitor.threeLetterIocCountryCode + ") in leg #" + (quickRank.legNumber + 1);
|
||||
}
|
||||
@@ -104,7 +104,7 @@ public class QuickRanksListBoxComposite extends Composite implements CompetitorS
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addedToSelection(CompetitorDAO competitor) {
|
||||
public void addedToSelection(CompetitorDTO competitor) {
|
||||
int pos = quickRankList.indexOf(competitor);
|
||||
if (pos >= 0) {
|
||||
quickRankListBox.setItemSelected(pos, true);
|
||||
@@ -112,7 +112,7 @@ public class QuickRanksListBoxComposite extends Composite implements CompetitorS
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removedFromSelection(CompetitorDAO competitor) {
|
||||
public void removedFromSelection(CompetitorDTO competitor) {
|
||||
int pos = quickRankList.indexOf(competitor);
|
||||
if (pos >= 0) {
|
||||
quickRankListBox.setItemSelected(pos, false);
|
||||
|
||||
+12
-12
@@ -9,27 +9,27 @@ import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.gwt.ui.client.DataEntryDialog;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceInLeaderboardDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceInLeaderboardDTO;
|
||||
|
||||
public class RaceInLeaderboardDialog extends DataEntryDialog<RaceInLeaderboardDAO> {
|
||||
public class RaceInLeaderboardDialog extends DataEntryDialog<RaceInLeaderboardDTO> {
|
||||
|
||||
private final TextBox raceNameBox;
|
||||
private final CheckBox isMedalRace;
|
||||
|
||||
private RaceInLeaderboardDAO raceInLeaderboard;
|
||||
private RaceInLeaderboardDTO raceInLeaderboard;
|
||||
|
||||
private static class RaceDialogValidator implements Validator<RaceInLeaderboardDAO> {
|
||||
private static class RaceDialogValidator implements Validator<RaceInLeaderboardDTO> {
|
||||
|
||||
private StringMessages stringConstants;
|
||||
private Collection<RaceInLeaderboardDAO> existingRaces;
|
||||
private Collection<RaceInLeaderboardDTO> existingRaces;
|
||||
|
||||
public RaceDialogValidator(StringMessages stringConstants, Collection<RaceInLeaderboardDAO> existingRaces) {
|
||||
public RaceDialogValidator(StringMessages stringConstants, Collection<RaceInLeaderboardDTO> existingRaces) {
|
||||
this.stringConstants = stringConstants;
|
||||
this.existingRaces = existingRaces;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorMessage(RaceInLeaderboardDAO valueToValidate) {
|
||||
public String getErrorMessage(RaceInLeaderboardDTO valueToValidate) {
|
||||
String errorMessage;
|
||||
String racename = valueToValidate.getRaceColumnName();
|
||||
Boolean isMedalRace = valueToValidate.isMedalRace();
|
||||
@@ -37,7 +37,7 @@ public class RaceInLeaderboardDialog extends DataEntryDialog<RaceInLeaderboardDA
|
||||
boolean medalRaceNotNull = isMedalRace != null;
|
||||
|
||||
boolean unique = true;
|
||||
for (RaceInLeaderboardDAO dao : existingRaces) {
|
||||
for (RaceInLeaderboardDTO dao : existingRaces) {
|
||||
if (dao.getRaceColumnName().equals(valueToValidate.getRaceColumnName())) {
|
||||
unique = false;
|
||||
}
|
||||
@@ -57,9 +57,9 @@ public class RaceInLeaderboardDialog extends DataEntryDialog<RaceInLeaderboardDA
|
||||
|
||||
}
|
||||
|
||||
public RaceInLeaderboardDialog(Collection<RaceInLeaderboardDAO> existingRaces,
|
||||
RaceInLeaderboardDAO raceInLeaderboard, StringMessages stringConstants,
|
||||
AsyncCallback<RaceInLeaderboardDAO> callback) {
|
||||
public RaceInLeaderboardDialog(Collection<RaceInLeaderboardDTO> existingRaces,
|
||||
RaceInLeaderboardDTO raceInLeaderboard, StringMessages stringConstants,
|
||||
AsyncCallback<RaceInLeaderboardDTO> callback) {
|
||||
super(stringConstants.name(), stringConstants.name(), stringConstants.ok(), stringConstants.cancel(),
|
||||
new RaceDialogValidator(stringConstants, existingRaces), callback);
|
||||
this.raceInLeaderboard = raceInLeaderboard;
|
||||
@@ -69,7 +69,7 @@ public class RaceInLeaderboardDialog extends DataEntryDialog<RaceInLeaderboardDA
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RaceInLeaderboardDAO getResult() {
|
||||
protected RaceInLeaderboardDTO getResult() {
|
||||
raceInLeaderboard.setRaceColumnName(raceNameBox.getValue());
|
||||
raceInLeaderboard.setMedalRace(isMedalRace.getValue());
|
||||
return raceInLeaderboard;
|
||||
|
||||
+116
-116
@@ -51,13 +51,13 @@ import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.client.TimeListener;
|
||||
import com.sap.sailing.gwt.ui.client.Timer;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.GPSFixDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.ManeuverDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.MarkDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.GPSFixDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.ManeuverDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.MarkDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.components.Component;
|
||||
import com.sap.sailing.gwt.ui.shared.components.SettingsDialogComponent;
|
||||
import com.sap.sailing.server.api.EventNameAndRaceName;
|
||||
@@ -72,33 +72,33 @@ public class RaceMap implements TimeListener, CompetitorSelectionChangeListener,
|
||||
/**
|
||||
* Tails of competitors currently displayed as overlays on the map.
|
||||
*/
|
||||
private final Map<CompetitorDAO, Polyline> tails;
|
||||
private final Map<CompetitorDTO, Polyline> tails;
|
||||
|
||||
/**
|
||||
* Key set is equal to that of {@link #tails} and tells what the index in in {@link #fixes} of the first fix shown
|
||||
* in {@link #tails} is .
|
||||
*/
|
||||
private final Map<CompetitorDAO, Integer> firstShownFix;
|
||||
private final Map<CompetitorDTO, Integer> firstShownFix;
|
||||
|
||||
/**
|
||||
* Key set is equal to that of {@link #tails} and tells what the index in in {@link #fixes} of the last fix shown in
|
||||
* {@link #tails} is .
|
||||
*/
|
||||
private final Map<CompetitorDAO, Integer> lastShownFix;
|
||||
private final Map<CompetitorDTO, Integer> lastShownFix;
|
||||
|
||||
/**
|
||||
* Fixes of each competitors tail. If a list is contained for a competitor, the list contains a timely "contiguous"
|
||||
* list of fixes for the competitor. This means the server has no more data for the time interval covered, unless
|
||||
* the last fix was {@link GPSFixDAO#extrapolated obtained by extrapolation}.
|
||||
* the last fix was {@link GPSFixDTO#extrapolated obtained by extrapolation}.
|
||||
*/
|
||||
private final Map<CompetitorDAO, List<GPSFixDAO>> fixes;
|
||||
private final Map<CompetitorDTO, List<GPSFixDTO>> fixes;
|
||||
|
||||
/**
|
||||
* Markers used as boat display on the map
|
||||
*/
|
||||
protected final Map<CompetitorDAO, Marker> boatMarkers;
|
||||
protected final Map<CompetitorDTO, Marker> boatMarkers;
|
||||
|
||||
private final Map<MarkDAO, Marker> buoyMarkers;
|
||||
private final Map<MarkDTO, Marker> buoyMarkers;
|
||||
|
||||
/**
|
||||
* markers displayed in response to
|
||||
@@ -112,15 +112,15 @@ public class RaceMap implements TimeListener, CompetitorSelectionChangeListener,
|
||||
*/
|
||||
protected Set<Marker> maneuverMarkers;
|
||||
|
||||
protected Map<CompetitorDAO, List<ManeuverDAO>> lastManeuverResult;
|
||||
protected Map<CompetitorDTO, List<ManeuverDTO>> lastManeuverResult;
|
||||
|
||||
protected Map<CompetitorDAO, List<GPSFixDAO>> lastDouglasPeuckerResult;
|
||||
protected Map<CompetitorDTO, List<GPSFixDTO>> lastDouglasPeuckerResult;
|
||||
|
||||
private LatLng lastMousePosition;
|
||||
|
||||
private CompetitorSelectionProvider competitorSelection;
|
||||
|
||||
private List<Triple<EventDAO, RegattaDAO, RaceDAO>> selectedEventAndRace;
|
||||
private List<Triple<EventDTO, RegattaDTO, RaceDTO>> selectedEventAndRace;
|
||||
|
||||
/**
|
||||
* If the user explicitly zoomed or panned the map, don't adjust zoom/pan unless a new race is selected
|
||||
@@ -166,12 +166,12 @@ public class RaceMap implements TimeListener, CompetitorSelectionChangeListener,
|
||||
this.errorReporter = errorReporter;
|
||||
this.timer = timer;
|
||||
imageResources = new RaceMapResources();
|
||||
tails = new HashMap<CompetitorDAO, Polyline>();
|
||||
firstShownFix = new HashMap<CompetitorDAO, Integer>();
|
||||
lastShownFix = new HashMap<CompetitorDAO, Integer>();
|
||||
buoyMarkers = new HashMap<MarkDAO, Marker>();
|
||||
boatMarkers = new HashMap<CompetitorDAO, Marker>();
|
||||
fixes = new HashMap<CompetitorDAO, List<GPSFixDAO>>();
|
||||
tails = new HashMap<CompetitorDTO, Polyline>();
|
||||
firstShownFix = new HashMap<CompetitorDTO, Integer>();
|
||||
lastShownFix = new HashMap<CompetitorDTO, Integer>();
|
||||
buoyMarkers = new HashMap<MarkDTO, Marker>();
|
||||
boatMarkers = new HashMap<CompetitorDTO, Marker>();
|
||||
fixes = new HashMap<CompetitorDTO, List<GPSFixDTO>>();
|
||||
this.competitorSelection = competitorSelection;
|
||||
competitorSelection.addCompetitorSelectionChangeListener(this);
|
||||
settings = new RaceMapSettings();
|
||||
@@ -208,14 +208,14 @@ public class RaceMap implements TimeListener, CompetitorSelectionChangeListener,
|
||||
@Override
|
||||
public void onZoomEnd(MapZoomEndEvent event) {
|
||||
mapZoomedOrPannedSinceLastRaceSelectionChange = true;
|
||||
Set<CompetitorDAO> competitorDAOsOfUnusedMarkers = new HashSet<CompetitorDAO>(boatMarkers.keySet());
|
||||
for (CompetitorDAO competitorDAO : getCompetitorsToShow()) {
|
||||
Set<CompetitorDTO> competitorDAOsOfUnusedMarkers = new HashSet<CompetitorDTO>(boatMarkers.keySet());
|
||||
for (CompetitorDTO competitorDAO : getCompetitorsToShow()) {
|
||||
boolean usedExistingMarker = updateMarkerForCompetitor(competitorDAO);
|
||||
if (usedExistingMarker) {
|
||||
competitorDAOsOfUnusedMarkers.remove(competitorDAO);
|
||||
}
|
||||
}
|
||||
for (CompetitorDAO unusedMarkerCompetitorDAO : competitorDAOsOfUnusedMarkers) {
|
||||
for (CompetitorDTO unusedMarkerCompetitorDAO : competitorDAOsOfUnusedMarkers) {
|
||||
map.removeOverlay(boatMarkers.remove(unusedMarkerCompetitorDAO));
|
||||
}
|
||||
}
|
||||
@@ -241,7 +241,7 @@ public class RaceMap implements TimeListener, CompetitorSelectionChangeListener,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRaceSelectionChange(List<Triple<EventDAO, RegattaDAO, RaceDAO>> selectedRaces) {
|
||||
public void onRaceSelectionChange(List<Triple<EventDTO, RegattaDTO, RaceDTO>> selectedRaces) {
|
||||
mapFirstZoomDone = false;
|
||||
mapZoomedOrPannedSinceLastRaceSelectionChange = false;
|
||||
this.selectedEventAndRace = selectedRaces;
|
||||
@@ -251,22 +251,22 @@ public class RaceMap implements TimeListener, CompetitorSelectionChangeListener,
|
||||
public void timeChanged(final Date date) {
|
||||
if (date != null) {
|
||||
if (selectedEventAndRace != null && !selectedEventAndRace.isEmpty()) {
|
||||
EventDAO event = selectedEventAndRace.get(selectedEventAndRace.size() - 1).getA();
|
||||
RaceDAO race = selectedEventAndRace.get(selectedEventAndRace.size() - 1).getC();
|
||||
EventDTO event = selectedEventAndRace.get(selectedEventAndRace.size() - 1).getA();
|
||||
RaceDTO race = selectedEventAndRace.get(selectedEventAndRace.size() - 1).getC();
|
||||
if (event != null && race != null) {
|
||||
final Triple<Map<CompetitorDAO, Date>, Map<CompetitorDAO, Date>, Map<CompetitorDAO, Boolean>> fromAndToAndOverlap =
|
||||
final Triple<Map<CompetitorDTO, Date>, Map<CompetitorDTO, Date>, Map<CompetitorDTO, Boolean>> fromAndToAndOverlap =
|
||||
computeFromAndTo(date, getCompetitorsToShow());
|
||||
final int requestID = ++boatPositionRequestIDCounter;
|
||||
sailingService.getBoatPositions(new EventNameAndRaceName(event.name, race.name),
|
||||
fromAndToAndOverlap.getA(), fromAndToAndOverlap.getB(), true,
|
||||
new AsyncCallback<Map<CompetitorDAO, List<GPSFixDAO>>>() {
|
||||
new AsyncCallback<Map<CompetitorDTO, List<GPSFixDTO>>>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError("Error obtaining boat positions: " + caught.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Map<CompetitorDAO, List<GPSFixDAO>> result) {
|
||||
public void onSuccess(Map<CompetitorDTO, List<GPSFixDTO>> result) {
|
||||
// process response only if not received out of order
|
||||
if (startedProcessingRequestID < requestID) {
|
||||
startedProcessingRequestID = requestID;
|
||||
@@ -283,7 +283,7 @@ public class RaceMap implements TimeListener, CompetitorSelectionChangeListener,
|
||||
}
|
||||
});
|
||||
sailingService.getMarkPositions(new EventNameAndRaceName(event.name, race.name), date,
|
||||
new AsyncCallback<List<MarkDAO>>() {
|
||||
new AsyncCallback<List<MarkDTO>>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError("Error trying to obtain mark positions: "
|
||||
@@ -291,7 +291,7 @@ public class RaceMap implements TimeListener, CompetitorSelectionChangeListener,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<MarkDAO> result) {
|
||||
public void onSuccess(List<MarkDTO> result) {
|
||||
showMarksOnMap(result);
|
||||
}
|
||||
});
|
||||
@@ -313,15 +313,15 @@ public class RaceMap implements TimeListener, CompetitorSelectionChangeListener,
|
||||
* {@link Triple#getC() third} component tells whether the existing raceMapData.fixes can remain and be augmented by
|
||||
* those requested or need to be replaced
|
||||
*/
|
||||
protected Triple<Map<CompetitorDAO, Date>, Map<CompetitorDAO, Date>, Map<CompetitorDAO, Boolean>> computeFromAndTo(
|
||||
Date upTo, Iterable<CompetitorDAO> competitorsToShow) {
|
||||
protected Triple<Map<CompetitorDTO, Date>, Map<CompetitorDTO, Date>, Map<CompetitorDTO, Boolean>> computeFromAndTo(
|
||||
Date upTo, Iterable<CompetitorDTO> competitorsToShow) {
|
||||
Date tailstart = new Date(upTo.getTime() - settings.getTailLengthInMilliseconds());
|
||||
Map<CompetitorDAO, Date> from = new HashMap<CompetitorDAO, Date>();
|
||||
Map<CompetitorDAO, Date> to = new HashMap<CompetitorDAO, Date>();
|
||||
Map<CompetitorDAO, Boolean> overlapWithKnownFixes = new HashMap<CompetitorDAO, Boolean>();
|
||||
Map<CompetitorDTO, Date> from = new HashMap<CompetitorDTO, Date>();
|
||||
Map<CompetitorDTO, Date> to = new HashMap<CompetitorDTO, Date>();
|
||||
Map<CompetitorDTO, Boolean> overlapWithKnownFixes = new HashMap<CompetitorDTO, Boolean>();
|
||||
|
||||
for (CompetitorDAO competitor : competitorsToShow) {
|
||||
List<GPSFixDAO> fixesForCompetitor = fixes.get(competitor);
|
||||
for (CompetitorDTO competitor : competitorsToShow) {
|
||||
List<GPSFixDTO> fixesForCompetitor = fixes.get(competitor);
|
||||
Date fromDate;
|
||||
Date toDate;
|
||||
Date timepointOfLastKnownFix = fixesForCompetitor == null ? null : getTimepointOfLastNonExtrapolated(fixesForCompetitor);
|
||||
@@ -352,7 +352,7 @@ public class RaceMap implements TimeListener, CompetitorSelectionChangeListener,
|
||||
overlapWithKnownFixes.put(competitor, overlap);
|
||||
}
|
||||
}
|
||||
return new Triple<Map<CompetitorDAO, Date>, Map<CompetitorDAO, Date>, Map<CompetitorDAO, Boolean>>(from, to,
|
||||
return new Triple<Map<CompetitorDTO, Date>, Map<CompetitorDTO, Date>, Map<CompetitorDTO, Boolean>>(from, to,
|
||||
overlapWithKnownFixes);
|
||||
}
|
||||
|
||||
@@ -363,13 +363,13 @@ public class RaceMap implements TimeListener, CompetitorSelectionChangeListener,
|
||||
* overlap with those already known, the raceMapData.fixes are merged into the list of already known raceMapData.fixes for the competitor.
|
||||
* Otherwise, the raceMapData.fixes received in <code>result</code> replace those known so far for the respective competitor.
|
||||
*/
|
||||
protected void updateFixes(Map<CompetitorDAO, List<GPSFixDAO>> result,
|
||||
Map<CompetitorDAO, Boolean> overlapsWithKnownFixes) {
|
||||
for (Map.Entry<CompetitorDAO, List<GPSFixDAO>> e : result.entrySet()) {
|
||||
protected void updateFixes(Map<CompetitorDTO, List<GPSFixDTO>> result,
|
||||
Map<CompetitorDTO, Boolean> overlapsWithKnownFixes) {
|
||||
for (Map.Entry<CompetitorDTO, List<GPSFixDTO>> e : result.entrySet()) {
|
||||
if (e.getValue() != null && !e.getValue().isEmpty()) {
|
||||
List<GPSFixDAO> fixesForCompetitor = fixes.get(e.getKey());
|
||||
List<GPSFixDTO> fixesForCompetitor = fixes.get(e.getKey());
|
||||
if (fixesForCompetitor == null) {
|
||||
fixesForCompetitor = new ArrayList<GPSFixDAO>();
|
||||
fixesForCompetitor = new ArrayList<GPSFixDTO>();
|
||||
fixes.put(e.getKey(), fixesForCompetitor);
|
||||
}
|
||||
if (!overlapsWithKnownFixes.get(e.getKey())) {
|
||||
@@ -389,10 +389,10 @@ public class RaceMap implements TimeListener, CompetitorSelectionChangeListener,
|
||||
}
|
||||
}
|
||||
|
||||
protected void showMarksOnMap(List<MarkDAO> result) {
|
||||
protected void showMarksOnMap(List<MarkDTO> result) {
|
||||
if (map != null) {
|
||||
Set<MarkDAO> toRemove = new HashSet<MarkDAO>(buoyMarkers.keySet());
|
||||
for (MarkDAO markDAO : result) {
|
||||
Set<MarkDTO> toRemove = new HashSet<MarkDTO>(buoyMarkers.keySet());
|
||||
for (MarkDTO markDAO : result) {
|
||||
Marker buoyMarker = buoyMarkers.get(markDAO);
|
||||
if (buoyMarker == null) {
|
||||
buoyMarker = createBuoyMarker(markDAO);
|
||||
@@ -403,7 +403,7 @@ public class RaceMap implements TimeListener, CompetitorSelectionChangeListener,
|
||||
toRemove.remove(markDAO);
|
||||
}
|
||||
}
|
||||
for (MarkDAO toRemoveMarkDAO : toRemove) {
|
||||
for (MarkDTO toRemoveMarkDAO : toRemove) {
|
||||
Marker marker = buoyMarkers.remove(toRemoveMarkDAO);
|
||||
map.removeOverlay(marker);
|
||||
}
|
||||
@@ -418,11 +418,11 @@ public class RaceMap implements TimeListener, CompetitorSelectionChangeListener,
|
||||
* @param marksToZoomAt
|
||||
* the marks to zoom at
|
||||
*/
|
||||
protected void zoomMapFirstTimeToMarks(Set<MarkDAO> marksToZoomAt) {
|
||||
protected void zoomMapFirstTimeToMarks(Set<MarkDTO> marksToZoomAt) {
|
||||
if (!mapZoomedOrPannedSinceLastRaceSelectionChange && !mapFirstZoomDone) {
|
||||
LatLngBounds newBounds = null;
|
||||
if (marksToZoomAt != null && !marksToZoomAt.isEmpty()) {
|
||||
for (MarkDAO markDAO : marksToZoomAt) {
|
||||
for (MarkDTO markDAO : marksToZoomAt) {
|
||||
LatLng latLngZoomFirstTime = LatLng.newInstance(markDAO.position.latDeg, markDAO.position.lngDeg);
|
||||
LatLngBounds bounds = LatLngBounds.newInstance(latLngZoomFirstTime, latLngZoomFirstTime);
|
||||
if (newBounds == null) {
|
||||
@@ -455,13 +455,13 @@ public class RaceMap implements TimeListener, CompetitorSelectionChangeListener,
|
||||
* @param to
|
||||
* time point for last fix to show in tails
|
||||
*/
|
||||
protected void showBoatsOnMap(Date from, Date to, Iterable<CompetitorDAO> competitorsToShow) {
|
||||
protected void showBoatsOnMap(Date from, Date to, Iterable<CompetitorDTO> competitorsToShow) {
|
||||
if (map != null) {
|
||||
LatLngBounds newMapBounds = null;
|
||||
Set<CompetitorDAO> competitorDAOsOfUnusedTails = new HashSet<CompetitorDAO>(tails.keySet());
|
||||
Set<CompetitorDAO> competitorDAOsOfUnusedMarkers = new HashSet<CompetitorDAO>(boatMarkers.keySet());
|
||||
Set<CompetitorDTO> competitorDAOsOfUnusedTails = new HashSet<CompetitorDTO>(tails.keySet());
|
||||
Set<CompetitorDTO> competitorDAOsOfUnusedMarkers = new HashSet<CompetitorDTO>(boatMarkers.keySet());
|
||||
|
||||
for (CompetitorDAO competitorDAO : competitorsToShow) {
|
||||
for (CompetitorDTO competitorDAO : competitorsToShow) {
|
||||
if (fixes.containsKey(competitorDAO)) {
|
||||
Polyline tail = tails.get(competitorDAO);
|
||||
if (tail == null) {
|
||||
@@ -489,19 +489,19 @@ public class RaceMap implements TimeListener, CompetitorSelectionChangeListener,
|
||||
map.setCenter(newMapBounds.getCenter());
|
||||
mapFirstZoomDone = true;
|
||||
}
|
||||
for (CompetitorDAO unusedMarkerCompetitorDAO : competitorDAOsOfUnusedMarkers) {
|
||||
for (CompetitorDTO unusedMarkerCompetitorDAO : competitorDAOsOfUnusedMarkers) {
|
||||
map.removeOverlay(boatMarkers.remove(unusedMarkerCompetitorDAO));
|
||||
}
|
||||
for (CompetitorDAO unusedTailCompetitorDAO : competitorDAOsOfUnusedTails) {
|
||||
for (CompetitorDTO unusedTailCompetitorDAO : competitorDAOsOfUnusedTails) {
|
||||
map.removeOverlay(tails.remove(unusedTailCompetitorDAO));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean updateMarkerForCompetitor(CompetitorDAO competitorDAO) {
|
||||
private boolean updateMarkerForCompetitor(CompetitorDTO competitorDAO) {
|
||||
boolean usedExistingMarker = false;
|
||||
if (lastShownFix.containsKey(competitorDAO) && lastShownFix.get(competitorDAO) != -1) {
|
||||
GPSFixDAO lastPos = getBoatFix(competitorDAO);
|
||||
GPSFixDTO lastPos = getBoatFix(competitorDAO);
|
||||
Marker boatMarker = boatMarkers.get(competitorDAO);
|
||||
if (boatMarker == null) {
|
||||
boatMarker = createBoatMarker(competitorDAO, displayHighlighted(competitorDAO));
|
||||
@@ -531,11 +531,11 @@ public class RaceMap implements TimeListener, CompetitorSelectionChangeListener,
|
||||
return usedExistingMarker;
|
||||
}
|
||||
|
||||
private boolean displayHighlighted(CompetitorDAO competitorDAO) {
|
||||
private boolean displayHighlighted(CompetitorDTO competitorDAO) {
|
||||
return !getSettings().isShowOnlySelectedCompetitors() && competitorSelection.isSelected(competitorDAO);
|
||||
}
|
||||
|
||||
protected Marker createBuoyMarker(final MarkDAO markDAO) {
|
||||
protected Marker createBuoyMarker(final MarkDTO markDAO) {
|
||||
MarkerOptions options = MarkerOptions.newInstance();
|
||||
if (imageResources.buoyIcon != null) {
|
||||
options.setIcon(imageResources.buoyIcon);
|
||||
@@ -553,8 +553,8 @@ public class RaceMap implements TimeListener, CompetitorSelectionChangeListener,
|
||||
return buoyMarker;
|
||||
}
|
||||
|
||||
protected Marker createBoatMarker(final CompetitorDAO competitorDAO, boolean highlighted) {
|
||||
GPSFixDAO boatFix = getBoatFix(competitorDAO);
|
||||
protected Marker createBoatMarker(final CompetitorDTO competitorDAO, boolean highlighted) {
|
||||
GPSFixDTO boatFix = getBoatFix(competitorDAO);
|
||||
double latDeg = boatFix.position.latDeg;
|
||||
double lngDeg = boatFix.position.lngDeg;
|
||||
MarkerOptions options = MarkerOptions.newInstance();
|
||||
@@ -586,24 +586,24 @@ public class RaceMap implements TimeListener, CompetitorSelectionChangeListener,
|
||||
return boatMarker;
|
||||
}
|
||||
|
||||
private void showMarkInfoWindow(MarkDAO markDAO, LatLng latlng) {
|
||||
private void showMarkInfoWindow(MarkDTO markDAO, LatLng latlng) {
|
||||
map.getInfoWindow().open(latlng, new InfoWindowContent(getInfoWindowContent(markDAO)));
|
||||
}
|
||||
|
||||
private void showCompetitorInfoWindow(final CompetitorDAO competitorDAO, LatLng where) {
|
||||
GPSFixDAO latestFixForCompetitor = getBoatFix(competitorDAO);
|
||||
private void showCompetitorInfoWindow(final CompetitorDTO competitorDAO, LatLng where) {
|
||||
GPSFixDTO latestFixForCompetitor = getBoatFix(competitorDAO);
|
||||
map.getInfoWindow().open(where,
|
||||
new InfoWindowContent(getInfoWindowContent(competitorDAO, latestFixForCompetitor)));
|
||||
}
|
||||
|
||||
private Widget getInfoWindowContent(MarkDAO markDAO) {
|
||||
private Widget getInfoWindowContent(MarkDTO markDAO) {
|
||||
VerticalPanel result = new VerticalPanel();
|
||||
result.add(new Label("Mark " + markDAO.name));
|
||||
result.add(new Label("" + markDAO.position));
|
||||
return result;
|
||||
}
|
||||
|
||||
private Widget getInfoWindowContent(CompetitorDAO competitorDAO, GPSFixDAO lastFix) {
|
||||
private Widget getInfoWindowContent(CompetitorDTO competitorDAO, GPSFixDTO lastFix) {
|
||||
final VerticalPanel result = new VerticalPanel();
|
||||
result.add(new Label("Competitor " + competitorDAO.name));
|
||||
result.add(new Label("" + lastFix.position));
|
||||
@@ -611,22 +611,22 @@ public class RaceMap implements TimeListener, CompetitorSelectionChangeListener,
|
||||
+ "deg"));
|
||||
result.add(new Label("Tack: " + lastFix.tack.name()));
|
||||
if (!selectedEventAndRace.isEmpty()) {
|
||||
EventDAO event = selectedEventAndRace.get(selectedEventAndRace.size() - 1).getA();
|
||||
RaceDAO race = selectedEventAndRace.get(selectedEventAndRace.size() - 1).getC();
|
||||
EventDTO event = selectedEventAndRace.get(selectedEventAndRace.size() - 1).getA();
|
||||
RaceDTO race = selectedEventAndRace.get(selectedEventAndRace.size() - 1).getC();
|
||||
if (event != null && race != null) {
|
||||
Map<CompetitorDAO, Date> from = new HashMap<CompetitorDAO, Date>();
|
||||
Map<CompetitorDTO, Date> from = new HashMap<CompetitorDTO, Date>();
|
||||
from.put(competitorDAO, fixes.get(competitorDAO).get(firstShownFix.get(competitorDAO)).timepoint);
|
||||
Map<CompetitorDAO, Date> to = new HashMap<CompetitorDAO, Date>();
|
||||
Map<CompetitorDTO, Date> to = new HashMap<CompetitorDTO, Date>();
|
||||
to.put(competitorDAO, getBoatFix(competitorDAO).timepoint);
|
||||
sailingService.getDouglasPoints(new EventNameAndRaceName(event.name, race.name), from, to, 3,
|
||||
new AsyncCallback<Map<CompetitorDAO, List<GPSFixDAO>>>() {
|
||||
new AsyncCallback<Map<CompetitorDTO, List<GPSFixDTO>>>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError("Error obtaining douglas positions: " + caught.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Map<CompetitorDAO, List<GPSFixDAO>> result) {
|
||||
public void onSuccess(Map<CompetitorDTO, List<GPSFixDTO>> result) {
|
||||
lastDouglasPeuckerResult = result;
|
||||
if (douglasMarkers != null) {
|
||||
removeAllMarkDouglasPeuckerpoints();
|
||||
@@ -639,14 +639,14 @@ public class RaceMap implements TimeListener, CompetitorSelectionChangeListener,
|
||||
}
|
||||
});
|
||||
sailingService.getManeuvers(new EventNameAndRaceName(event.name, race.name), from, to,
|
||||
new AsyncCallback<Map<CompetitorDAO, List<ManeuverDAO>>>() {
|
||||
new AsyncCallback<Map<CompetitorDTO, List<ManeuverDTO>>>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError("Error obtaining maneuvers: " + caught.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Map<CompetitorDAO, List<ManeuverDAO>> result) {
|
||||
public void onSuccess(Map<CompetitorDTO, List<ManeuverDTO>> result) {
|
||||
lastManeuverResult = result;
|
||||
if (maneuverMarkers != null) {
|
||||
removeAllManeuverMarkers();
|
||||
@@ -662,9 +662,9 @@ public class RaceMap implements TimeListener, CompetitorSelectionChangeListener,
|
||||
return result;
|
||||
}
|
||||
|
||||
private Iterable<CompetitorDAO> getCompetitorsToShow() {
|
||||
Iterable<CompetitorDAO> result;
|
||||
Iterable<CompetitorDAO> selection = competitorSelection.getSelectedCompetitors();
|
||||
private Iterable<CompetitorDTO> getCompetitorsToShow() {
|
||||
Iterable<CompetitorDTO> result;
|
||||
Iterable<CompetitorDTO> selection = competitorSelection.getSelectedCompetitors();
|
||||
if (!getSettings().isShowOnlySelectedCompetitors() || Util.isEmpty(selection)) {
|
||||
result = competitorSelection.getAllCompetitors();
|
||||
} else {
|
||||
@@ -673,7 +673,7 @@ public class RaceMap implements TimeListener, CompetitorSelectionChangeListener,
|
||||
return result;
|
||||
}
|
||||
|
||||
private String getColorString(CompetitorDAO competitorDAO) {
|
||||
private String getColorString(CompetitorDTO competitorDAO) {
|
||||
// TODO green no more than 70, red no less than 120
|
||||
return "#" + (Integer.toHexString(competitorDAO.hashCode()) + "000000").substring(0, 4).toUpperCase() + "00";
|
||||
}
|
||||
@@ -684,14 +684,14 @@ public class RaceMap implements TimeListener, CompetitorSelectionChangeListener,
|
||||
* up to the last fix with time point before <code>to</code>. The polyline is returned. Updates are applied to
|
||||
* {@link #lastShownFix}, {@link #firstShownFix} and {@link #tails}.
|
||||
*/
|
||||
protected Polyline createTailAndUpdateIndices(final CompetitorDAO competitorDAO, Date from, Date to) {
|
||||
protected Polyline createTailAndUpdateIndices(final CompetitorDTO competitorDAO, Date from, Date to) {
|
||||
List<LatLng> points = new ArrayList<LatLng>();
|
||||
List<GPSFixDAO> fixesForCompetitor = fixes.get(competitorDAO);
|
||||
List<GPSFixDTO> fixesForCompetitor = fixes.get(competitorDAO);
|
||||
int indexOfFirst = -1;
|
||||
int indexOfLast = -1;
|
||||
int i = 0;
|
||||
for (Iterator<GPSFixDAO> fixIter = fixesForCompetitor.iterator(); fixIter.hasNext() && indexOfLast == -1;) {
|
||||
GPSFixDAO fix = fixIter.next();
|
||||
for (Iterator<GPSFixDTO> fixIter = fixesForCompetitor.iterator(); fixIter.hasNext() && indexOfLast == -1;) {
|
||||
GPSFixDTO fix = fixIter.next();
|
||||
if (!fix.timepoint.before(to)) {
|
||||
indexOfLast = i;
|
||||
} else {
|
||||
@@ -761,15 +761,15 @@ public class RaceMap implements TimeListener, CompetitorSelectionChangeListener,
|
||||
}
|
||||
}
|
||||
|
||||
protected void showMarkDouglasPeuckerPoints(Map<CompetitorDAO, List<GPSFixDAO>> gpsFixPointMapForCompetitors) {
|
||||
protected void showMarkDouglasPeuckerPoints(Map<CompetitorDTO, List<GPSFixDTO>> gpsFixPointMapForCompetitors) {
|
||||
douglasMarkers = new HashSet<Marker>();
|
||||
if (map != null && gpsFixPointMapForCompetitors != null) {
|
||||
Set<CompetitorDAO> keySet = gpsFixPointMapForCompetitors.keySet();
|
||||
Iterator<CompetitorDAO> iter = keySet.iterator();
|
||||
Set<CompetitorDTO> keySet = gpsFixPointMapForCompetitors.keySet();
|
||||
Iterator<CompetitorDTO> iter = keySet.iterator();
|
||||
while (iter.hasNext()) {
|
||||
CompetitorDAO competitorDAO = iter.next();
|
||||
List<GPSFixDAO> gpsFix = gpsFixPointMapForCompetitors.get(competitorDAO);
|
||||
for (GPSFixDAO fix : gpsFix) {
|
||||
CompetitorDTO competitorDAO = iter.next();
|
||||
List<GPSFixDTO> gpsFix = gpsFixPointMapForCompetitors.get(competitorDAO);
|
||||
for (GPSFixDTO fix : gpsFix) {
|
||||
LatLng latLng = LatLng.newInstance(fix.position.latDeg, fix.position.lngDeg);
|
||||
MarkerOptions options = MarkerOptions.newInstance();
|
||||
options.setTitle(fix.timepoint+": "+fix.position+", "+fix.speedWithBearing.toString());
|
||||
@@ -781,15 +781,15 @@ public class RaceMap implements TimeListener, CompetitorSelectionChangeListener,
|
||||
}
|
||||
}
|
||||
|
||||
protected void showManeuvers(Map<CompetitorDAO, List<ManeuverDAO>> maneuvers) {
|
||||
protected void showManeuvers(Map<CompetitorDTO, List<ManeuverDTO>> maneuvers) {
|
||||
maneuverMarkers = new HashSet<Marker>();
|
||||
if (map != null && maneuvers != null) {
|
||||
Set<CompetitorDAO> keySet = maneuvers.keySet();
|
||||
Iterator<CompetitorDAO> iter = keySet.iterator();
|
||||
Set<CompetitorDTO> keySet = maneuvers.keySet();
|
||||
Iterator<CompetitorDTO> iter = keySet.iterator();
|
||||
while (iter.hasNext()) {
|
||||
CompetitorDAO competitorDAO = iter.next();
|
||||
List<ManeuverDAO> maneuversForCompetitor = maneuvers.get(competitorDAO);
|
||||
for (ManeuverDAO maneuver : maneuversForCompetitor) {
|
||||
CompetitorDTO competitorDAO = iter.next();
|
||||
List<ManeuverDTO> maneuversForCompetitor = maneuvers.get(competitorDAO);
|
||||
for (ManeuverDTO maneuver : maneuversForCompetitor) {
|
||||
if (getSettings().isShowManeuverType(maneuver.type)) {
|
||||
LatLng latLng = LatLng.newInstance(maneuver.position.latDeg, maneuver.position.lngDeg);
|
||||
MarkerOptions options = MarkerOptions.newInstance();
|
||||
@@ -807,8 +807,8 @@ public class RaceMap implements TimeListener, CompetitorSelectionChangeListener,
|
||||
}
|
||||
}
|
||||
|
||||
protected Date getTimepointOfFirstNonExtrapolated(List<GPSFixDAO> fixesForCompetitor) {
|
||||
for (GPSFixDAO fix : fixesForCompetitor) {
|
||||
protected Date getTimepointOfFirstNonExtrapolated(List<GPSFixDTO> fixesForCompetitor) {
|
||||
for (GPSFixDTO fix : fixesForCompetitor) {
|
||||
if (!fix.extrapolated) {
|
||||
return fix.timepoint;
|
||||
}
|
||||
@@ -816,11 +816,11 @@ public class RaceMap implements TimeListener, CompetitorSelectionChangeListener,
|
||||
return null;
|
||||
}
|
||||
|
||||
protected Date getTimepointOfLastNonExtrapolated(List<GPSFixDAO> fixesForCompetitor) {
|
||||
protected Date getTimepointOfLastNonExtrapolated(List<GPSFixDTO> fixesForCompetitor) {
|
||||
if (!fixesForCompetitor.isEmpty()) {
|
||||
for (ListIterator<GPSFixDAO> fixIter = fixesForCompetitor.listIterator(fixesForCompetitor.size() - 1); fixIter
|
||||
for (ListIterator<GPSFixDTO> fixIter = fixesForCompetitor.listIterator(fixesForCompetitor.size() - 1); fixIter
|
||||
.hasPrevious();) {
|
||||
GPSFixDAO fix = fixIter.previous();
|
||||
GPSFixDTO fix = fixIter.previous();
|
||||
if (!fix.extrapolated) {
|
||||
return fix.timepoint;
|
||||
}
|
||||
@@ -837,13 +837,13 @@ public class RaceMap implements TimeListener, CompetitorSelectionChangeListener,
|
||||
* Additionally, if the fix is in between the fixes shown in the competitor's tail, the tail is adjusted by
|
||||
* inserting the corresponding fix.
|
||||
*/
|
||||
protected void mergeFixes(CompetitorDAO competitorDAO, List<GPSFixDAO> mergeThis) {
|
||||
List<GPSFixDAO> intoThis = fixes.get(competitorDAO);
|
||||
protected void mergeFixes(CompetitorDTO competitorDAO, List<GPSFixDTO> mergeThis) {
|
||||
List<GPSFixDTO> intoThis = fixes.get(competitorDAO);
|
||||
int indexOfFirstShownFix = firstShownFix.get(competitorDAO) == null ? -1 : firstShownFix.get(competitorDAO);
|
||||
int indexOfLastShownFix = lastShownFix.get(competitorDAO) == null ? -1 : lastShownFix.get(competitorDAO);
|
||||
Polyline tail = tails.get(competitorDAO);
|
||||
int intoThisIndex = 0;
|
||||
for (GPSFixDAO mergeThisFix : mergeThis) {
|
||||
for (GPSFixDTO mergeThisFix : mergeThis) {
|
||||
while (intoThisIndex < intoThis.size()
|
||||
&& intoThis.get(intoThisIndex).timepoint.before(mergeThisFix.timepoint)) {
|
||||
intoThisIndex++;
|
||||
@@ -868,7 +868,7 @@ public class RaceMap implements TimeListener, CompetitorSelectionChangeListener,
|
||||
}
|
||||
}
|
||||
|
||||
protected GPSFixDAO getBoatFix(CompetitorDAO competitorDAO) {
|
||||
protected GPSFixDTO getBoatFix(CompetitorDTO competitorDAO) {
|
||||
return fixes.get(competitorDAO).get(lastShownFix.get(competitorDAO));
|
||||
}
|
||||
|
||||
@@ -890,8 +890,8 @@ public class RaceMap implements TimeListener, CompetitorSelectionChangeListener,
|
||||
*
|
||||
* When this method returns, {@link #firstShownFix} and {@link #lastShownFix} have been updated accordingly.
|
||||
*/
|
||||
protected void updateTail(Polyline tail, CompetitorDAO competitorDAO, Date from, Date to) {
|
||||
List<GPSFixDAO> fixesForCompetitor = fixes.get(competitorDAO);
|
||||
protected void updateTail(Polyline tail, CompetitorDTO competitorDAO, Date from, Date to) {
|
||||
List<GPSFixDTO> fixesForCompetitor = fixes.get(competitorDAO);
|
||||
int indexOfFirstShownFix = firstShownFix.get(competitorDAO) == null ? -1 : firstShownFix.get(competitorDAO);
|
||||
while (indexOfFirstShownFix != -1 && tail.getVertexCount() > 0
|
||||
&& fixesForCompetitor.get(indexOfFirstShownFix).timepoint.before(from)) {
|
||||
@@ -903,7 +903,7 @@ public class RaceMap implements TimeListener, CompetitorSelectionChangeListener,
|
||||
// and insert corresponding vertices into the polyline
|
||||
while (indexOfFirstShownFix > 0 && !fixesForCompetitor.get(indexOfFirstShownFix - 1).timepoint.before(from)) {
|
||||
indexOfFirstShownFix--;
|
||||
GPSFixDAO fix = fixesForCompetitor.get(indexOfFirstShownFix);
|
||||
GPSFixDTO fix = fixesForCompetitor.get(indexOfFirstShownFix);
|
||||
tail.insertVertex(0, LatLng.newInstance(fix.position.latDeg, fix.position.lngDeg));
|
||||
}
|
||||
// now adjust the polylines tail: remove excess vertices that are after "to"
|
||||
@@ -919,7 +919,7 @@ public class RaceMap implements TimeListener, CompetitorSelectionChangeListener,
|
||||
while (indexOfLastShownFix < fixesForCompetitor.size() - 1
|
||||
&& !fixesForCompetitor.get(indexOfLastShownFix + 1).timepoint.after(to)) {
|
||||
indexOfLastShownFix++;
|
||||
GPSFixDAO fix = fixesForCompetitor.get(indexOfLastShownFix);
|
||||
GPSFixDTO fix = fixesForCompetitor.get(indexOfLastShownFix);
|
||||
tail.insertVertex(tail.getVertexCount(), LatLng.newInstance(fix.position.latDeg, fix.position.lngDeg));
|
||||
}
|
||||
firstShownFix.put(competitorDAO, indexOfFirstShownFix);
|
||||
@@ -931,13 +931,13 @@ public class RaceMap implements TimeListener, CompetitorSelectionChangeListener,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addedToSelection(CompetitorDAO competitor) {
|
||||
public void addedToSelection(CompetitorDTO competitor) {
|
||||
if (getSettings().isShowOnlySelectedCompetitors()) {
|
||||
if (Util.size(competitorSelection.getSelectedCompetitors()) == 1) {
|
||||
// first competitors selected; remove all others from map
|
||||
Iterator<Map.Entry<CompetitorDAO, Marker>> i = boatMarkers.entrySet().iterator();
|
||||
Iterator<Map.Entry<CompetitorDTO, Marker>> i = boatMarkers.entrySet().iterator();
|
||||
while (i.hasNext()) {
|
||||
Entry<CompetitorDAO, Marker> next = i.next();
|
||||
Entry<CompetitorDTO, Marker> next = i.next();
|
||||
if (!next.getKey().equals(competitor)) {
|
||||
map.removeOverlay(next.getValue());
|
||||
removeTail(next.getKey());
|
||||
@@ -969,14 +969,14 @@ public class RaceMap implements TimeListener, CompetitorSelectionChangeListener,
|
||||
* Consistently removes the <code>competitor</code>'s tail from {@link #tails} and from the map, and the corresponding position
|
||||
* data from {@link #firstShownFix} and {@link #lastShownFix}.
|
||||
*/
|
||||
private void removeTail(CompetitorDAO competitor) {
|
||||
private void removeTail(CompetitorDTO competitor) {
|
||||
map.removeOverlay(tails.remove(competitor));
|
||||
firstShownFix.remove(competitor);
|
||||
lastShownFix.remove(competitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removedFromSelection(CompetitorDAO competitor) {
|
||||
public void removedFromSelection(CompetitorDTO competitor) {
|
||||
if (getSettings().isShowOnlySelectedCompetitors()) {
|
||||
// if selection is now empty, show all competitors
|
||||
if (Util.isEmpty(competitorSelection.getSelectedCompetitors())) {
|
||||
|
||||
+15
-15
@@ -30,11 +30,11 @@ import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.client.TimeListener;
|
||||
import com.sap.sailing.gwt.ui.client.Timer;
|
||||
import com.sap.sailing.gwt.ui.leaderboard.SmallWindHistoryPanel;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.PositionDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.QuickRankDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.PositionDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.QuickRankDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.components.SettingsDialog;
|
||||
import com.sap.sailing.server.api.EventNameAndRaceName;
|
||||
|
||||
@@ -72,7 +72,7 @@ public class RaceMapPanel extends FormPanel implements EventDisplayer, TimeListe
|
||||
raceListBox = new RacesListBoxPanel(eventRefresher, stringMessages);
|
||||
raceListBox.addRaceSelectionChangeListener(this);
|
||||
grid.setWidget(0, 0, raceListBox);
|
||||
PositionDAO pos = new PositionDAO();
|
||||
PositionDTO pos = new PositionDTO();
|
||||
if (!raceMap.boatMarkers.isEmpty()) {
|
||||
LatLng latLng = raceMap.boatMarkers.values().iterator().next().getLatLng();
|
||||
pos.latDeg = latLng.getLatitude();
|
||||
@@ -112,14 +112,14 @@ public class RaceMapPanel extends FormPanel implements EventDisplayer, TimeListe
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillEvents(List<EventDAO> result) {
|
||||
public void fillEvents(List<EventDTO> result) {
|
||||
raceListBox.fillEvents(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRaceSelectionChange(List<Triple<EventDAO, RegattaDAO, RaceDAO>> selectedRaces) {
|
||||
public void onRaceSelectionChange(List<Triple<EventDTO, RegattaDTO, RaceDTO>> selectedRaces) {
|
||||
if (!selectedRaces.isEmpty() && selectedRaces.get(selectedRaces.size() - 1) != null) {
|
||||
RaceDAO raceDAO = selectedRaces.get(selectedRaces.size() - 1).getC();
|
||||
RaceDTO raceDAO = selectedRaces.get(selectedRaces.size() - 1).getC();
|
||||
competitorSelectionProvider.setCompetitors(raceDAO.competitors);
|
||||
if (raceDAO.startOfRace != null) {
|
||||
timePanel.timeChanged(raceDAO.startOfRace);
|
||||
@@ -130,7 +130,7 @@ public class RaceMapPanel extends FormPanel implements EventDisplayer, TimeListe
|
||||
raceMap.onRaceSelectionChange(selectedRaces);
|
||||
}
|
||||
|
||||
private void updateSlider(RaceDAO selectedRace) {
|
||||
private void updateSlider(RaceDTO selectedRace) {
|
||||
if (selectedRace.startOfTracking != null) {
|
||||
timePanel.setMin(selectedRace.startOfTracking);
|
||||
}
|
||||
@@ -142,20 +142,20 @@ public class RaceMapPanel extends FormPanel implements EventDisplayer, TimeListe
|
||||
@Override
|
||||
public void timeChanged(final Date date) {
|
||||
if (date != null) {
|
||||
List<Triple<EventDAO, RegattaDAO, RaceDAO>> selection = raceListBox.getSelectedEventAndRace();
|
||||
List<Triple<EventDTO, RegattaDTO, RaceDTO>> selection = raceListBox.getSelectedEventAndRace();
|
||||
if (!selection.isEmpty()) {
|
||||
EventDAO event = selection.get(selection.size() - 1).getA();
|
||||
RaceDAO race = selection.get(selection.size() - 1).getC();
|
||||
EventDTO event = selection.get(selection.size() - 1).getA();
|
||||
RaceDTO race = selection.get(selection.size() - 1).getC();
|
||||
if (event != null && race != null) {
|
||||
sailingService.getQuickRanks(new EventNameAndRaceName(event.name, race.name), date,
|
||||
new AsyncCallback<List<QuickRankDAO>>() {
|
||||
new AsyncCallback<List<QuickRankDTO>>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError("Error obtaining quick rankings: " + caught.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<QuickRankDAO> result) {
|
||||
public void onSuccess(List<QuickRankDTO> result) {
|
||||
quickRanksListBox.fillQuickRanks(result);
|
||||
}
|
||||
});
|
||||
|
||||
+5
-5
@@ -13,7 +13,7 @@ import com.sap.sailing.domain.common.LegType;
|
||||
import com.sap.sailing.domain.common.ManeuverType;
|
||||
import com.sap.sailing.domain.common.Tack;
|
||||
import com.sap.sailing.domain.common.impl.Util.Pair;
|
||||
import com.sap.sailing.gwt.ui.shared.GPSFixDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.GPSFixDTO;
|
||||
|
||||
public class RaceMapResources {
|
||||
/**
|
||||
@@ -141,7 +141,7 @@ public class RaceMapResources {
|
||||
maneuverIconsForTypeAndTargetTack.put(new Pair<ManeuverType, Tack>(ManeuverType.PENALTY_CIRCLE, Tack.PORT), penaltyCircleToPortIcon);
|
||||
}
|
||||
|
||||
public ImageTransformer getBoatImageTransformer(GPSFixDAO boatFix, boolean highlighted) {
|
||||
public ImageTransformer getBoatImageTransformer(GPSFixDTO boatFix, boolean highlighted) {
|
||||
if (boatFix.tack == Tack.PORT) {
|
||||
if (LegType.DOWNWIND == boatFix.legType) {
|
||||
if (highlighted) {
|
||||
@@ -173,11 +173,11 @@ public class RaceMapResources {
|
||||
}
|
||||
}
|
||||
|
||||
public String getBoatImageURL(GPSFixDAO boatFix, boolean highlighted) {
|
||||
public String getBoatImageURL(GPSFixDTO boatFix, boolean highlighted) {
|
||||
return getBoatImageURL(getBoatImageTransformer(boatFix, highlighted), boatFix);
|
||||
}
|
||||
|
||||
public String getBoatImageURL(ImageTransformer boatImageTransformer, GPSFixDAO boatFix) {
|
||||
public String getBoatImageURL(ImageTransformer boatImageTransformer, GPSFixDTO boatFix) {
|
||||
double realBoatSizeScaleFactor = getRealBoatSizeScaleFactor();
|
||||
return boatImageTransformer.getTransformedImageURL(boatFix.speedWithBearing.bearingInDegrees, realBoatSizeScaleFactor);
|
||||
}
|
||||
@@ -205,7 +205,7 @@ public class RaceMapResources {
|
||||
return realBoatSizeScaleFactor;
|
||||
}
|
||||
|
||||
public Icon getBoatImageIcon(GPSFixDAO boatFix, boolean highlighted) {
|
||||
public Icon getBoatImageIcon(GPSFixDTO boatFix, boolean highlighted) {
|
||||
ImageTransformer boatImageTransformer = getBoatImageTransformer(boatFix, highlighted);
|
||||
Icon icon = Icon.newInstance(getBoatImageURL(boatImageTransformer, boatFix));
|
||||
icon.setIconAnchor(boatImageTransformer.getAnchor(getRealBoatSizeScaleFactor()));
|
||||
|
||||
+4
-4
@@ -4,15 +4,15 @@ import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.common.impl.Util.Triple;
|
||||
import com.sap.sailing.gwt.ui.client.RaceSelectionChangeListener;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaDTO;
|
||||
|
||||
public interface RaceSelectionProvider {
|
||||
/**
|
||||
* @return a non-<code>null</code> list which may be empty
|
||||
*/
|
||||
List<Triple<EventDAO, RegattaDAO, RaceDAO>> getSelectedEventAndRace();
|
||||
List<Triple<EventDTO, RegattaDTO, RaceDTO>> getSelectedEventAndRace();
|
||||
|
||||
void addRaceSelectionChangeListener(RaceSelectionChangeListener listener);
|
||||
|
||||
|
||||
+22
-22
@@ -22,13 +22,13 @@ import com.sap.sailing.gwt.ui.client.EventDisplayer;
|
||||
import com.sap.sailing.gwt.ui.client.EventRefresher;
|
||||
import com.sap.sailing.gwt.ui.client.RaceSelectionChangeListener;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaDTO;
|
||||
|
||||
public class RacesListBoxPanel extends FormPanel implements RaceSelectionProvider, EventDisplayer {
|
||||
private final Set<RaceSelectionChangeListener> raceSelectionChangeListeners;
|
||||
private final List<Triple<EventDAO, RegattaDAO, RaceDAO>> raceList;
|
||||
private final List<Triple<EventDTO, RegattaDTO, RaceDTO>> raceList;
|
||||
private final ListBox raceListBox;
|
||||
private final EventRefresher eventRefresher;
|
||||
private final StringMessages stringConstants;
|
||||
@@ -47,15 +47,15 @@ public class RacesListBoxPanel extends FormPanel implements RaceSelectionProvide
|
||||
raceListBox.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
Triple<EventDAO, RegattaDAO, RaceDAO> selectedRace = getSelectedRace();
|
||||
List<Triple<EventDAO, RegattaDAO, RaceDAO>> selectedRacesCollection = Collections.emptyList();
|
||||
Triple<EventDTO, RegattaDTO, RaceDTO> selectedRace = getSelectedRace();
|
||||
List<Triple<EventDTO, RegattaDTO, RaceDTO>> selectedRacesCollection = Collections.emptyList();
|
||||
if (selectedRace != null) {
|
||||
selectedRacesCollection = Collections.singletonList(selectedRace);
|
||||
}
|
||||
fireRaceSelectionChanged(selectedRacesCollection);
|
||||
}
|
||||
});
|
||||
raceList = new ArrayList<Triple<EventDAO, RegattaDAO, RaceDAO>>();
|
||||
raceList = new ArrayList<Triple<EventDTO, RegattaDTO, RaceDTO>>();
|
||||
VerticalPanel vp = new VerticalPanel();
|
||||
HorizontalPanel labelAndRefreshButton = new HorizontalPanel();
|
||||
labelAndRefreshButton.setSpacing(20);
|
||||
@@ -73,9 +73,9 @@ public class RacesListBoxPanel extends FormPanel implements RaceSelectionProvide
|
||||
setWidget(vp);
|
||||
}
|
||||
|
||||
private Triple<EventDAO, RegattaDAO, RaceDAO> getSelectedRace() {
|
||||
private Triple<EventDTO, RegattaDTO, RaceDTO> getSelectedRace() {
|
||||
int i = raceListBox.getSelectedIndex();
|
||||
Triple<EventDAO, RegattaDAO, RaceDAO> result = null;
|
||||
Triple<EventDTO, RegattaDTO, RaceDTO> result = null;
|
||||
if (i >= 0) {
|
||||
result = raceList.get(i);
|
||||
}
|
||||
@@ -83,36 +83,36 @@ public class RacesListBoxPanel extends FormPanel implements RaceSelectionProvide
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillEvents(List<EventDAO> result) {
|
||||
public void fillEvents(List<EventDTO> result) {
|
||||
raceList.clear();
|
||||
raceListBox.clear();
|
||||
for (EventDAO event : result) {
|
||||
for (RegattaDAO regatta : event.regattas) {
|
||||
for (RaceDAO race : regatta.races) {
|
||||
raceList.add(new Triple<EventDAO, RegattaDAO, RaceDAO>(event, regatta, race));
|
||||
for (EventDTO event : result) {
|
||||
for (RegattaDTO regatta : event.regattas) {
|
||||
for (RaceDTO race : regatta.races) {
|
||||
raceList.add(new Triple<EventDTO, RegattaDTO, RaceDTO>(event, regatta, race));
|
||||
}
|
||||
}
|
||||
}
|
||||
Collections.sort(raceList, new Comparator<Triple<EventDAO, RegattaDAO, RaceDAO>>() {
|
||||
Collections.sort(raceList, new Comparator<Triple<EventDTO, RegattaDTO, RaceDTO>>() {
|
||||
@Override
|
||||
public int compare(Triple<EventDAO, RegattaDAO, RaceDAO> o1, Triple<EventDAO, RegattaDAO, RaceDAO> o2) {
|
||||
public int compare(Triple<EventDTO, RegattaDTO, RaceDTO> o1, Triple<EventDTO, RegattaDTO, RaceDTO> o2) {
|
||||
String name1 = RacesListBoxPanel.this.toString(o1);
|
||||
String name2 = RacesListBoxPanel.this.toString(o2);
|
||||
return name1.compareTo(name2);
|
||||
}
|
||||
|
||||
});
|
||||
for (Triple<EventDAO, RegattaDAO, RaceDAO> p : raceList) {
|
||||
for (Triple<EventDTO, RegattaDTO, RaceDTO> p : raceList) {
|
||||
raceListBox.addItem(toString(p));
|
||||
}
|
||||
fireRaceSelectionChanged(getSelectedEventAndRace());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Triple<EventDAO, RegattaDAO, RaceDAO>> getSelectedEventAndRace() {
|
||||
public List<Triple<EventDTO, RegattaDTO, RaceDTO>> getSelectedEventAndRace() {
|
||||
int i=0;
|
||||
List<Triple<EventDAO, RegattaDAO, RaceDAO>> result = new ArrayList<Triple<EventDAO,RegattaDAO,RaceDAO>>();
|
||||
for (Triple<EventDAO, RegattaDAO, RaceDAO> triple : raceList) {
|
||||
List<Triple<EventDTO, RegattaDTO, RaceDTO>> result = new ArrayList<Triple<EventDTO,RegattaDTO,RaceDTO>>();
|
||||
for (Triple<EventDTO, RegattaDTO, RaceDTO> triple : raceList) {
|
||||
if (raceListBox.isItemSelected(i)) {
|
||||
result.add(triple);
|
||||
}
|
||||
@@ -131,13 +131,13 @@ public class RacesListBoxPanel extends FormPanel implements RaceSelectionProvide
|
||||
raceSelectionChangeListeners.remove(listener);
|
||||
}
|
||||
|
||||
private void fireRaceSelectionChanged(List<Triple<EventDAO, RegattaDAO, RaceDAO>> selectedRaces) {
|
||||
private void fireRaceSelectionChanged(List<Triple<EventDTO, RegattaDTO, RaceDTO>> selectedRaces) {
|
||||
for (RaceSelectionChangeListener listener : raceSelectionChangeListeners) {
|
||||
listener.onRaceSelectionChange(selectedRaces);
|
||||
}
|
||||
}
|
||||
|
||||
private String toString(Triple<EventDAO, RegattaDAO, RaceDAO> pair) {
|
||||
private String toString(Triple<EventDTO, RegattaDTO, RaceDTO> pair) {
|
||||
return pair.getA().name+" - "+pair.getC().name+(pair.getC().currentlyTracked ? " ("+stringConstants.tracked()+")" : "");
|
||||
}
|
||||
|
||||
|
||||
+32
-32
@@ -38,9 +38,9 @@ import com.sap.sailing.gwt.ui.client.ErrorReporter;
|
||||
import com.sap.sailing.gwt.ui.client.EventRefresher;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.SwissTimingConfigurationDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.SwissTimingRaceRecordDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.SwissTimingConfigurationDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.SwissTimingRaceRecordDTO;
|
||||
|
||||
/**
|
||||
* Allows the user to start and stop tracking of events, regattas and races using the TracTrac connector. In particular,
|
||||
@@ -59,12 +59,12 @@ public class SwissTimingEventManagementPanel extends AbstractEventManagementPane
|
||||
private final IntegerBox portIntegerbox;
|
||||
private final TextBox hostnameTextbox;
|
||||
private final TextBox filterEventsTextbox;
|
||||
private final ListDataProvider<SwissTimingRaceRecordDAO> raceList;
|
||||
private final CellTable<SwissTimingRaceRecordDAO> raceTable;
|
||||
private final Map<String, SwissTimingConfigurationDAO> previousConfigurations;
|
||||
private final ListDataProvider<SwissTimingRaceRecordDTO> raceList;
|
||||
private final CellTable<SwissTimingRaceRecordDTO> raceTable;
|
||||
private final Map<String, SwissTimingConfigurationDTO> previousConfigurations;
|
||||
private final ListBox previousConfigurationsComboBox;
|
||||
private final CheckBox canSendRequestsCheckbox;
|
||||
private final List<SwissTimingRaceRecordDAO> availableSwissTimingRaces = new ArrayList<SwissTimingRaceRecordDAO>();
|
||||
private final List<SwissTimingRaceRecordDTO> availableSwissTimingRaces = new ArrayList<SwissTimingRaceRecordDTO>();
|
||||
|
||||
public SwissTimingEventManagementPanel(final SailingServiceAsync sailingService, ErrorReporter errorReporter,
|
||||
EventRefresher eventRefresher, StringMessages stringConstants) {
|
||||
@@ -89,7 +89,7 @@ public class SwissTimingEventManagementPanel extends AbstractEventManagementPane
|
||||
Label lblPredefined = new Label(stringConstants.connections() +":");
|
||||
connectionsGrid.setWidget(0, 0, lblPredefined);
|
||||
|
||||
previousConfigurations = new HashMap<String, SwissTimingConfigurationDAO>();
|
||||
previousConfigurations = new HashMap<String, SwissTimingConfigurationDTO>();
|
||||
previousConfigurationsComboBox = new ListBox();
|
||||
connectionsGrid.setWidget(0, 1, previousConfigurationsComboBox);
|
||||
previousConfigurationsComboBox.addChangeHandler(new ChangeHandler() {
|
||||
@@ -139,16 +139,16 @@ public class SwissTimingEventManagementPanel extends AbstractEventManagementPane
|
||||
});
|
||||
|
||||
|
||||
TextColumn<SwissTimingRaceRecordDAO> raceNameColumn = new TextColumn<SwissTimingRaceRecordDAO>() {
|
||||
TextColumn<SwissTimingRaceRecordDTO> raceNameColumn = new TextColumn<SwissTimingRaceRecordDTO>() {
|
||||
@Override
|
||||
public String getValue(SwissTimingRaceRecordDAO object) {
|
||||
public String getValue(SwissTimingRaceRecordDTO object) {
|
||||
return object.ID;
|
||||
}
|
||||
};
|
||||
|
||||
TextColumn<SwissTimingRaceRecordDAO> raceStartTrackingColumn = new TextColumn<SwissTimingRaceRecordDAO>() {
|
||||
TextColumn<SwissTimingRaceRecordDTO> raceStartTrackingColumn = new TextColumn<SwissTimingRaceRecordDTO>() {
|
||||
@Override
|
||||
public String getValue(SwissTimingRaceRecordDAO object) {
|
||||
public String getValue(SwissTimingRaceRecordDTO object) {
|
||||
return object.raceStartTime==null?"":dateFormatter.render(object.raceStartTime) + " " + timeFormatter.render(object.raceStartTime);
|
||||
}
|
||||
};
|
||||
@@ -203,16 +203,16 @@ public class SwissTimingEventManagementPanel extends AbstractEventManagementPane
|
||||
raceStartTrackingColumn.setSortable(true);
|
||||
|
||||
AdminConsoleTableResources tableRes = GWT.create(AdminConsoleTableResources.class);
|
||||
raceTable = new CellTable<SwissTimingRaceRecordDAO>(/* pageSize */ 200, tableRes);
|
||||
raceTable = new CellTable<SwissTimingRaceRecordDTO>(/* pageSize */ 200, tableRes);
|
||||
raceTable.addColumn(raceNameColumn, stringConstants.name());
|
||||
raceTable.addColumn(raceStartTrackingColumn, stringConstants.raceStartTimeColumn());
|
||||
raceTable.setWidth("300px");
|
||||
raceTable.setSelectionModel(new MultiSelectionModel<SwissTimingRaceRecordDAO>() {});
|
||||
raceTable.setSelectionModel(new MultiSelectionModel<SwissTimingRaceRecordDTO>() {});
|
||||
|
||||
racesHorizontalPanel.add(raceTable);
|
||||
racesHorizontalPanel.add(trackPanel);
|
||||
|
||||
raceList = new ListDataProvider<SwissTimingRaceRecordDAO>();
|
||||
raceList = new ListDataProvider<SwissTimingRaceRecordDTO>();
|
||||
raceList.addDataDisplay(raceTable);
|
||||
Handler columnSortHandler = getRaceTableColumnSortHandler(raceList.getList(), raceNameColumn, raceStartTrackingColumn);
|
||||
raceTable.addColumnSortHandler(columnSortHandler);
|
||||
@@ -246,18 +246,18 @@ public class SwissTimingEventManagementPanel extends AbstractEventManagementPane
|
||||
|
||||
}
|
||||
|
||||
private ListHandler<SwissTimingRaceRecordDAO> getRaceTableColumnSortHandler(List<SwissTimingRaceRecordDAO> raceRecords,
|
||||
Column<SwissTimingRaceRecordDAO, ?> nameColumn, Column<SwissTimingRaceRecordDAO, ?> trackingStartColumn) {
|
||||
ListHandler<SwissTimingRaceRecordDAO> result = new ListHandler<SwissTimingRaceRecordDAO>(raceRecords);
|
||||
result.setComparator(nameColumn, new Comparator<SwissTimingRaceRecordDAO>() {
|
||||
private ListHandler<SwissTimingRaceRecordDTO> getRaceTableColumnSortHandler(List<SwissTimingRaceRecordDTO> raceRecords,
|
||||
Column<SwissTimingRaceRecordDTO, ?> nameColumn, Column<SwissTimingRaceRecordDTO, ?> trackingStartColumn) {
|
||||
ListHandler<SwissTimingRaceRecordDTO> result = new ListHandler<SwissTimingRaceRecordDTO>(raceRecords);
|
||||
result.setComparator(nameColumn, new Comparator<SwissTimingRaceRecordDTO>() {
|
||||
@Override
|
||||
public int compare(SwissTimingRaceRecordDAO o1, SwissTimingRaceRecordDAO o2) {
|
||||
public int compare(SwissTimingRaceRecordDTO o1, SwissTimingRaceRecordDTO o2) {
|
||||
return o1.ID.compareTo(o2.ID);
|
||||
}
|
||||
});
|
||||
result.setComparator(trackingStartColumn, new Comparator<SwissTimingRaceRecordDAO>() {
|
||||
result.setComparator(trackingStartColumn, new Comparator<SwissTimingRaceRecordDTO>() {
|
||||
@Override
|
||||
public int compare(SwissTimingRaceRecordDAO o1, SwissTimingRaceRecordDAO o2) {
|
||||
public int compare(SwissTimingRaceRecordDTO o1, SwissTimingRaceRecordDTO o2) {
|
||||
return o1.raceStartTime == null ? -1 : o2.raceStartTime == null ? 1 : o1.raceStartTime
|
||||
.compareTo(o2.raceStartTime);
|
||||
}
|
||||
@@ -266,7 +266,7 @@ public class SwissTimingEventManagementPanel extends AbstractEventManagementPane
|
||||
}
|
||||
|
||||
private void fillConfigurations() {
|
||||
sailingService.getPreviousSwissTimingConfigurations(new AsyncCallback<List<SwissTimingConfigurationDAO>>() {
|
||||
sailingService.getPreviousSwissTimingConfigurations(new AsyncCallback<List<SwissTimingConfigurationDTO>>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError("Remote Procedure Call getPreviousConfigurations() - Failure: "
|
||||
@@ -274,11 +274,11 @@ public class SwissTimingEventManagementPanel extends AbstractEventManagementPane
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<SwissTimingConfigurationDAO> result) {
|
||||
public void onSuccess(List<SwissTimingConfigurationDTO> result) {
|
||||
while (previousConfigurationsComboBox.getItemCount() > 0) {
|
||||
previousConfigurationsComboBox.removeItem(0);
|
||||
}
|
||||
for (SwissTimingConfigurationDAO stConfig : result) {
|
||||
for (SwissTimingConfigurationDTO stConfig : result) {
|
||||
previousConfigurations.put(stConfig.name, stConfig);
|
||||
previousConfigurationsComboBox.addItem(stConfig.name);
|
||||
}
|
||||
@@ -294,7 +294,7 @@ public class SwissTimingEventManagementPanel extends AbstractEventManagementPane
|
||||
final int port = portIntegerbox.getValue();
|
||||
final boolean canSendRequests = canSendRequestsCheckbox.getValue();
|
||||
sailingService.listSwissTimingRaces(hostname, port, canSendRequests,
|
||||
new AsyncCallback<List<SwissTimingRaceRecordDAO>>() {
|
||||
new AsyncCallback<List<SwissTimingRaceRecordDTO>>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
SwissTimingEventManagementPanel.this.errorReporter.reportError("Error trying to list races: "
|
||||
@@ -302,7 +302,7 @@ public class SwissTimingEventManagementPanel extends AbstractEventManagementPane
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(final List<SwissTimingRaceRecordDAO> result) {
|
||||
public void onSuccess(final List<SwissTimingRaceRecordDTO> result) {
|
||||
availableSwissTimingRaces.clear();
|
||||
if (result != null)
|
||||
availableSwissTimingRaces.addAll(result);
|
||||
@@ -325,7 +325,7 @@ public class SwissTimingEventManagementPanel extends AbstractEventManagementPane
|
||||
@Override
|
||||
public void onSuccess(Void voidResult) {
|
||||
// refresh list of previous configurations
|
||||
SwissTimingConfigurationDAO stConfig = new SwissTimingConfigurationDAO(configName,
|
||||
SwissTimingConfigurationDTO stConfig = new SwissTimingConfigurationDTO(configName,
|
||||
hostname, port, canSendRequests);
|
||||
if (previousConfigurations.put(stConfig.name, stConfig) == null) {
|
||||
previousConfigurationsComboBox.addItem(stConfig.name);
|
||||
@@ -339,7 +339,7 @@ public class SwissTimingEventManagementPanel extends AbstractEventManagementPane
|
||||
private void trackSelectedRaces(boolean trackWind, boolean correctWindByDeclination) {
|
||||
String hostname = hostnameTextbox.getValue();
|
||||
int port = portIntegerbox.getValue();
|
||||
for (final SwissTimingRaceRecordDAO rr : raceList.getList()) {
|
||||
for (final SwissTimingRaceRecordDTO rr : raceList.getList()) {
|
||||
if (raceTable.getSelectionModel().isSelected(rr)) {
|
||||
sailingService.trackWithSwissTiming(rr, hostname, port, /* TODO canSendRequests */false, trackWind,
|
||||
correctWindByDeclination, new AsyncCallback<Void>() {
|
||||
@@ -360,7 +360,7 @@ public class SwissTimingEventManagementPanel extends AbstractEventManagementPane
|
||||
|
||||
private void updatePanelFromSelectedStoredConfiguration() {
|
||||
if (previousConfigurationsComboBox.getSelectedIndex() >= 0) {
|
||||
SwissTimingConfigurationDAO stConfig = previousConfigurations.get(previousConfigurationsComboBox
|
||||
SwissTimingConfigurationDTO stConfig = previousConfigurations.get(previousConfigurationsComboBox
|
||||
.getItemText(previousConfigurationsComboBox.getSelectedIndex()));
|
||||
if (stConfig != null) {
|
||||
hostnameTextbox.setValue(stConfig.hostname);
|
||||
@@ -371,7 +371,7 @@ public class SwissTimingEventManagementPanel extends AbstractEventManagementPane
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillEvents(List<EventDAO> result) {
|
||||
public void fillEvents(List<EventDTO> result) {
|
||||
trackedEventsComposite.fillEvents(result);
|
||||
}
|
||||
|
||||
@@ -379,7 +379,7 @@ public class SwissTimingEventManagementPanel extends AbstractEventManagementPane
|
||||
List<String> wordsToFilter = Arrays.asList(text.split(" "));
|
||||
raceList.getList().clear();
|
||||
if (text != null && !text.isEmpty()) {
|
||||
for (SwissTimingRaceRecordDAO triple : availableSwissTimingRaces) {
|
||||
for (SwissTimingRaceRecordDTO triple : availableSwissTimingRaces) {
|
||||
boolean failed = textContainingStringsToCheck(wordsToFilter, triple.ID);
|
||||
if (!failed) {
|
||||
raceList.getList().add(triple);
|
||||
|
||||
+35
-35
@@ -39,9 +39,9 @@ import com.sap.sailing.gwt.ui.client.ErrorReporter;
|
||||
import com.sap.sailing.gwt.ui.client.EventRefresher;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.TracTracConfigurationDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.TracTracRaceRecordDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.TracTracConfigurationDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.TracTracRaceRecordDTO;
|
||||
|
||||
/**
|
||||
* Allows the user to start and stop tracking of events, regattas and races using the TracTrac connector. In particular,
|
||||
@@ -66,18 +66,18 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel {
|
||||
private final TextBox hostnameTextbox;
|
||||
private final TextBox eventNameTextbox;
|
||||
private final TextBox filterEventsTextbox;
|
||||
private final ListDataProvider<TracTracRaceRecordDAO> raceList;
|
||||
private final CellTable<TracTracRaceRecordDAO> raceTable;
|
||||
private final Map<String, TracTracConfigurationDAO> previousConfigurations;
|
||||
private final ListDataProvider<TracTracRaceRecordDTO> raceList;
|
||||
private final CellTable<TracTracRaceRecordDTO> raceTable;
|
||||
private final Map<String, TracTracConfigurationDTO> previousConfigurations;
|
||||
private final ListBox previousConfigurationsComboBox;
|
||||
private final Grid grid;
|
||||
private final List<TracTracRaceRecordDAO> availableTracTracRaces;
|
||||
private final List<TracTracRaceRecordDTO> availableTracTracRaces;
|
||||
|
||||
public TracTracEventManagementPanel(final SailingServiceAsync sailingService, ErrorReporter errorReporter,
|
||||
EventRefresher eventRefresher, StringMessages stringConstants) {
|
||||
super(sailingService, eventRefresher, errorReporter, stringConstants);
|
||||
this.errorReporter = errorReporter;
|
||||
availableTracTracRaces = new ArrayList<TracTracRaceRecordDAO>();
|
||||
availableTracTracRaces = new ArrayList<TracTracRaceRecordDTO>();
|
||||
|
||||
VerticalPanel mainPanel = new VerticalPanel();
|
||||
this.setWidget(mainPanel);
|
||||
@@ -100,7 +100,7 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel {
|
||||
Label lblPredefined = new Label(stringConstants.historyOfConnections());
|
||||
grid.setWidget(0, 0, lblPredefined);
|
||||
|
||||
previousConfigurations = new HashMap<String, TracTracConfigurationDAO>();
|
||||
previousConfigurations = new HashMap<String, TracTracConfigurationDTO>();
|
||||
previousConfigurationsComboBox = new ListBox();
|
||||
grid.setWidget(0, 1, previousConfigurationsComboBox);
|
||||
previousConfigurationsComboBox.addChangeHandler(new ChangeHandler() {
|
||||
@@ -229,21 +229,21 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel {
|
||||
storedURIBox.setTitle(stringConstants.leaveEmptyForDefault());
|
||||
horizontalPanel.add(storedURIBox);
|
||||
|
||||
TextColumn<TracTracRaceRecordDAO> eventNameColumn = new TextColumn<TracTracRaceRecordDAO>() {
|
||||
TextColumn<TracTracRaceRecordDTO> eventNameColumn = new TextColumn<TracTracRaceRecordDTO>() {
|
||||
@Override
|
||||
public String getValue(TracTracRaceRecordDAO object) {
|
||||
public String getValue(TracTracRaceRecordDTO object) {
|
||||
return object.eventName;
|
||||
}
|
||||
};
|
||||
TextColumn<TracTracRaceRecordDAO> raceNameColumn = new TextColumn<TracTracRaceRecordDAO>() {
|
||||
TextColumn<TracTracRaceRecordDTO> raceNameColumn = new TextColumn<TracTracRaceRecordDTO>() {
|
||||
@Override
|
||||
public String getValue(TracTracRaceRecordDAO object) {
|
||||
public String getValue(TracTracRaceRecordDTO object) {
|
||||
return object.name;
|
||||
}
|
||||
};
|
||||
TextColumn<TracTracRaceRecordDAO> raceStartTrackingColumn = new TextColumn<TracTracRaceRecordDAO>() {
|
||||
TextColumn<TracTracRaceRecordDTO> raceStartTrackingColumn = new TextColumn<TracTracRaceRecordDTO>() {
|
||||
@Override
|
||||
public String getValue(TracTracRaceRecordDAO object) {
|
||||
public String getValue(TracTracRaceRecordDTO object) {
|
||||
return object.trackingStartTime==null?"":dateFormatter.render(object.trackingStartTime) + " " + timeFormatter.render(object.trackingStartTime);
|
||||
}
|
||||
};
|
||||
@@ -298,17 +298,17 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel {
|
||||
raceStartTrackingColumn.setSortable(true);
|
||||
|
||||
AdminConsoleTableResources tableRes = GWT.create(AdminConsoleTableResources.class);
|
||||
raceTable = new CellTable<TracTracRaceRecordDAO>(/* pageSize */ 200, tableRes);
|
||||
raceTable = new CellTable<TracTracRaceRecordDTO>(/* pageSize */ 200, tableRes);
|
||||
raceTable.addColumn(eventNameColumn, stringConstants.event());
|
||||
raceTable.addColumn(raceNameColumn, stringConstants.race());
|
||||
raceTable.addColumn(raceStartTrackingColumn, stringConstants.startTime());
|
||||
raceTable.setWidth("300px");
|
||||
raceTable.setSelectionModel(new MultiSelectionModel<TracTracRaceRecordDAO>() {});
|
||||
raceTable.setSelectionModel(new MultiSelectionModel<TracTracRaceRecordDTO>() {});
|
||||
|
||||
racesHorizontalPanel.add(raceTable);
|
||||
racesHorizontalPanel.add(trackPanel);
|
||||
|
||||
raceList = new ListDataProvider<TracTracRaceRecordDAO>();
|
||||
raceList = new ListDataProvider<TracTracRaceRecordDTO>();
|
||||
raceList.addDataDisplay(raceTable);
|
||||
Handler columnSortHandler = getRaceTableColumnSortHandler(raceList.getList(), raceNameColumn, raceStartTrackingColumn);
|
||||
raceTable.addColumnSortHandler(columnSortHandler);
|
||||
@@ -345,18 +345,18 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel {
|
||||
updateJsonUrl();
|
||||
}
|
||||
|
||||
private ListHandler<TracTracRaceRecordDAO> getRaceTableColumnSortHandler(List<TracTracRaceRecordDAO> raceRecords,
|
||||
Column<TracTracRaceRecordDAO, ?> nameColumn, Column<TracTracRaceRecordDAO, ?> trackingStartColumn) {
|
||||
ListHandler<TracTracRaceRecordDAO> result = new ListHandler<TracTracRaceRecordDAO>(raceRecords);
|
||||
result.setComparator(nameColumn, new Comparator<TracTracRaceRecordDAO>() {
|
||||
private ListHandler<TracTracRaceRecordDTO> getRaceTableColumnSortHandler(List<TracTracRaceRecordDTO> raceRecords,
|
||||
Column<TracTracRaceRecordDTO, ?> nameColumn, Column<TracTracRaceRecordDTO, ?> trackingStartColumn) {
|
||||
ListHandler<TracTracRaceRecordDTO> result = new ListHandler<TracTracRaceRecordDTO>(raceRecords);
|
||||
result.setComparator(nameColumn, new Comparator<TracTracRaceRecordDTO>() {
|
||||
@Override
|
||||
public int compare(TracTracRaceRecordDAO o1, TracTracRaceRecordDAO o2) {
|
||||
public int compare(TracTracRaceRecordDTO o1, TracTracRaceRecordDTO o2) {
|
||||
return o1.name.compareTo(o2.name);
|
||||
}
|
||||
});
|
||||
result.setComparator(trackingStartColumn, new Comparator<TracTracRaceRecordDAO>() {
|
||||
result.setComparator(trackingStartColumn, new Comparator<TracTracRaceRecordDTO>() {
|
||||
@Override
|
||||
public int compare(TracTracRaceRecordDAO o1, TracTracRaceRecordDAO o2) {
|
||||
public int compare(TracTracRaceRecordDTO o1, TracTracRaceRecordDTO o2) {
|
||||
return o1.trackingStartTime == null ? -1 : o2.trackingStartTime == null ? 1 : o1.trackingStartTime
|
||||
.compareTo(o2.trackingStartTime);
|
||||
}
|
||||
@@ -382,7 +382,7 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel {
|
||||
}
|
||||
|
||||
private void fillConfigurations() {
|
||||
sailingService.getPreviousTracTracConfigurations(new AsyncCallback<List<TracTracConfigurationDAO>>() {
|
||||
sailingService.getPreviousTracTracConfigurations(new AsyncCallback<List<TracTracConfigurationDTO>>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError("Remote Procedure Call getPreviousConfigurations() - Failure: "
|
||||
@@ -390,11 +390,11 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<TracTracConfigurationDAO> result) {
|
||||
public void onSuccess(List<TracTracConfigurationDTO> result) {
|
||||
while (previousConfigurationsComboBox.getItemCount() > 0) {
|
||||
previousConfigurationsComboBox.removeItem(0);
|
||||
}
|
||||
for (TracTracConfigurationDAO ttConfig : result) {
|
||||
for (TracTracConfigurationDTO ttConfig : result) {
|
||||
previousConfigurations.put(ttConfig.name, ttConfig);
|
||||
previousConfigurationsComboBox.addItem(ttConfig.name);
|
||||
}
|
||||
@@ -409,7 +409,7 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel {
|
||||
final String jsonURL = jsonURLBox.getValue();
|
||||
final String liveDataURI = liveURIBox.getValue();
|
||||
final String storedDataURI = storedURIBox.getValue();
|
||||
sailingService.listTracTracRacesInEvent(jsonURL, new AsyncCallback<Pair<String, List<TracTracRaceRecordDAO>>>() {
|
||||
sailingService.listTracTracRacesInEvent(jsonURL, new AsyncCallback<Pair<String, List<TracTracRaceRecordDTO>>>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
TracTracEventManagementPanel.this.errorReporter.reportError("Error trying to list races: "
|
||||
@@ -417,7 +417,7 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(final Pair<String, List<TracTracRaceRecordDAO>> result) {
|
||||
public void onSuccess(final Pair<String, List<TracTracRaceRecordDTO>> result) {
|
||||
availableTracTracRaces.clear();
|
||||
if (result.getB() != null) {
|
||||
availableTracTracRaces.addAll(result.getB());
|
||||
@@ -437,7 +437,7 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel {
|
||||
@Override
|
||||
public void onSuccess(Void voidResult) {
|
||||
// refresh list of previous configurations
|
||||
TracTracConfigurationDAO ttConfig = new TracTracConfigurationDAO(result.getA(),
|
||||
TracTracConfigurationDTO ttConfig = new TracTracConfigurationDTO(result.getA(),
|
||||
jsonURL, liveDataURI, storedDataURI);
|
||||
if (previousConfigurations.put(ttConfig.name, ttConfig) == null) {
|
||||
previousConfigurationsComboBox.addItem(ttConfig.name);
|
||||
@@ -452,7 +452,7 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel {
|
||||
private void trackSelectedRaces(boolean trackWind, boolean correctWindByDeclination) {
|
||||
String liveURI = liveURIBox.getValue();
|
||||
String storedURI = storedURIBox.getValue();
|
||||
for (final TracTracRaceRecordDAO rr : raceList.getList()) {
|
||||
for (final TracTracRaceRecordDTO rr : raceList.getList()) {
|
||||
if (raceTable.getSelectionModel().isSelected(rr)) {
|
||||
sailingService.track(rr, liveURI, storedURI, trackWind, correctWindByDeclination, new AsyncCallback<Void>() {
|
||||
@Override
|
||||
@@ -471,7 +471,7 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel {
|
||||
}
|
||||
|
||||
private void updatePanelFromSelectedStoredConfiguration() {
|
||||
TracTracConfigurationDAO ttConfig = previousConfigurations.get(previousConfigurationsComboBox
|
||||
TracTracConfigurationDTO ttConfig = previousConfigurations.get(previousConfigurationsComboBox
|
||||
.getItemText(previousConfigurationsComboBox.getSelectedIndex()));
|
||||
if (ttConfig != null) {
|
||||
hostnameTextbox.setValue("");
|
||||
@@ -485,7 +485,7 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillEvents(List<EventDAO> result) {
|
||||
public void fillEvents(List<EventDTO> result) {
|
||||
trackedEventsComposite.fillEvents(result);
|
||||
}
|
||||
|
||||
@@ -493,7 +493,7 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel {
|
||||
List<String> wordsToFilter = Arrays.asList(text.split(" "));
|
||||
raceList.getList().clear();
|
||||
if (text != null && !text.isEmpty()) {
|
||||
for (TracTracRaceRecordDAO triple : availableTracTracRaces) {
|
||||
for (TracTracRaceRecordDTO triple : availableTracTracRaces) {
|
||||
boolean failed = textContainingStringsToCheck(wordsToFilter, triple.eventName, triple.name);
|
||||
if (!failed) {
|
||||
raceList.getList().add(triple);
|
||||
|
||||
+55
-55
@@ -41,9 +41,9 @@ import com.sap.sailing.gwt.ui.client.EventRefresher;
|
||||
import com.sap.sailing.gwt.ui.client.RaceSelectionChangeListener;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaDTO;
|
||||
import com.sap.sailing.server.api.EventNameAndRaceName;
|
||||
|
||||
/**
|
||||
@@ -58,11 +58,11 @@ public class TrackedEventsComposite extends FormPanel implements EventDisplayer,
|
||||
|
||||
private boolean dontFireNextSelectionChangeEvent;
|
||||
|
||||
private final SelectionModel<Triple<EventDAO, RegattaDAO, RaceDAO>> selectionModel;
|
||||
private final SelectionModel<Triple<EventDTO, RegattaDTO, RaceDTO>> selectionModel;
|
||||
|
||||
private CellTable<Triple<EventDAO, RegattaDAO, RaceDAO>> raceTable;
|
||||
private CellTable<Triple<EventDTO, RegattaDTO, RaceDTO>> raceTable;
|
||||
|
||||
private ListDataProvider<Triple<EventDAO, RegattaDAO, RaceDAO>> raceList;
|
||||
private ListDataProvider<Triple<EventDTO, RegattaDTO, RaceDTO>> raceList;
|
||||
|
||||
private VerticalPanel panel;
|
||||
|
||||
@@ -83,9 +83,9 @@ public class TrackedEventsComposite extends FormPanel implements EventDisplayer,
|
||||
|
||||
private TextBox filterRacesTextbox;
|
||||
|
||||
private List<Triple<EventDAO, RegattaDAO, RaceDAO>> availableRaceList;
|
||||
private List<Triple<EventDTO, RegattaDTO, RaceDTO>> availableRaceList;
|
||||
|
||||
private Triple<EventDAO, RegattaDAO, RaceDAO> lastSelectedTriple;
|
||||
private Triple<EventDTO, RegattaDTO, RaceDTO> lastSelectedTriple;
|
||||
|
||||
public TrackedEventsComposite(final SailingServiceAsync sailingService, final ErrorReporter errorReporter,
|
||||
final EventRefresher eventRefresher, StringMessages stringConstants, boolean hasMultiSelection) {
|
||||
@@ -98,11 +98,11 @@ public class TrackedEventsComposite extends FormPanel implements EventDisplayer,
|
||||
this.multiSelection = hasMultiSelection;
|
||||
this.raceSelectionChangeListeners = new HashSet<RaceSelectionChangeListener>();
|
||||
this.raceIsTrackedRaceChangeListener = new HashSet<TrackedRaceChangedListener>();
|
||||
this.availableRaceList = new ArrayList<Triple<EventDAO, RegattaDAO, RaceDAO>>();
|
||||
this.availableRaceList = new ArrayList<Triple<EventDTO, RegattaDTO, RaceDTO>>();
|
||||
this.lastSelectedTriple = null;
|
||||
raceList = new ListDataProvider<Triple<EventDAO, RegattaDAO, RaceDAO>>();
|
||||
selectionModel = multiSelection ? new MultiSelectionModel<Triple<EventDAO, RegattaDAO, RaceDAO>>()
|
||||
: new SingleSelectionModel<Triple<EventDAO, RegattaDAO, RaceDAO>>();
|
||||
raceList = new ListDataProvider<Triple<EventDTO, RegattaDTO, RaceDTO>>();
|
||||
selectionModel = multiSelection ? new MultiSelectionModel<Triple<EventDTO, RegattaDTO, RaceDTO>>()
|
||||
: new SingleSelectionModel<Triple<EventDTO, RegattaDTO, RaceDTO>>();
|
||||
panel = new VerticalPanel();
|
||||
setWidget(panel);
|
||||
HorizontalPanel filterPanel = new HorizontalPanel();
|
||||
@@ -125,22 +125,22 @@ public class TrackedEventsComposite extends FormPanel implements EventDisplayer,
|
||||
panel.add(noTrackedRacesLabel);
|
||||
|
||||
AdminConsoleTableResources tableRes = GWT.create(AdminConsoleTableResources.class);
|
||||
raceTable = new CellTable<Triple<EventDAO, RegattaDAO, RaceDAO>>(/* pageSize */200, tableRes);
|
||||
ListHandler<Triple<EventDAO, RegattaDAO, RaceDAO>> columnSortHandler = new ListHandler<Triple<EventDAO, RegattaDAO, RaceDAO>>(
|
||||
raceTable = new CellTable<Triple<EventDTO, RegattaDTO, RaceDTO>>(/* pageSize */200, tableRes);
|
||||
ListHandler<Triple<EventDTO, RegattaDTO, RaceDTO>> columnSortHandler = new ListHandler<Triple<EventDTO, RegattaDTO, RaceDTO>>(
|
||||
raceList.getList());
|
||||
TextColumn<Triple<EventDAO, RegattaDAO, RaceDAO>> eventNameColumn = new TextColumn<Triple<EventDAO, RegattaDAO, RaceDAO>>() {
|
||||
TextColumn<Triple<EventDTO, RegattaDTO, RaceDTO>> eventNameColumn = new TextColumn<Triple<EventDTO, RegattaDTO, RaceDTO>>() {
|
||||
@Override
|
||||
public String getValue(Triple<EventDAO, RegattaDAO, RaceDAO> object) {
|
||||
public String getValue(Triple<EventDTO, RegattaDTO, RaceDTO> object) {
|
||||
return object.getA().name;
|
||||
}
|
||||
};
|
||||
eventNameColumn.setSortable(true);
|
||||
|
||||
columnSortHandler.setComparator(eventNameColumn, new Comparator<Triple<EventDAO, RegattaDAO, RaceDAO>>() {
|
||||
columnSortHandler.setComparator(eventNameColumn, new Comparator<Triple<EventDTO, RegattaDTO, RaceDTO>>() {
|
||||
@Override
|
||||
public int compare(Triple<EventDAO, RegattaDAO, RaceDAO> t1, Triple<EventDAO, RegattaDAO, RaceDAO> t2) {
|
||||
EventDAO eventOne = t1.getA();
|
||||
EventDAO eventTwo = t2.getA();
|
||||
public int compare(Triple<EventDTO, RegattaDTO, RaceDTO> t1, Triple<EventDTO, RegattaDTO, RaceDTO> t2) {
|
||||
EventDTO eventOne = t1.getA();
|
||||
EventDTO eventTwo = t2.getA();
|
||||
boolean ascending = isSortedAscending();
|
||||
if (eventOne.name.equals(eventTwo.name)) {
|
||||
return 0;
|
||||
@@ -157,20 +157,20 @@ public class TrackedEventsComposite extends FormPanel implements EventDisplayer,
|
||||
}
|
||||
});
|
||||
|
||||
TextColumn<Triple<EventDAO, RegattaDAO, RaceDAO>> regattaNameColumn = new TextColumn<Triple<EventDAO, RegattaDAO, RaceDAO>>() {
|
||||
TextColumn<Triple<EventDTO, RegattaDTO, RaceDTO>> regattaNameColumn = new TextColumn<Triple<EventDTO, RegattaDTO, RaceDTO>>() {
|
||||
|
||||
@Override
|
||||
public String getValue(Triple<EventDAO, RegattaDAO, RaceDAO> object) {
|
||||
public String getValue(Triple<EventDTO, RegattaDTO, RaceDTO> object) {
|
||||
return object.getB().boatClass.name;
|
||||
}
|
||||
};
|
||||
regattaNameColumn.setSortable(true);
|
||||
|
||||
columnSortHandler.setComparator(regattaNameColumn, new Comparator<Triple<EventDAO, RegattaDAO, RaceDAO>>() {
|
||||
columnSortHandler.setComparator(regattaNameColumn, new Comparator<Triple<EventDTO, RegattaDTO, RaceDTO>>() {
|
||||
@Override
|
||||
public int compare(Triple<EventDAO, RegattaDAO, RaceDAO> t1, Triple<EventDAO, RegattaDAO, RaceDAO> t2) {
|
||||
RegattaDAO regattaOne = t1.getB();
|
||||
RegattaDAO regattaTwo = t2.getB();
|
||||
public int compare(Triple<EventDTO, RegattaDTO, RaceDTO> t1, Triple<EventDTO, RegattaDTO, RaceDTO> t2) {
|
||||
RegattaDTO regattaOne = t1.getB();
|
||||
RegattaDTO regattaTwo = t2.getB();
|
||||
boolean ascending = isSortedAscending();
|
||||
if (regattaOne.boatClass.name.equals(regattaTwo.boatClass.name)) {
|
||||
return 0;
|
||||
@@ -188,18 +188,18 @@ public class TrackedEventsComposite extends FormPanel implements EventDisplayer,
|
||||
}
|
||||
});
|
||||
|
||||
TextColumn<Triple<EventDAO, RegattaDAO, RaceDAO>> raceNameColumn = new TextColumn<Triple<EventDAO, RegattaDAO, RaceDAO>>() {
|
||||
TextColumn<Triple<EventDTO, RegattaDTO, RaceDTO>> raceNameColumn = new TextColumn<Triple<EventDTO, RegattaDTO, RaceDTO>>() {
|
||||
|
||||
@Override
|
||||
public String getValue(Triple<EventDAO, RegattaDAO, RaceDAO> object) {
|
||||
public String getValue(Triple<EventDTO, RegattaDTO, RaceDTO> object) {
|
||||
return object.getC().name;
|
||||
}
|
||||
};
|
||||
raceNameColumn.setSortable(true);
|
||||
|
||||
columnSortHandler.setComparator(raceNameColumn, new Comparator<Triple<EventDAO, RegattaDAO, RaceDAO>>() {
|
||||
columnSortHandler.setComparator(raceNameColumn, new Comparator<Triple<EventDTO, RegattaDTO, RaceDTO>>() {
|
||||
@Override
|
||||
public int compare(Triple<EventDAO, RegattaDAO, RaceDAO> t1, Triple<EventDAO, RegattaDAO, RaceDAO> t2) {
|
||||
public int compare(Triple<EventDTO, RegattaDTO, RaceDTO> t1, Triple<EventDTO, RegattaDTO, RaceDTO> t2) {
|
||||
boolean ascending = isSortedAscending();
|
||||
if (t1.getC().name.equals(t2.getC().name)) {
|
||||
return 0;
|
||||
@@ -216,9 +216,9 @@ public class TrackedEventsComposite extends FormPanel implements EventDisplayer,
|
||||
}
|
||||
});
|
||||
|
||||
TextColumn<Triple<EventDAO, RegattaDAO, RaceDAO>> raceStartColumn = new TextColumn<Triple<EventDAO, RegattaDAO, RaceDAO>>() {
|
||||
TextColumn<Triple<EventDTO, RegattaDTO, RaceDTO>> raceStartColumn = new TextColumn<Triple<EventDTO, RegattaDTO, RaceDTO>>() {
|
||||
@Override
|
||||
public String getValue(Triple<EventDAO, RegattaDAO, RaceDAO> object) {
|
||||
public String getValue(Triple<EventDTO, RegattaDTO, RaceDTO> object) {
|
||||
if (object.getC().startOfRace != null) {
|
||||
return dateFormatter.render(object.getC().startOfRace) + " "
|
||||
+ timeFormatter.render(object.getC().startOfRace);
|
||||
@@ -229,9 +229,9 @@ public class TrackedEventsComposite extends FormPanel implements EventDisplayer,
|
||||
};
|
||||
raceStartColumn.setSortable(true);
|
||||
|
||||
columnSortHandler.setComparator(raceStartColumn, new Comparator<Triple<EventDAO, RegattaDAO, RaceDAO>>() {
|
||||
columnSortHandler.setComparator(raceStartColumn, new Comparator<Triple<EventDTO, RegattaDTO, RaceDTO>>() {
|
||||
@Override
|
||||
public int compare(Triple<EventDAO, RegattaDAO, RaceDAO> t1, Triple<EventDAO, RegattaDAO, RaceDAO> t2) {
|
||||
public int compare(Triple<EventDTO, RegattaDTO, RaceDTO> t1, Triple<EventDTO, RegattaDTO, RaceDTO> t2) {
|
||||
if (t1.getC().startOfRace != null && t2.getC().startOfRace != null) {
|
||||
boolean ascending = isSortedAscending();
|
||||
int val = -1;
|
||||
@@ -247,9 +247,9 @@ public class TrackedEventsComposite extends FormPanel implements EventDisplayer,
|
||||
}
|
||||
});
|
||||
|
||||
TextColumn<Triple<EventDAO, RegattaDAO, RaceDAO>> raceTrackedColumn = new TextColumn<Triple<EventDAO, RegattaDAO, RaceDAO>>() {
|
||||
TextColumn<Triple<EventDTO, RegattaDTO, RaceDTO>> raceTrackedColumn = new TextColumn<Triple<EventDTO, RegattaDTO, RaceDTO>>() {
|
||||
@Override
|
||||
public String getValue(Triple<EventDAO, RegattaDAO, RaceDAO> object) {
|
||||
public String getValue(Triple<EventDTO, RegattaDTO, RaceDTO> object) {
|
||||
if (object.getC().currentlyTracked == true)
|
||||
return "tracked";
|
||||
|
||||
@@ -271,7 +271,7 @@ public class TrackedEventsComposite extends FormPanel implements EventDisplayer,
|
||||
raceTable.getSelectionModel().addSelectionChangeHandler(new Handler() {
|
||||
@Override
|
||||
public void onSelectionChange(SelectionChangeEvent event) {
|
||||
List<Triple<EventDAO, RegattaDAO, RaceDAO>> selectedEventAndRace = getSelectedEventAndRace();
|
||||
List<Triple<EventDTO, RegattaDTO, RaceDTO>> selectedEventAndRace = getSelectedEventAndRace();
|
||||
if (selectedEventAndRace.isEmpty()) {
|
||||
lastSelectedTriple = null;
|
||||
btnRemoveRace.setEnabled(false);
|
||||
@@ -291,7 +291,7 @@ public class TrackedEventsComposite extends FormPanel implements EventDisplayer,
|
||||
btnRemoveRace.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
for (Triple<EventDAO, RegattaDAO, RaceDAO> selection : getSelectedEventAndRace()) {
|
||||
for (Triple<EventDTO, RegattaDTO, RaceDTO> selection : getSelectedEventAndRace()) {
|
||||
removeAndUntrackRace(selection.getA(), selection.getC());
|
||||
}
|
||||
}
|
||||
@@ -302,7 +302,7 @@ public class TrackedEventsComposite extends FormPanel implements EventDisplayer,
|
||||
btnUntrack.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent click) {
|
||||
for (Triple<EventDAO, RegattaDAO, RaceDAO> selection : getSelectedEventAndRace()) {
|
||||
for (Triple<EventDTO, RegattaDTO, RaceDTO> selection : getSelectedEventAndRace()) {
|
||||
if (selection.getC().currentlyTracked) {
|
||||
stopTrackingRace(selection.getA(), selection.getC());
|
||||
}
|
||||
@@ -324,10 +324,10 @@ public class TrackedEventsComposite extends FormPanel implements EventDisplayer,
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Triple<EventDAO, RegattaDAO, RaceDAO>> getSelectedEventAndRace() {
|
||||
List<Triple<EventDAO, RegattaDAO, RaceDAO>> result = new ArrayList<Triple<EventDAO, RegattaDAO, RaceDAO>>();
|
||||
public List<Triple<EventDTO, RegattaDTO, RaceDTO>> getSelectedEventAndRace() {
|
||||
List<Triple<EventDTO, RegattaDTO, RaceDTO>> result = new ArrayList<Triple<EventDTO, RegattaDTO, RaceDTO>>();
|
||||
if (raceList != null) {
|
||||
for (Triple<EventDAO, RegattaDAO, RaceDAO> raceTriple : raceList.getList()) {
|
||||
for (Triple<EventDTO, RegattaDTO, RaceDTO> raceTriple : raceList.getList()) {
|
||||
if (selectionModel.isSelected(raceTriple)) {
|
||||
result.add(raceTriple);
|
||||
}
|
||||
@@ -338,9 +338,9 @@ public class TrackedEventsComposite extends FormPanel implements EventDisplayer,
|
||||
|
||||
public void selectRaceByName(String eventName, String raceName) {
|
||||
if (raceList != null) {
|
||||
for (Triple<EventDAO, RegattaDAO, RaceDAO> raceTriple : raceList.getList()) {
|
||||
EventDAO event = raceTriple.getA();
|
||||
RaceDAO race = raceTriple.getC();
|
||||
for (Triple<EventDTO, RegattaDTO, RaceDTO> raceTriple : raceList.getList()) {
|
||||
EventDTO event = raceTriple.getA();
|
||||
RaceDTO race = raceTriple.getC();
|
||||
|
||||
if (event.name.equals(eventName) && race.name.equals(raceName)) {
|
||||
dontFireNextSelectionChangeEvent = true;
|
||||
@@ -353,7 +353,7 @@ public class TrackedEventsComposite extends FormPanel implements EventDisplayer,
|
||||
|
||||
public void clearSelection() {
|
||||
if (raceList != null) {
|
||||
for (Triple<EventDAO, RegattaDAO, RaceDAO> raceTriple : raceList.getList()) {
|
||||
for (Triple<EventDTO, RegattaDTO, RaceDTO> raceTriple : raceList.getList()) {
|
||||
selectionModel.setSelected(raceTriple, false);
|
||||
}
|
||||
}
|
||||
@@ -369,7 +369,7 @@ public class TrackedEventsComposite extends FormPanel implements EventDisplayer,
|
||||
raceSelectionChangeListeners.remove(listener);
|
||||
}
|
||||
|
||||
private void fireRaceSelectionChanged(List<Triple<EventDAO, RegattaDAO, RaceDAO>> selectedRaces) {
|
||||
private void fireRaceSelectionChanged(List<Triple<EventDTO, RegattaDTO, RaceDTO>> selectedRaces) {
|
||||
if (dontFireNextSelectionChangeEvent) {
|
||||
dontFireNextSelectionChangeEvent = false;
|
||||
} else {
|
||||
@@ -380,7 +380,7 @@ public class TrackedEventsComposite extends FormPanel implements EventDisplayer,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillEvents(List<EventDAO> events) {
|
||||
public void fillEvents(List<EventDTO> events) {
|
||||
if (events.isEmpty()) {
|
||||
raceTable.setVisible(false);
|
||||
btnUntrack.setVisible(false);
|
||||
@@ -395,10 +395,10 @@ public class TrackedEventsComposite extends FormPanel implements EventDisplayer,
|
||||
noTrackedRacesLabel.setVisible(false);
|
||||
}
|
||||
availableRaceList.clear();
|
||||
for (EventDAO event : events) {
|
||||
for (RegattaDAO regatta : event.regattas) {
|
||||
for (RaceDAO race : regatta.races) {
|
||||
Triple<EventDAO, RegattaDAO, RaceDAO> triple = new Triple<EventDAO, RegattaDAO, RaceDAO>(event,
|
||||
for (EventDTO event : events) {
|
||||
for (RegattaDTO regatta : event.regattas) {
|
||||
for (RaceDTO race : regatta.races) {
|
||||
Triple<EventDTO, RegattaDTO, RaceDTO> triple = new Triple<EventDTO, RegattaDTO, RaceDTO>(event,
|
||||
regatta, race);
|
||||
if (race != null) {
|
||||
availableRaceList.add(triple);
|
||||
@@ -416,7 +416,7 @@ public class TrackedEventsComposite extends FormPanel implements EventDisplayer,
|
||||
this.raceIsTrackedRaceChangeListener.add(listener);
|
||||
}
|
||||
|
||||
private void stopTrackingRace(final EventDAO event, final RaceDAO race) {
|
||||
private void stopTrackingRace(final EventDTO event, final RaceDTO race) {
|
||||
final EventNameAndRaceName eventNameAndRaceName = new EventNameAndRaceName(event.name, race.name);
|
||||
sailingService.stopTrackingRace(eventNameAndRaceName, new AsyncCallback<Void>() {
|
||||
@Override
|
||||
@@ -435,7 +435,7 @@ public class TrackedEventsComposite extends FormPanel implements EventDisplayer,
|
||||
});
|
||||
}
|
||||
|
||||
private void removeAndUntrackRace(final EventDAO event, final RaceDAO race) {
|
||||
private void removeAndUntrackRace(final EventDTO event, final RaceDTO race) {
|
||||
final EventNameAndRaceName eventNameAndRaceName = new EventNameAndRaceName(event.name, race.name);
|
||||
sailingService.removeAndUntrackRace(eventNameAndRaceName,
|
||||
new AsyncCallback<Void>() {
|
||||
@@ -460,7 +460,7 @@ public class TrackedEventsComposite extends FormPanel implements EventDisplayer,
|
||||
List<String> wordsToFilter = Arrays.asList(text.split(" "));
|
||||
raceList.getList().clear();
|
||||
if (text != null && !text.isEmpty()) {
|
||||
for (Triple<EventDAO, RegattaDAO, RaceDAO> triple : availableRaceList) {
|
||||
for (Triple<EventDTO, RegattaDTO, RaceDTO> triple : availableRaceList) {
|
||||
boolean failed = false;
|
||||
for (String word : wordsToFilter) {
|
||||
String textAsUppercase = word.toUpperCase().trim();
|
||||
|
||||
+7
-7
@@ -39,9 +39,9 @@ import com.sap.sailing.domain.common.WindSource;
|
||||
import com.sap.sailing.gwt.ui.client.ColorMap;
|
||||
import com.sap.sailing.gwt.ui.client.ErrorReporter;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.WindDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindInfoForRaceDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindTrackInfoDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindInfoForRaceDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindTrackInfoDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.components.Component;
|
||||
import com.sap.sailing.gwt.ui.shared.components.SettingsDialogComponent;
|
||||
|
||||
@@ -168,10 +168,10 @@ public class WindChart implements Component<WindChartSettings> {
|
||||
return series;
|
||||
}
|
||||
|
||||
public void updateStripChartSeries(WindInfoForRaceDAO result) {
|
||||
public void updateStripChartSeries(WindInfoForRaceDTO result) {
|
||||
long min = Long.MAX_VALUE;
|
||||
long max = Long.MIN_VALUE;
|
||||
for (Map.Entry<WindSource, WindTrackInfoDAO> e : result.windTrackInfoByWindSource.entrySet()) {
|
||||
for (Map.Entry<WindSource, WindTrackInfoDTO> e : result.windTrackInfoByWindSource.entrySet()) {
|
||||
WindSource windSource = e.getKey();
|
||||
SeriesHandler seriesHandler = stripChartSeries.get(windSource);
|
||||
if (e.getValue().windFixes.isEmpty()) {
|
||||
@@ -187,7 +187,7 @@ public class WindChart implements Component<WindChartSettings> {
|
||||
} else {
|
||||
seriesHandler.clear();
|
||||
}
|
||||
for (WindDAO windFix : e.getValue().windFixes) {
|
||||
for (WindDTO windFix : e.getValue().windFixes) {
|
||||
seriesHandler.add(new DataPoint(windFix.timepoint, windFix.dampenedTrueWindFromDeg));
|
||||
min = Math.min(min, windFix.timepoint);
|
||||
max = Math.max(max, windFix.timepoint);
|
||||
@@ -225,7 +225,7 @@ public class WindChart implements Component<WindChartSettings> {
|
||||
|
||||
/**
|
||||
* Sets the visibilities of the wind source series based on the new settings. Note that this does not
|
||||
* re-load any wind data. This has to happen by calling {@link #updateStripChartSeries(WindInfoForRaceDAO)}.
|
||||
* re-load any wind data. This has to happen by calling {@link #updateStripChartSeries(WindInfoForRaceDTO)}.
|
||||
*/
|
||||
@Override
|
||||
public void updateSettings(WindChartSettings newSettings) {
|
||||
|
||||
+56
-56
@@ -45,12 +45,12 @@ import com.sap.sailing.gwt.ui.client.EventRefresher;
|
||||
import com.sap.sailing.gwt.ui.client.RaceSelectionChangeListener;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindInfoForRaceDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindTrackInfoDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindInfoForRaceDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindTrackInfoDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.components.SettingsDialog;
|
||||
import com.sap.sailing.server.api.EventNameAndRaceName;
|
||||
|
||||
@@ -61,15 +61,15 @@ public class WindPanel extends FormPanel implements EventDisplayer, WindShower,
|
||||
private final StringMessages stringMessages;
|
||||
private final WindSettingPanel windSettingPanel;
|
||||
private ColumnSortList columnSortList;
|
||||
private final IdentityColumn<WindDAO> removeColumn;
|
||||
private final TextColumn<WindDAO> timeColumn;
|
||||
private final TextColumn<WindDAO> speedInKnotsColumn;
|
||||
private final TextColumn<WindDAO> windDirectionInDegColumn;
|
||||
private final TextColumn<WindDAO> dampenedSpeedInKnotsColumn;
|
||||
private final TextColumn<WindDAO> dampenedWindDirectionInDegColumn;
|
||||
private final IdentityColumn<WindDTO> removeColumn;
|
||||
private final TextColumn<WindDTO> timeColumn;
|
||||
private final TextColumn<WindDTO> speedInKnotsColumn;
|
||||
private final TextColumn<WindDTO> windDirectionInDegColumn;
|
||||
private final TextColumn<WindDTO> dampenedSpeedInKnotsColumn;
|
||||
private final TextColumn<WindDTO> dampenedWindDirectionInDegColumn;
|
||||
private final TrackedEventsComposite trackedEventsComposite;
|
||||
private final ListBox windSourceSelection;
|
||||
private final Map<WindSource, ListDataProvider<WindDAO>> windLists;
|
||||
private final Map<WindSource, ListDataProvider<WindDTO>> windLists;
|
||||
private final CheckBox raceIsKnownToStartUpwindBox;
|
||||
private final WindChart windChart;
|
||||
private static AdminConsoleResources resources = GWT.create(AdminConsoleResources.class);
|
||||
@@ -79,7 +79,7 @@ public class WindPanel extends FormPanel implements EventDisplayer, WindShower,
|
||||
this.sailingService = sailingService;
|
||||
this.errorReporter = errorReporter;
|
||||
this.stringMessages = stringMessages;
|
||||
windLists = new HashMap<WindSource, ListDataProvider<WindDAO>>();
|
||||
windLists = new HashMap<WindSource, ListDataProvider<WindDTO>>();
|
||||
windSourceSelection = new ListBox();
|
||||
windSourceSelection.addChangeHandler(new ChangeHandler() {
|
||||
@Override
|
||||
@@ -87,11 +87,11 @@ public class WindPanel extends FormPanel implements EventDisplayer, WindShower,
|
||||
setWindSource(/* runOnSuccess */ null);
|
||||
}
|
||||
});
|
||||
removeColumn = new IdentityColumn<WindDAO>(new ActionCell<WindDAO>(stringMessages.remove(), new Delegate<WindDAO>() {
|
||||
removeColumn = new IdentityColumn<WindDTO>(new ActionCell<WindDTO>(stringMessages.remove(), new Delegate<WindDTO>() {
|
||||
@Override
|
||||
public void execute(final WindDAO wind) {
|
||||
List<Triple<EventDAO, RegattaDAO, RaceDAO>> eventAndRaces = trackedEventsComposite.getSelectedEventAndRace();
|
||||
final Triple<EventDAO, RegattaDAO, RaceDAO> eventAndRace = eventAndRaces.get(eventAndRaces.size()-1);
|
||||
public void execute(final WindDTO wind) {
|
||||
List<Triple<EventDTO, RegattaDTO, RaceDTO>> eventAndRaces = trackedEventsComposite.getSelectedEventAndRace();
|
||||
final Triple<EventDTO, RegattaDTO, RaceDTO> eventAndRace = eventAndRaces.get(eventAndRaces.size()-1);
|
||||
sailingService.removeWind(new EventNameAndRaceName(eventAndRace.getA().name, eventAndRace.getC().name), wind, new AsyncCallback<Void>() {
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
@@ -107,33 +107,33 @@ public class WindPanel extends FormPanel implements EventDisplayer, WindShower,
|
||||
});
|
||||
}
|
||||
}));
|
||||
timeColumn = new TextColumn<WindDAO>() {
|
||||
timeColumn = new TextColumn<WindDTO>() {
|
||||
@Override
|
||||
public String getValue(WindDAO object) {
|
||||
public String getValue(WindDTO object) {
|
||||
return new Date(object.timepoint).toString();
|
||||
}
|
||||
};
|
||||
speedInKnotsColumn = new TextColumn<WindDAO>() {
|
||||
speedInKnotsColumn = new TextColumn<WindDTO>() {
|
||||
@Override
|
||||
public String getValue(WindDAO object) {
|
||||
public String getValue(WindDTO object) {
|
||||
return ""+object.trueWindSpeedInKnots;
|
||||
}
|
||||
};
|
||||
windDirectionInDegColumn = new TextColumn<WindDAO>() {
|
||||
windDirectionInDegColumn = new TextColumn<WindDTO>() {
|
||||
@Override
|
||||
public String getValue(WindDAO object) {
|
||||
public String getValue(WindDTO object) {
|
||||
return ""+object.trueWindFromDeg;
|
||||
}
|
||||
};
|
||||
dampenedSpeedInKnotsColumn = new TextColumn<WindDAO>() {
|
||||
dampenedSpeedInKnotsColumn = new TextColumn<WindDTO>() {
|
||||
@Override
|
||||
public String getValue(WindDAO object) {
|
||||
public String getValue(WindDTO object) {
|
||||
return ""+object.dampenedTrueWindSpeedInKnots;
|
||||
}
|
||||
};
|
||||
dampenedWindDirectionInDegColumn = new TextColumn<WindDAO>() {
|
||||
dampenedWindDirectionInDegColumn = new TextColumn<WindDTO>() {
|
||||
@Override
|
||||
public String getValue(WindDAO object) {
|
||||
public String getValue(WindDTO object) {
|
||||
return ""+object.dampenedTrueWindFromDeg;
|
||||
}
|
||||
};
|
||||
@@ -176,7 +176,7 @@ public class WindPanel extends FormPanel implements EventDisplayer, WindShower,
|
||||
this.setWidget(grid);
|
||||
}
|
||||
|
||||
private void clearOrShowWindBasedOnRaceSelection(List<Triple<EventDAO, RegattaDAO, RaceDAO>> selectedRaces) {
|
||||
private void clearOrShowWindBasedOnRaceSelection(List<Triple<EventDTO, RegattaDTO, RaceDTO>> selectedRaces) {
|
||||
if (selectedRaces.isEmpty()) {
|
||||
clearWindDisplay(); // no wind known for untracked race
|
||||
} else {
|
||||
@@ -185,19 +185,19 @@ public class WindPanel extends FormPanel implements EventDisplayer, WindShower,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillEvents(List<EventDAO> result) {
|
||||
public void fillEvents(List<EventDTO> result) {
|
||||
trackedEventsComposite.fillEvents(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showWind(final EventDAO event, final RaceDAO race) {
|
||||
public void showWind(final EventDTO event, final RaceDTO race) {
|
||||
sailingService.getWindInfo(new EventNameAndRaceName(event.name, race.name),
|
||||
// TODO Time interval should be determined by a selection in the chart but be at most 60s. See bug #121. Consider incremental updates for new data only.
|
||||
null, null, // use race start and time of newest event as default time period
|
||||
null, // retrieve data on all wind sources
|
||||
new AsyncCallback<WindInfoForRaceDAO>() {
|
||||
new AsyncCallback<WindInfoForRaceDTO>() {
|
||||
@Override
|
||||
public void onSuccess(WindInfoForRaceDAO result) {
|
||||
public void onSuccess(WindInfoForRaceDTO result) {
|
||||
if (result != null) {
|
||||
showWindForRace(result);
|
||||
windSettingPanel.setEnabled(true);
|
||||
@@ -215,7 +215,7 @@ public class WindPanel extends FormPanel implements EventDisplayer, WindShower,
|
||||
});
|
||||
}
|
||||
|
||||
private void updateWindSources(WindInfoForRaceDAO result) {
|
||||
private void updateWindSources(WindInfoForRaceDTO result) {
|
||||
int selectedIndex = -1;
|
||||
for (WindSource windSource : result.windTrackInfoByWindSource.keySet()) {
|
||||
boolean found = false;
|
||||
@@ -243,13 +243,13 @@ public class WindPanel extends FormPanel implements EventDisplayer, WindShower,
|
||||
windLists.clear();
|
||||
}
|
||||
|
||||
private void showWindForRace(WindInfoForRaceDAO result) {
|
||||
private void showWindForRace(WindInfoForRaceDTO result) {
|
||||
raceIsKnownToStartUpwindBox.setValue(result.raceIsKnownToStartUpwind);
|
||||
grid.setWidget(3, 0, null);
|
||||
VerticalPanel windDisplay = new VerticalPanel();
|
||||
grid.setWidget(3, 0, windDisplay);
|
||||
windChart.updateStripChartSeries(result);
|
||||
for (Map.Entry<WindSource, WindTrackInfoDAO> e : result.windTrackInfoByWindSource.entrySet()) {
|
||||
for (Map.Entry<WindSource, WindTrackInfoDTO> e : result.windTrackInfoByWindSource.entrySet()) {
|
||||
Label windSourceLabel = new Label(stringMessages.windSource()+": "+e.getKey()+
|
||||
", "+stringMessages.dampeningInterval()+" "+e.getValue().dampeningIntervalInMilliseconds+"ms");
|
||||
windDisplay.add(windSourceLabel);
|
||||
@@ -258,7 +258,7 @@ public class WindPanel extends FormPanel implements EventDisplayer, WindShower,
|
||||
windDirectionInDegColumn.setSortable(true);
|
||||
dampenedSpeedInKnotsColumn.setSortable(true);
|
||||
dampenedWindDirectionInDegColumn.setSortable(true);
|
||||
CellTable<WindDAO> windTable = new CellTable<WindDAO>(/* pageSize */ 10000);
|
||||
CellTable<WindDTO> windTable = new CellTable<WindDTO>(/* pageSize */ 10000);
|
||||
if (e.getKey() == WindSource.WEB) {
|
||||
// only the WEB wind source is editable, hence has a "Remove" column
|
||||
windTable.addColumn(removeColumn, "Remove");
|
||||
@@ -268,7 +268,7 @@ public class WindPanel extends FormPanel implements EventDisplayer, WindShower,
|
||||
windTable.addColumn(windDirectionInDegColumn, "From (deg)");
|
||||
windTable.addColumn(dampenedSpeedInKnotsColumn, "Avg Speed (kn)");
|
||||
windTable.addColumn(dampenedWindDirectionInDegColumn, "Avg From (deg)");
|
||||
ListDataProvider<WindDAO> windList = new ListDataProvider<WindDAO>(e.getValue().windFixes);
|
||||
ListDataProvider<WindDTO> windList = new ListDataProvider<WindDTO>(e.getValue().windFixes);
|
||||
windLists.put(e.getKey(), windList);
|
||||
windList.addDataDisplay(windTable);
|
||||
Handler columnSortHandler = getWindTableColumnSortHandler(windList.getList(), timeColumn,
|
||||
@@ -293,40 +293,40 @@ public class WindPanel extends FormPanel implements EventDisplayer, WindShower,
|
||||
}
|
||||
}
|
||||
|
||||
private Handler getWindTableColumnSortHandler(List<WindDAO> list, TextColumn<WindDAO> timeColumn,
|
||||
TextColumn<WindDAO> speedInKnotsColumn, TextColumn<WindDAO> windDirectionInDegColumn,
|
||||
TextColumn<WindDAO> dampenedSpeedInKnotsColumn, TextColumn<WindDAO> dampenedWindDirectionInDegColumn) {
|
||||
ListHandler<WindDAO> result = new ListHandler<WindDAO>(list);
|
||||
result.setComparator(timeColumn, new Comparator<WindDAO>() {
|
||||
private Handler getWindTableColumnSortHandler(List<WindDTO> list, TextColumn<WindDTO> timeColumn,
|
||||
TextColumn<WindDTO> speedInKnotsColumn, TextColumn<WindDTO> windDirectionInDegColumn,
|
||||
TextColumn<WindDTO> dampenedSpeedInKnotsColumn, TextColumn<WindDTO> dampenedWindDirectionInDegColumn) {
|
||||
ListHandler<WindDTO> result = new ListHandler<WindDTO>(list);
|
||||
result.setComparator(timeColumn, new Comparator<WindDTO>() {
|
||||
@Override
|
||||
public int compare(WindDAO o1, WindDAO o2) {
|
||||
public int compare(WindDTO o1, WindDTO o2) {
|
||||
return o1.timepoint < o2.timepoint ? -1 : o1.timepoint == o2.timepoint ? 0 : 1;
|
||||
}
|
||||
});
|
||||
result.setComparator(speedInKnotsColumn, new Comparator<WindDAO>() {
|
||||
result.setComparator(speedInKnotsColumn, new Comparator<WindDTO>() {
|
||||
@Override
|
||||
public int compare(WindDAO o1, WindDAO o2) {
|
||||
public int compare(WindDTO o1, WindDTO o2) {
|
||||
return o1.trueWindSpeedInKnots < o2.trueWindSpeedInKnots ? -1 :
|
||||
o1.trueWindSpeedInKnots == o2.trueWindSpeedInKnots ? 0 : 1;
|
||||
}
|
||||
});
|
||||
result.setComparator(windDirectionInDegColumn, new Comparator<WindDAO>() {
|
||||
result.setComparator(windDirectionInDegColumn, new Comparator<WindDTO>() {
|
||||
@Override
|
||||
public int compare(WindDAO o1, WindDAO o2) {
|
||||
public int compare(WindDTO o1, WindDTO o2) {
|
||||
return o1.trueWindFromDeg < o2.trueWindFromDeg ? -1 :
|
||||
o1.trueWindFromDeg == o2.trueWindFromDeg ? 0 : 1;
|
||||
}
|
||||
});
|
||||
result.setComparator(dampenedSpeedInKnotsColumn, new Comparator<WindDAO>() {
|
||||
result.setComparator(dampenedSpeedInKnotsColumn, new Comparator<WindDTO>() {
|
||||
@Override
|
||||
public int compare(WindDAO o1, WindDAO o2) {
|
||||
public int compare(WindDTO o1, WindDTO o2) {
|
||||
return o1.dampenedTrueWindSpeedInKnots < o2.dampenedTrueWindSpeedInKnots ? -1 :
|
||||
o1.dampenedTrueWindSpeedInKnots == o2.dampenedTrueWindSpeedInKnots ? 0 : 1;
|
||||
}
|
||||
});
|
||||
result.setComparator(dampenedWindDirectionInDegColumn, new Comparator<WindDAO>() {
|
||||
result.setComparator(dampenedWindDirectionInDegColumn, new Comparator<WindDTO>() {
|
||||
@Override
|
||||
public int compare(WindDAO o1, WindDAO o2) {
|
||||
public int compare(WindDTO o1, WindDTO o2) {
|
||||
return o1.dampenedTrueWindFromDeg < o2.dampenedTrueWindFromDeg ? -1 :
|
||||
o1.dampenedTrueWindFromDeg == o2.dampenedTrueWindFromDeg ? 0 : 1;
|
||||
}
|
||||
@@ -335,9 +335,9 @@ public class WindPanel extends FormPanel implements EventDisplayer, WindShower,
|
||||
}
|
||||
|
||||
private void setWindSource(final Runnable runOnSuccess) {
|
||||
List<Triple<EventDAO, RegattaDAO, RaceDAO>> selection = trackedEventsComposite.getSelectedEventAndRace();
|
||||
List<Triple<EventDTO, RegattaDTO, RaceDTO>> selection = trackedEventsComposite.getSelectedEventAndRace();
|
||||
if (selection != null && !selection.isEmpty()) {
|
||||
final Triple<EventDAO, RegattaDAO, RaceDAO> selectedRace = selection.get(0);
|
||||
final Triple<EventDTO, RegattaDTO, RaceDTO> selectedRace = selection.get(0);
|
||||
final String windSourceName = windSourceSelection.getItemText(windSourceSelection.getSelectedIndex());
|
||||
sailingService.setWindSource(new EventNameAndRaceName(selectedRace.getA().name, selectedRace.getC().name),
|
||||
windSourceName, raceIsKnownToStartUpwindBox.getValue(), new AsyncCallback<Void>() {
|
||||
@@ -359,11 +359,11 @@ public class WindPanel extends FormPanel implements EventDisplayer, WindShower,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRaceSelectionChange(List<Triple<EventDAO, RegattaDAO, RaceDAO>> selectedRaces) {
|
||||
public void onRaceSelectionChange(List<Triple<EventDTO, RegattaDTO, RaceDTO>> selectedRaces) {
|
||||
clearOrShowWindBasedOnRaceSelection(selectedRaces);
|
||||
}
|
||||
|
||||
public List<Triple<EventDAO, RegattaDAO, RaceDAO>> getSelectedRaces(){
|
||||
public List<Triple<EventDTO, RegattaDTO, RaceDTO>> getSelectedRaces(){
|
||||
return trackedEventsComposite.getSelectedEventAndRace();
|
||||
}
|
||||
}
|
||||
+9
-9
@@ -14,11 +14,11 @@ import com.sap.sailing.domain.common.impl.Util.Triple;
|
||||
import com.sap.sailing.gwt.ui.client.AbstractEntryPoint;
|
||||
import com.sap.sailing.gwt.ui.client.ErrorReporter;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.PositionDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.PositionDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindDTO;
|
||||
import com.sap.sailing.server.api.EventNameAndRaceName;
|
||||
|
||||
public class WindSettingPanel extends FormPanel {
|
||||
@@ -47,16 +47,16 @@ public class WindSettingPanel extends FormPanel {
|
||||
setWindButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
WindDAO wind = new WindDAO();
|
||||
WindDTO wind = new WindDTO();
|
||||
wind.trueWindSpeedInKnots = speedInKnotsBox.getValue();
|
||||
wind.trueWindFromDeg = fromInDegBox.getValue();
|
||||
wind.timepoint = System.currentTimeMillis();
|
||||
if (latDegBox.getValue() != null && lngDegBox.getValue() != null) {
|
||||
wind.position = new PositionDAO(latDegBox.getValue(), lngDegBox.getValue());
|
||||
wind.position = new PositionDTO(latDegBox.getValue(), lngDegBox.getValue());
|
||||
}
|
||||
List<Triple<EventDAO, RegattaDAO, RaceDAO>> eventAndRaces = raceSelectionProvider.getSelectedEventAndRace();
|
||||
List<Triple<EventDTO, RegattaDTO, RaceDTO>> eventAndRaces = raceSelectionProvider.getSelectedEventAndRace();
|
||||
// Here we assume that single selection is enabled because the WindPanel creates a TrackedComposite with disabled multi selection.
|
||||
final Triple<EventDAO, RegattaDAO, RaceDAO> eventAndRace = eventAndRaces.get(eventAndRaces.size()-1);
|
||||
final Triple<EventDTO, RegattaDTO, RaceDTO> eventAndRace = eventAndRaces.get(eventAndRaces.size()-1);
|
||||
sailingService.setWind(new EventNameAndRaceName(eventAndRace.getA().name, eventAndRace.getC().name), wind, new AsyncCallback<Void>() {
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
|
||||
+3
-3
@@ -1,10 +1,10 @@
|
||||
package com.sap.sailing.gwt.ui.adminconsole;
|
||||
|
||||
import com.sap.sailing.gwt.ui.shared.EventDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceDTO;
|
||||
|
||||
public interface WindShower {
|
||||
|
||||
void showWind(EventDAO event, RaceDAO race);
|
||||
void showWind(EventDTO event, RaceDTO race);
|
||||
|
||||
}
|
||||
+2
-2
@@ -6,7 +6,7 @@ import com.google.gwt.i18n.client.DateTimeFormat;
|
||||
import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat;
|
||||
import com.google.gwt.text.client.DateTimeFormatRenderer;
|
||||
import com.google.gwt.user.client.ui.FormPanel;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDTO;
|
||||
|
||||
public abstract class AbstractEventPanel extends FormPanel implements EventDisplayer{
|
||||
protected final SailingServiceAsync sailingService;
|
||||
@@ -26,7 +26,7 @@ public abstract class AbstractEventPanel extends FormPanel implements EventDispl
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract void fillEvents(List<EventDAO> result);
|
||||
public abstract void fillEvents(List<EventDTO> result);
|
||||
|
||||
/**
|
||||
* Returns if <code>wordsToFilter</code> contain a value of the <code>valuesToCheck</code>
|
||||
|
||||
+3
-3
@@ -1,14 +1,14 @@
|
||||
package com.sap.sailing.gwt.ui.client;
|
||||
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorDTO;
|
||||
|
||||
|
||||
/**
|
||||
* Allows UI components to observe a competitor selector, such as a drop-down box showing a list of competitors
|
||||
*/
|
||||
public interface CompetitorSelectionChangeListener {
|
||||
void addedToSelection(CompetitorDAO competitor);
|
||||
void addedToSelection(CompetitorDTO competitor);
|
||||
|
||||
void removedFromSelection(CompetitorDAO competitor);
|
||||
void removedFromSelection(CompetitorDTO competitor);
|
||||
|
||||
}
|
||||
+25
-25
@@ -7,12 +7,12 @@ import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorDTO;
|
||||
|
||||
public class CompetitorSelectionModel implements CompetitorSelectionProvider {
|
||||
private final Set<CompetitorDAO> allCompetitors;
|
||||
private final Set<CompetitorDTO> allCompetitors;
|
||||
|
||||
private final LinkedHashSet<CompetitorDAO> selectedCompetitors;
|
||||
private final LinkedHashSet<CompetitorDTO> selectedCompetitors;
|
||||
|
||||
private final Set<CompetitorSelectionChangeListener> listeners;
|
||||
|
||||
@@ -21,8 +21,8 @@ public class CompetitorSelectionModel implements CompetitorSelectionProvider {
|
||||
public CompetitorSelectionModel(boolean hasMultiSelection) {
|
||||
super();
|
||||
this.hasMultiSelection = hasMultiSelection;
|
||||
this.allCompetitors = new HashSet<CompetitorDAO>();
|
||||
this.selectedCompetitors = new LinkedHashSet<CompetitorDAO>();
|
||||
this.allCompetitors = new HashSet<CompetitorDTO>();
|
||||
this.selectedCompetitors = new LinkedHashSet<CompetitorDTO>();
|
||||
this.listeners = new HashSet<CompetitorSelectionChangeListener>();
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class CompetitorSelectionModel implements CompetitorSelectionProvider {
|
||||
* Adds a competitor to the {@link #getAllCompetitors() set of all competitors}. If the competitor was not yet
|
||||
* contained, it will be deselected.
|
||||
*/
|
||||
public void add(CompetitorDAO competitor) {
|
||||
public void add(CompetitorDTO competitor) {
|
||||
allCompetitors.add(competitor);
|
||||
}
|
||||
|
||||
@@ -44,9 +44,9 @@ public class CompetitorSelectionModel implements CompetitorSelectionProvider {
|
||||
* were selected so far.
|
||||
*/
|
||||
public void clear() {
|
||||
Iterator<CompetitorDAO> selIter = getSelectedCompetitors().iterator();
|
||||
Iterator<CompetitorDTO> selIter = getSelectedCompetitors().iterator();
|
||||
while (selIter.hasNext()) {
|
||||
CompetitorDAO selected = selIter.next();
|
||||
CompetitorDTO selected = selIter.next();
|
||||
setSelected(selected, false);
|
||||
selIter = getSelectedCompetitors().iterator();
|
||||
}
|
||||
@@ -54,8 +54,8 @@ public class CompetitorSelectionModel implements CompetitorSelectionProvider {
|
||||
allCompetitors.clear();
|
||||
}
|
||||
|
||||
public void addAll(Iterable<CompetitorDAO> competitors) {
|
||||
for (CompetitorDAO competitor : competitors) {
|
||||
public void addAll(Iterable<CompetitorDTO> competitors) {
|
||||
for (CompetitorDTO competitor : competitors) {
|
||||
add(competitor);
|
||||
}
|
||||
}
|
||||
@@ -64,7 +64,7 @@ public class CompetitorSelectionModel implements CompetitorSelectionProvider {
|
||||
* Removes the competitor from the {@link #getAllCompetitors() set of all competitor}. If the competitor was previously
|
||||
* contained and selected, it is deselected first.
|
||||
*/
|
||||
public void remove(CompetitorDAO competitor) {
|
||||
public void remove(CompetitorDTO competitor) {
|
||||
if (isSelected(competitor)) {
|
||||
setSelected(competitor, false);
|
||||
}
|
||||
@@ -72,16 +72,16 @@ public class CompetitorSelectionModel implements CompetitorSelectionProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<CompetitorDAO> getSelectedCompetitors() {
|
||||
public Iterable<CompetitorDTO> getSelectedCompetitors() {
|
||||
return Collections.unmodifiableCollection(selectedCompetitors);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<CompetitorDAO> getAllCompetitors() {
|
||||
public Iterable<CompetitorDTO> getAllCompetitors() {
|
||||
return Collections.unmodifiableCollection(allCompetitors);
|
||||
}
|
||||
|
||||
public void setSelected(CompetitorDAO competitor, boolean selected, CompetitorSelectionChangeListener... listenersNotToNotify) {
|
||||
public void setSelected(CompetitorDTO competitor, boolean selected, CompetitorSelectionChangeListener... listenersNotToNotify) {
|
||||
if (selected) {
|
||||
if (allCompetitors.contains(competitor) && !selectedCompetitors.contains(competitor)) {
|
||||
selectedCompetitors.add(competitor);
|
||||
@@ -95,7 +95,7 @@ public class CompetitorSelectionModel implements CompetitorSelectionProvider {
|
||||
}
|
||||
}
|
||||
|
||||
private void fireAddedToSelection(CompetitorDAO competitor, CompetitorSelectionChangeListener... listenersNotToNotify) {
|
||||
private void fireAddedToSelection(CompetitorDTO competitor, CompetitorSelectionChangeListener... listenersNotToNotify) {
|
||||
for (CompetitorSelectionChangeListener listener : listeners) {
|
||||
if (listenersNotToNotify == null || !Arrays.asList(listenersNotToNotify).contains(listener)) {
|
||||
listener.addedToSelection(competitor);
|
||||
@@ -103,7 +103,7 @@ public class CompetitorSelectionModel implements CompetitorSelectionProvider {
|
||||
}
|
||||
}
|
||||
|
||||
private void fireRemovedFromSelection(CompetitorDAO competitor, CompetitorSelectionChangeListener... listenersNotToNotify) {
|
||||
private void fireRemovedFromSelection(CompetitorDTO competitor, CompetitorSelectionChangeListener... listenersNotToNotify) {
|
||||
for (CompetitorSelectionChangeListener listener : listeners) {
|
||||
if (listenersNotToNotify == null || !Arrays.asList(listenersNotToNotify).contains(listener)) {
|
||||
listener.removedFromSelection(competitor);
|
||||
@@ -112,7 +112,7 @@ public class CompetitorSelectionModel implements CompetitorSelectionProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelected(CompetitorDAO competitor) {
|
||||
public boolean isSelected(CompetitorDTO competitor) {
|
||||
return selectedCompetitors.contains(competitor);
|
||||
}
|
||||
|
||||
@@ -127,28 +127,28 @@ public class CompetitorSelectionModel implements CompetitorSelectionProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelection(Iterable<CompetitorDAO> newSelection, CompetitorSelectionChangeListener... listenersNotToNotify) {
|
||||
Set<CompetitorDAO> competitorsToRemoveFromSelection = new HashSet<CompetitorDAO>(selectedCompetitors);
|
||||
for (CompetitorDAO newSelectedCompetitor : newSelection) {
|
||||
public void setSelection(Iterable<CompetitorDTO> newSelection, CompetitorSelectionChangeListener... listenersNotToNotify) {
|
||||
Set<CompetitorDTO> competitorsToRemoveFromSelection = new HashSet<CompetitorDTO>(selectedCompetitors);
|
||||
for (CompetitorDTO newSelectedCompetitor : newSelection) {
|
||||
setSelected(newSelectedCompetitor, true, listenersNotToNotify);
|
||||
competitorsToRemoveFromSelection.remove(newSelectedCompetitor);
|
||||
}
|
||||
for (CompetitorDAO competitorToRemoveFromSelection : competitorsToRemoveFromSelection) {
|
||||
for (CompetitorDTO competitorToRemoveFromSelection : competitorsToRemoveFromSelection) {
|
||||
setSelected(competitorToRemoveFromSelection, false, listenersNotToNotify);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCompetitors(Iterable<CompetitorDAO> newCompetitors) {
|
||||
Set<CompetitorDAO> oldCompetitorsToRemove = new HashSet<CompetitorDAO>(allCompetitors);
|
||||
for (CompetitorDAO newCompetitor : newCompetitors) {
|
||||
public void setCompetitors(Iterable<CompetitorDTO> newCompetitors) {
|
||||
Set<CompetitorDTO> oldCompetitorsToRemove = new HashSet<CompetitorDTO>(allCompetitors);
|
||||
for (CompetitorDTO newCompetitor : newCompetitors) {
|
||||
if (allCompetitors.contains(newCompetitor)) {
|
||||
oldCompetitorsToRemove.remove(newCompetitor);
|
||||
} else {
|
||||
add(newCompetitor);
|
||||
}
|
||||
}
|
||||
for (CompetitorDAO oldCompetitorToRemove : oldCompetitorsToRemove) {
|
||||
for (CompetitorDTO oldCompetitorToRemove : oldCompetitorsToRemove) {
|
||||
remove(oldCompetitorToRemove);
|
||||
}
|
||||
}
|
||||
|
||||
+7
-7
@@ -1,6 +1,6 @@
|
||||
package com.sap.sailing.gwt.ui.client;
|
||||
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorDTO;
|
||||
|
||||
public interface CompetitorSelectionProvider {
|
||||
|
||||
@@ -9,16 +9,16 @@ public interface CompetitorSelectionProvider {
|
||||
* which elements were selected; all competitors contained in the structure returned are also in the
|
||||
* structure returned by {@link #getAllCompetitors()} at the time of the call.
|
||||
*/
|
||||
Iterable<CompetitorDAO> getSelectedCompetitors();
|
||||
Iterable<CompetitorDTO> getSelectedCompetitors();
|
||||
|
||||
Iterable<CompetitorDAO> getAllCompetitors();
|
||||
Iterable<CompetitorDTO> getAllCompetitors();
|
||||
|
||||
/**
|
||||
* Updates the selection state of <code>competitor</code> if contained in {@link #getAllCompetitors()}. If this
|
||||
* means a change in <code>competitor</code>'s selection state, all listeners except for those in
|
||||
* <code>listenersNotToNotify</code> will be informed.
|
||||
*/
|
||||
void setSelected(CompetitorDAO competitor, boolean selected, CompetitorSelectionChangeListener... listenersNotToNotify);
|
||||
void setSelected(CompetitorDTO competitor, boolean selected, CompetitorSelectionChangeListener... listenersNotToNotify);
|
||||
|
||||
/**
|
||||
* Those competitors in <code>newSelection</code> that are also in {@link #getAllCompetitors()} will be selected,
|
||||
@@ -29,7 +29,7 @@ public interface CompetitorSelectionProvider {
|
||||
* @param listenersNotToNotify
|
||||
* if provided, these listeners will not be notified about the selection changes caused by this call
|
||||
*/
|
||||
void setSelection(Iterable<CompetitorDAO> newSelection, CompetitorSelectionChangeListener... listenersNotToNotify);
|
||||
void setSelection(Iterable<CompetitorDTO> newSelection, CompetitorSelectionChangeListener... listenersNotToNotify);
|
||||
|
||||
/**
|
||||
* Deselects and removes all competitors from {@link #getAllCompetitors()} which are not in <code>newCompetitor</code> and
|
||||
@@ -37,9 +37,9 @@ public interface CompetitorSelectionProvider {
|
||||
* of {@link #getAllCompetitors()} are equal to <code>newCompetitors</code> except for ordering which is not guaranteed
|
||||
* to be stable.
|
||||
*/
|
||||
void setCompetitors(Iterable<CompetitorDAO> newCompetitors);
|
||||
void setCompetitors(Iterable<CompetitorDTO> newCompetitors);
|
||||
|
||||
boolean isSelected(CompetitorDAO competitor);
|
||||
boolean isSelected(CompetitorDTO competitor);
|
||||
|
||||
boolean hasMultiSelection();
|
||||
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@ package com.sap.sailing.gwt.ui.client;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.gwt.ui.shared.EventDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDTO;
|
||||
|
||||
public interface EventDisplayer {
|
||||
void fillEvents(List<EventDAO> result);
|
||||
void fillEvents(List<EventDTO> result);
|
||||
}
|
||||
+4
-4
@@ -3,9 +3,9 @@ package com.sap.sailing.gwt.ui.client;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.common.impl.Util.Triple;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaDTO;
|
||||
|
||||
|
||||
/**
|
||||
@@ -21,6 +21,6 @@ public interface RaceSelectionChangeListener {
|
||||
*
|
||||
* @param selectedRaces a non-<code>null</code> list which is empty if nothing is selected
|
||||
*/
|
||||
void onRaceSelectionChange(List<Triple<EventDAO, RegattaDAO, RaceDAO>> selectedRaces);
|
||||
void onRaceSelectionChange(List<Triple<EventDTO, RegattaDTO, RaceDTO>> selectedRaces);
|
||||
|
||||
}
|
||||
+41
-41
@@ -10,21 +10,21 @@ import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
||||
import com.sap.sailing.domain.common.NoWindException;
|
||||
import com.sap.sailing.domain.common.WindSource;
|
||||
import com.sap.sailing.domain.common.impl.Util.Pair;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorInRaceDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorsAndTimePointsDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.GPSFixDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.ManeuverDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.MarkDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.QuickRankDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.SwissTimingConfigurationDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.SwissTimingRaceRecordDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.TracTracConfigurationDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.TracTracRaceRecordDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindInfoForRaceDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorInRaceDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorsAndTimePointsDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.GPSFixDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.ManeuverDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.MarkDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.QuickRankDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.SwissTimingConfigurationDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.SwissTimingRaceRecordDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.TracTracConfigurationDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.TracTracRaceRecordDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindInfoForRaceDTO;
|
||||
import com.sap.sailing.server.api.DetailType;
|
||||
import com.sap.sailing.server.api.EventAndRaceIdentifier;
|
||||
import com.sap.sailing.server.api.EventIdentifier;
|
||||
@@ -36,13 +36,13 @@ import com.sap.sailing.server.api.RaceIdentifier;
|
||||
*/
|
||||
@RemoteServiceRelativePath("sailing")
|
||||
public interface SailingService extends RemoteService {
|
||||
List<TracTracConfigurationDAO> getPreviousTracTracConfigurations() throws Exception;
|
||||
List<TracTracConfigurationDTO> getPreviousTracTracConfigurations() throws Exception;
|
||||
|
||||
List<EventDAO> listEvents(boolean withRacePlaces);
|
||||
List<EventDTO> listEvents(boolean withRacePlaces);
|
||||
|
||||
Pair<String, List<TracTracRaceRecordDAO>> listTracTracRacesInEvent(String eventJsonURL) throws Exception;
|
||||
Pair<String, List<TracTracRaceRecordDTO>> listTracTracRacesInEvent(String eventJsonURL) throws Exception;
|
||||
|
||||
void track(TracTracRaceRecordDAO rr, String liveURI, String storedURI, boolean trackWind, boolean correctWindByDeclination) throws Exception;
|
||||
void track(TracTracRaceRecordDTO rr, String liveURI, String storedURI, boolean trackWind, boolean correctWindByDeclination) throws Exception;
|
||||
|
||||
void storeTracTracConfiguration(String name, String jsonURL, String liveDataURI, String storedDataURI) throws Exception;
|
||||
|
||||
@@ -52,37 +52,37 @@ public interface SailingService extends RemoteService {
|
||||
|
||||
void removeAndUntrackRace(EventAndRaceIdentifier eventAndRaceidentifier) throws Exception;
|
||||
|
||||
WindInfoForRaceDAO getWindInfo(RaceIdentifier raceIdentifier, Date from, Date to, WindSource[] windSources);
|
||||
WindInfoForRaceDTO getWindInfo(RaceIdentifier raceIdentifier, Date from, Date to, WindSource[] windSources);
|
||||
|
||||
void setWind(RaceIdentifier raceIdentifier, WindDAO wind);
|
||||
void setWind(RaceIdentifier raceIdentifier, WindDTO wind);
|
||||
|
||||
Map<CompetitorDAO, List<GPSFixDAO>> getBoatPositions(RaceIdentifier raceIdentifier, Map<CompetitorDAO, Date> from,
|
||||
Map<CompetitorDAO, Date> to, boolean extrapolate) throws NoWindException;
|
||||
Map<CompetitorDTO, List<GPSFixDTO>> getBoatPositions(RaceIdentifier raceIdentifier, Map<CompetitorDTO, Date> from,
|
||||
Map<CompetitorDTO, Date> to, boolean extrapolate) throws NoWindException;
|
||||
|
||||
List<MarkDAO> getMarkPositions(RaceIdentifier raceIdentifier, Date date);
|
||||
List<MarkDTO> getMarkPositions(RaceIdentifier raceIdentifier, Date date);
|
||||
|
||||
List<QuickRankDAO> getQuickRanks(RaceIdentifier raceIdentifier, Date date) throws NoWindException;
|
||||
List<QuickRankDTO> getQuickRanks(RaceIdentifier raceIdentifier, Date date) throws NoWindException;
|
||||
|
||||
WindInfoForRaceDAO getWindInfo(RaceIdentifier raceIdentifier, Date from, long millisecondsStepWidth,
|
||||
WindInfoForRaceDTO getWindInfo(RaceIdentifier raceIdentifier, Date from, long millisecondsStepWidth,
|
||||
int numberOfFixes, double latDeg, double lngDeg, Collection<String> windSources) throws NoWindException;
|
||||
|
||||
void setWindSource(RaceIdentifier raceIdentifier, String windSourceName, boolean raceIsKnownToStartUpwind);
|
||||
|
||||
void removeWind(RaceIdentifier raceIdentifier, WindDAO windDAO);
|
||||
void removeWind(RaceIdentifier raceIdentifier, WindDTO windDAO);
|
||||
|
||||
public List<String> getLeaderboardNames() throws Exception;
|
||||
|
||||
LeaderboardDAO getLeaderboardByName(String leaderboardName, Date date,
|
||||
LeaderboardDTO getLeaderboardByName(String leaderboardName, Date date,
|
||||
Collection<String> namesOfRacesForWhichToLoadLegDetails)
|
||||
throws NoWindException;
|
||||
|
||||
List<LeaderboardDAO> getLeaderboards();
|
||||
List<LeaderboardDTO> getLeaderboards();
|
||||
|
||||
List<LeaderboardDAO> getLeaderboardsByEvent(EventIdentifier eventIdentifier);
|
||||
List<LeaderboardDTO> getLeaderboardsByEvent(EventIdentifier eventIdentifier);
|
||||
|
||||
void updateLeaderboard(String leaderboardName, String newLeaderboardName, int[] newDiscardingThreasholds);
|
||||
|
||||
LeaderboardDAO createLeaderboard(String leaderboardName, int[] discardThresholds);
|
||||
LeaderboardDTO createLeaderboard(String leaderboardName, int[] discardThresholds);
|
||||
|
||||
void removeLeaderboard(String leaderboardName);
|
||||
|
||||
@@ -120,13 +120,13 @@ public interface SailingService extends RemoteService {
|
||||
|
||||
void updateIsMedalRace(String leaderboardName, String columnName, boolean isMedalRace);
|
||||
|
||||
List<SwissTimingConfigurationDAO> getPreviousSwissTimingConfigurations();
|
||||
List<SwissTimingConfigurationDTO> getPreviousSwissTimingConfigurations();
|
||||
|
||||
List<SwissTimingRaceRecordDAO> listSwissTimingRaces(String hostname, int port, boolean canSendRequests) throws Exception;
|
||||
List<SwissTimingRaceRecordDTO> listSwissTimingRaces(String hostname, int port, boolean canSendRequests) throws Exception;
|
||||
|
||||
void storeSwissTimingConfiguration(String configName, String hostname, int port, boolean canSendRequests);
|
||||
|
||||
void trackWithSwissTiming(SwissTimingRaceRecordDAO rr, String hostname, int port, boolean canSendRequests,
|
||||
void trackWithSwissTiming(SwissTimingRaceRecordDTO rr, String hostname, int port, boolean canSendRequests,
|
||||
boolean trackWind, boolean correctWindByDeclination) throws Exception;
|
||||
|
||||
void sendSwissTimingDummyRace(String racMessage, String stlMesssage, String ccgMessage) throws IllegalArgumentException;
|
||||
@@ -135,14 +135,14 @@ public interface SailingService extends RemoteService {
|
||||
|
||||
String[] getCountryCodes();
|
||||
|
||||
CompetitorInRaceDAO getCompetitorRaceData(RaceIdentifier race,
|
||||
CompetitorsAndTimePointsDAO competitorsAndTimePointsDAO, DetailType dataType) throws NoWindException;
|
||||
CompetitorInRaceDTO getCompetitorRaceData(RaceIdentifier race,
|
||||
CompetitorsAndTimePointsDTO competitorsAndTimePointsDAO, DetailType dataType) throws NoWindException;
|
||||
|
||||
CompetitorsAndTimePointsDAO getCompetitorsAndTimePoints(RaceIdentifier race, int steps);
|
||||
CompetitorsAndTimePointsDTO getCompetitorsAndTimePoints(RaceIdentifier race, int steps);
|
||||
|
||||
Map<CompetitorDAO, List<GPSFixDAO>> getDouglasPoints(RaceIdentifier raceIdentifier,
|
||||
Map<CompetitorDAO, Date> from, Map<CompetitorDAO, Date> to, double meters) throws NoWindException;
|
||||
Map<CompetitorDTO, List<GPSFixDTO>> getDouglasPoints(RaceIdentifier raceIdentifier,
|
||||
Map<CompetitorDTO, Date> from, Map<CompetitorDTO, Date> to, double meters) throws NoWindException;
|
||||
|
||||
Map<CompetitorDAO, List<ManeuverDAO>> getManeuvers(RaceIdentifier raceIdentifier,
|
||||
Map<CompetitorDAO, Date> from, Map<CompetitorDAO, Date> to) throws NoWindException;
|
||||
Map<CompetitorDTO, List<ManeuverDTO>> getManeuvers(RaceIdentifier raceIdentifier,
|
||||
Map<CompetitorDTO, Date> from, Map<CompetitorDTO, Date> to) throws NoWindException;
|
||||
}
|
||||
+58
-58
@@ -10,23 +10,23 @@ import com.sap.sailing.domain.base.Course;
|
||||
import com.sap.sailing.domain.common.WindSource;
|
||||
import com.sap.sailing.domain.common.impl.Util.Pair;
|
||||
import com.sap.sailing.domain.leaderboard.RaceInLeaderboard;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorInRaceDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorsAndTimePointsDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.GPSFixDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardEntryDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.ManeuverDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.MarkDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.QuickRankDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceInLeaderboardDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.SwissTimingConfigurationDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.SwissTimingRaceRecordDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.TracTracConfigurationDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.TracTracRaceRecordDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindInfoForRaceDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorInRaceDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorsAndTimePointsDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.GPSFixDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardEntryDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.ManeuverDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.MarkDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.QuickRankDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceInLeaderboardDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.SwissTimingConfigurationDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.SwissTimingRaceRecordDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.TracTracConfigurationDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.TracTracRaceRecordDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindInfoForRaceDTO;
|
||||
import com.sap.sailing.server.api.DetailType;
|
||||
import com.sap.sailing.server.api.EventAndRaceIdentifier;
|
||||
import com.sap.sailing.server.api.EventIdentifier;
|
||||
@@ -37,23 +37,23 @@ import com.sap.sailing.server.api.RaceIdentifier;
|
||||
*/
|
||||
public interface SailingServiceAsync {
|
||||
|
||||
void listEvents(boolean withRacePlaces, AsyncCallback<List<EventDAO>> callback);
|
||||
void listEvents(boolean withRacePlaces, AsyncCallback<List<EventDTO>> callback);
|
||||
|
||||
/**
|
||||
* The string returned in the callback's pair is the common event name
|
||||
*/
|
||||
void listTracTracRacesInEvent(String eventJsonURL, AsyncCallback<Pair<String, List<TracTracRaceRecordDAO>>> callback);
|
||||
void listTracTracRacesInEvent(String eventJsonURL, AsyncCallback<Pair<String, List<TracTracRaceRecordDTO>>> callback);
|
||||
|
||||
/**
|
||||
* @param liveURI may be <code>null</code> or the empty string in which case the server will
|
||||
* use the {@link TracTracRaceRecordDAO#liveURI} from the <code>rr</code> race record.
|
||||
* use the {@link TracTracRaceRecordDTO#liveURI} from the <code>rr</code> race record.
|
||||
* @param storedURImay be <code>null</code> or the empty string in which case the server will
|
||||
* use the {@link TracTracRaceRecordDAO#storedURI} from the <code>rr</code> race record.
|
||||
* use the {@link TracTracRaceRecordDTO#storedURI} from the <code>rr</code> race record.
|
||||
*/
|
||||
void track(TracTracRaceRecordDAO rr, String liveURI, String storedURI, boolean trackWind, boolean correctWindByDeclination,
|
||||
void track(TracTracRaceRecordDTO rr, String liveURI, String storedURI, boolean trackWind, boolean correctWindByDeclination,
|
||||
AsyncCallback<Void> callback);
|
||||
|
||||
void getPreviousTracTracConfigurations(AsyncCallback<List<TracTracConfigurationDAO>> callback);
|
||||
void getPreviousTracTracConfigurations(AsyncCallback<List<TracTracConfigurationDTO>> callback);
|
||||
|
||||
void storeTracTracConfiguration(String name, String jsonURL, String liveDataURI, String storedDataURI,
|
||||
AsyncCallback<Void> callback);
|
||||
@@ -73,7 +73,7 @@ public interface SailingServiceAsync {
|
||||
* @param windSources if <code>null</code>, information about all available wind sources will be provided
|
||||
*/
|
||||
void getWindInfo(RaceIdentifier raceIdentifier, Date from, Date to, WindSource[] windSources,
|
||||
AsyncCallback<WindInfoForRaceDAO> callback);
|
||||
AsyncCallback<WindInfoForRaceDTO> callback);
|
||||
|
||||
/**
|
||||
* @param windSources
|
||||
@@ -82,11 +82,11 @@ public interface SailingServiceAsync {
|
||||
*/
|
||||
void getWindInfo(RaceIdentifier raceIdentifier, Date from, long millisecondsStepWidth, int numberOfFixes,
|
||||
double latDeg, double lngDeg, Collection<String> windSources,
|
||||
AsyncCallback<WindInfoForRaceDAO> callback);
|
||||
AsyncCallback<WindInfoForRaceDTO> callback);
|
||||
|
||||
void setWind(RaceIdentifier raceIdentifier, WindDAO wind, AsyncCallback<Void> callback);
|
||||
void setWind(RaceIdentifier raceIdentifier, WindDTO wind, AsyncCallback<Void> callback);
|
||||
|
||||
void removeWind(RaceIdentifier raceIdentifier, WindDAO windDAO, AsyncCallback<Void> callback);
|
||||
void removeWind(RaceIdentifier raceIdentifier, WindDTO windDAO, AsyncCallback<Void> callback);
|
||||
|
||||
/**
|
||||
* @param from
|
||||
@@ -104,48 +104,48 @@ public interface SailingServiceAsync {
|
||||
* chronological order is provided. The last one is the last position at or before <code>date</code>.
|
||||
*/
|
||||
void getBoatPositions(RaceIdentifier raceIdentifier,
|
||||
Map<CompetitorDAO, Date> from, Map<CompetitorDAO, Date> to,
|
||||
boolean extrapolate, AsyncCallback<Map<CompetitorDAO, List<GPSFixDAO>>> callback);
|
||||
Map<CompetitorDTO, Date> from, Map<CompetitorDTO, Date> to,
|
||||
boolean extrapolate, AsyncCallback<Map<CompetitorDTO, List<GPSFixDTO>>> callback);
|
||||
|
||||
void getMarkPositions(RaceIdentifier raceIdentifier, Date date, AsyncCallback<List<MarkDAO>> asyncCallback);
|
||||
void getMarkPositions(RaceIdentifier raceIdentifier, Date date, AsyncCallback<List<MarkDTO>> asyncCallback);
|
||||
|
||||
void getQuickRanks(RaceIdentifier raceIdentifier, Date date, AsyncCallback<List<QuickRankDAO>> callback);
|
||||
void getQuickRanks(RaceIdentifier raceIdentifier, Date date, AsyncCallback<List<QuickRankDTO>> callback);
|
||||
|
||||
void setWindSource(RaceIdentifier raceIdentifier, String windSourceName, boolean raceIsKnownToStartUpwind, AsyncCallback<Void> callback);
|
||||
|
||||
/**
|
||||
* Returns a {@link LeaderboardDAO} will information about all races, their points and competitor display names
|
||||
* Returns a {@link LeaderboardDTO} will information about all races, their points and competitor display names
|
||||
* filled in. The column details are filled for the races whose named are provided in
|
||||
* <code>namesOfRacesForWhichToLoadLegDetails</code>.
|
||||
*
|
||||
* @param namesOfRacesForWhichToLoadLegDetails
|
||||
* if <code>null</code>, no {@link LeaderboardEntryDAO#legDetails leg details} will be present in the
|
||||
* result ({@link LeaderboardEntryDAO#legDetails} will be <code>null</code> for all
|
||||
* {@link LeaderboardEntryDAO} objects contained). Otherwise, the {@link LeaderboardEntryDAO#legDetails}
|
||||
* if <code>null</code>, no {@link LeaderboardEntryDTO#legDetails leg details} will be present in the
|
||||
* result ({@link LeaderboardEntryDTO#legDetails} will be <code>null</code> for all
|
||||
* {@link LeaderboardEntryDTO} objects contained). Otherwise, the {@link LeaderboardEntryDTO#legDetails}
|
||||
* list will contain one entry per leg of the race {@link Course} for those race columns whose
|
||||
* {@link RaceInLeaderboard#getName() name} is contained in
|
||||
* <code>namesOfRacesForWhichToLoadLegDetails</code>. For all other columns,
|
||||
* {@link LeaderboardEntryDAO#legDetails} is <code>null</code>.
|
||||
* {@link LeaderboardEntryDTO#legDetails} is <code>null</code>.
|
||||
*/
|
||||
void getLeaderboardByName(String leaderboardName, Date date,
|
||||
Collection<String> namesOfRacesForWhichToLoadLegDetails, AsyncCallback<LeaderboardDAO> callback);
|
||||
Collection<String> namesOfRacesForWhichToLoadLegDetails, AsyncCallback<LeaderboardDTO> callback);
|
||||
|
||||
void getLeaderboardNames(AsyncCallback<List<String>> callback);
|
||||
|
||||
/**
|
||||
* Creates a {@link LeaderboardDAO} for each leaderboard known by the server and fills in the name, race master data
|
||||
* in the form of {@link RaceInLeaderboardDAO}s, whether or not there are {@link LeaderboardDAO#hasCarriedPoints
|
||||
* carried points} and the {@link LeaderboardDAO#discardThresholds discarding thresholds} for the leaderboard. No
|
||||
* Creates a {@link LeaderboardDTO} for each leaderboard known by the server and fills in the name, race master data
|
||||
* in the form of {@link RaceInLeaderboardDTO}s, whether or not there are {@link LeaderboardDTO#hasCarriedPoints
|
||||
* carried points} and the {@link LeaderboardDTO#discardThresholds discarding thresholds} for the leaderboard. No
|
||||
* data about the points is filled into the result object. No data about the competitor display names is filled in;
|
||||
* instead, an empty map is used for {@link LeaderboardDAO#competitorDisplayNames}.
|
||||
* instead, an empty map is used for {@link LeaderboardDTO#competitorDisplayNames}.
|
||||
*/
|
||||
void getLeaderboards(AsyncCallback<List<LeaderboardDAO>> callback);
|
||||
void getLeaderboards(AsyncCallback<List<LeaderboardDTO>> callback);
|
||||
|
||||
/**
|
||||
* Does the same as {@link SailingServiceAsync#getLeaderboards(AsyncCallback) getLeaderboards} but returns only
|
||||
* leaderboards which have the given event as race
|
||||
*/
|
||||
void getLeaderboardsByEvent(EventIdentifier eventIdentifier, AsyncCallback<List<LeaderboardDAO>> callback);
|
||||
void getLeaderboardsByEvent(EventIdentifier eventIdentifier, AsyncCallback<List<LeaderboardDTO>> callback);
|
||||
|
||||
void updateLeaderboard(String leaderboardName, String newLeaderboardName, int[] newDiscardingThreasholds,
|
||||
AsyncCallback<Void> callback);
|
||||
@@ -156,7 +156,7 @@ public interface SailingServiceAsync {
|
||||
* data about the race columns filled in, but no details about the race points. As such, the result structure
|
||||
* equals that of the result of {@link #getLeaderboards(AsyncCallback)}.
|
||||
*/
|
||||
void createLeaderboard(String leaderboardName, int[] discardThresholds, AsyncCallback<LeaderboardDAO> asyncCallback);
|
||||
void createLeaderboard(String leaderboardName, int[] discardThresholds, AsyncCallback<LeaderboardDTO> asyncCallback);
|
||||
|
||||
void removeLeaderboard(String leaderboardName, AsyncCallback<Void> asyncCallback);
|
||||
|
||||
@@ -201,20 +201,20 @@ public interface SailingServiceAsync {
|
||||
void updateIsMedalRace(String leaderboardName, String columnName, boolean isMedalRace,
|
||||
AsyncCallback<Void> callback);
|
||||
|
||||
void getPreviousSwissTimingConfigurations(AsyncCallback<List<SwissTimingConfigurationDAO>> asyncCallback);
|
||||
void getPreviousSwissTimingConfigurations(AsyncCallback<List<SwissTimingConfigurationDTO>> asyncCallback);
|
||||
|
||||
void listSwissTimingRaces(String hostname, int port, boolean canSendRequests,
|
||||
AsyncCallback<List<SwissTimingRaceRecordDAO>> asyncCallback);
|
||||
AsyncCallback<List<SwissTimingRaceRecordDTO>> asyncCallback);
|
||||
|
||||
void storeSwissTimingConfiguration(String configName, String hostname, int port, boolean canSendRequests, AsyncCallback<Void> asyncCallback);
|
||||
|
||||
void trackWithSwissTiming(SwissTimingRaceRecordDAO rr, String hostname, int port, boolean canSendRequests,
|
||||
void trackWithSwissTiming(SwissTimingRaceRecordDTO rr, String hostname, int port, boolean canSendRequests,
|
||||
boolean trackWind, boolean correctWindByDeclination, AsyncCallback<Void> asyncCallback);
|
||||
|
||||
void sendSwissTimingDummyRace(String racMessage, String stlMesssage, String ccgMessage, AsyncCallback<Void> callback);
|
||||
|
||||
/**
|
||||
* Requests the computation of the {@link LeaderboardDAO} for <code>leaderboardName</code> <code>times</code> times.
|
||||
* Requests the computation of the {@link LeaderboardDTO} for <code>leaderboardName</code> <code>times</code> times.
|
||||
* The date used for the {@link #getLeaderboardByName(String, Date, Collection, AsyncCallback)} call is iterated
|
||||
* in 10ms time steps, going backwards from "now." For all races, all details are requested.
|
||||
*/
|
||||
@@ -224,9 +224,9 @@ public interface SailingServiceAsync {
|
||||
|
||||
/**
|
||||
* This method computes the in {@code dataType} selected data for the in {@code race} specified race
|
||||
* for all competitors returned by {@link CompetitorsAndTimePointsDAO#getCompetitor()} at the timepoints
|
||||
* returned by {@link CompetitorsAndTimePointsDAO#getTimePoints()}.
|
||||
* The returned {@link CompetitorInRaceDAO} contains the values for the timepoints as well as the values for the markpassings.
|
||||
* for all competitors returned by {@link CompetitorsAndTimePointsDTO#getCompetitor()} at the timepoints
|
||||
* returned by {@link CompetitorsAndTimePointsDTO#getTimePoints()}.
|
||||
* The returned {@link CompetitorInRaceDTO} contains the values for the timepoints as well as the values for the markpassings.
|
||||
*
|
||||
* @see DetailType
|
||||
*
|
||||
@@ -238,20 +238,20 @@ public interface SailingServiceAsync {
|
||||
* @param callback An AsyncCallback that returns the computed data as a parameter in the {@link AsyncCallback#onSuccess(Object)} method.
|
||||
*/
|
||||
void getCompetitorRaceData(RaceIdentifier race,
|
||||
CompetitorsAndTimePointsDAO competitorsAndTimePointsDAO,
|
||||
DetailType dataType, AsyncCallback<CompetitorInRaceDAO> callback);
|
||||
CompetitorsAndTimePointsDTO competitorsAndTimePointsDAO,
|
||||
DetailType dataType, AsyncCallback<CompetitorInRaceDTO> callback);
|
||||
|
||||
void getDouglasPoints(RaceIdentifier raceIdentifier, Map<CompetitorDAO, Date> from, Map<CompetitorDAO, Date> to,
|
||||
double meters, AsyncCallback<Map<CompetitorDAO, List<GPSFixDAO>>> callback);
|
||||
void getDouglasPoints(RaceIdentifier raceIdentifier, Map<CompetitorDTO, Date> from, Map<CompetitorDTO, Date> to,
|
||||
double meters, AsyncCallback<Map<CompetitorDTO, List<GPSFixDTO>>> callback);
|
||||
|
||||
void getManeuvers(RaceIdentifier raceIdentifier, Map<CompetitorDAO, Date> from, Map<CompetitorDAO, Date> to,
|
||||
AsyncCallback<Map<CompetitorDAO, List<ManeuverDAO>>> callback);
|
||||
void getManeuvers(RaceIdentifier raceIdentifier, Map<CompetitorDTO, Date> from, Map<CompetitorDTO, Date> to,
|
||||
AsyncCallback<Map<CompetitorDTO, List<ManeuverDTO>>> callback);
|
||||
|
||||
/**
|
||||
* For the race identified by <code>race</code> computes <code>steps</code> equidistant time points starting at a
|
||||
* few seconds before the race starts, up to the end of the race. The result describes the race's competitors, their
|
||||
* mark passing times, the race start time and the list of time points according to the above specification.
|
||||
*/
|
||||
void getCompetitorsAndTimePoints(RaceIdentifier race, int steps, AsyncCallback<CompetitorsAndTimePointsDAO> callback);
|
||||
void getCompetitorsAndTimePoints(RaceIdentifier race, int steps, AsyncCallback<CompetitorsAndTimePointsDTO> callback);
|
||||
|
||||
}
|
||||
+32
-32
@@ -56,9 +56,9 @@ import com.sap.sailing.gwt.ui.client.DetailTypeFormatter;
|
||||
import com.sap.sailing.gwt.ui.client.ErrorReporter;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorInRaceDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorsAndTimePointsDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorInRaceDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorsAndTimePointsDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.components.Component;
|
||||
import com.sap.sailing.gwt.ui.shared.components.SettingsDialog;
|
||||
import com.sap.sailing.server.api.DetailType;
|
||||
@@ -77,8 +77,8 @@ import com.sap.sailing.server.api.RaceIdentifier;
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractChartPanel<SettingsType extends ChartSettings> extends SimplePanel implements CompetitorSelectionChangeListener {
|
||||
private CompetitorInRaceDAO chartData;
|
||||
private CompetitorsAndTimePointsDAO competitorsAndTimePointsDAO = null;
|
||||
private CompetitorInRaceDTO chartData;
|
||||
private CompetitorsAndTimePointsDTO competitorsAndTimePointsDAO = null;
|
||||
private final SailingServiceAsync sailingService;
|
||||
private final ErrorReporter errorReporter;
|
||||
private final DateTimeFormat dateFormat;
|
||||
@@ -95,9 +95,9 @@ public abstract class AbstractChartPanel<SettingsType extends ChartSettings> ext
|
||||
private PlotWithOverview plot;
|
||||
private final List<SeriesHandler> seriesID;
|
||||
private final Set<SeriesHandler> seriesIsUsed;
|
||||
private final List<CompetitorDAO> competitorID;
|
||||
private final List<CompetitorDTO> competitorID;
|
||||
private final List<SeriesHandler> markSeriesID;
|
||||
private final HashMap<CompetitorDAO, Widget> competitorLabels;
|
||||
private final HashMap<CompetitorDTO, Widget> competitorLabels;
|
||||
private final HashMap<String, String> markPassingBuoyName;
|
||||
private int width, height;
|
||||
|
||||
@@ -115,13 +115,13 @@ public abstract class AbstractChartPanel<SettingsType extends ChartSettings> ext
|
||||
this.competitorSelectionProvider = competitorSelectionProvider;
|
||||
competitorSelectionProvider.addCompetitorSelectionChangeListener(this);
|
||||
this.errorReporter = errorReporter;
|
||||
chartData = new CompetitorInRaceDAO();
|
||||
chartData = new CompetitorInRaceDTO();
|
||||
seriesID = new ArrayList<SeriesHandler>();
|
||||
seriesIsUsed = new HashSet<SeriesHandler>();
|
||||
competitorID = new ArrayList<CompetitorDAO>();
|
||||
competitorID = new ArrayList<CompetitorDTO>();
|
||||
markSeriesID = new ArrayList<SeriesHandler>();
|
||||
colorMap = new ColorMap<Integer>();
|
||||
competitorLabels = new HashMap<CompetitorDAO, Widget>();
|
||||
competitorLabels = new HashMap<CompetitorDTO, Widget>();
|
||||
markPassingBuoyName = new HashMap<String, String>();
|
||||
this.sailingService = sailingService;
|
||||
this.races = races;
|
||||
@@ -192,24 +192,24 @@ public abstract class AbstractChartPanel<SettingsType extends ChartSettings> ext
|
||||
final Runnable loadData = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final List<CompetitorDAO> competitorsToLoad = new ArrayList<CompetitorDAO>();
|
||||
for (CompetitorDAO competitor : competitorSelectionProvider.getAllCompetitors()) {
|
||||
final List<CompetitorDTO> competitorsToLoad = new ArrayList<CompetitorDTO>();
|
||||
for (CompetitorDTO competitor : competitorSelectionProvider.getAllCompetitors()) {
|
||||
if (isCompetitorVisible(competitor) && !competitorID.contains(competitor)) {
|
||||
competitorsToLoad.add(competitor);
|
||||
}
|
||||
}
|
||||
final CompetitorsAndTimePointsDAO competitorsAndTimePointsToLoad = new CompetitorsAndTimePointsDAO(
|
||||
final CompetitorsAndTimePointsDTO competitorsAndTimePointsToLoad = new CompetitorsAndTimePointsDTO(
|
||||
getStepsToLoad());
|
||||
competitorsAndTimePointsToLoad.setStartTime(getCompetitorsAndTimePointsDAO().getStartTime());
|
||||
competitorsAndTimePointsToLoad.setTimePointOfNewestEvent(getCompetitorsAndTimePointsDAO()
|
||||
.getTimePointOfNewestEvent());
|
||||
for (CompetitorDAO competitor : competitorsToLoad) {
|
||||
for (CompetitorDTO competitor : competitorsToLoad) {
|
||||
competitorsAndTimePointsToLoad.setMarkPassings(competitor,
|
||||
getCompetitorsAndTimePointsDAO().getMarkPassings(competitor));
|
||||
}
|
||||
competitorsAndTimePointsToLoad.setCompetitor(competitorsToLoad.toArray(new CompetitorDAO[0]));
|
||||
competitorsAndTimePointsToLoad.setCompetitor(competitorsToLoad.toArray(new CompetitorDTO[0]));
|
||||
AbstractChartPanel.this.sailingService.getCompetitorRaceData(races[selectedRace],
|
||||
competitorsAndTimePointsToLoad, dataToShow, new AsyncCallback<CompetitorInRaceDAO>() {
|
||||
competitorsAndTimePointsToLoad, dataToShow, new AsyncCallback<CompetitorInRaceDTO>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError(getStringMessages().failedToLoadRaceData() + ": "
|
||||
@@ -217,9 +217,9 @@ public abstract class AbstractChartPanel<SettingsType extends ChartSettings> ext
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(CompetitorInRaceDAO result) {
|
||||
public void onSuccess(CompetitorInRaceDTO result) {
|
||||
fireEvent(new DataLoadedEvent());
|
||||
for (CompetitorDAO competitor : competitorsToLoad) {
|
||||
for (CompetitorDTO competitor : competitorsToLoad) {
|
||||
chartData.setRaceData(competitor, result.getRaceData(competitor));
|
||||
chartData.setMarkPassingData(competitor, result.getMarkPassings(competitor));
|
||||
}
|
||||
@@ -233,14 +233,14 @@ public abstract class AbstractChartPanel<SettingsType extends ChartSettings> ext
|
||||
loadData.run();
|
||||
} else {
|
||||
this.sailingService.getCompetitorsAndTimePoints(races[selectedRace], getStepsToLoad(),
|
||||
new AsyncCallback<CompetitorsAndTimePointsDAO>() {
|
||||
new AsyncCallback<CompetitorsAndTimePointsDTO>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError(stringMessages.failedToLoadRaceInformation(caught.toString()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(CompetitorsAndTimePointsDAO result) {
|
||||
public void onSuccess(CompetitorsAndTimePointsDTO result) {
|
||||
setCompetitorsAndTimePointsDAO(result);
|
||||
if (chart.getWidgetCount() == 1){
|
||||
chart.add(createChart());
|
||||
@@ -252,12 +252,12 @@ public abstract class AbstractChartPanel<SettingsType extends ChartSettings> ext
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addedToSelection(CompetitorDAO competitor) {
|
||||
public void addedToSelection(CompetitorDTO competitor) {
|
||||
loadData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removedFromSelection(CompetitorDAO competitor) {
|
||||
public void removedFromSelection(CompetitorDTO competitor) {
|
||||
if (competitorID.contains(competitor)) {
|
||||
setLegendVisible(competitor, false);
|
||||
getCompetitorSeries(competitor).setVisible(false);
|
||||
@@ -266,7 +266,7 @@ public abstract class AbstractChartPanel<SettingsType extends ChartSettings> ext
|
||||
plot.redraw();
|
||||
}
|
||||
|
||||
private synchronized void updateTableData(CompetitorDAO[] competitorDAOs) {
|
||||
private synchronized void updateTableData(CompetitorDTO[] competitorDAOs) {
|
||||
List<SeriesHandler> series = new ArrayList<SeriesHandler>();
|
||||
for (SeriesHandler sh : seriesID){
|
||||
series.add(sh);
|
||||
@@ -274,9 +274,9 @@ public abstract class AbstractChartPanel<SettingsType extends ChartSettings> ext
|
||||
for (SeriesHandler sh : markSeriesID){
|
||||
series.add(sh);
|
||||
}
|
||||
CompetitorDAO firstCompetitor = null;
|
||||
CompetitorDTO firstCompetitor = null;
|
||||
if (getCompetitorsAndTimePointsDAO() != null && chartData != null) {
|
||||
for (CompetitorDAO competitor : competitorDAOs) {
|
||||
for (CompetitorDTO competitor : competitorDAOs) {
|
||||
if (firstCompetitor == null){
|
||||
firstCompetitor = competitor;
|
||||
}
|
||||
@@ -369,7 +369,7 @@ public abstract class AbstractChartPanel<SettingsType extends ChartSettings> ext
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isCompetitorVisible(CompetitorDAO competitor) {
|
||||
private boolean isCompetitorVisible(CompetitorDTO competitor) {
|
||||
return competitorSelectionProvider.isSelected(competitor);
|
||||
}
|
||||
|
||||
@@ -410,7 +410,7 @@ public abstract class AbstractChartPanel<SettingsType extends ChartSettings> ext
|
||||
plot.addHoverListener(new PlotHoverListener() {
|
||||
public void onPlotHover(Plot plot, PlotPosition position, PlotItem item) {
|
||||
// FIXME can the indexOf ever find anything? seriesID is a List<SeriesHandler>; item.getSeries() returns a Series object
|
||||
CompetitorDAO competitor = competitorID.get(seriesID.indexOf(item.getSeries()));
|
||||
CompetitorDTO competitor = competitorID.get(seriesID.indexOf(item.getSeries()));
|
||||
if (item != null && competitor != null) {
|
||||
if (item.getSeries().getLabel().toLowerCase().contains("mark")) {
|
||||
selectedPointLabel.setText(stringMessages.competitorPassedMarkAtDate(competitor.name,
|
||||
@@ -494,7 +494,7 @@ public abstract class AbstractChartPanel<SettingsType extends ChartSettings> ext
|
||||
* @param competitor
|
||||
* @return A series in the chart, that can be used to show the data of a specific competitor.
|
||||
*/
|
||||
private SeriesHandler getCompetitorSeries(CompetitorDAO competitor){
|
||||
private SeriesHandler getCompetitorSeries(CompetitorDTO competitor){
|
||||
return seriesID.get(competitorID.indexOf(competitor));
|
||||
}
|
||||
|
||||
@@ -503,14 +503,14 @@ public abstract class AbstractChartPanel<SettingsType extends ChartSettings> ext
|
||||
* @param competitor
|
||||
* @return A series in the chart, that can be used to show the mark passings.
|
||||
*/
|
||||
private SeriesHandler getCompetitorMarkPassingSeries(CompetitorDAO competitor){
|
||||
private SeriesHandler getCompetitorMarkPassingSeries(CompetitorDTO competitor){
|
||||
return markSeriesID.get(competitorID.indexOf(competitor));
|
||||
}
|
||||
|
||||
/**
|
||||
* Decide if the legend for a specific competitor should be shown or not.
|
||||
*/
|
||||
private void setLegendVisible(CompetitorDAO competitor, boolean visible) {
|
||||
private void setLegendVisible(CompetitorDTO competitor, boolean visible) {
|
||||
Widget label = competitorLabels.get(competitor);
|
||||
if (label == null){
|
||||
label = createCompetitorLabel(competitor.name, colorMap.getColorByID(competitorID.indexOf(competitor)));
|
||||
@@ -617,11 +617,11 @@ public abstract class AbstractChartPanel<SettingsType extends ChartSettings> ext
|
||||
this.dataToShow = dataToShow;
|
||||
}
|
||||
|
||||
protected CompetitorsAndTimePointsDAO getCompetitorsAndTimePointsDAO() {
|
||||
protected CompetitorsAndTimePointsDTO getCompetitorsAndTimePointsDAO() {
|
||||
return competitorsAndTimePointsDAO;
|
||||
}
|
||||
|
||||
protected void setCompetitorsAndTimePointsDAO(CompetitorsAndTimePointsDAO competitorsAndTimePointsDAO) {
|
||||
protected void setCompetitorsAndTimePointsDAO(CompetitorsAndTimePointsDTO competitorsAndTimePointsDAO) {
|
||||
this.competitorsAndTimePointsDAO = competitorsAndTimePointsDAO;
|
||||
}
|
||||
}
|
||||
+17
-17
@@ -13,7 +13,7 @@ import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||
import com.google.gwt.user.cellview.client.CellTable;
|
||||
import com.google.gwt.user.cellview.client.Header;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardRowDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardRowDTO;
|
||||
import com.sap.sailing.server.api.DetailType;
|
||||
|
||||
/**
|
||||
@@ -22,11 +22,11 @@ import com.sap.sailing.server.api.DetailType;
|
||||
* @author Axel Uhl (D043530)
|
||||
*
|
||||
*/
|
||||
public abstract class ExpandableSortableColumn<C> extends SortableColumn<LeaderboardRowDAO, C> {
|
||||
public abstract class ExpandableSortableColumn<C> extends SortableColumn<LeaderboardRowDTO, C> {
|
||||
private boolean enableExpansion;
|
||||
private boolean suppressSortingOnce;
|
||||
private final LeaderboardPanel leaderboardPanel;
|
||||
private final Map<DetailType, SortableColumn<LeaderboardRowDAO, ?>> detailColumnsMap;
|
||||
private final Map<DetailType, SortableColumn<LeaderboardRowDTO, ?>> detailColumnsMap;
|
||||
private final List<DetailType> detailSelection;
|
||||
|
||||
/**
|
||||
@@ -36,7 +36,7 @@ public abstract class ExpandableSortableColumn<C> extends SortableColumn<Leaderb
|
||||
* collection and are dynamically inserted to and removed from the {@link CellTable} to the right
|
||||
* of this column.
|
||||
*/
|
||||
protected List<SortableColumn<LeaderboardRowDAO, ?>> directChildren;
|
||||
protected List<SortableColumn<LeaderboardRowDTO, ?>> directChildren;
|
||||
|
||||
/**
|
||||
* Tells if this race column is currently displayed in expanded form which includes a visualization
|
||||
@@ -58,7 +58,7 @@ public abstract class ExpandableSortableColumn<C> extends SortableColumn<Leaderb
|
||||
* By default, an expandable sortable column has no detail columns. Subclasses that want to offer detail columns must
|
||||
* override this method.
|
||||
*/
|
||||
protected Map<DetailType, SortableColumn<LeaderboardRowDAO, ?>> getDetailColumnMap(
|
||||
protected Map<DetailType, SortableColumn<LeaderboardRowDTO, ?>> getDetailColumnMap(
|
||||
LeaderboardPanel leaderboardPanel, StringMessages stringConstants, String detailHeaderStyle,
|
||||
String detailColumnStyle) {
|
||||
return Collections.emptyMap();
|
||||
@@ -86,12 +86,12 @@ public abstract class ExpandableSortableColumn<C> extends SortableColumn<Leaderb
|
||||
* ManeuverCountRaceColumn is not known at this point because it will be later set in the constructor of
|
||||
* TextRaceColumn
|
||||
*/
|
||||
protected Iterable<SortableColumn<LeaderboardRowDAO, ?>> getDirectChildren() {
|
||||
List<SortableColumn<LeaderboardRowDAO, ?>> result;
|
||||
protected Iterable<SortableColumn<LeaderboardRowDTO, ?>> getDirectChildren() {
|
||||
List<SortableColumn<LeaderboardRowDTO, ?>> result;
|
||||
if (isExpanded()) {
|
||||
result = new ArrayList<SortableColumn<LeaderboardRowDAO,?>>();
|
||||
result = new ArrayList<SortableColumn<LeaderboardRowDTO,?>>();
|
||||
for (DetailType detailColumnType : detailSelection) {
|
||||
SortableColumn<LeaderboardRowDAO, ?> selectedColumn = detailColumnsMap.get(detailColumnType);
|
||||
SortableColumn<LeaderboardRowDTO, ?> selectedColumn = detailColumnsMap.get(detailColumnType);
|
||||
if (selectedColumn != null) {
|
||||
result.add(selectedColumn);
|
||||
}
|
||||
@@ -102,7 +102,7 @@ public abstract class ExpandableSortableColumn<C> extends SortableColumn<Leaderb
|
||||
return result;
|
||||
}
|
||||
|
||||
protected SortableColumn<LeaderboardRowDAO, ?> createExpansionColumn(DetailType detailColumnType) {
|
||||
protected SortableColumn<LeaderboardRowDTO, ?> createExpansionColumn(DetailType detailColumnType) {
|
||||
throw new RuntimeException("Detail column type "+detailColumnType+" not supported by column of type "+getClass().getName());
|
||||
}
|
||||
|
||||
@@ -119,10 +119,10 @@ public abstract class ExpandableSortableColumn<C> extends SortableColumn<Leaderb
|
||||
* the column collection returned does not necessarily contain only columns really part of the {@link CellTable}
|
||||
* used to display this column.
|
||||
*/
|
||||
private Collection<SortableColumn<LeaderboardRowDAO, ?>> getAllVisibleChildren() {
|
||||
List<SortableColumn<LeaderboardRowDAO, ?>> transitiveChildren = new ArrayList<SortableColumn<LeaderboardRowDAO,?>>();
|
||||
private Collection<SortableColumn<LeaderboardRowDTO, ?>> getAllVisibleChildren() {
|
||||
List<SortableColumn<LeaderboardRowDTO, ?>> transitiveChildren = new ArrayList<SortableColumn<LeaderboardRowDTO,?>>();
|
||||
if (isExpanded()) {
|
||||
for (SortableColumn<LeaderboardRowDAO, ?> childColumn : getDirectChildren()) {
|
||||
for (SortableColumn<LeaderboardRowDTO, ?> childColumn : getDirectChildren()) {
|
||||
transitiveChildren.add(childColumn);
|
||||
if (childColumn instanceof ExpandableSortableColumn<?>) {
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -145,9 +145,9 @@ public abstract class ExpandableSortableColumn<C> extends SortableColumn<Leaderb
|
||||
*/
|
||||
public void toggleExpansion() {
|
||||
if (isExpansionEnabled()) {
|
||||
final CellTable<LeaderboardRowDAO> table = getLeaderboardPanel().getLeaderboardTable();
|
||||
final CellTable<LeaderboardRowDTO> table = getLeaderboardPanel().getLeaderboardTable();
|
||||
if (isExpanded()) {
|
||||
for (SortableColumn<LeaderboardRowDAO, ?> column : getAllVisibleChildren()) {
|
||||
for (SortableColumn<LeaderboardRowDTO, ?> column : getAllVisibleChildren()) {
|
||||
getLeaderboardPanel().removeColumn(column); // removes only the children currently displayed
|
||||
}
|
||||
// important: toggle expanded state after asking for all visible children
|
||||
@@ -162,7 +162,7 @@ public abstract class ExpandableSortableColumn<C> extends SortableColumn<Leaderb
|
||||
// while toggling the columns.
|
||||
if (insertIndex != -1) {
|
||||
insertIndex++;
|
||||
for (SortableColumn<LeaderboardRowDAO, ?> column : getAllVisibleChildren()) {
|
||||
for (SortableColumn<LeaderboardRowDTO, ?> column : getAllVisibleChildren()) {
|
||||
column.updateMinMax(getLeaderboardPanel().getLeaderboard());
|
||||
getLeaderboardPanel().insertColumn(insertIndex++, column);
|
||||
}
|
||||
@@ -207,7 +207,7 @@ public abstract class ExpandableSortableColumn<C> extends SortableColumn<Leaderb
|
||||
this.enableExpansion = enableLegDrillDown;
|
||||
}
|
||||
|
||||
protected void defaultRender(Context context, LeaderboardRowDAO object, SafeHtmlBuilder html) {
|
||||
protected void defaultRender(Context context, LeaderboardRowDTO object, SafeHtmlBuilder html) {
|
||||
super.render(context, object, html);
|
||||
}
|
||||
|
||||
|
||||
+11
-11
@@ -5,8 +5,8 @@ import com.google.gwt.cell.client.TextCell;
|
||||
import com.google.gwt.i18n.client.NumberFormat;
|
||||
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||
import com.google.gwt.user.cellview.client.CellTable;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardRowDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardRowDTO;
|
||||
|
||||
public class FormattedDoubleLegDetailColumn extends LegDetailColumn<Double, String> implements HasStringAndDoubleValue {
|
||||
private final NumberFormat formatter;
|
||||
@@ -14,7 +14,7 @@ public class FormattedDoubleLegDetailColumn extends LegDetailColumn<Double, Stri
|
||||
|
||||
public FormattedDoubleLegDetailColumn(String title, String unit,
|
||||
com.sap.sailing.gwt.ui.leaderboard.LegDetailColumn.LegDetailField<Double> field, int decimals,
|
||||
CellTable<LeaderboardRowDAO> leaderboardTable, String headerStyle, String columnStyle) {
|
||||
CellTable<LeaderboardRowDTO> leaderboardTable, String headerStyle, String columnStyle) {
|
||||
super(title, unit, field, new TextCell(), leaderboardTable, headerStyle, columnStyle);
|
||||
StringBuilder patternBuilder = new StringBuilder("0");
|
||||
if (decimals > 0) {
|
||||
@@ -32,7 +32,7 @@ public class FormattedDoubleLegDetailColumn extends LegDetailColumn<Double, Stri
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateMinMax(LeaderboardDAO leaderboard) {
|
||||
protected void updateMinMax(LeaderboardDTO leaderboard) {
|
||||
getMinMaxRenderer().updateMinMax(leaderboard.rows.values());
|
||||
}
|
||||
|
||||
@@ -43,10 +43,10 @@ public class FormattedDoubleLegDetailColumn extends LegDetailColumn<Double, Stri
|
||||
/**
|
||||
* Computes the string representation of the value to be displayed in the table. Note that it's not the resulting
|
||||
* string used for comparisons with the {@link #getComparator() comparator} but the sortable value extracted using
|
||||
* {@link #getFieldValue(LeaderboardRowDAO)}.
|
||||
* {@link #getFieldValue(LeaderboardRowDTO)}.
|
||||
*/
|
||||
@Override
|
||||
public String getValue(LeaderboardRowDAO row) {
|
||||
public String getValue(LeaderboardRowDTO row) {
|
||||
Double fieldValue = getFieldValue(row);
|
||||
String result = "";
|
||||
if (fieldValue != null) {
|
||||
@@ -56,27 +56,27 @@ public class FormattedDoubleLegDetailColumn extends LegDetailColumn<Double, Stri
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double getDoubleValue(LeaderboardRowDAO row) {
|
||||
public Double getDoubleValue(LeaderboardRowDTO row) {
|
||||
return getFieldValue(row);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Context context, LeaderboardRowDAO row, SafeHtmlBuilder sb) {
|
||||
public void render(Context context, LeaderboardRowDTO row, SafeHtmlBuilder sb) {
|
||||
getMinMaxRenderer().render(context, row, getTitle(row), sb);
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes a tool-tip text to add to the table cell's content as rendered by
|
||||
* {@link #render(Context, LeaderboardRowDAO, SafeHtmlBuilder)}.
|
||||
* {@link #render(Context, LeaderboardRowDTO, SafeHtmlBuilder)}.
|
||||
*
|
||||
* @return This default implementation returns <code>null</code> for no tool tip / title
|
||||
*/
|
||||
protected String getTitle(LeaderboardRowDAO row) {
|
||||
protected String getTitle(LeaderboardRowDTO row) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStringValueToRender(LeaderboardRowDAO object) {
|
||||
public String getStringValueToRender(LeaderboardRowDTO object) {
|
||||
String value = getValue(object);
|
||||
if (!value.isEmpty() & value != null) {
|
||||
return getValue(object);
|
||||
|
||||
+4
-4
@@ -1,9 +1,9 @@
|
||||
package com.sap.sailing.gwt.ui.leaderboard;
|
||||
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardRowDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardRowDTO;
|
||||
|
||||
/**
|
||||
* This interface helps to get the String or the Double values of a {@link LeaderboardRowDAO}.
|
||||
* This interface helps to get the String or the Double values of a {@link LeaderboardRowDTO}.
|
||||
*/
|
||||
public interface HasStringAndDoubleValue {
|
||||
/**
|
||||
@@ -12,7 +12,7 @@ public interface HasStringAndDoubleValue {
|
||||
*
|
||||
* @return the value of the Column
|
||||
*/
|
||||
String getStringValueToRender(LeaderboardRowDAO row);
|
||||
String getStringValueToRender(LeaderboardRowDTO row);
|
||||
|
||||
Double getDoubleValue(LeaderboardRowDAO row);
|
||||
Double getDoubleValue(LeaderboardRowDTO row);
|
||||
}
|
||||
+110
-110
@@ -48,12 +48,12 @@ import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.client.TimeListener;
|
||||
import com.sap.sailing.gwt.ui.client.Timer;
|
||||
import com.sap.sailing.gwt.ui.leaderboard.LegDetailColumn.LegDetailField;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardEntryDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardRowDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LegEntryDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceInLeaderboardDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardEntryDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardRowDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.LegEntryDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceInLeaderboardDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.components.Component;
|
||||
import com.sap.sailing.gwt.ui.shared.components.SettingsDialog;
|
||||
import com.sap.sailing.gwt.ui.shared.components.SettingsDialogComponent;
|
||||
@@ -88,15 +88,15 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
|
||||
private final StringMessages stringConstants;
|
||||
|
||||
private final CellTable<LeaderboardRowDAO> leaderboardTable;
|
||||
private final CellTable<LeaderboardRowDTO> leaderboardTable;
|
||||
|
||||
private final MultiSelectionModel<LeaderboardRowDAO> leaderboardSelectionModel;
|
||||
private final MultiSelectionModel<LeaderboardRowDTO> leaderboardSelectionModel;
|
||||
|
||||
private ListDataProvider<LeaderboardRowDAO> data;
|
||||
private ListDataProvider<LeaderboardRowDTO> data;
|
||||
|
||||
private final ListHandler<LeaderboardRowDAO> listHandler;
|
||||
private final ListHandler<LeaderboardRowDTO> listHandler;
|
||||
|
||||
private LeaderboardDAO leaderboard;
|
||||
private LeaderboardDTO leaderboard;
|
||||
|
||||
private final RankColumn rankColumn;
|
||||
|
||||
@@ -170,7 +170,7 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
public void updateSettings(LeaderboardSettings result) {
|
||||
List<ExpandableSortableColumn<?>> columnsToExpandAgain = new ArrayList<ExpandableSortableColumn<?>>();
|
||||
for (int i = 0; i < getLeaderboardTable().getColumnCount(); i++) {
|
||||
Column<LeaderboardRowDAO, ?> c = getLeaderboardTable().getColumn(i);
|
||||
Column<LeaderboardRowDTO, ?> c = getLeaderboardTable().getColumn(i);
|
||||
if (c instanceof ExpandableSortableColumn<?>) {
|
||||
ExpandableSortableColumn<?> expandableSortableColumn = (ExpandableSortableColumn<?>) c;
|
||||
if (expandableSortableColumn.isExpanded()) {
|
||||
@@ -200,7 +200,7 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
}
|
||||
}
|
||||
|
||||
protected class CompetitorColumn extends SortableColumn<LeaderboardRowDAO, String> {
|
||||
protected class CompetitorColumn extends SortableColumn<LeaderboardRowDTO, String> {
|
||||
|
||||
protected CompetitorColumn() {
|
||||
super(new TextCell());
|
||||
@@ -211,10 +211,10 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
}
|
||||
|
||||
@Override
|
||||
public Comparator<LeaderboardRowDAO> getComparator() {
|
||||
return new Comparator<LeaderboardRowDAO>() {
|
||||
public Comparator<LeaderboardRowDTO> getComparator() {
|
||||
return new Comparator<LeaderboardRowDTO>() {
|
||||
@Override
|
||||
public int compare(LeaderboardRowDAO o1, LeaderboardRowDAO o2) {
|
||||
public int compare(LeaderboardRowDTO o1, LeaderboardRowDTO o2) {
|
||||
return Collator.getInstance().compare(getLeaderboard().getDisplayName(o1.competitor),
|
||||
getLeaderboard().getDisplayName(o2.competitor));
|
||||
}
|
||||
@@ -227,7 +227,7 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue(LeaderboardRowDAO object) {
|
||||
public String getValue(LeaderboardRowDTO object) {
|
||||
return getLeaderboard().getDisplayName(object.competitor);
|
||||
}
|
||||
}
|
||||
@@ -238,17 +238,17 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
* @author Axel Uhl (d043530)
|
||||
*
|
||||
*/
|
||||
private class SailIDColumn extends SortableColumn<LeaderboardRowDAO, String> {
|
||||
private class SailIDColumn extends SortableColumn<LeaderboardRowDTO, String> {
|
||||
|
||||
protected SailIDColumn() {
|
||||
super(new TextCell());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Comparator<LeaderboardRowDAO> getComparator() {
|
||||
return new Comparator<LeaderboardRowDAO>() {
|
||||
public Comparator<LeaderboardRowDTO> getComparator() {
|
||||
return new Comparator<LeaderboardRowDTO>() {
|
||||
@Override
|
||||
public int compare(LeaderboardRowDAO o1, LeaderboardRowDAO o2) {
|
||||
public int compare(LeaderboardRowDTO o1, LeaderboardRowDTO o2) {
|
||||
return o1.competitor.sailID == null ? o2.competitor.sailID == null ? 0 : -1
|
||||
: o2.competitor.sailID == null ? 1 : Collator.getInstance().compare(o1.competitor.sailID,
|
||||
o2.competitor.sailID);
|
||||
@@ -262,7 +262,7 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Context context, LeaderboardRowDAO object, SafeHtmlBuilder sb) {
|
||||
public void render(Context context, LeaderboardRowDTO object, SafeHtmlBuilder sb) {
|
||||
sb.appendHtmlConstant("<img title=\"" + object.competitor.countryName + "\" src=\""
|
||||
+ getFlagURL(object.competitor.twoLetterIsoCountryCode) + "\"/> ");
|
||||
sb.appendEscaped(object.competitor.sailID);
|
||||
@@ -273,13 +273,13 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue(LeaderboardRowDAO object) {
|
||||
public String getValue(LeaderboardRowDTO object) {
|
||||
return object.competitor.sailID;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays net/total points and possible max-points reasons based on a {@link LeaderboardRowDAO} and a race name
|
||||
* Displays net/total points and possible max-points reasons based on a {@link LeaderboardRowDTO} and a race name
|
||||
* and makes the column sortable by the total points.
|
||||
*
|
||||
* @author Axel Uhl (D043530)
|
||||
@@ -326,8 +326,8 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
* </pre>
|
||||
*/
|
||||
@Override
|
||||
public void render(Context context, LeaderboardRowDAO object, SafeHtmlBuilder html) {
|
||||
LeaderboardEntryDAO entry = object.fieldsByRaceName.get(raceName);
|
||||
public void render(Context context, LeaderboardRowDTO object, SafeHtmlBuilder html) {
|
||||
LeaderboardEntryDTO entry = object.fieldsByRaceName.get(raceName);
|
||||
if (entry != null) {
|
||||
// don't show points if max points / penalty
|
||||
if (entry.reasonForMaxPoints.equals("NONE")) {
|
||||
@@ -355,16 +355,16 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
}
|
||||
|
||||
@Override
|
||||
public Comparator<LeaderboardRowDAO> getComparator() {
|
||||
public Comparator<LeaderboardRowDTO> getComparator() {
|
||||
if (medalRace) {
|
||||
return getLeaderboard().getMedalRaceComparator(getRaceName());
|
||||
} else {
|
||||
return new Comparator<LeaderboardRowDAO>() {
|
||||
return new Comparator<LeaderboardRowDTO>() {
|
||||
@Override
|
||||
public int compare(LeaderboardRowDAO o1, LeaderboardRowDAO o2) {
|
||||
public int compare(LeaderboardRowDTO o1, LeaderboardRowDTO o2) {
|
||||
boolean ascending = isSortedAscendingForThisColumn(getLeaderboardPanel().getLeaderboardTable());
|
||||
LeaderboardEntryDAO o1Entry = o1.fieldsByRaceName.get(raceName);
|
||||
LeaderboardEntryDAO o2Entry = o2.fieldsByRaceName.get(raceName);
|
||||
LeaderboardEntryDTO o1Entry = o1.fieldsByRaceName.get(raceName);
|
||||
LeaderboardEntryDTO o2Entry = o2.fieldsByRaceName.get(raceName);
|
||||
return (o1Entry == null || o1Entry.netPoints == 0) ? (o2Entry == null || o2Entry.netPoints == 0) ? 0
|
||||
: ascending ? 1 : -1
|
||||
: (o2Entry == null || o2Entry.netPoints == 0) ? ascending ? -1 : 1 : o1Entry.netPoints
|
||||
@@ -412,7 +412,7 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue(LeaderboardRowDAO object) {
|
||||
public String getValue(LeaderboardRowDTO object) {
|
||||
return "" + object.fieldsByRaceName.get(getRaceName()).totalPoints;
|
||||
}
|
||||
|
||||
@@ -423,9 +423,9 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
} else {
|
||||
getSailingService().getLeaderboardByName(getLeaderboardName(), getLeaderboardDisplayDate(),
|
||||
/* namesOfRacesForWhichToLoadLegDetails */getNamesOfExpandedRaces(),
|
||||
new AsyncCallback<LeaderboardDAO>() {
|
||||
new AsyncCallback<LeaderboardDTO>() {
|
||||
@Override
|
||||
public void onSuccess(LeaderboardDAO result) {
|
||||
public void onSuccess(LeaderboardDTO result) {
|
||||
updateLeaderboard(result);
|
||||
callWhenExpansionDataIsLoaded.run();
|
||||
}
|
||||
@@ -440,10 +440,10 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<DetailType, SortableColumn<LeaderboardRowDAO, ?>> getDetailColumnMap(
|
||||
protected Map<DetailType, SortableColumn<LeaderboardRowDTO, ?>> getDetailColumnMap(
|
||||
LeaderboardPanel leaderboardPanel, StringMessages stringConstants, String detailHeaderStyle,
|
||||
String detailColumnStyle) {
|
||||
Map<DetailType, SortableColumn<LeaderboardRowDAO, ?>> result = new HashMap<DetailType, SortableColumn<LeaderboardRowDAO, ?>>();
|
||||
Map<DetailType, SortableColumn<LeaderboardRowDTO, ?>> result = new HashMap<DetailType, SortableColumn<LeaderboardRowDTO, ?>>();
|
||||
result.put(DetailType.RACE_DISTANCE_TRAVELED,
|
||||
new FormattedDoubleLegDetailColumn(stringConstants.distanceInMeters(), stringConstants.distanceInMetersUnit(),
|
||||
new RaceDistanceTraveledInMeters(), 0, getLeaderboardPanel().getLeaderboardTable(),
|
||||
@@ -468,9 +468,9 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Iterable<SortableColumn<LeaderboardRowDAO, ?>> getDirectChildren() {
|
||||
List<SortableColumn<LeaderboardRowDAO, ?>> result = new ArrayList<SortableColumn<LeaderboardRowDAO, ?>>();
|
||||
for (SortableColumn<LeaderboardRowDAO, ?> column : super.getDirectChildren()) {
|
||||
protected Iterable<SortableColumn<LeaderboardRowDTO, ?>> getDirectChildren() {
|
||||
List<SortableColumn<LeaderboardRowDTO, ?>> result = new ArrayList<SortableColumn<LeaderboardRowDTO, ?>>();
|
||||
for (SortableColumn<LeaderboardRowDTO, ?> column : super.getDirectChildren()) {
|
||||
result.add(column);
|
||||
}
|
||||
if (isExpanded()) {
|
||||
@@ -518,13 +518,13 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
*/
|
||||
private class RaceAverageSpeedInKnots implements LegDetailField<Double> {
|
||||
@Override
|
||||
public Double get(LeaderboardRowDAO row) {
|
||||
public Double get(LeaderboardRowDTO row) {
|
||||
Double result = null;
|
||||
LeaderboardEntryDAO fieldsForRace = row.fieldsByRaceName.get(getRaceName());
|
||||
LeaderboardEntryDTO fieldsForRace = row.fieldsByRaceName.get(getRaceName());
|
||||
if (fieldsForRace != null && fieldsForRace.legDetails != null) {
|
||||
double distanceTraveledInMeters = 0;
|
||||
long timeInMilliseconds = 0;
|
||||
for (LegEntryDAO legDetail : fieldsForRace.legDetails) {
|
||||
for (LegEntryDTO legDetail : fieldsForRace.legDetails) {
|
||||
if (legDetail != null) {
|
||||
distanceTraveledInMeters += legDetail.distanceTraveledInMeters;
|
||||
timeInMilliseconds += legDetail.timeInMilliseconds;
|
||||
@@ -545,11 +545,11 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
*/
|
||||
private class RaceDistanceTraveledInMeters implements LegDetailField<Double> {
|
||||
@Override
|
||||
public Double get(LeaderboardRowDAO row) {
|
||||
public Double get(LeaderboardRowDTO row) {
|
||||
Double result = null;
|
||||
LeaderboardEntryDAO fieldsForRace = row.fieldsByRaceName.get(getRaceName());
|
||||
LeaderboardEntryDTO fieldsForRace = row.fieldsByRaceName.get(getRaceName());
|
||||
if (fieldsForRace != null && fieldsForRace.legDetails != null) {
|
||||
for (LegEntryDAO legDetail : fieldsForRace.legDetails) {
|
||||
for (LegEntryDTO legDetail : fieldsForRace.legDetails) {
|
||||
if (legDetail != null) {
|
||||
if (legDetail.distanceTraveledInMeters != null) {
|
||||
if (result == null) {
|
||||
@@ -571,11 +571,11 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
*/
|
||||
private class RaceGapToLeaderInSeconds implements LegDetailField<Double> {
|
||||
@Override
|
||||
public Double get(LeaderboardRowDAO row) {
|
||||
public Double get(LeaderboardRowDTO row) {
|
||||
Double result = null;
|
||||
LeaderboardEntryDAO fieldsForRace = row.fieldsByRaceName.get(getRaceName());
|
||||
LeaderboardEntryDTO fieldsForRace = row.fieldsByRaceName.get(getRaceName());
|
||||
if (fieldsForRace != null && fieldsForRace.legDetails != null) {
|
||||
LegEntryDAO lastLegDetail = fieldsForRace.legDetails.get(fieldsForRace.legDetails.size() - 1);
|
||||
LegEntryDTO lastLegDetail = fieldsForRace.legDetails.get(fieldsForRace.legDetails.size() - 1);
|
||||
if (lastLegDetail != null) {
|
||||
result = lastLegDetail.gapToLeaderInSeconds;
|
||||
}
|
||||
@@ -591,7 +591,7 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
* @author Axel Uhl (D043530)
|
||||
*
|
||||
*/
|
||||
private class TotalsColumn extends SortableColumn<LeaderboardRowDAO, String> {
|
||||
private class TotalsColumn extends SortableColumn<LeaderboardRowDTO, String> {
|
||||
private final String columnStyle;
|
||||
|
||||
protected TotalsColumn(String columnStyle) {
|
||||
@@ -601,20 +601,20 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue(LeaderboardRowDAO object) {
|
||||
public String getValue(LeaderboardRowDTO object) {
|
||||
int totalPoints = getLeaderboard().getTotalPoints(object);
|
||||
return "" + totalPoints;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Context context, LeaderboardRowDAO object, SafeHtmlBuilder sb) {
|
||||
public void render(Context context, LeaderboardRowDTO object, SafeHtmlBuilder sb) {
|
||||
sb.appendHtmlConstant("<span style=\"font-weight: bold;\">");
|
||||
sb.appendEscaped(getValue(object));
|
||||
sb.appendHtmlConstant("</span>");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Comparator<LeaderboardRowDAO> getComparator() {
|
||||
public Comparator<LeaderboardRowDTO> getComparator() {
|
||||
return getLeaderboard().getTotalRankingComparator();
|
||||
}
|
||||
|
||||
@@ -629,7 +629,7 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
}
|
||||
}
|
||||
|
||||
protected class CarryColumn extends SortableColumn<LeaderboardRowDAO, String> {
|
||||
protected class CarryColumn extends SortableColumn<LeaderboardRowDTO, String> {
|
||||
public CarryColumn() {
|
||||
super(new TextCell());
|
||||
setSortable(true);
|
||||
@@ -641,15 +641,15 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue(LeaderboardRowDAO object) {
|
||||
public String getValue(LeaderboardRowDTO object) {
|
||||
return object.carriedPoints == null ? "" : "" + object.carriedPoints;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Comparator<LeaderboardRowDAO> getComparator() {
|
||||
return new Comparator<LeaderboardRowDAO>() {
|
||||
public Comparator<LeaderboardRowDTO> getComparator() {
|
||||
return new Comparator<LeaderboardRowDTO>() {
|
||||
@Override
|
||||
public int compare(LeaderboardRowDAO o1, LeaderboardRowDAO o2) {
|
||||
public int compare(LeaderboardRowDTO o1, LeaderboardRowDTO o2) {
|
||||
return (o1.carriedPoints == null ? 0 : o1.carriedPoints)
|
||||
- (o2.carriedPoints == null ? 0 : o2.carriedPoints);
|
||||
}
|
||||
@@ -662,7 +662,7 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
}
|
||||
}
|
||||
|
||||
private class RankColumn extends SortableColumn<LeaderboardRowDAO, String> {
|
||||
private class RankColumn extends SortableColumn<LeaderboardRowDTO, String> {
|
||||
public RankColumn() {
|
||||
super(new TextCell());
|
||||
setHorizontalAlignment(ALIGN_CENTER);
|
||||
@@ -670,15 +670,15 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue(LeaderboardRowDAO object) {
|
||||
public String getValue(LeaderboardRowDTO object) {
|
||||
return "" + getLeaderboard().getRank(object.competitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Comparator<LeaderboardRowDAO> getComparator() {
|
||||
return new Comparator<LeaderboardRowDAO>() {
|
||||
public Comparator<LeaderboardRowDTO> getComparator() {
|
||||
return new Comparator<LeaderboardRowDTO>() {
|
||||
@Override
|
||||
public int compare(LeaderboardRowDAO o1, LeaderboardRowDAO o2) {
|
||||
public int compare(LeaderboardRowDTO o1, LeaderboardRowDTO o2) {
|
||||
return getLeaderboard().getRank(o1.competitor) - getLeaderboard().getRank(o2.competitor);
|
||||
}
|
||||
};
|
||||
@@ -724,15 +724,15 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
LEG_COLUMN_STYLE = resources.cellTableStyle().cellTableLegColumn();
|
||||
LEG_DETAIL_COLUMN_STYLE = resources.cellTableStyle().cellTableLegDetailColumn();
|
||||
TOTAL_COLUMN_STYLE = resources.cellTableStyle().cellTableTotalColumn();
|
||||
leaderboardTable = new CellTableWithStylableHeaders<LeaderboardRowDAO>(
|
||||
leaderboardTable = new CellTableWithStylableHeaders<LeaderboardRowDTO>(
|
||||
/* pageSize */100, resources);
|
||||
getLeaderboardTable().setWidth("100%");
|
||||
leaderboardSelectionModel = new MultiSelectionModel<LeaderboardRowDAO>() {};
|
||||
leaderboardSelectionModel = new MultiSelectionModel<LeaderboardRowDTO>() {};
|
||||
leaderboardSelectionModel.addSelectionChangeHandler(new Handler() {
|
||||
@Override
|
||||
public void onSelectionChange(SelectionChangeEvent event) {
|
||||
List<CompetitorDAO> selection = new ArrayList<CompetitorDAO>();
|
||||
for (LeaderboardRowDAO row : leaderboardSelectionModel.getSelectedSet()) {
|
||||
List<CompetitorDTO> selection = new ArrayList<CompetitorDTO>();
|
||||
for (LeaderboardRowDTO row : leaderboardSelectionModel.getSelectedSet()) {
|
||||
selection.add(row.competitor);
|
||||
}
|
||||
LeaderboardPanel.this.competitorSelectionProvider.setSelection(selection,
|
||||
@@ -740,9 +740,9 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
}
|
||||
});
|
||||
getLeaderboardTable().setSelectionModel(leaderboardSelectionModel);
|
||||
setData(new ListDataProvider<LeaderboardRowDAO>());
|
||||
setData(new ListDataProvider<LeaderboardRowDTO>());
|
||||
getData().addDataDisplay(getLeaderboardTable());
|
||||
listHandler = new ListHandler<LeaderboardRowDAO>(getData().getList());
|
||||
listHandler = new ListHandler<LeaderboardRowDTO>(getData().getList());
|
||||
getLeaderboardTable().addColumnSortHandler(listHandler);
|
||||
loadCompleteLeaderboard(getLeaderboardDisplayDate());
|
||||
|
||||
@@ -829,7 +829,7 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
* adds the <code>column</code> to the right end of the {@link #getLeaderboardTable() leaderboard table} and sets
|
||||
* the column style according to the {@link SortableColumn#getColumnStyle() column's style definition}.
|
||||
*/
|
||||
protected void addColumn(SortableColumn<LeaderboardRowDAO, ?> column) {
|
||||
protected void addColumn(SortableColumn<LeaderboardRowDTO, ?> column) {
|
||||
getLeaderboardTable().addColumn(column, column.getHeader());
|
||||
listHandler.setComparator(column, column.getComparator());
|
||||
String columnStyle = column.getColumnStyle();
|
||||
@@ -838,7 +838,7 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
}
|
||||
}
|
||||
|
||||
protected void insertColumn(int beforeIndex, SortableColumn<LeaderboardRowDAO, ?> column) {
|
||||
protected void insertColumn(int beforeIndex, SortableColumn<LeaderboardRowDTO, ?> column) {
|
||||
// remove column styles of those columns whose index will shift right by
|
||||
// one:
|
||||
removeColumnStyles(beforeIndex);
|
||||
@@ -849,7 +849,7 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
|
||||
private void addColumnStyles(int startColumn) {
|
||||
for (int i = startColumn; i < getLeaderboardTable().getColumnCount(); i++) {
|
||||
SortableColumn<LeaderboardRowDAO, ?> columnToRemoveStyleFor = (SortableColumn<LeaderboardRowDAO, ?>) getLeaderboardTable()
|
||||
SortableColumn<LeaderboardRowDTO, ?> columnToRemoveStyleFor = (SortableColumn<LeaderboardRowDTO, ?>) getLeaderboardTable()
|
||||
.getColumn(i);
|
||||
String columnStyle = columnToRemoveStyleFor.getColumnStyle();
|
||||
if (columnStyle != null) {
|
||||
@@ -860,7 +860,7 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
|
||||
private void removeColumnStyles(int startColumn) {
|
||||
for (int i = startColumn; i < getLeaderboardTable().getColumnCount(); i++) {
|
||||
SortableColumn<LeaderboardRowDAO, ?> columnToRemoveStyleFor = (SortableColumn<LeaderboardRowDAO, ?>) getLeaderboardTable()
|
||||
SortableColumn<LeaderboardRowDTO, ?> columnToRemoveStyleFor = (SortableColumn<LeaderboardRowDTO, ?>) getLeaderboardTable()
|
||||
.getColumn(i);
|
||||
String columnStyle = columnToRemoveStyleFor.getColumnStyle();
|
||||
if (columnStyle != null) {
|
||||
@@ -874,7 +874,7 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
* table} and fixes the column styles again (see {@link #addColumnStyles(int)}).
|
||||
*/
|
||||
protected void removeColumn(int columnIndex) {
|
||||
Column<LeaderboardRowDAO, ?> c = getLeaderboardTable().getColumn(columnIndex);
|
||||
Column<LeaderboardRowDTO, ?> c = getLeaderboardTable().getColumn(columnIndex);
|
||||
if (c instanceof ExpandableSortableColumn<?>) {
|
||||
ExpandableSortableColumn<?> expandableColumn = (ExpandableSortableColumn<?>) c;
|
||||
if (expandableColumn.isExpanded()) {
|
||||
@@ -889,7 +889,7 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
addColumnStyles(/* startColumn */columnIndex);
|
||||
}
|
||||
|
||||
protected void removeColumn(Column<LeaderboardRowDAO, ?> c) {
|
||||
protected void removeColumn(Column<LeaderboardRowDTO, ?> c) {
|
||||
int columnIndex = getLeaderboardTable().getColumnIndex(c);
|
||||
if (columnIndex != -1) {
|
||||
removeColumn(columnIndex);
|
||||
@@ -898,9 +898,9 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
|
||||
private void loadCompleteLeaderboard(Date date) {
|
||||
getSailingService().getLeaderboardByName(getLeaderboardName(), date,
|
||||
/* namesOfRacesForWhichToLoadLegDetails */getNamesOfExpandedRaces(), new AsyncCallback<LeaderboardDAO>() {
|
||||
/* namesOfRacesForWhichToLoadLegDetails */getNamesOfExpandedRaces(), new AsyncCallback<LeaderboardDTO>() {
|
||||
@Override
|
||||
public void onSuccess(LeaderboardDAO result) {
|
||||
public void onSuccess(LeaderboardDTO result) {
|
||||
updateLeaderboard(result);
|
||||
}
|
||||
|
||||
@@ -917,7 +917,7 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
private Collection<String> getNamesOfExpandedRaces() {
|
||||
Collection<String> namesOfExpandedRaces = new ArrayList<String>();
|
||||
for (int i = 0; i < getLeaderboardTable().getColumnCount(); i++) {
|
||||
Column<LeaderboardRowDAO, ?> column = getLeaderboardTable().getColumn(i);
|
||||
Column<LeaderboardRowDTO, ?> column = getLeaderboardTable().getColumn(i);
|
||||
if (column instanceof RaceColumn<?>) {
|
||||
RaceColumn<?> raceColumn = (RaceColumn<?>) column;
|
||||
if (raceColumn.isExpanded()) {
|
||||
@@ -931,7 +931,7 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
/**
|
||||
* Also updates the min/max values on the columns
|
||||
*/
|
||||
protected void updateLeaderboard(LeaderboardDAO leaderboard) {
|
||||
protected void updateLeaderboard(LeaderboardDTO leaderboard) {
|
||||
competitorSelectionProvider.setCompetitors(leaderboard.competitors);
|
||||
selectedRaceColumns.addAll(getRacesAddedNew(getLeaderboard(), leaderboard));
|
||||
setLeaderboard(leaderboard);
|
||||
@@ -943,7 +943,7 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
SortableColumn<?, ?> c = (SortableColumn<?, ?>) getLeaderboardTable().getColumn(i);
|
||||
c.updateMinMax(leaderboard);
|
||||
}
|
||||
Comparator<LeaderboardRowDAO> comparator = getComparatorForSelectedSorting();
|
||||
Comparator<LeaderboardRowDTO> comparator = getComparatorForSelectedSorting();
|
||||
if (comparator != null) {
|
||||
Collections.sort(getData().getList(), comparator);
|
||||
} else {
|
||||
@@ -955,12 +955,12 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
}
|
||||
}
|
||||
|
||||
private Comparator<LeaderboardRowDAO> getComparatorForSelectedSorting() {
|
||||
Comparator<LeaderboardRowDAO> result = null;
|
||||
private Comparator<LeaderboardRowDTO> getComparatorForSelectedSorting() {
|
||||
Comparator<LeaderboardRowDTO> result = null;
|
||||
if (getLeaderboardTable().getColumnSortList().size() > 0) {
|
||||
ColumnSortInfo columnSortInfo = getLeaderboardTable().getColumnSortList().get(0);
|
||||
@SuppressWarnings("unchecked")
|
||||
SortableColumn<LeaderboardRowDAO, ?> castResult = (SortableColumn<LeaderboardRowDAO, ?>) columnSortInfo
|
||||
SortableColumn<LeaderboardRowDTO, ?> castResult = (SortableColumn<LeaderboardRowDTO, ?>) columnSortInfo
|
||||
.getColumn();
|
||||
if (columnSortInfo.isAscending()) {
|
||||
result = castResult.getComparator();
|
||||
@@ -975,15 +975,15 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
return rankColumn;
|
||||
}
|
||||
|
||||
private void setLeaderboard(LeaderboardDAO leaderboard) {
|
||||
private void setLeaderboard(LeaderboardDTO leaderboard) {
|
||||
this.leaderboard = leaderboard;
|
||||
}
|
||||
|
||||
protected LeaderboardDAO getLeaderboard() {
|
||||
protected LeaderboardDTO getLeaderboard() {
|
||||
return leaderboard;
|
||||
}
|
||||
|
||||
private void adjustColumnLayout(LeaderboardDAO leaderboard) {
|
||||
private void adjustColumnLayout(LeaderboardDTO leaderboard) {
|
||||
ensureRankColumn();
|
||||
ensureSailIDAndCompetitorColumn();
|
||||
updateCarryColumn(leaderboard);
|
||||
@@ -995,7 +995,7 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
}
|
||||
}
|
||||
|
||||
private List<String> getRacesAddedNew(LeaderboardDAO oldLeaderboard, LeaderboardDAO newLeaderboard){
|
||||
private List<String> getRacesAddedNew(LeaderboardDTO oldLeaderboard, LeaderboardDTO newLeaderboard){
|
||||
List<String> result = new ArrayList<String>();
|
||||
for (String s : newLeaderboard.getRaceColumnNameList()) {
|
||||
if (oldLeaderboard == null || !oldLeaderboard.getRaceColumnNameList().contains(s)) {
|
||||
@@ -1007,7 +1007,7 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
|
||||
private boolean leaderboardTableContainsRace(String raceName) {
|
||||
for (int leaderboardposition = 0; leaderboardposition < getLeaderboardTable().getColumnCount(); leaderboardposition++) {
|
||||
Column<LeaderboardRowDAO, ?> c = getLeaderboardTable().getColumn(leaderboardposition);
|
||||
Column<LeaderboardRowDTO, ?> c = getLeaderboardTable().getColumn(leaderboardposition);
|
||||
if (c instanceof RaceColumn) {
|
||||
RaceColumn<?> raceColumn = (RaceColumn<?>) c;
|
||||
if (raceColumn.getRaceName().equals(raceName)) {
|
||||
@@ -1047,7 +1047,7 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
private void removeRaceColumnFromRaceColumnStartIndexBeforeRace(int raceColumnStartIndex, String raceName) {
|
||||
int counter = 0;
|
||||
for (int leaderboardposition = 0; leaderboardposition < getLeaderboardTable().getColumnCount(); leaderboardposition++) {
|
||||
Column<LeaderboardRowDAO, ?> c = getLeaderboardTable().getColumn(leaderboardposition);
|
||||
Column<LeaderboardRowDTO, ?> c = getLeaderboardTable().getColumn(leaderboardposition);
|
||||
if (c instanceof RaceColumn) {
|
||||
RaceColumn<?> raceColumn = (RaceColumn<?>) c;
|
||||
if (!raceColumn.getRaceName().equals(raceName) && raceColumnStartIndex==counter) {
|
||||
@@ -1067,7 +1067,7 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
*/
|
||||
private int getRaceColumnPosition(RaceColumn<?> raceColumn){
|
||||
for (int leaderboardposition = 0; leaderboardposition < getLeaderboardTable().getColumnCount(); leaderboardposition++) {
|
||||
Column<LeaderboardRowDAO, ?> c = getLeaderboardTable().getColumn(leaderboardposition);
|
||||
Column<LeaderboardRowDTO, ?> c = getLeaderboardTable().getColumn(leaderboardposition);
|
||||
if (c instanceof RaceColumn) {
|
||||
RaceColumn<?> rc = (RaceColumn<?>) c;
|
||||
if(rc.equals(raceColumn)){
|
||||
@@ -1089,7 +1089,7 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
int noRaceColumnCounter = 0;
|
||||
boolean raceColumnfound = false;
|
||||
for (int leaderboardposition = 0; !raceColumnfound & leaderboardposition < getLeaderboardTable().getColumnCount(); leaderboardposition++) {
|
||||
Column<LeaderboardRowDAO, ?> c = getLeaderboardTable().getColumn(leaderboardposition);
|
||||
Column<LeaderboardRowDTO, ?> c = getLeaderboardTable().getColumn(leaderboardposition);
|
||||
if (c instanceof RaceColumn) {
|
||||
//RaceColumn<?> raceColumn = (RaceColumn<?>) c;
|
||||
if (raceColumnCounter == listpos) {
|
||||
@@ -1111,15 +1111,15 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
* Removes all Columns of type racecolumns of leaderboardTable
|
||||
*/
|
||||
private void removeRaceColumnsNotSelected(List<String> selectedRaceColumns) {
|
||||
List<Column<LeaderboardRowDAO, ?>> columnsToRemove = new ArrayList<Column<LeaderboardRowDAO, ?>>();
|
||||
List<Column<LeaderboardRowDTO, ?>> columnsToRemove = new ArrayList<Column<LeaderboardRowDTO, ?>>();
|
||||
for (int i = 0; i < getLeaderboardTable().getColumnCount(); i++) {
|
||||
Column<LeaderboardRowDAO, ?> c = getLeaderboardTable().getColumn(i);
|
||||
Column<LeaderboardRowDTO, ?> c = getLeaderboardTable().getColumn(i);
|
||||
if (c instanceof RaceColumn
|
||||
&& (leaderboard == null || !selectedRaceColumns.contains(((RaceColumn<?>) c).getRaceName()))) {
|
||||
columnsToRemove.add(c);
|
||||
}
|
||||
}
|
||||
for (Column<LeaderboardRowDAO, ?> c : columnsToRemove) {
|
||||
for (Column<LeaderboardRowDTO, ?> c : columnsToRemove) {
|
||||
removeColumn(c);
|
||||
}
|
||||
}
|
||||
@@ -1128,7 +1128,7 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
* Existing and matching race columns may still need to be removed, re-created and inserted because the "tracked"
|
||||
* property may have changed, changing the columns expandability.
|
||||
*/
|
||||
private void createMissingAndAdjustExistingRaceColumns(LeaderboardDAO leaderboard) {
|
||||
private void createMissingAndAdjustExistingRaceColumns(LeaderboardDTO leaderboard) {
|
||||
// Correct order of races in selectedRaceColum
|
||||
List<String> correctedOrderSelectedRaces = new ArrayList<String>();
|
||||
for (String string : leaderboard.getRaceColumnNameList()) {
|
||||
@@ -1166,10 +1166,10 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
return textRaceColumn;
|
||||
}
|
||||
|
||||
private void removeUnusedRaceColumns(LeaderboardDAO leaderboard) {
|
||||
List<Column<LeaderboardRowDAO, ?>> columnsToRemove = new ArrayList<Column<LeaderboardRowDAO, ?>>();
|
||||
private void removeUnusedRaceColumns(LeaderboardDTO leaderboard) {
|
||||
List<Column<LeaderboardRowDTO, ?>> columnsToRemove = new ArrayList<Column<LeaderboardRowDTO, ?>>();
|
||||
for (int i = 0; i < getLeaderboardTable().getColumnCount(); i++) {
|
||||
Column<LeaderboardRowDAO, ?> c = getLeaderboardTable().getColumn(i);
|
||||
Column<LeaderboardRowDTO, ?> c = getLeaderboardTable().getColumn(i);
|
||||
if (c instanceof RaceColumn
|
||||
&& (leaderboard == null || !leaderboard.raceListContains(((RaceColumn<?>) c).getRaceName()))) {
|
||||
columnsToRemove.add(c);
|
||||
@@ -1178,7 +1178,7 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
// Tricky issue: if the race column is currently expanded, we can't know anymore how many detail columns
|
||||
// there are because the updated LeaderboardDAO object doesn't contain the race anymore. We have to
|
||||
// collapse and remove all LegColumns following the RaceColumn
|
||||
for (Column<LeaderboardRowDAO, ?> c : columnsToRemove) {
|
||||
for (Column<LeaderboardRowDTO, ?> c : columnsToRemove) {
|
||||
removeColumn(c);
|
||||
}
|
||||
}
|
||||
@@ -1229,12 +1229,12 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
}
|
||||
|
||||
/**
|
||||
* If the <code>leaderboard</code> {@link LeaderboardDAO#hasCarriedPoints has carried points} and if column #1
|
||||
* If the <code>leaderboard</code> {@link LeaderboardDTO#hasCarriedPoints has carried points} and if column #1
|
||||
* (second column, right of the competitor column) does not exist or is not of type {@link CarryColumn}, all columns
|
||||
* starting from #1 will be removed and a {@link CarryColumn} will be added. If the leaderboard has no carried
|
||||
* points but the display still shows a carry column, the column is removed.
|
||||
*/
|
||||
protected void updateCarryColumn(LeaderboardDAO leaderboard) {
|
||||
protected void updateCarryColumn(LeaderboardDTO leaderboard) {
|
||||
if (leaderboard != null && leaderboard.hasCarriedPoints) {
|
||||
ensureCarryColumn();
|
||||
} else {
|
||||
@@ -1263,7 +1263,7 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
return new CarryColumn();
|
||||
}
|
||||
|
||||
protected CellTable<LeaderboardRowDAO> getLeaderboardTable() {
|
||||
protected CellTable<LeaderboardRowDTO> getLeaderboardTable() {
|
||||
return leaderboardTable;
|
||||
}
|
||||
|
||||
@@ -1283,11 +1283,11 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
return errorReporter;
|
||||
}
|
||||
|
||||
protected ListDataProvider<LeaderboardRowDAO> getData() {
|
||||
protected ListDataProvider<LeaderboardRowDTO> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
private void setData(ListDataProvider<LeaderboardRowDAO> data) {
|
||||
private void setData(ListDataProvider<LeaderboardRowDTO> data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@@ -1304,7 +1304,7 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
|
||||
private void compareCompetitors(){
|
||||
List<RaceIdentifier> races = new ArrayList<RaceIdentifier>();
|
||||
for (RaceInLeaderboardDAO race : getLeaderboard().getRaceList()) {
|
||||
for (RaceInLeaderboardDTO race : getLeaderboard().getRaceList()) {
|
||||
if (race.isTrackedRace()){
|
||||
races.add(new LeaderboardNameAndRaceColumnName(leaderboardName, race.getRaceColumnName()));
|
||||
}
|
||||
@@ -1333,8 +1333,8 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
return stringConstants.leaderboard();
|
||||
}
|
||||
|
||||
private LeaderboardRowDAO getRow(CompetitorDAO competitor) {
|
||||
for (LeaderboardRowDAO row : getData().getList()) {
|
||||
private LeaderboardRowDTO getRow(CompetitorDTO competitor) {
|
||||
for (LeaderboardRowDTO row : getData().getList()) {
|
||||
if (row.competitor.equals(competitor)) {
|
||||
return row;
|
||||
}
|
||||
@@ -1343,16 +1343,16 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addedToSelection(CompetitorDAO competitor) {
|
||||
LeaderboardRowDAO row = getRow(competitor);
|
||||
public void addedToSelection(CompetitorDTO competitor) {
|
||||
LeaderboardRowDTO row = getRow(competitor);
|
||||
if (row != null) {
|
||||
leaderboardSelectionModel.setSelected(row, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removedFromSelection(CompetitorDAO competitor) {
|
||||
LeaderboardRowDAO row = getRow(competitor);
|
||||
public void removedFromSelection(CompetitorDTO competitor) {
|
||||
LeaderboardRowDTO row = getRow(competitor);
|
||||
if (row != null) {
|
||||
leaderboardSelectionModel.setSelected(row, false);
|
||||
}
|
||||
|
||||
+37
-37
@@ -11,14 +11,14 @@ import com.google.gwt.user.cellview.client.CellTable;
|
||||
import com.google.gwt.user.cellview.client.Header;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.leaderboard.LegDetailColumn.LegDetailField;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardEntryDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardRowDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LegEntryDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardEntryDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardRowDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.LegEntryDTO;
|
||||
import com.sap.sailing.server.api.DetailType;
|
||||
|
||||
/**
|
||||
* Displays competitor's rank in leg and makes the column sortable by rank. The leg is
|
||||
* identified as an index into the {@link LeaderboardEntryDAO#legDetails} list.
|
||||
* identified as an index into the {@link LeaderboardEntryDTO#legDetails} list.
|
||||
*
|
||||
* @author Axel Uhl (D043530)
|
||||
*
|
||||
@@ -31,8 +31,8 @@ public class LegColumn extends ExpandableSortableColumn<String> {
|
||||
private final String columnStyle;
|
||||
|
||||
private abstract class AbstractLegDetailField<T extends Comparable<?>> implements LegDetailField<T> {
|
||||
public T get(LeaderboardRowDAO row) {
|
||||
LegEntryDAO entry = getLegEntry(row);
|
||||
public T get(LeaderboardRowDTO row) {
|
||||
LegEntryDTO entry = getLegEntry(row);
|
||||
if (entry == null) {
|
||||
return null;
|
||||
} else {
|
||||
@@ -40,82 +40,82 @@ public class LegColumn extends ExpandableSortableColumn<String> {
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract T getFromNonNullEntry(LegEntryDAO entry);
|
||||
protected abstract T getFromNonNullEntry(LegEntryDTO entry);
|
||||
}
|
||||
|
||||
private class DistanceTraveledInMeters extends AbstractLegDetailField<Double> {
|
||||
@Override
|
||||
protected Double getFromNonNullEntry(LegEntryDAO entry) {
|
||||
protected Double getFromNonNullEntry(LegEntryDTO entry) {
|
||||
return entry.distanceTraveledInMeters;
|
||||
}
|
||||
}
|
||||
|
||||
private class AverageSpeedOverGroundInKnots extends AbstractLegDetailField<Double> {
|
||||
@Override
|
||||
protected Double getFromNonNullEntry(LegEntryDAO entry) {
|
||||
protected Double getFromNonNullEntry(LegEntryDTO entry) {
|
||||
return entry.averageSpeedOverGroundInKnots;
|
||||
}
|
||||
}
|
||||
|
||||
private class CurrentSpeedOverGroundInKnots extends AbstractLegDetailField<Double> {
|
||||
@Override
|
||||
protected Double getFromNonNullEntry(LegEntryDAO entry) {
|
||||
protected Double getFromNonNullEntry(LegEntryDTO entry) {
|
||||
return entry.currentSpeedOverGroundInKnots;
|
||||
}
|
||||
}
|
||||
|
||||
private class EstimatedTimeToNextWaypointInSeconds extends AbstractLegDetailField<Double> {
|
||||
@Override
|
||||
protected Double getFromNonNullEntry(LegEntryDAO entry) {
|
||||
protected Double getFromNonNullEntry(LegEntryDTO entry) {
|
||||
return entry.estimatedTimeToNextWaypointInSeconds;
|
||||
}
|
||||
}
|
||||
|
||||
private class GapToLeaderInSeconds extends AbstractLegDetailField<Double> {
|
||||
@Override
|
||||
protected Double getFromNonNullEntry(LegEntryDAO entry) {
|
||||
protected Double getFromNonNullEntry(LegEntryDTO entry) {
|
||||
return entry.gapToLeaderInSeconds;
|
||||
}
|
||||
}
|
||||
|
||||
private class VelocityMadeGoodInKnots extends AbstractLegDetailField<Double> {
|
||||
@Override
|
||||
protected Double getFromNonNullEntry(LegEntryDAO entry) {
|
||||
protected Double getFromNonNullEntry(LegEntryDTO entry) {
|
||||
return entry.velocityMadeGoodInKnots;
|
||||
}
|
||||
}
|
||||
|
||||
private class WindwardDistanceToGoInMeters extends AbstractLegDetailField<Double> {
|
||||
@Override
|
||||
protected Double getFromNonNullEntry(LegEntryDAO entry) {
|
||||
protected Double getFromNonNullEntry(LegEntryDTO entry) {
|
||||
return entry.windwardDistanceToGoInMeters;
|
||||
}
|
||||
}
|
||||
|
||||
private class RankGain implements LegDetailField<Integer> {
|
||||
@Override
|
||||
public Integer get(LeaderboardRowDAO row) {
|
||||
LegEntryDAO legEntry = getLegEntry(row);
|
||||
public Integer get(LeaderboardRowDTO row) {
|
||||
LegEntryDTO legEntry = getLegEntry(row);
|
||||
if (legEntry == null || getLegIndex() == 0) {
|
||||
// no gain/loss for first leg
|
||||
return null;
|
||||
} else {
|
||||
LegEntryDAO previousEntry = getLegEntry(row, getLegIndex()-1);
|
||||
LegEntryDTO previousEntry = getLegEntry(row, getLegIndex()-1);
|
||||
return previousEntry == null ? null : legEntry.rank - previousEntry.rank;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class ManeuverCountLegDetailsColumn extends FormattedDoubleLegDetailColumn {
|
||||
public ManeuverCountLegDetailsColumn(String title, CellTable<LeaderboardRowDAO> leaderboardTable,
|
||||
public ManeuverCountLegDetailsColumn(String title, CellTable<LeaderboardRowDTO> leaderboardTable,
|
||||
String headerStyle, String columnStyle) {
|
||||
super(title, /*unit*/null, /* field */ null, /* decimals */ 0, leaderboardTable, headerStyle, columnStyle);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTitle(LeaderboardRowDAO row) {
|
||||
protected String getTitle(LeaderboardRowDTO row) {
|
||||
String resultString = null;
|
||||
LegEntryDAO entry = getLegEntry(row);
|
||||
LegEntryDTO entry = getLegEntry(row);
|
||||
if (entry != null) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
if (entry.numberOfTacks != null) {
|
||||
@@ -146,13 +146,13 @@ public class LegColumn extends ExpandableSortableColumn<String> {
|
||||
|
||||
|
||||
@Override
|
||||
public String getValue(LeaderboardRowDAO row) {
|
||||
public String getValue(LeaderboardRowDTO row) {
|
||||
Double fieldValue = getFieldValue(row);
|
||||
StringBuilder result = new StringBuilder();
|
||||
if (fieldValue != null) {
|
||||
result.append(getFormatter().format(fieldValue));
|
||||
}
|
||||
LegEntryDAO entry = getLegEntry(row);
|
||||
LegEntryDTO entry = getLegEntry(row);
|
||||
if (entry != null && entry.numberOfPenaltyCircles != null && (int) entry.numberOfPenaltyCircles != 0) {
|
||||
result.append(" (");
|
||||
result.append(entry.numberOfPenaltyCircles);
|
||||
@@ -162,8 +162,8 @@ public class LegColumn extends ExpandableSortableColumn<String> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Double getFieldValue(LeaderboardRowDAO row) {
|
||||
LegEntryDAO entry = getLegEntry(row);
|
||||
protected Double getFieldValue(LeaderboardRowDTO row) {
|
||||
LegEntryDTO entry = getLegEntry(row);
|
||||
Double result = null;
|
||||
if (entry != null) {
|
||||
if (entry.numberOfTacks != null) {
|
||||
@@ -212,10 +212,10 @@ public class LegColumn extends ExpandableSortableColumn<String> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<DetailType, SortableColumn<LeaderboardRowDAO, ?>> getDetailColumnMap(
|
||||
protected Map<DetailType, SortableColumn<LeaderboardRowDTO, ?>> getDetailColumnMap(
|
||||
LeaderboardPanel leaderboardPanel, StringMessages stringConstants, String detailHeaderStyle,
|
||||
String detailColumnStyle) {
|
||||
Map<DetailType, SortableColumn<LeaderboardRowDAO, ?>> result = new HashMap<DetailType, SortableColumn<LeaderboardRowDAO, ?>>();
|
||||
Map<DetailType, SortableColumn<LeaderboardRowDTO, ?>> result = new HashMap<DetailType, SortableColumn<LeaderboardRowDTO, ?>>();
|
||||
result.put(DetailType.DISTANCE_TRAVELED,
|
||||
new FormattedDoubleLegDetailColumn(stringConstants.distanceInMeters(), stringConstants.distanceInMetersUnit(),
|
||||
new DistanceTraveledInMeters(), 0, getLeaderboardPanel().getLeaderboardTable(), detailHeaderStyle, detailColumnStyle));
|
||||
@@ -267,14 +267,14 @@ public class LegColumn extends ExpandableSortableColumn<String> {
|
||||
return raceName;
|
||||
}
|
||||
|
||||
private LegEntryDAO getLegEntry(LeaderboardRowDAO row) {
|
||||
private LegEntryDTO getLegEntry(LeaderboardRowDTO row) {
|
||||
int theLegIndex = getLegIndex();
|
||||
return getLegEntry(row, theLegIndex);
|
||||
}
|
||||
|
||||
private LegEntryDAO getLegEntry(LeaderboardRowDAO row, int theLegIndex) {
|
||||
LegEntryDAO legEntry = null;
|
||||
LeaderboardEntryDAO entry = row.fieldsByRaceName.get(getRaceName());
|
||||
private LegEntryDTO getLegEntry(LeaderboardRowDTO row, int theLegIndex) {
|
||||
LegEntryDTO legEntry = null;
|
||||
LeaderboardEntryDTO entry = row.fieldsByRaceName.get(getRaceName());
|
||||
if (entry != null && entry.legDetails != null) {
|
||||
legEntry = entry.legDetails.get(theLegIndex);
|
||||
}
|
||||
@@ -282,13 +282,13 @@ public class LegColumn extends ExpandableSortableColumn<String> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Comparator<LeaderboardRowDAO> getComparator() {
|
||||
return new Comparator<LeaderboardRowDAO>() {
|
||||
public Comparator<LeaderboardRowDTO> getComparator() {
|
||||
return new Comparator<LeaderboardRowDTO>() {
|
||||
@Override
|
||||
public int compare(LeaderboardRowDAO o1, LeaderboardRowDAO o2) {
|
||||
public int compare(LeaderboardRowDTO o1, LeaderboardRowDTO o2) {
|
||||
boolean ascending = isSortedAscendingForThisColumn(getLeaderboardPanel().getLeaderboardTable());
|
||||
LegEntryDAO o1Entry = getLegEntry(o1);
|
||||
LegEntryDAO o2Entry = getLegEntry(o2);
|
||||
LegEntryDTO o1Entry = getLegEntry(o1);
|
||||
LegEntryDTO o2Entry = getLegEntry(o2);
|
||||
return o1Entry == null ? o2Entry == null ? 0 : ascending?1:-1
|
||||
: o2Entry == null ? ascending?-1:1 : o1Entry.rank - o2Entry.rank;
|
||||
}
|
||||
@@ -303,8 +303,8 @@ public class LegColumn extends ExpandableSortableColumn<String> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue(LeaderboardRowDAO row) {
|
||||
LegEntryDAO legEntry = getLegEntry(row);
|
||||
public String getValue(LeaderboardRowDTO row) {
|
||||
LegEntryDTO legEntry = getLegEntry(row);
|
||||
if (legEntry != null) {
|
||||
return ""+legEntry.rank;
|
||||
} else {
|
||||
|
||||
+9
-9
@@ -7,23 +7,23 @@ import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||
import com.google.gwt.user.cellview.client.CellTable;
|
||||
import com.google.gwt.user.cellview.client.Header;
|
||||
import com.google.gwt.user.cellview.client.SafeHtmlHeader;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardRowDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardRowDTO;
|
||||
|
||||
public abstract class LegDetailColumn<FieldType extends Comparable<?>, RenderingType> extends
|
||||
SortableColumn<LeaderboardRowDAO, RenderingType> {
|
||||
SortableColumn<LeaderboardRowDTO, RenderingType> {
|
||||
private final String title;
|
||||
private final LegDetailField<FieldType> field;
|
||||
private final CellTable<LeaderboardRowDAO> leaderboardTable;
|
||||
private final CellTable<LeaderboardRowDTO> leaderboardTable;
|
||||
private final String headerStyle;
|
||||
private final String columnStyle;
|
||||
private final String unit;
|
||||
|
||||
public interface LegDetailField<T extends Comparable<?>> {
|
||||
T get(LeaderboardRowDAO row);
|
||||
T get(LeaderboardRowDTO row);
|
||||
}
|
||||
|
||||
protected LegDetailColumn(String title, String unit, LegDetailField<FieldType> field, Cell<RenderingType> cell,
|
||||
CellTable<LeaderboardRowDAO> leaderboardTable, String headerStyle, String columnStyle) {
|
||||
CellTable<LeaderboardRowDTO> leaderboardTable, String headerStyle, String columnStyle) {
|
||||
super(cell);
|
||||
setHorizontalAlignment(ALIGN_CENTER);
|
||||
this.title = title;
|
||||
@@ -53,10 +53,10 @@ public abstract class LegDetailColumn<FieldType extends Comparable<?>, Rendering
|
||||
}
|
||||
|
||||
@Override
|
||||
public Comparator<LeaderboardRowDAO> getComparator() {
|
||||
return new Comparator<LeaderboardRowDAO>() {
|
||||
public Comparator<LeaderboardRowDTO> getComparator() {
|
||||
return new Comparator<LeaderboardRowDTO>() {
|
||||
@Override
|
||||
public int compare(LeaderboardRowDAO o1, LeaderboardRowDAO o2) {
|
||||
public int compare(LeaderboardRowDTO o1, LeaderboardRowDTO o2) {
|
||||
boolean ascending = isSortedAscendingForThisColumn(leaderboardTable);
|
||||
try {
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -88,7 +88,7 @@ public abstract class LegDetailColumn<FieldType extends Comparable<?>, Rendering
|
||||
* {@link #getComparator() comparator}. This default implementation uses the {@link #getField()} to obtain the logic
|
||||
* for extracting a comparable value from the <code>row</code>.
|
||||
*/
|
||||
protected FieldType getFieldValue(LeaderboardRowDAO row) {
|
||||
protected FieldType getFieldValue(LeaderboardRowDTO row) {
|
||||
return getField().get(row);
|
||||
}
|
||||
|
||||
|
||||
+31
-31
@@ -12,10 +12,10 @@ import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||
import com.google.gwt.user.cellview.client.Header;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.leaderboard.LegDetailColumn.LegDetailField;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardEntryDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardRowDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LegEntryDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardEntryDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardRowDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.LegEntryDTO;
|
||||
import com.sap.sailing.server.api.DetailType;
|
||||
import com.sap.sailing.domain.common.impl.Util.Triple;
|
||||
|
||||
@@ -30,8 +30,8 @@ public class ManeuverCountRaceColumn extends ExpandableSortableColumn<String> im
|
||||
private final MinMaxRenderer minmaxRenderer;
|
||||
|
||||
private abstract class AbstractManeuverDetailField<T extends Comparable<?>> implements LegDetailField<T> {
|
||||
public T get(LeaderboardRowDAO row) {
|
||||
LeaderboardEntryDAO fieldsForRace = row.fieldsByRaceName.get(getRaceName());
|
||||
public T get(LeaderboardRowDTO row) {
|
||||
LeaderboardEntryDTO fieldsForRace = row.fieldsByRaceName.get(getRaceName());
|
||||
if (fieldsForRace == null) {
|
||||
return null;
|
||||
} else {
|
||||
@@ -40,13 +40,13 @@ public class ManeuverCountRaceColumn extends ExpandableSortableColumn<String> im
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract T getFromNonNullEntry(LeaderboardEntryDAO entry);
|
||||
protected abstract T getFromNonNullEntry(LeaderboardEntryDTO entry);
|
||||
}
|
||||
|
||||
private class NumberOfTacks extends AbstractManeuverDetailField<Double> {
|
||||
|
||||
@Override
|
||||
protected Double getFromNonNullEntry(LeaderboardEntryDAO entry) {
|
||||
protected Double getFromNonNullEntry(LeaderboardEntryDTO entry) {
|
||||
return ManeuverCountRaceColumn.this.getTotalNumberOfTacks(entry);
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,7 @@ public class ManeuverCountRaceColumn extends ExpandableSortableColumn<String> im
|
||||
private class NumberOfJibes extends AbstractManeuverDetailField<Double> {
|
||||
|
||||
@Override
|
||||
protected Double getFromNonNullEntry(LeaderboardEntryDAO entry) {
|
||||
protected Double getFromNonNullEntry(LeaderboardEntryDTO entry) {
|
||||
return ManeuverCountRaceColumn.this.getTotalNumberOfJibes(entry);
|
||||
}
|
||||
}
|
||||
@@ -62,7 +62,7 @@ public class ManeuverCountRaceColumn extends ExpandableSortableColumn<String> im
|
||||
private class NumberOfPenaltyCircles extends AbstractManeuverDetailField<Double> {
|
||||
|
||||
@Override
|
||||
protected Double getFromNonNullEntry(LeaderboardEntryDAO entry) {
|
||||
protected Double getFromNonNullEntry(LeaderboardEntryDTO entry) {
|
||||
return ManeuverCountRaceColumn.this.getTotalNumberOfPenaltyCircles(entry);
|
||||
}
|
||||
}
|
||||
@@ -80,10 +80,10 @@ public class ManeuverCountRaceColumn extends ExpandableSortableColumn<String> im
|
||||
this.minmaxRenderer = new MinMaxRenderer(this, getComparator());
|
||||
}
|
||||
|
||||
private Double getTotalNumberOfTacks(LeaderboardEntryDAO row) {
|
||||
private Double getTotalNumberOfTacks(LeaderboardEntryDTO row) {
|
||||
Double totalNumberOfTacks = null;
|
||||
if (row != null && row.legDetails != null) {
|
||||
for (LegEntryDAO legDetail : row.legDetails) {
|
||||
for (LegEntryDTO legDetail : row.legDetails) {
|
||||
if (legDetail != null) {
|
||||
if (legDetail.numberOfTacks != null) {
|
||||
if (totalNumberOfTacks == null) {
|
||||
@@ -98,10 +98,10 @@ public class ManeuverCountRaceColumn extends ExpandableSortableColumn<String> im
|
||||
return totalNumberOfTacks;
|
||||
}
|
||||
|
||||
private Double getTotalNumberOfJibes(LeaderboardEntryDAO row) {
|
||||
private Double getTotalNumberOfJibes(LeaderboardEntryDTO row) {
|
||||
Double totalNumberOfJibes = null;
|
||||
if (row != null && row.legDetails != null) {
|
||||
for (LegEntryDAO legDetail : row.legDetails) {
|
||||
for (LegEntryDTO legDetail : row.legDetails) {
|
||||
if (legDetail != null) {
|
||||
if (legDetail.numberOfJibes != null) {
|
||||
if (totalNumberOfJibes == null) {
|
||||
@@ -116,10 +116,10 @@ public class ManeuverCountRaceColumn extends ExpandableSortableColumn<String> im
|
||||
return totalNumberOfJibes;
|
||||
}
|
||||
|
||||
private Double getTotalNumberOfPenaltyCircles(LeaderboardEntryDAO row) {
|
||||
private Double getTotalNumberOfPenaltyCircles(LeaderboardEntryDTO row) {
|
||||
Double totalNumberOfPnaltyCicles = null;
|
||||
if (row != null && row.legDetails != null) {
|
||||
for (LegEntryDAO legDetail : row.legDetails) {
|
||||
for (LegEntryDTO legDetail : row.legDetails) {
|
||||
if (legDetail != null) {
|
||||
if (legDetail.numberOfPenaltyCircles != null) {
|
||||
if (totalNumberOfPnaltyCicles == null) {
|
||||
@@ -134,13 +134,13 @@ public class ManeuverCountRaceColumn extends ExpandableSortableColumn<String> im
|
||||
return totalNumberOfPnaltyCicles;
|
||||
}
|
||||
|
||||
private Triple<Double, Double, Double> getTotalNumberOfTacksJibesAndPenaltyCircles(LeaderboardRowDAO row) {
|
||||
private Triple<Double, Double, Double> getTotalNumberOfTacksJibesAndPenaltyCircles(LeaderboardRowDTO row) {
|
||||
Double totalNumberOfTacks = null;
|
||||
Double totalNumberOfJibes = null;
|
||||
Double totalNumberOfPenaltyCircles = null;
|
||||
LeaderboardEntryDAO fieldsForRace = row.fieldsByRaceName.get(getRaceName());
|
||||
LeaderboardEntryDTO fieldsForRace = row.fieldsByRaceName.get(getRaceName());
|
||||
if (fieldsForRace != null && fieldsForRace.legDetails != null) {
|
||||
for (LegEntryDAO legDetail : fieldsForRace.legDetails) {
|
||||
for (LegEntryDTO legDetail : fieldsForRace.legDetails) {
|
||||
if (legDetail != null) {
|
||||
if (legDetail.numberOfTacks != null) {
|
||||
if (totalNumberOfTacks == null) {
|
||||
@@ -182,10 +182,10 @@ public class ManeuverCountRaceColumn extends ExpandableSortableColumn<String> im
|
||||
}
|
||||
|
||||
@Override
|
||||
public Comparator<LeaderboardRowDAO> getComparator() {
|
||||
return new Comparator<LeaderboardRowDAO>() {
|
||||
public Comparator<LeaderboardRowDTO> getComparator() {
|
||||
return new Comparator<LeaderboardRowDTO>() {
|
||||
@Override
|
||||
public int compare(LeaderboardRowDAO o1, LeaderboardRowDAO o2) {
|
||||
public int compare(LeaderboardRowDTO o1, LeaderboardRowDTO o2) {
|
||||
boolean ascending = isSortedAscendingForThisColumn(getLeaderboardPanel().getLeaderboardTable());
|
||||
Double val1 = getDoubleValue(o1);
|
||||
Double val2 = getDoubleValue(o2);
|
||||
@@ -196,7 +196,7 @@ public class ManeuverCountRaceColumn extends ExpandableSortableColumn<String> im
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue(LeaderboardRowDAO object) {
|
||||
public String getValue(LeaderboardRowDTO object) {
|
||||
Double result = getDoubleValue(object);
|
||||
if (result == null) {
|
||||
return "";
|
||||
@@ -207,21 +207,21 @@ public class ManeuverCountRaceColumn extends ExpandableSortableColumn<String> im
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Context context, LeaderboardRowDAO row, SafeHtmlBuilder sb) {
|
||||
public void render(Context context, LeaderboardRowDTO row, SafeHtmlBuilder sb) {
|
||||
minmaxRenderer.render(context, row, getTitle(row), sb);
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes a tool-tip text to add to the table cell's content as rendered by
|
||||
* {@link #render(Context, LeaderboardRowDAO, SafeHtmlBuilder)}.
|
||||
* {@link #render(Context, LeaderboardRowDTO, SafeHtmlBuilder)}.
|
||||
*
|
||||
* @return This default implementation returns <code>null</code> for no tool tip / title
|
||||
*/
|
||||
protected String getTitle(LeaderboardRowDAO row) {
|
||||
protected String getTitle(LeaderboardRowDTO row) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Double getDoubleValue(LeaderboardRowDAO row) {
|
||||
public Double getDoubleValue(LeaderboardRowDTO row) {
|
||||
Double result = null;
|
||||
Triple<Double, Double, Double> tacksJibesAndPenalties = getTotalNumberOfTacksJibesAndPenaltyCircles(row);
|
||||
Double totalNumberOfTacks = tacksJibesAndPenalties.getA();
|
||||
@@ -248,15 +248,15 @@ public class ManeuverCountRaceColumn extends ExpandableSortableColumn<String> im
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateMinMax(LeaderboardDAO leaderboard) {
|
||||
protected void updateMinMax(LeaderboardDTO leaderboard) {
|
||||
minmaxRenderer.updateMinMax(leaderboard.rows.values());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<DetailType, SortableColumn<LeaderboardRowDAO, ?>> getDetailColumnMap(
|
||||
protected Map<DetailType, SortableColumn<LeaderboardRowDTO, ?>> getDetailColumnMap(
|
||||
LeaderboardPanel leaderboardPanel, StringMessages stringConstants, String detailHeaderStyle,
|
||||
String detailColumnStyle) {
|
||||
Map<DetailType, SortableColumn<LeaderboardRowDAO, ?>> result = new HashMap<DetailType, SortableColumn<LeaderboardRowDAO, ?>>();
|
||||
Map<DetailType, SortableColumn<LeaderboardRowDTO, ?>> result = new HashMap<DetailType, SortableColumn<LeaderboardRowDTO, ?>>();
|
||||
result.put(DetailType.TACK, new FormattedDoubleLegDetailColumn(stringConstants.tack(), "", new NumberOfTacks(),
|
||||
0, getLeaderboardPanel().getLeaderboardTable(), detailHeaderStyle, detailColumnStyle));
|
||||
result.put(DetailType.JIBE, new FormattedDoubleLegDetailColumn(stringConstants.jibe(), "", new NumberOfJibes(),
|
||||
@@ -282,7 +282,7 @@ public class ManeuverCountRaceColumn extends ExpandableSortableColumn<String> im
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStringValueToRender(LeaderboardRowDAO object) {
|
||||
public String getStringValueToRender(LeaderboardRowDTO object) {
|
||||
String result = getValue(object);
|
||||
if (!result.equals("")) {
|
||||
return getValue(object);
|
||||
|
||||
+13
-13
@@ -5,7 +5,7 @@ import java.util.Comparator;
|
||||
|
||||
import com.google.gwt.cell.client.Cell.Context;
|
||||
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardRowDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardRowDTO;
|
||||
|
||||
/**
|
||||
* Renders the values and the percentage bar of the {@link LegDetailColumn} and {@link ManeuverCountRaceColumn}.
|
||||
@@ -16,7 +16,7 @@ import com.sap.sailing.gwt.ui.shared.LeaderboardRowDAO;
|
||||
*/
|
||||
public class MinMaxRenderer {
|
||||
private HasStringAndDoubleValue valueProvider;
|
||||
private Comparator<LeaderboardRowDAO> comparator;
|
||||
private Comparator<LeaderboardRowDTO> comparator;
|
||||
private Double minimumValue;
|
||||
private Double maximumValue;
|
||||
|
||||
@@ -25,22 +25,22 @@ public class MinMaxRenderer {
|
||||
* {@link ManeuverCountRaceColumn}.
|
||||
*
|
||||
* @param valueProvider
|
||||
* Gets the String value of a {@link LeaderboardRowDAO}.
|
||||
* Gets the String value of a {@link LeaderboardRowDTO}.
|
||||
* @param comparator
|
||||
* The comparator to update the minimum and maximum values.
|
||||
*/
|
||||
public MinMaxRenderer(HasStringAndDoubleValue valueProvider, Comparator<LeaderboardRowDAO> comparator) {
|
||||
public MinMaxRenderer(HasStringAndDoubleValue valueProvider, Comparator<LeaderboardRowDTO> comparator) {
|
||||
this.valueProvider = valueProvider;
|
||||
this.comparator = comparator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the value of a {@link LeaderboardRowDAO}.
|
||||
* Renders the value of a {@link LeaderboardRowDTO}.
|
||||
*
|
||||
* @param title
|
||||
* tool tip title to display; if <code>null</code>, no tool tip will be rendered
|
||||
*/
|
||||
public void render(Context context, LeaderboardRowDAO row, String title, SafeHtmlBuilder sb) {
|
||||
public void render(Context context, LeaderboardRowDTO row, String title, SafeHtmlBuilder sb) {
|
||||
int percent = getPercentage(row);
|
||||
String stringValue = valueProvider.getStringValueToRender(row);
|
||||
stringValue = stringValue == null ? "" : stringValue;
|
||||
@@ -52,13 +52,13 @@ public class MinMaxRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the percentage of a {@link LeaderboardRowDAO}. If no minimum or maximum value was set by calling
|
||||
* Gets the percentage of a {@link LeaderboardRowDTO}. If no minimum or maximum value was set by calling
|
||||
* {@link MinMaxRenderer#updateMinMax(Collection)} before zero is returned.
|
||||
*
|
||||
* @param row
|
||||
* The row to get the percentage for.
|
||||
*/
|
||||
private int getPercentage(LeaderboardRowDAO row) {
|
||||
private int getPercentage(LeaderboardRowDTO row) {
|
||||
int percentage = 0;
|
||||
Double value = valueProvider.getDoubleValue(row);
|
||||
if (value != null) {
|
||||
@@ -85,12 +85,12 @@ public class MinMaxRenderer {
|
||||
* Updates the {@link MinMaxRenderer#minimumValue} and {@link MinMaxRenderer#maximumValue}.
|
||||
*
|
||||
* @param values
|
||||
* The values of {@link LeaderboardRowDAO}s to determine the minimum and maximum values for.
|
||||
* The values of {@link LeaderboardRowDTO}s to determine the minimum and maximum values for.
|
||||
*/
|
||||
public void updateMinMax(Collection<LeaderboardRowDAO> values) {
|
||||
LeaderboardRowDAO minimumRow = null;
|
||||
LeaderboardRowDAO maximumRow = null;
|
||||
for (LeaderboardRowDAO row : values) {
|
||||
public void updateMinMax(Collection<LeaderboardRowDTO> values) {
|
||||
LeaderboardRowDTO minimumRow = null;
|
||||
LeaderboardRowDTO maximumRow = null;
|
||||
for (LeaderboardRowDTO row : values) {
|
||||
if (valueProvider.getDoubleValue(row) != null
|
||||
&& (minimumRow == null || comparator.compare(minimumRow, row) > 0)) {
|
||||
minimumRow = row;
|
||||
|
||||
+3
-3
@@ -5,16 +5,16 @@ import com.google.gwt.safehtml.shared.SafeHtml;
|
||||
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||
import com.google.gwt.text.shared.SafeHtmlRenderer;
|
||||
import com.google.gwt.user.cellview.client.CellTable;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardRowDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardRowDTO;
|
||||
|
||||
public class RankGainColumn extends LegDetailColumn<Integer, Integer> {
|
||||
public RankGainColumn(String title, LegDetailField<Integer> field, CellTable<LeaderboardRowDAO> leaderboardTable,
|
||||
public RankGainColumn(String title, LegDetailField<Integer> field, CellTable<LeaderboardRowDTO> leaderboardTable,
|
||||
String headerStyle, String columnStyle) {
|
||||
super(title, null, field, new RankGainCell(), leaderboardTable, headerStyle, columnStyle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getValue(LeaderboardRowDAO row) {
|
||||
public Integer getValue(LeaderboardRowDTO row) {
|
||||
return getField().get(row);
|
||||
}
|
||||
|
||||
|
||||
+15
-15
@@ -16,12 +16,12 @@ import com.sap.sailing.gwt.ui.client.RaceSelectionChangeListener;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.client.TimeListener;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.PositionDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindInfoForRaceDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.PositionDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindInfoForRaceDTO;
|
||||
import com.sap.sailing.server.api.EventNameAndRaceName;
|
||||
|
||||
/**
|
||||
@@ -31,12 +31,12 @@ import com.sap.sailing.server.api.EventNameAndRaceName;
|
||||
*
|
||||
*/
|
||||
public class SmallWindHistoryPanel extends FormPanel implements TimeListener, RaceSelectionChangeListener {
|
||||
private final PositionDAO position;
|
||||
private final PositionDTO position;
|
||||
private final WindIndicator[] windIndicators;
|
||||
private final Label selectedWindSourceLabel;
|
||||
private Date date;
|
||||
private EventDAO event;
|
||||
private RaceDAO race;
|
||||
private EventDTO event;
|
||||
private RaceDTO race;
|
||||
private final SailingServiceAsync sailingService;
|
||||
private final long millisecondStepsPerLabel;
|
||||
private final ErrorReporter errorReporter;
|
||||
@@ -51,7 +51,7 @@ public class SmallWindHistoryPanel extends FormPanel implements TimeListener, Ra
|
||||
* @param windTrack
|
||||
* the wind track to visualize using this panel
|
||||
*/
|
||||
public SmallWindHistoryPanel(SailingServiceAsync sailingService, PositionDAO position,
|
||||
public SmallWindHistoryPanel(SailingServiceAsync sailingService, PositionDTO position,
|
||||
int numberOfTimepoints, long millisecondStepsPerLabel, StringMessages stringConstants, ErrorReporter errorReporter) {
|
||||
this.sailingService = sailingService;
|
||||
this.position = position;
|
||||
@@ -78,9 +78,9 @@ public class SmallWindHistoryPanel extends FormPanel implements TimeListener, Ra
|
||||
if (event != null && race != null) {
|
||||
sailingService.getWindInfo(new EventNameAndRaceName(event.name, race.name), from, millisecondStepsPerLabel,
|
||||
windIndicators.length, position.latDeg, position.lngDeg, /* all sources */ null,
|
||||
new AsyncCallback<WindInfoForRaceDAO>() {
|
||||
new AsyncCallback<WindInfoForRaceDTO>() {
|
||||
@Override
|
||||
public void onSuccess(WindInfoForRaceDAO result) {
|
||||
public void onSuccess(WindInfoForRaceDTO result) {
|
||||
// expecting to find windIndicators.length fixes
|
||||
if (result == null || result.windTrackInfoByWindSource.get(result.selectedWindSource).windFixes
|
||||
.size() != windIndicators.length) {
|
||||
@@ -88,7 +88,7 @@ public class SmallWindHistoryPanel extends FormPanel implements TimeListener, Ra
|
||||
} else {
|
||||
setSelectedWindSource(result.selectedWindSource);
|
||||
int i = 0;
|
||||
for (WindDAO fix : result.windTrackInfoByWindSource.get(result.selectedWindSource).windFixes) {
|
||||
for (WindDTO fix : result.windTrackInfoByWindSource.get(result.selectedWindSource).windFixes) {
|
||||
updateWindIndicator(i, fix);
|
||||
i++;
|
||||
}
|
||||
@@ -112,7 +112,7 @@ public class SmallWindHistoryPanel extends FormPanel implements TimeListener, Ra
|
||||
}
|
||||
}
|
||||
|
||||
private void updateWindIndicator(int i, WindDAO fix) {
|
||||
private void updateWindIndicator(int i, WindDTO fix) {
|
||||
windIndicators[i].setFromDeg(fix.dampenedTrueWindFromDeg);
|
||||
windIndicators[i].setSpeedInKnots(fix.dampenedTrueWindSpeedInKnots);
|
||||
}
|
||||
@@ -128,7 +128,7 @@ public class SmallWindHistoryPanel extends FormPanel implements TimeListener, Ra
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRaceSelectionChange(List<Triple<EventDAO, RegattaDAO, RaceDAO>> selectedRaces) {
|
||||
public void onRaceSelectionChange(List<Triple<EventDTO, RegattaDTO, RaceDTO>> selectedRaces) {
|
||||
if (!selectedRaces.isEmpty()) {
|
||||
event = selectedRaces.get(selectedRaces.size() - 1).getA();
|
||||
race = selectedRaces.get(selectedRaces.size() - 1).getC();
|
||||
|
||||
+4
-4
@@ -7,8 +7,8 @@ import com.google.gwt.user.cellview.client.CellTable;
|
||||
import com.google.gwt.user.cellview.client.Column;
|
||||
import com.google.gwt.user.cellview.client.ColumnSortList;
|
||||
import com.google.gwt.user.cellview.client.Header;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardRowDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardRowDTO;
|
||||
|
||||
public abstract class SortableColumn<T, C> extends Column<T, C> {
|
||||
protected SortableColumn(Cell<C> cell) {
|
||||
@@ -16,14 +16,14 @@ public abstract class SortableColumn<T, C> extends Column<T, C> {
|
||||
setSortable(true);
|
||||
}
|
||||
|
||||
protected void updateMinMax(LeaderboardDAO leaderboard) {}
|
||||
protected void updateMinMax(LeaderboardDTO leaderboard) {}
|
||||
|
||||
/**
|
||||
* To enable sorting of <code>null</code> values to the end even in ascending order, the comparators provided
|
||||
* by the subclasses will want to know whether the leaderboard table is currently sorted in ascending order
|
||||
* for this column.
|
||||
*/
|
||||
protected boolean isSortedAscendingForThisColumn(CellTable<LeaderboardRowDAO> leaderboardTable) {
|
||||
protected boolean isSortedAscendingForThisColumn(CellTable<LeaderboardRowDTO> leaderboardTable) {
|
||||
ColumnSortList sortList = leaderboardTable.getColumnSortList();
|
||||
return sortList.size() > 0 && sortList.get(0).getColumn() == this && sortList.get(0).isAscending();
|
||||
}
|
||||
|
||||
+37
-37
@@ -19,10 +19,10 @@ import com.sap.sailing.gwt.ui.client.ErrorReporter;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.leaderboard.LeaderboardPanel;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardEntryDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardRowDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardEntryDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardRowDTO;
|
||||
|
||||
/**
|
||||
* An editable version of the {@link LeaderboardPanel} which allows a user to enter carried / accumulated
|
||||
@@ -35,9 +35,9 @@ public class EditableLeaderboardPanel extends LeaderboardPanel {
|
||||
private class EditableCarryColumn extends CarryColumn {
|
||||
public EditableCarryColumn() {
|
||||
super(new EditTextCell());
|
||||
setFieldUpdater(new FieldUpdater<LeaderboardRowDAO, String>() {
|
||||
setFieldUpdater(new FieldUpdater<LeaderboardRowDTO, String>() {
|
||||
@Override
|
||||
public void update(final int rowIndex, final LeaderboardRowDAO row, final String value) {
|
||||
public void update(final int rowIndex, final LeaderboardRowDTO row, final String value) {
|
||||
getSailingService().updateLeaderboardCarryValue(getLeaderboardName(), row.competitor.name,
|
||||
value == null || value.length() == 0 ? null : Integer.valueOf(value.trim()),
|
||||
new AsyncCallback<Void>() {
|
||||
@@ -68,9 +68,9 @@ public class EditableLeaderboardPanel extends LeaderboardPanel {
|
||||
|
||||
public EditableCompetitorColumn() {
|
||||
super(new EditTextCell());
|
||||
setFieldUpdater(new FieldUpdater<LeaderboardRowDAO, String>() {
|
||||
setFieldUpdater(new FieldUpdater<LeaderboardRowDTO, String>() {
|
||||
@Override
|
||||
public void update(final int rowIndex, final LeaderboardRowDAO row, final String value) {
|
||||
public void update(final int rowIndex, final LeaderboardRowDTO row, final String value) {
|
||||
getSailingService().updateCompetitorDisplayNameInLeaderboard(getLeaderboardName(), row.competitor.name,
|
||||
value == null || value.length() == 0 ? null : value.trim(),
|
||||
new AsyncCallback<Void>() {
|
||||
@@ -84,7 +84,7 @@ public class EditableLeaderboardPanel extends LeaderboardPanel {
|
||||
@Override
|
||||
public void onSuccess(Void v) {
|
||||
if (getLeaderboard().competitorDisplayNames == null) {
|
||||
getLeaderboard().competitorDisplayNames = new HashMap<CompetitorDAO, String>();
|
||||
getLeaderboard().competitorDisplayNames = new HashMap<CompetitorDTO, String>();
|
||||
}
|
||||
getCell().setViewData(row, null); // ensure that getValue() is called again
|
||||
getLeaderboard().competitorDisplayNames.put(row.competitor, value == null || value.trim().length() == 0 ? null : value.trim());
|
||||
@@ -96,21 +96,21 @@ public class EditableLeaderboardPanel extends LeaderboardPanel {
|
||||
}
|
||||
}
|
||||
|
||||
private class EditableRaceColumn extends RaceColumn<LeaderboardRowDAO> implements RowUpdateWhiteboardOwner<LeaderboardRowDAO> {
|
||||
private RowUpdateWhiteboard<LeaderboardRowDAO> currentRowUpdateWhiteboard;
|
||||
private class EditableRaceColumn extends RaceColumn<LeaderboardRowDTO> implements RowUpdateWhiteboardOwner<LeaderboardRowDTO> {
|
||||
private RowUpdateWhiteboard<LeaderboardRowDTO> currentRowUpdateWhiteboard;
|
||||
|
||||
public EditableRaceColumn(String raceName, boolean medalRace, List<RowUpdateWhiteboardProducerThatAlsoHasCell<LeaderboardRowDAO, ?>> cellList) {
|
||||
public EditableRaceColumn(String raceName, boolean medalRace, List<RowUpdateWhiteboardProducerThatAlsoHasCell<LeaderboardRowDTO, ?>> cellList) {
|
||||
super(raceName, medalRace,
|
||||
/* expandable */ false, // we don't want leg expansion when editing scores
|
||||
new CompositeCell<LeaderboardRowDAO>(new ArrayList<HasCell<LeaderboardRowDAO, ?>>(cellList)),
|
||||
new CompositeCell<LeaderboardRowDTO>(new ArrayList<HasCell<LeaderboardRowDTO, ?>>(cellList)),
|
||||
RACE_COLUMN_HEADER_STYLE, RACE_COLUMN_STYLE);
|
||||
for (RowUpdateWhiteboardProducer<LeaderboardRowDAO> rowUpdateWhiteboardProducer : cellList) {
|
||||
for (RowUpdateWhiteboardProducer<LeaderboardRowDTO> rowUpdateWhiteboardProducer : cellList) {
|
||||
rowUpdateWhiteboardProducer.setWhiteboardOwner(this);
|
||||
}
|
||||
// the field updater for the composite is invoked after any component has updated its field
|
||||
setFieldUpdater(new FieldUpdater<LeaderboardRowDAO, LeaderboardRowDAO>() {
|
||||
setFieldUpdater(new FieldUpdater<LeaderboardRowDTO, LeaderboardRowDTO>() {
|
||||
@Override
|
||||
public void update(int rowIndex, LeaderboardRowDAO row, LeaderboardRowDAO value) {
|
||||
public void update(int rowIndex, LeaderboardRowDTO row, LeaderboardRowDTO value) {
|
||||
currentRowUpdateWhiteboard.setIndexOfRowToUpdate(rowIndex);
|
||||
currentRowUpdateWhiteboard = null; // show that it has been consumed and updated
|
||||
}
|
||||
@@ -118,22 +118,22 @@ public class EditableLeaderboardPanel extends LeaderboardPanel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Context context, LeaderboardRowDAO object, SafeHtmlBuilder html) {
|
||||
public void render(Context context, LeaderboardRowDTO object, SafeHtmlBuilder html) {
|
||||
defaultRender(context, object, html);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LeaderboardRowDAO getValue(LeaderboardRowDAO object) {
|
||||
public LeaderboardRowDTO getValue(LeaderboardRowDTO object) {
|
||||
return object;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whiteboardProduced(RowUpdateWhiteboard<LeaderboardRowDAO> whiteboard) {
|
||||
public void whiteboardProduced(RowUpdateWhiteboard<LeaderboardRowDTO> whiteboard) {
|
||||
currentRowUpdateWhiteboard = whiteboard;
|
||||
}
|
||||
}
|
||||
|
||||
private class MaxPointsDropDownCellProvider extends AbstractRowUpdateWhiteboardProducerThatHasCell<LeaderboardRowDAO, String> {
|
||||
private class MaxPointsDropDownCellProvider extends AbstractRowUpdateWhiteboardProducerThatHasCell<LeaderboardRowDTO, String> {
|
||||
private final SelectionCell dropDownCell;
|
||||
private final String raceName;
|
||||
|
||||
@@ -148,11 +148,11 @@ public class EditableLeaderboardPanel extends LeaderboardPanel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public FieldUpdater<LeaderboardRowDAO, String> getFieldUpdater() {
|
||||
return new FieldUpdater<LeaderboardRowDAO, String>() {
|
||||
public FieldUpdater<LeaderboardRowDTO, String> getFieldUpdater() {
|
||||
return new FieldUpdater<LeaderboardRowDTO, String>() {
|
||||
@Override
|
||||
public void update(final int rowIndex, final LeaderboardRowDAO row, final String value) {
|
||||
final RowUpdateWhiteboard<LeaderboardRowDAO> whiteboard = new RowUpdateWhiteboard<LeaderboardRowDAO>(
|
||||
public void update(final int rowIndex, final LeaderboardRowDTO row, final String value) {
|
||||
final RowUpdateWhiteboard<LeaderboardRowDTO> whiteboard = new RowUpdateWhiteboard<LeaderboardRowDTO>(
|
||||
EditableLeaderboardPanel.this.getData());
|
||||
getWhiteboardOwner().whiteboardProduced(whiteboard);
|
||||
getSailingService().updateLeaderboardMaxPointsReason(getLeaderboardName(), row.competitor.name,
|
||||
@@ -181,8 +181,8 @@ public class EditableLeaderboardPanel extends LeaderboardPanel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue(LeaderboardRowDAO object) {
|
||||
LeaderboardEntryDAO leaderboardEntryDAO = object.fieldsByRaceName.get(raceName);
|
||||
public String getValue(LeaderboardRowDTO object) {
|
||||
LeaderboardEntryDTO leaderboardEntryDAO = object.fieldsByRaceName.get(raceName);
|
||||
String reasonForMaxPoints = null;
|
||||
if (leaderboardEntryDAO != null) {
|
||||
reasonForMaxPoints = leaderboardEntryDAO.reasonForMaxPoints;
|
||||
@@ -191,7 +191,7 @@ public class EditableLeaderboardPanel extends LeaderboardPanel {
|
||||
}
|
||||
}
|
||||
|
||||
private class NetPointsEditCellProvider extends AbstractRowUpdateWhiteboardProducerThatHasCell<LeaderboardRowDAO, String> {
|
||||
private class NetPointsEditCellProvider extends AbstractRowUpdateWhiteboardProducerThatHasCell<LeaderboardRowDTO, String> {
|
||||
private final EditTextCell netPointsEditCell;
|
||||
private final String raceName;
|
||||
|
||||
@@ -206,11 +206,11 @@ public class EditableLeaderboardPanel extends LeaderboardPanel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public FieldUpdater<LeaderboardRowDAO, String> getFieldUpdater() {
|
||||
return new FieldUpdater<LeaderboardRowDAO, String>() {
|
||||
public FieldUpdater<LeaderboardRowDTO, String> getFieldUpdater() {
|
||||
return new FieldUpdater<LeaderboardRowDTO, String>() {
|
||||
@Override
|
||||
public void update(final int rowIndex, final LeaderboardRowDAO row, final String value) {
|
||||
final RowUpdateWhiteboard<LeaderboardRowDAO> whiteboard = new RowUpdateWhiteboard<LeaderboardRowDAO>(
|
||||
public void update(final int rowIndex, final LeaderboardRowDTO row, final String value) {
|
||||
final RowUpdateWhiteboard<LeaderboardRowDTO> whiteboard = new RowUpdateWhiteboard<LeaderboardRowDTO>(
|
||||
EditableLeaderboardPanel.this.getData());
|
||||
getWhiteboardOwner().whiteboardProduced(whiteboard);
|
||||
getSailingService().updateLeaderboardScoreCorrection(getLeaderboardName(), row.competitor.name, raceName,
|
||||
@@ -237,8 +237,8 @@ public class EditableLeaderboardPanel extends LeaderboardPanel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue(LeaderboardRowDAO object) {
|
||||
LeaderboardEntryDAO leaderboardEntryDAO = object.fieldsByRaceName.get(raceName);
|
||||
public String getValue(LeaderboardRowDTO object) {
|
||||
LeaderboardEntryDTO leaderboardEntryDAO = object.fieldsByRaceName.get(raceName);
|
||||
String result = "";
|
||||
if (leaderboardEntryDAO != null) {
|
||||
result = result+leaderboardEntryDAO.netPoints;
|
||||
@@ -258,7 +258,7 @@ public class EditableLeaderboardPanel extends LeaderboardPanel {
|
||||
* the column must always be shown.
|
||||
*/
|
||||
@Override
|
||||
protected void updateCarryColumn(LeaderboardDAO leaderboard) {
|
||||
protected void updateCarryColumn(LeaderboardDTO leaderboard) {
|
||||
ensureCarryColumn();
|
||||
}
|
||||
|
||||
@@ -286,9 +286,9 @@ public class EditableLeaderboardPanel extends LeaderboardPanel {
|
||||
getCellList(raceName, isMedalRace));
|
||||
}
|
||||
|
||||
private List<RowUpdateWhiteboardProducerThatAlsoHasCell<LeaderboardRowDAO, ?>> getCellList(String raceName, boolean medalRace) {
|
||||
List<RowUpdateWhiteboardProducerThatAlsoHasCell<LeaderboardRowDAO, ?>> list =
|
||||
new ArrayList<RowUpdateWhiteboardProducerThatAlsoHasCell<LeaderboardRowDAO, ?>>();
|
||||
private List<RowUpdateWhiteboardProducerThatAlsoHasCell<LeaderboardRowDTO, ?>> getCellList(String raceName, boolean medalRace) {
|
||||
List<RowUpdateWhiteboardProducerThatAlsoHasCell<LeaderboardRowDTO, ?>> list =
|
||||
new ArrayList<RowUpdateWhiteboardProducerThatAlsoHasCell<LeaderboardRowDTO, ?>>();
|
||||
list.add(new MaxPointsDropDownCellProvider(raceName));
|
||||
list.add(new NetPointsEditCellProvider(raceName));
|
||||
return list;
|
||||
|
||||
+161
-161
@@ -90,31 +90,31 @@ import com.sap.sailing.domain.tractracadapter.DomainFactory;
|
||||
import com.sap.sailing.domain.tractracadapter.RaceRecord;
|
||||
import com.sap.sailing.domain.tractracadapter.TracTracConfiguration;
|
||||
import com.sap.sailing.gwt.ui.client.SailingService;
|
||||
import com.sap.sailing.gwt.ui.shared.BoatClassDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorInRaceDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorsAndTimePointsDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.GPSFixDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardEntryDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardRowDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.LegEntryDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.ManeuverDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.MarkDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.PositionDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.QuickRankDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceInLeaderboardDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.SpeedWithBearingDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.SwissTimingConfigurationDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.SwissTimingRaceRecordDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.TracTracConfigurationDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.TracTracRaceRecordDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindInfoForRaceDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindTrackInfoDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.BoatClassDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorInRaceDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorsAndTimePointsDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.GPSFixDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardEntryDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardRowDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.LegEntryDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.ManeuverDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.MarkDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.PositionDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.QuickRankDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceInLeaderboardDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.SpeedWithBearingDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.SwissTimingConfigurationDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.SwissTimingRaceRecordDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.TracTracConfigurationDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.TracTracRaceRecordDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindInfoForRaceDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindTrackInfoDTO;
|
||||
import com.sap.sailing.server.RacingEventService;
|
||||
import com.sap.sailing.server.api.DetailType;
|
||||
import com.sap.sailing.server.api.EventAndRaceIdentifier;
|
||||
@@ -176,37 +176,37 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
}
|
||||
|
||||
@Override
|
||||
public LeaderboardDAO getLeaderboardByName(String leaderboardName, Date date,
|
||||
public LeaderboardDTO getLeaderboardByName(String leaderboardName, Date date,
|
||||
final Collection<String> namesOfRacesForWhichToLoadLegDetails)
|
||||
throws NoWindException {
|
||||
long startOfRequestHandling = System.currentTimeMillis();
|
||||
LeaderboardDAO result = null;
|
||||
LeaderboardDTO result = null;
|
||||
Leaderboard leaderboard = getService().getLeaderboardByName(leaderboardName);
|
||||
if (leaderboard != null) {
|
||||
result = new LeaderboardDAO();
|
||||
result = new LeaderboardDTO();
|
||||
final TimePoint timePoint = new MillisecondsTimePoint(date);
|
||||
result.competitors = new ArrayList<CompetitorDAO>();
|
||||
result.competitors = new ArrayList<CompetitorDTO>();
|
||||
result.name = leaderboard.getName();
|
||||
result.competitorDisplayNames = new HashMap<CompetitorDAO, String>();
|
||||
result.competitorDisplayNames = new HashMap<CompetitorDTO, String>();
|
||||
for (RaceInLeaderboard raceColumn : leaderboard.getRaceColumns()) {
|
||||
result.addRace(raceColumn.getName(), raceColumn.isMedalRace(), raceColumn.getTrackedRace() != null);
|
||||
}
|
||||
result.rows = new HashMap<CompetitorDAO, LeaderboardRowDAO>();
|
||||
result.rows = new HashMap<CompetitorDTO, LeaderboardRowDTO>();
|
||||
result.hasCarriedPoints = leaderboard.hasCarriedPoints();
|
||||
result.discardThresholds = leaderboard.getResultDiscardingRule().getDiscardIndexResultsStartingWithHowManyRaces();
|
||||
for (final Competitor competitor : leaderboard.getCompetitors()) {
|
||||
CompetitorDAO competitorDAO = getCompetitorDAO(competitor);
|
||||
LeaderboardRowDAO row = new LeaderboardRowDAO();
|
||||
CompetitorDTO competitorDAO = getCompetitorDAO(competitor);
|
||||
LeaderboardRowDTO row = new LeaderboardRowDTO();
|
||||
row.competitor = competitorDAO;
|
||||
row.fieldsByRaceName = new HashMap<String, LeaderboardEntryDAO>();
|
||||
row.fieldsByRaceName = new HashMap<String, LeaderboardEntryDTO>();
|
||||
row.carriedPoints = leaderboard.hasCarriedPoints(competitor) ? leaderboard.getCarriedPoints(competitor) : null;
|
||||
result.competitors.add(competitorDAO);
|
||||
Map<String, Future<LeaderboardEntryDAO>> futuresForColumnName = new HashMap<String, Future<LeaderboardEntryDAO>>();
|
||||
Map<String, Future<LeaderboardEntryDTO>> futuresForColumnName = new HashMap<String, Future<LeaderboardEntryDTO>>();
|
||||
for (final RaceInLeaderboard raceColumn : leaderboard.getRaceColumns()) {
|
||||
final Entry entry = leaderboard.getEntry(competitor, raceColumn, timePoint);
|
||||
RunnableFuture<LeaderboardEntryDAO> future = new FutureTask<LeaderboardEntryDAO>(new Callable<LeaderboardEntryDAO>() {
|
||||
RunnableFuture<LeaderboardEntryDTO> future = new FutureTask<LeaderboardEntryDTO>(new Callable<LeaderboardEntryDTO>() {
|
||||
@Override
|
||||
public LeaderboardEntryDAO call() {
|
||||
public LeaderboardEntryDTO call() {
|
||||
try {
|
||||
return getLeaderboardEntryDAO(entry, raceColumn.getTrackedRace(), competitor, timePoint,
|
||||
namesOfRacesForWhichToLoadLegDetails != null
|
||||
@@ -219,7 +219,7 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
executor.execute(future);
|
||||
futuresForColumnName.put(raceColumn.getName(), future);
|
||||
}
|
||||
for (Map.Entry<String, Future<LeaderboardEntryDAO>> raceColumnNameAndFuture : futuresForColumnName.entrySet()) {
|
||||
for (Map.Entry<String, Future<LeaderboardEntryDTO>> raceColumnNameAndFuture : futuresForColumnName.entrySet()) {
|
||||
try {
|
||||
row.fieldsByRaceName.put(raceColumnNameAndFuture.getKey(), raceColumnNameAndFuture.getValue().get());
|
||||
} catch (InterruptedException e) {
|
||||
@@ -258,18 +258,18 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
}
|
||||
}
|
||||
|
||||
private LeaderboardEntryDAO getLeaderboardEntryDAO(Entry entry, TrackedRace trackedRace, Competitor competitor,
|
||||
private LeaderboardEntryDTO getLeaderboardEntryDAO(Entry entry, TrackedRace trackedRace, Competitor competitor,
|
||||
TimePoint timePoint, boolean addLegDetails) throws NoWindException {
|
||||
LeaderboardEntryDAO entryDAO = new LeaderboardEntryDAO();
|
||||
LeaderboardEntryDTO entryDAO = new LeaderboardEntryDTO();
|
||||
entryDAO.netPoints = entry.getNetPoints();
|
||||
entryDAO.totalPoints = entry.getTotalPoints();
|
||||
entryDAO.reasonForMaxPoints = entry.getMaxPointsReason().name();
|
||||
entryDAO.discarded = entry.isDiscarded();
|
||||
if (addLegDetails && trackedRace != null) {
|
||||
entryDAO.legDetails = new ArrayList<LegEntryDAO>();
|
||||
entryDAO.legDetails = new ArrayList<LegEntryDTO>();
|
||||
for (Leg leg : trackedRace.getRace().getCourse().getLegs()) {
|
||||
TrackedLegOfCompetitor trackedLeg = trackedRace.getTrackedLeg(competitor, leg);
|
||||
LegEntryDAO legEntry;
|
||||
LegEntryDTO legEntry;
|
||||
if (trackedLeg != null && trackedLeg.hasStartedLeg(timePoint)) {
|
||||
legEntry = createLegEntry(trackedLeg, timePoint);
|
||||
} else {
|
||||
@@ -281,12 +281,12 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
return entryDAO;
|
||||
}
|
||||
|
||||
private LegEntryDAO createLegEntry(TrackedLegOfCompetitor trackedLeg, TimePoint timePoint) throws NoWindException {
|
||||
LegEntryDAO result;
|
||||
private LegEntryDTO createLegEntry(TrackedLegOfCompetitor trackedLeg, TimePoint timePoint) throws NoWindException {
|
||||
LegEntryDTO result;
|
||||
if (trackedLeg == null) {
|
||||
result = null;
|
||||
} else {
|
||||
result = new LegEntryDAO();
|
||||
result = new LegEntryDTO();
|
||||
Speed averageSpeedOverGround = trackedLeg.getAverageSpeedOverGround(timePoint);
|
||||
result.averageSpeedOverGroundInKnots = averageSpeedOverGround == null ? null : averageSpeedOverGround
|
||||
.getKnots();
|
||||
@@ -328,12 +328,12 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<EventDAO> listEvents(boolean withRacePlaces) throws IllegalArgumentException {
|
||||
List<EventDAO> result = new ArrayList<EventDAO>();
|
||||
public List<EventDTO> listEvents(boolean withRacePlaces) throws IllegalArgumentException {
|
||||
List<EventDTO> result = new ArrayList<EventDTO>();
|
||||
for (Event event : getService().getAllEvents()) {
|
||||
List<CompetitorDAO> competitorList = getCompetitorDAOs(event.getCompetitors());
|
||||
List<RegattaDAO> regattasList = getRegattaDAOs(event, withRacePlaces);
|
||||
EventDAO eventDAO = new EventDAO(event.getName(), regattasList, competitorList);
|
||||
List<CompetitorDTO> competitorList = getCompetitorDAOs(event.getCompetitors());
|
||||
List<RegattaDTO> regattasList = getRegattaDAOs(event, withRacePlaces);
|
||||
EventDTO eventDAO = new EventDTO(event.getName(), regattasList, competitorList);
|
||||
if (!eventDAO.regattas.isEmpty()) {
|
||||
result.add(eventDAO);
|
||||
}
|
||||
@@ -341,7 +341,7 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<RegattaDAO> getRegattaDAOs(Event event, boolean withRacePlaces) {
|
||||
private List<RegattaDTO> getRegattaDAOs(Event event, boolean withRacePlaces) {
|
||||
Map<BoatClass, Set<RaceDefinition>> racesByBoatClass = new HashMap<BoatClass, Set<RaceDefinition>>();
|
||||
for (RaceDefinition r : event.getAllRaces()) {
|
||||
Set<RaceDefinition> racesForBoatClass = racesByBoatClass.get(r.getBoatClass());
|
||||
@@ -351,21 +351,21 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
}
|
||||
racesForBoatClass.add(r);
|
||||
}
|
||||
List<RegattaDAO> result = new ArrayList<RegattaDAO>();
|
||||
List<RegattaDTO> result = new ArrayList<RegattaDTO>();
|
||||
for (Map.Entry<BoatClass, Set<RaceDefinition>> e : racesByBoatClass.entrySet()) {
|
||||
List<RaceDAO> raceDAOsInBoatClass = getRaceDAOs(event, e.getValue(), withRacePlaces);
|
||||
List<RaceDTO> raceDAOsInBoatClass = getRaceDAOs(event, e.getValue(), withRacePlaces);
|
||||
if (!raceDAOsInBoatClass.isEmpty()) {
|
||||
RegattaDAO regatta = new RegattaDAO(new BoatClassDAO(e.getKey()==null?"":e.getKey().getName()), raceDAOsInBoatClass);
|
||||
RegattaDTO regatta = new RegattaDTO(new BoatClassDTO(e.getKey()==null?"":e.getKey().getName()), raceDAOsInBoatClass);
|
||||
result.add(regatta);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<RaceDAO> getRaceDAOs(Event event, Set<RaceDefinition> races, boolean withRacePlaces) {
|
||||
List<RaceDAO> result = new ArrayList<RaceDAO>();
|
||||
private List<RaceDTO> getRaceDAOs(Event event, Set<RaceDefinition> races, boolean withRacePlaces) {
|
||||
List<RaceDTO> result = new ArrayList<RaceDTO>();
|
||||
for (RaceDefinition r : races) {
|
||||
RaceDAO raceDAO = new RaceDAO(r.getName(), getCompetitorDAOs(r.getCompetitors()), getService().isRaceBeingTracked(r));
|
||||
RaceDTO raceDAO = new RaceDTO(r.getName(), getCompetitorDAOs(r.getCompetitors()), getService().isRaceBeingTracked(r));
|
||||
if (raceDAO.currentlyTracked) {
|
||||
TrackedRace trackedRace = getService().getTrackedRace(event, r);
|
||||
raceDAO.startOfRace = trackedRace.getStart() == null ? null : trackedRace.getStart().asDate();
|
||||
@@ -381,40 +381,40 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<CompetitorDAO> getCompetitorDAOs(Iterable<Competitor> competitors) {
|
||||
List<CompetitorDAO> result = new ArrayList<CompetitorDAO>();
|
||||
private List<CompetitorDTO> getCompetitorDAOs(Iterable<Competitor> competitors) {
|
||||
List<CompetitorDTO> result = new ArrayList<CompetitorDTO>();
|
||||
for (Competitor c : competitors) {
|
||||
CompetitorDAO competitorDAO = getCompetitorDAO(c);
|
||||
CompetitorDTO competitorDAO = getCompetitorDAO(c);
|
||||
result.add(competitorDAO);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private CompetitorDAO getCompetitorDAO(Competitor c) {
|
||||
private CompetitorDTO getCompetitorDAO(Competitor c) {
|
||||
CountryCode countryCode = c.getTeam().getNationality().getCountryCode();
|
||||
CompetitorDAO competitorDAO = new CompetitorDAO(c.getName(), countryCode==null?"":countryCode.getTwoLetterISOCode(),
|
||||
CompetitorDTO competitorDAO = new CompetitorDTO(c.getName(), countryCode==null?"":countryCode.getTwoLetterISOCode(),
|
||||
countryCode==null?"":countryCode.getThreeLetterIOCCode(), countryCode==null?"":countryCode.getName(), c.getBoat().getSailID(),
|
||||
c.getId().toString());
|
||||
return competitorDAO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pair<String, List<TracTracRaceRecordDAO>> listTracTracRacesInEvent(String eventJsonURL) throws MalformedURLException, IOException,
|
||||
public Pair<String, List<TracTracRaceRecordDTO>> listTracTracRacesInEvent(String eventJsonURL) throws MalformedURLException, IOException,
|
||||
ParseException, org.json.simple.parser.ParseException, URISyntaxException {
|
||||
com.sap.sailing.domain.common.impl.Util.Pair<String,List<RaceRecord>> raceRecords;
|
||||
raceRecords = getService().getTracTracRaceRecords(new URL(eventJsonURL));
|
||||
List<TracTracRaceRecordDAO> result = new ArrayList<TracTracRaceRecordDAO>();
|
||||
List<TracTracRaceRecordDTO> result = new ArrayList<TracTracRaceRecordDTO>();
|
||||
for (RaceRecord raceRecord : raceRecords.getB()) {
|
||||
result.add(new TracTracRaceRecordDAO(raceRecord.getID(), raceRecord.getEventName(), raceRecord.getName(),
|
||||
result.add(new TracTracRaceRecordDTO(raceRecord.getID(), raceRecord.getEventName(), raceRecord.getName(),
|
||||
raceRecord.getParamURL().toString(), raceRecord.getReplayURL(), raceRecord.getLiveURI().toString(),
|
||||
raceRecord.getStoredURI().toString(), raceRecord.getTrackingStartTime().asDate(), raceRecord
|
||||
.getTrackingEndTime().asDate(), raceRecord.getRaceStartTime().asDate()));
|
||||
}
|
||||
return new Pair<String, List<TracTracRaceRecordDAO>>(raceRecords.getA(), result);
|
||||
return new Pair<String, List<TracTracRaceRecordDTO>>(raceRecords.getA(), result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void track(TracTracRaceRecordDAO rr, String liveURI, String storedURI, boolean trackWind, final boolean correctWindByDeclination) throws Exception {
|
||||
public void track(TracTracRaceRecordDTO rr, String liveURI, String storedURI, boolean trackWind, final boolean correctWindByDeclination) throws Exception {
|
||||
if (liveURI == null || liveURI.trim().length() == 0) {
|
||||
liveURI = rr.liveURI;
|
||||
}
|
||||
@@ -437,11 +437,11 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TracTracConfigurationDAO> getPreviousTracTracConfigurations() throws Exception {
|
||||
public List<TracTracConfigurationDTO> getPreviousTracTracConfigurations() throws Exception {
|
||||
Iterable<TracTracConfiguration> configs = tractracDomainObjectFactory.getTracTracConfigurations();
|
||||
List<TracTracConfigurationDAO> result = new ArrayList<TracTracConfigurationDAO>();
|
||||
List<TracTracConfigurationDTO> result = new ArrayList<TracTracConfigurationDTO>();
|
||||
for (TracTracConfiguration ttConfig : configs) {
|
||||
result.add(new TracTracConfigurationDAO(ttConfig.getName(), ttConfig.getJSONURL().toString(),
|
||||
result.add(new TracTracConfigurationDTO(ttConfig.getName(), ttConfig.getJSONURL().toString(),
|
||||
ttConfig.getLiveDataURI().toString(), ttConfig.getStoredDataURI().toString()));
|
||||
}
|
||||
return result;
|
||||
@@ -511,21 +511,21 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
}
|
||||
|
||||
@Override
|
||||
public WindInfoForRaceDAO getWindInfo(RaceIdentifier raceIdentifier, Date fromDate, Date toDate, WindSource[] windSources) {
|
||||
WindInfoForRaceDAO result = null;
|
||||
public WindInfoForRaceDTO getWindInfo(RaceIdentifier raceIdentifier, Date fromDate, Date toDate, WindSource[] windSources) {
|
||||
WindInfoForRaceDTO result = null;
|
||||
TrackedRace trackedRace = getExistingTrackedRace(raceIdentifier);
|
||||
if (trackedRace != null) {
|
||||
result = new WindInfoForRaceDAO();
|
||||
result = new WindInfoForRaceDTO();
|
||||
result.raceIsKnownToStartUpwind = trackedRace.raceIsKnownToStartUpwind();
|
||||
result.selectedWindSource = trackedRace.getWindSource();
|
||||
TimePoint from = fromDate == null ? trackedRace.getStart() : new MillisecondsTimePoint(fromDate);
|
||||
TimePoint to = toDate == null ? trackedRace.getTimePointOfNewestEvent() : new MillisecondsTimePoint(toDate);
|
||||
Map<WindSource, WindTrackInfoDAO> windTrackInfoDAOs = new HashMap<WindSource, WindTrackInfoDAO>();
|
||||
Map<WindSource, WindTrackInfoDTO> windTrackInfoDAOs = new HashMap<WindSource, WindTrackInfoDTO>();
|
||||
result.windTrackInfoByWindSource = windTrackInfoDAOs;
|
||||
if (from != null && to != null) {
|
||||
for (WindSource windSource : (windSources == null ? WindSource.values() : windSources)) {
|
||||
WindTrackInfoDAO windTrackInfoDAO = new WindTrackInfoDAO();
|
||||
windTrackInfoDAO.windFixes = new ArrayList<WindDAO>();
|
||||
WindTrackInfoDTO windTrackInfoDAO = new WindTrackInfoDTO();
|
||||
windTrackInfoDAO.windFixes = new ArrayList<WindDTO>();
|
||||
WindTrack windTrack = trackedRace.getWindTrack(windSource);
|
||||
windTrackInfoDAO.dampeningIntervalInMilliseconds = windTrack
|
||||
.getMillisecondsOverWhichToAverageWind();
|
||||
@@ -535,7 +535,7 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
if (wind.getTimePoint().compareTo(to) > 0) {
|
||||
break;
|
||||
}
|
||||
WindDAO windDAO = createWindDAO(wind, windTrack);
|
||||
WindDTO windDAO = createWindDAO(wind, windTrack);
|
||||
windTrackInfoDAO.windFixes.add(windDAO);
|
||||
}
|
||||
windTrackInfoDAOs.put(windSource, windTrackInfoDAO);
|
||||
@@ -545,14 +545,14 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
return result;
|
||||
}
|
||||
|
||||
protected WindDAO createWindDAO(Wind wind, WindTrack windTrack) {
|
||||
WindDAO windDAO = new WindDAO();
|
||||
protected WindDTO createWindDAO(Wind wind, WindTrack windTrack) {
|
||||
WindDTO windDAO = new WindDTO();
|
||||
windDAO.trueWindBearingDeg = wind.getBearing().getDegrees();
|
||||
windDAO.trueWindFromDeg = wind.getBearing().reverse().getDegrees();
|
||||
windDAO.trueWindSpeedInKnots = wind.getKnots();
|
||||
windDAO.trueWindSpeedInMetersPerSecond = wind.getMetersPerSecond();
|
||||
if (wind.getPosition() != null) {
|
||||
windDAO.position = new PositionDAO(wind.getPosition().getLatDeg(), wind.getPosition()
|
||||
windDAO.position = new PositionDTO(wind.getPosition().getLatDeg(), wind.getPosition()
|
||||
.getLngDeg());
|
||||
}
|
||||
if (wind.getTimePoint() != null) {
|
||||
@@ -570,23 +570,23 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
}
|
||||
|
||||
@Override
|
||||
public WindInfoForRaceDAO getWindInfo(RaceIdentifier raceIdentifier, Date from, long millisecondsStepWidth,
|
||||
public WindInfoForRaceDTO getWindInfo(RaceIdentifier raceIdentifier, Date from, long millisecondsStepWidth,
|
||||
int numberOfFixes, double latDeg, double lngDeg, Collection<String> windSources)
|
||||
throws NoWindException {
|
||||
Position position = new DegreePosition(latDeg, lngDeg);
|
||||
WindInfoForRaceDAO result = null;
|
||||
WindInfoForRaceDTO result = null;
|
||||
TrackedRace trackedRace = getExistingTrackedRace(raceIdentifier);
|
||||
if (trackedRace != null) {
|
||||
result = new WindInfoForRaceDAO();
|
||||
result = new WindInfoForRaceDTO();
|
||||
result.raceIsKnownToStartUpwind = trackedRace.raceIsKnownToStartUpwind();
|
||||
result.selectedWindSource = trackedRace.getWindSource();
|
||||
Map<WindSource, WindTrackInfoDAO> windTrackInfoDAOs = new HashMap<WindSource, WindTrackInfoDAO>();
|
||||
Map<WindSource, WindTrackInfoDTO> windTrackInfoDAOs = new HashMap<WindSource, WindTrackInfoDTO>();
|
||||
result.windTrackInfoByWindSource = windTrackInfoDAOs;
|
||||
for (WindSource windSource : WindSource.values()) {
|
||||
if (windSources == null || windSources.contains(windSource.name())) {
|
||||
TimePoint fromTimePoint = new MillisecondsTimePoint(from);
|
||||
WindTrackInfoDAO windTrackInfoDAO = new WindTrackInfoDAO();
|
||||
windTrackInfoDAO.windFixes = new ArrayList<WindDAO>();
|
||||
WindTrackInfoDTO windTrackInfoDAO = new WindTrackInfoDTO();
|
||||
windTrackInfoDAO.windFixes = new ArrayList<WindDTO>();
|
||||
WindTrack windTrack = trackedRace.getWindTrack(windSource);
|
||||
windTrackInfoDAOs.put(windSource, windTrackInfoDAO);
|
||||
windTrackInfoDAO.dampeningIntervalInMilliseconds = windTrack
|
||||
@@ -595,7 +595,7 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
for (int i = 0; i < numberOfFixes; i++) {
|
||||
Wind wind = windTrack.getEstimatedWind(position, timePoint);
|
||||
if (wind != null) {
|
||||
WindDAO windDAO = createWindDAO(wind, windTrack);
|
||||
WindDTO windDAO = createWindDAO(wind, windTrack);
|
||||
windTrackInfoDAO.windFixes.add(windDAO);
|
||||
}
|
||||
timePoint = new MillisecondsTimePoint(timePoint.asMillis() + millisecondsStepWidth);
|
||||
@@ -607,7 +607,7 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWind(RaceIdentifier raceIdentifier, WindDAO windDAO) {
|
||||
public void setWind(RaceIdentifier raceIdentifier, WindDTO windDAO) {
|
||||
DynamicTrackedRace trackedRace = (DynamicTrackedRace) getExistingTrackedRace(raceIdentifier);
|
||||
if (trackedRace != null) {
|
||||
Position p = null;
|
||||
@@ -654,16 +654,16 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<CompetitorDAO, List<GPSFixDAO>> getBoatPositions(RaceIdentifier raceIdentifier,
|
||||
Map<CompetitorDAO, Date> from, Map<CompetitorDAO, Date> to,
|
||||
public Map<CompetitorDTO, List<GPSFixDTO>> getBoatPositions(RaceIdentifier raceIdentifier,
|
||||
Map<CompetitorDTO, Date> from, Map<CompetitorDTO, Date> to,
|
||||
boolean extrapolate) throws NoWindException {
|
||||
Map<CompetitorDAO, List<GPSFixDAO>> result = new HashMap<CompetitorDAO, List<GPSFixDAO>>();
|
||||
Map<CompetitorDTO, List<GPSFixDTO>> result = new HashMap<CompetitorDTO, List<GPSFixDTO>>();
|
||||
TrackedRace trackedRace = getExistingTrackedRace(raceIdentifier);
|
||||
if (trackedRace != null) {
|
||||
for (Competitor competitor : trackedRace.getRace().getCompetitors()) {
|
||||
CompetitorDAO competitorDAO = getCompetitorDAO(competitor);
|
||||
CompetitorDTO competitorDAO = getCompetitorDAO(competitor);
|
||||
if (from.containsKey(competitorDAO)) {
|
||||
List<GPSFixDAO> fixesForCompetitor = new ArrayList<GPSFixDAO>();
|
||||
List<GPSFixDTO> fixesForCompetitor = new ArrayList<GPSFixDTO>();
|
||||
result.put(competitorDAO, fixesForCompetitor);
|
||||
GPSFixTrack<Competitor, GPSFixMoving> track = trackedRace.getTrack(competitor);
|
||||
TimePoint fromTimePoint = new MillisecondsTimePoint(from.get(competitorDAO));
|
||||
@@ -691,7 +691,7 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
fix.getTimePoint());
|
||||
LegType legType = trackedLegOfCompetitor == null ? null : trackedRace.getTrackedLeg(
|
||||
trackedLegOfCompetitor.getLeg()).getLegType(fix.getTimePoint());
|
||||
GPSFixDAO fixDAO = createGPSFixDAO(fix, fix.getSpeed(), tack, legType, /* extrapolate */
|
||||
GPSFixDTO fixDAO = createGPSFixDAO(fix, fix.getSpeed(), tack, legType, /* extrapolate */
|
||||
false);
|
||||
fixesForCompetitor.add(fixDAO);
|
||||
if (fixIter.hasNext()) {
|
||||
@@ -705,7 +705,7 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
.getTrackedLeg(trackedLegOfCompetitor.getLeg()).getLegType(
|
||||
fix.getTimePoint());
|
||||
SpeedWithBearing speedWithBearing = track.getEstimatedSpeed(toTimePointExcluding);
|
||||
GPSFixDAO extrapolated = new GPSFixDAO(to.get(competitorDAO), new PositionDAO(
|
||||
GPSFixDTO extrapolated = new GPSFixDTO(to.get(competitorDAO), new PositionDTO(
|
||||
position.getLatDeg(), position.getLngDeg()),
|
||||
createSpeedWithBearingDAO(speedWithBearing), tack2, /* extrapolated */
|
||||
legType2, true);
|
||||
@@ -721,20 +721,20 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
return result;
|
||||
}
|
||||
|
||||
private SpeedWithBearingDAO createSpeedWithBearingDAO(SpeedWithBearing speedWithBearing) {
|
||||
return new SpeedWithBearingDAO(speedWithBearing.getKnots(), speedWithBearing
|
||||
private SpeedWithBearingDTO createSpeedWithBearingDAO(SpeedWithBearing speedWithBearing) {
|
||||
return new SpeedWithBearingDTO(speedWithBearing.getKnots(), speedWithBearing
|
||||
.getBearing().getDegrees());
|
||||
}
|
||||
|
||||
private GPSFixDAO createGPSFixDAO(GPSFix fix, SpeedWithBearing speedWithBearing, Tack tack, LegType legType, boolean extrapolated) {
|
||||
return new GPSFixDAO(fix.getTimePoint().asDate(), new PositionDAO(fix
|
||||
private GPSFixDTO createGPSFixDAO(GPSFix fix, SpeedWithBearing speedWithBearing, Tack tack, LegType legType, boolean extrapolated) {
|
||||
return new GPSFixDTO(fix.getTimePoint().asDate(), new PositionDTO(fix
|
||||
.getPosition().getLatDeg(), fix.getPosition().getLngDeg()),
|
||||
createSpeedWithBearingDAO(speedWithBearing), tack, legType, extrapolated);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MarkDAO> getMarkPositions(RaceIdentifier raceIdentifier, Date date) {
|
||||
List<MarkDAO> result = new ArrayList<MarkDAO>();
|
||||
public List<MarkDTO> getMarkPositions(RaceIdentifier raceIdentifier, Date date) {
|
||||
List<MarkDTO> result = new ArrayList<MarkDTO>();
|
||||
if (date != null) {
|
||||
TimePoint dateAsTimePoint = new MillisecondsTimePoint(date);
|
||||
TrackedRace trackedRace = getExistingTrackedRace(raceIdentifier);
|
||||
@@ -749,7 +749,7 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
GPSFixTrack<Buoy, GPSFix> track = trackedRace.getOrCreateTrack(buoy);
|
||||
Position positionAtDate = track.getEstimatedPosition(dateAsTimePoint, /* extrapolate */false);
|
||||
if (positionAtDate != null) {
|
||||
MarkDAO markDAO = new MarkDAO(buoy.getName(), positionAtDate.getLatDeg(),
|
||||
MarkDTO markDAO = new MarkDTO(buoy.getName(), positionAtDate.getLatDeg(),
|
||||
positionAtDate.getLngDeg());
|
||||
result.add(markDAO);
|
||||
}
|
||||
@@ -760,8 +760,8 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QuickRankDAO> getQuickRanks(RaceIdentifier raceIdentifier, Date date) throws NoWindException {
|
||||
List<QuickRankDAO> result = new ArrayList<QuickRankDAO>();
|
||||
public List<QuickRankDTO> getQuickRanks(RaceIdentifier raceIdentifier, Date date) throws NoWindException {
|
||||
List<QuickRankDTO> result = new ArrayList<QuickRankDTO>();
|
||||
if (date != null) {
|
||||
TimePoint dateAsTimePoint = new MillisecondsTimePoint(date);
|
||||
TrackedRace trackedRace = getExistingTrackedRace(raceIdentifier);
|
||||
@@ -772,13 +772,13 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
TrackedLegOfCompetitor trackedLeg = trackedRace.getTrackedLeg(competitor, dateAsTimePoint);
|
||||
if (trackedLeg != null) {
|
||||
int legNumber = race.getCourse().getLegs().indexOf(trackedLeg.getLeg());
|
||||
QuickRankDAO quickRankDAO = new QuickRankDAO(getCompetitorDAO(competitor), rank, legNumber);
|
||||
QuickRankDTO quickRankDAO = new QuickRankDTO(getCompetitorDAO(competitor), rank, legNumber);
|
||||
result.add(quickRankDAO);
|
||||
}
|
||||
}
|
||||
Collections.sort(result, new Comparator<QuickRankDAO>() {
|
||||
Collections.sort(result, new Comparator<QuickRankDTO>() {
|
||||
@Override
|
||||
public int compare(QuickRankDAO o1, QuickRankDAO o2) {
|
||||
public int compare(QuickRankDTO o1, QuickRankDTO o2) {
|
||||
return o1.rank - o2.rank;
|
||||
}
|
||||
});
|
||||
@@ -788,7 +788,7 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeWind(RaceIdentifier raceIdentifier, WindDAO windDAO) {
|
||||
public void removeWind(RaceIdentifier raceIdentifier, WindDTO windDAO) {
|
||||
TrackedRace trackedRace = getExistingTrackedRace(raceIdentifier);
|
||||
if (trackedRace != null) {
|
||||
Position p = null;
|
||||
@@ -839,16 +839,16 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
}
|
||||
|
||||
@Override
|
||||
public LeaderboardDAO createLeaderboard(String leaderboardName, int[] discardThresholds) {
|
||||
public LeaderboardDTO createLeaderboard(String leaderboardName, int[] discardThresholds) {
|
||||
return createStrippedLeaderboardDAO(getService().addLeaderboard(leaderboardName, discardThresholds));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LeaderboardDAO> getLeaderboards() {
|
||||
public List<LeaderboardDTO> getLeaderboards() {
|
||||
Map<String, Leaderboard> leaderboards = getService().getLeaderboards();
|
||||
List<LeaderboardDAO> results = new ArrayList<LeaderboardDAO>();
|
||||
List<LeaderboardDTO> results = new ArrayList<LeaderboardDTO>();
|
||||
for(Leaderboard leaderboard: leaderboards.values()) {
|
||||
LeaderboardDAO dao = createStrippedLeaderboardDAO(leaderboard);
|
||||
LeaderboardDTO dao = createStrippedLeaderboardDAO(leaderboard);
|
||||
results.add(dao);
|
||||
}
|
||||
|
||||
@@ -856,15 +856,15 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LeaderboardDAO> getLeaderboardsByEvent(EventIdentifier eventIdentifier) {
|
||||
public List<LeaderboardDTO> getLeaderboardsByEvent(EventIdentifier eventIdentifier) {
|
||||
Event event = getEvent(eventIdentifier);
|
||||
Map<String, Leaderboard> leaderboards = getService().getLeaderboards();
|
||||
List<LeaderboardDAO> results = new ArrayList<LeaderboardDAO>();
|
||||
List<LeaderboardDTO> results = new ArrayList<LeaderboardDTO>();
|
||||
|
||||
for (Leaderboard leaderboard : leaderboards.values()) {
|
||||
for (RaceInLeaderboard race : leaderboard.getRaceColumns()) {
|
||||
if (Util.contains(event.getAllRaces(), race.getTrackedRace().getRace())) {
|
||||
LeaderboardDAO dao = createStrippedLeaderboardDAO(leaderboard);
|
||||
LeaderboardDTO dao = createStrippedLeaderboardDAO(leaderboard);
|
||||
results.add(dao);
|
||||
}
|
||||
}
|
||||
@@ -874,16 +874,16 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link LeaderboardDAO} for <code>leaderboard</code> and fills in the name, race master data
|
||||
* in the form of {@link RaceInLeaderboardDAO}s, whether or not there are {@link LeaderboardDAO#hasCarriedPoints carried points}
|
||||
* and the {@link LeaderboardDAO#discardThresholds discarding thresholds} for the leaderboard. No data about the points
|
||||
* Creates a {@link LeaderboardDTO} for <code>leaderboard</code> and fills in the name, race master data
|
||||
* in the form of {@link RaceInLeaderboardDTO}s, whether or not there are {@link LeaderboardDTO#hasCarriedPoints carried points}
|
||||
* and the {@link LeaderboardDTO#discardThresholds discarding thresholds} for the leaderboard. No data about the points
|
||||
* is filled into the result object. No data about the competitor display names is filled in; instead, an empty map
|
||||
* is used for {@link LeaderboardDAO#competitorDisplayNames}.
|
||||
* is used for {@link LeaderboardDTO#competitorDisplayNames}.
|
||||
*/
|
||||
private LeaderboardDAO createStrippedLeaderboardDAO(Leaderboard leaderboard) {
|
||||
LeaderboardDAO dao = new LeaderboardDAO();
|
||||
private LeaderboardDTO createStrippedLeaderboardDAO(Leaderboard leaderboard) {
|
||||
LeaderboardDTO dao = new LeaderboardDTO();
|
||||
dao.name = leaderboard.getName();
|
||||
dao.competitorDisplayNames = new HashMap<CompetitorDAO, String>();
|
||||
dao.competitorDisplayNames = new HashMap<CompetitorDTO, String>();
|
||||
for (RaceInLeaderboard raceColumn : leaderboard.getRaceColumns()) {
|
||||
dao.addRace(raceColumn.getName(), raceColumn.isMedalRace(), raceColumn.getTrackedRace() != null);
|
||||
}
|
||||
@@ -1124,21 +1124,21 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SwissTimingConfigurationDAO> getPreviousSwissTimingConfigurations() {
|
||||
public List<SwissTimingConfigurationDTO> getPreviousSwissTimingConfigurations() {
|
||||
Iterable<SwissTimingConfiguration> configs = swissTimingAdapterPersistence.getSwissTimingConfigurations();
|
||||
List<SwissTimingConfigurationDAO> result = new ArrayList<SwissTimingConfigurationDAO>();
|
||||
List<SwissTimingConfigurationDTO> result = new ArrayList<SwissTimingConfigurationDTO>();
|
||||
for (SwissTimingConfiguration stConfig : configs) {
|
||||
result.add(new SwissTimingConfigurationDAO(stConfig.getName(), stConfig.getHostname(), stConfig.getPort(), stConfig.canSendRequests()));
|
||||
result.add(new SwissTimingConfigurationDTO(stConfig.getName(), stConfig.getHostname(), stConfig.getPort(), stConfig.canSendRequests()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SwissTimingRaceRecordDAO> listSwissTimingRaces(String hostname, int port, boolean canSendRequests)
|
||||
public List<SwissTimingRaceRecordDTO> listSwissTimingRaces(String hostname, int port, boolean canSendRequests)
|
||||
throws UnknownHostException, IOException, InterruptedException, ParseException {
|
||||
List<SwissTimingRaceRecordDAO> result = new ArrayList<SwissTimingRaceRecordDAO>();
|
||||
List<SwissTimingRaceRecordDTO> result = new ArrayList<SwissTimingRaceRecordDTO>();
|
||||
for (com.sap.sailing.domain.swisstimingadapter.RaceRecord rr : getService().getSwissTimingRaceRecords(hostname, port, canSendRequests)) {
|
||||
result.add(new SwissTimingRaceRecordDAO(rr.getRaceID(), rr.getDescription(), rr.getStartTime()));
|
||||
result.add(new SwissTimingRaceRecordDTO(rr.getRaceID(), rr.getDescription(), rr.getStartTime()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -1149,7 +1149,7 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
}
|
||||
|
||||
@Override
|
||||
public void trackWithSwissTiming(SwissTimingRaceRecordDAO rr, String hostname, int port, boolean canSendRequests,
|
||||
public void trackWithSwissTiming(SwissTimingRaceRecordDTO rr, String hostname, int port, boolean canSendRequests,
|
||||
boolean trackWind, final boolean correctWindByDeclination) throws Exception {
|
||||
final RacesHandle raceHandle = getService().addSwissTimingRace(rr.ID, hostname, port, canSendRequests,
|
||||
MongoWindStoreFactory.INSTANCE.getMongoWindStore(mongoObjectFactory, domainObjectFactory),
|
||||
@@ -1185,14 +1185,14 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompetitorInRaceDAO getCompetitorRaceData(RaceIdentifier race,
|
||||
CompetitorsAndTimePointsDAO competitorAndTimePointsDAO, DetailType dataType) throws NoWindException {
|
||||
CompetitorInRaceDAO competitorData = new CompetitorInRaceDAO();
|
||||
public CompetitorInRaceDTO getCompetitorRaceData(RaceIdentifier race,
|
||||
CompetitorsAndTimePointsDTO competitorAndTimePointsDAO, DetailType dataType) throws NoWindException {
|
||||
CompetitorInRaceDTO competitorData = new CompetitorInRaceDTO();
|
||||
TrackedRace trackedRace = getExistingTrackedRace(race);
|
||||
if (trackedRace != null) {
|
||||
Iterable<Competitor> competitors = trackedRace.getRace().getCompetitors();
|
||||
List<Competitor> selectedCompetitor = new ArrayList<Competitor>();
|
||||
for (CompetitorDAO cDAO : competitorAndTimePointsDAO.getCompetitor()) {
|
||||
for (CompetitorDTO cDAO : competitorAndTimePointsDAO.getCompetitor()) {
|
||||
for (Competitor c : competitors) {
|
||||
if (c.getId().toString().equals(cDAO.id)) {
|
||||
selectedCompetitor.add(c);
|
||||
@@ -1213,7 +1213,7 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
entries[i] = (speedOverGround == null) ? null : speedOverGround.getKnots();
|
||||
}
|
||||
}
|
||||
CompetitorDAO competitor = competitorAndTimePointsDAO.getCompetitor()[c];
|
||||
CompetitorDTO competitor = competitorAndTimePointsDAO.getCompetitor()[c];
|
||||
competitorData.setRaceData(competitor, entries);
|
||||
entries = new Double[competitorAndTimePointsDAO.getMarkPassings(competitor).length];
|
||||
for (int i = 0; i < competitorAndTimePointsDAO.getMarkPassings(competitor).length; i++) {
|
||||
@@ -1241,7 +1241,7 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
}
|
||||
}
|
||||
competitorData.setRaceData(competitorAndTimePointsDAO.getCompetitor()[c], entries);
|
||||
CompetitorDAO competitor = competitorAndTimePointsDAO.getCompetitor()[c];
|
||||
CompetitorDTO competitor = competitorAndTimePointsDAO.getCompetitor()[c];
|
||||
entries = new Double[competitorAndTimePointsDAO.getMarkPassings(competitor).length];
|
||||
for (int i = 0; i < competitorAndTimePointsDAO.getMarkPassings(competitor).length; i++) {
|
||||
MillisecondsTimePoint time = new MillisecondsTimePoint(
|
||||
@@ -1277,7 +1277,7 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
}
|
||||
}
|
||||
competitorData.setRaceData(competitorAndTimePointsDAO.getCompetitor()[c], entries);
|
||||
CompetitorDAO competitor = competitorAndTimePointsDAO.getCompetitor()[c];
|
||||
CompetitorDTO competitor = competitorAndTimePointsDAO.getCompetitor()[c];
|
||||
entries = new Double[competitorAndTimePointsDAO.getMarkPassings(competitor).length];
|
||||
for (int i = 0; i < competitorAndTimePointsDAO.getMarkPassings(competitor).length; i++) {
|
||||
MillisecondsTimePoint time = new MillisecondsTimePoint(
|
||||
@@ -1310,7 +1310,7 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
}
|
||||
}
|
||||
competitorData.setRaceData(competitorAndTimePointsDAO.getCompetitor()[c], entries);
|
||||
CompetitorDAO competitor = competitorAndTimePointsDAO.getCompetitor()[c];
|
||||
CompetitorDTO competitor = competitorAndTimePointsDAO.getCompetitor()[c];
|
||||
entries = new Double[competitorAndTimePointsDAO.getMarkPassings(competitor).length];
|
||||
for (int i = 0; i < competitorAndTimePointsDAO.getMarkPassings(competitor).length; i++) {
|
||||
MillisecondsTimePoint time = new MillisecondsTimePoint(
|
||||
@@ -1325,7 +1325,7 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
break;
|
||||
case WINDWARD_DISTANCE_TO_OVERALL_LEADER:
|
||||
for (int c = 0; c < selectedCompetitor.size(); c++) {
|
||||
CompetitorDAO competitor = competitorAndTimePointsDAO.getCompetitor()[c];
|
||||
CompetitorDTO competitor = competitorAndTimePointsDAO.getCompetitor()[c];
|
||||
Double[] entries = new Double[competitorAndTimePointsDAO.getTimePoints().length];
|
||||
Double[] markEntries = new Double[competitorAndTimePointsDAO.getMarkPassings(competitor).length];
|
||||
MillisecondsTimePoint markTime = new MillisecondsTimePoint(
|
||||
@@ -1364,15 +1364,15 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<CompetitorDAO, List<GPSFixDAO>> getDouglasPoints(RaceIdentifier raceIdentifier,
|
||||
Map<CompetitorDAO, Date> from, Map<CompetitorDAO, Date> to,
|
||||
public Map<CompetitorDTO, List<GPSFixDTO>> getDouglasPoints(RaceIdentifier raceIdentifier,
|
||||
Map<CompetitorDTO, Date> from, Map<CompetitorDTO, Date> to,
|
||||
double meters) throws NoWindException {
|
||||
Map<CompetitorDAO, List<GPSFixDAO>> result = new HashMap<CompetitorDAO, List<GPSFixDAO>>();
|
||||
Map<CompetitorDTO, List<GPSFixDTO>> result = new HashMap<CompetitorDTO, List<GPSFixDTO>>();
|
||||
TrackedRace trackedRace = getExistingTrackedRace(raceIdentifier);
|
||||
if (trackedRace != null) {
|
||||
MeterDistance maxDistance = new MeterDistance(meters);
|
||||
for (Competitor competitor : trackedRace.getRace().getCompetitors()) {
|
||||
CompetitorDAO competitorDAO = getCompetitorDAO(competitor);
|
||||
CompetitorDTO competitorDAO = getCompetitorDAO(competitor);
|
||||
if (from.containsKey(competitorDAO)) {
|
||||
// get Track of competitor
|
||||
GPSFixTrack<Competitor, GPSFixMoving> gpsFixTrack = trackedRace.getTrack(competitor);
|
||||
@@ -1381,7 +1381,7 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
TimePoint timePointTo = new MillisecondsTimePoint(to.get(competitorDAO));
|
||||
List<GPSFixMoving> gpsFixApproximation = trackedRace.approximate(competitor, maxDistance,
|
||||
timePointFrom, timePointTo);
|
||||
List<GPSFixDAO> gpsFixDouglasList = new ArrayList<GPSFixDAO>();
|
||||
List<GPSFixDTO> gpsFixDouglasList = new ArrayList<GPSFixDTO>();
|
||||
for (int i = 0; i < gpsFixApproximation.size(); i++) {
|
||||
GPSFix fix = gpsFixApproximation.get(i);
|
||||
SpeedWithBearing speedWithBearing;
|
||||
@@ -1398,7 +1398,7 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
TrackedLegOfCompetitor trackedLegOfCompetitor = trackedRace.getTrackedLeg(competitor, fix.getTimePoint());
|
||||
LegType legType = trackedLegOfCompetitor == null ? null : trackedRace.getTrackedLeg(
|
||||
trackedLegOfCompetitor.getLeg()).getLegType(fix.getTimePoint());
|
||||
GPSFixDAO fixDAO = createGPSFixDAO(fix, speedWithBearing, tack, legType, /* extrapolated */false);
|
||||
GPSFixDTO fixDAO = createGPSFixDAO(fix, speedWithBearing, tack, legType, /* extrapolated */false);
|
||||
gpsFixDouglasList.add(fixDAO);
|
||||
}
|
||||
result.put(competitorDAO, gpsFixDouglasList);
|
||||
@@ -1409,21 +1409,21 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<CompetitorDAO, List<ManeuverDAO>> getManeuvers(RaceIdentifier raceIdentifier,
|
||||
Map<CompetitorDAO, Date> from, Map<CompetitorDAO, Date> to) throws NoWindException {
|
||||
Map<CompetitorDAO, List<ManeuverDAO>> result = new HashMap<CompetitorDAO, List<ManeuverDAO>>();
|
||||
public Map<CompetitorDTO, List<ManeuverDTO>> getManeuvers(RaceIdentifier raceIdentifier,
|
||||
Map<CompetitorDTO, Date> from, Map<CompetitorDTO, Date> to) throws NoWindException {
|
||||
Map<CompetitorDTO, List<ManeuverDTO>> result = new HashMap<CompetitorDTO, List<ManeuverDTO>>();
|
||||
final TrackedRace trackedRace = getExistingTrackedRace(raceIdentifier);
|
||||
if (trackedRace != null) {
|
||||
Map<CompetitorDAO, Future<List<ManeuverDAO>>> futures = new HashMap<CompetitorDAO, Future<List<ManeuverDAO>>>();
|
||||
Map<CompetitorDTO, Future<List<ManeuverDTO>>> futures = new HashMap<CompetitorDTO, Future<List<ManeuverDTO>>>();
|
||||
for (final Competitor competitor : trackedRace.getRace().getCompetitors()) {
|
||||
CompetitorDAO competitorDAO = getCompetitorDAO(competitor);
|
||||
CompetitorDTO competitorDAO = getCompetitorDAO(competitor);
|
||||
if (from.containsKey(competitorDAO)) {
|
||||
final TimePoint timePointFrom = new MillisecondsTimePoint(from.get(competitorDAO));
|
||||
final TimePoint timePointTo = new MillisecondsTimePoint(to.get(competitorDAO));
|
||||
RunnableFuture<List<ManeuverDAO>> future = new FutureTask<List<ManeuverDAO>>(
|
||||
new Callable<List<ManeuverDAO>>() {
|
||||
RunnableFuture<List<ManeuverDTO>> future = new FutureTask<List<ManeuverDTO>>(
|
||||
new Callable<List<ManeuverDTO>>() {
|
||||
@Override
|
||||
public List<ManeuverDAO> call() {
|
||||
public List<ManeuverDTO> call() {
|
||||
List<Maneuver> maneuversForCompetitor;
|
||||
try {
|
||||
maneuversForCompetitor = trackedRace.getManeuvers(competitor, timePointFrom,
|
||||
@@ -1439,7 +1439,7 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
futures.put(competitorDAO, future);
|
||||
}
|
||||
}
|
||||
for (Map.Entry<CompetitorDAO, Future<List<ManeuverDAO>>> competitorAndFuture : futures.entrySet()) {
|
||||
for (Map.Entry<CompetitorDTO, Future<List<ManeuverDTO>>> competitorAndFuture : futures.entrySet()) {
|
||||
try {
|
||||
result.put(competitorAndFuture.getKey(), competitorAndFuture.getValue().get());
|
||||
} catch (InterruptedException e) {
|
||||
@@ -1452,11 +1452,11 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<ManeuverDAO> createManeuverDAOsForCompetitor(List<Maneuver> maneuvers, TrackedRace trackedRace, Competitor competitor) {
|
||||
List<ManeuverDAO> result = new ArrayList<ManeuverDAO>();
|
||||
private List<ManeuverDTO> createManeuverDAOsForCompetitor(List<Maneuver> maneuvers, TrackedRace trackedRace, Competitor competitor) {
|
||||
List<ManeuverDTO> result = new ArrayList<ManeuverDTO>();
|
||||
for (Maneuver maneuver : maneuvers) {
|
||||
ManeuverDAO maneuverDAO = new ManeuverDAO(maneuver.getType(), maneuver.getNewTack(),
|
||||
new PositionDAO(maneuver.getPosition().getLatDeg(), maneuver.getPosition().getLngDeg()),
|
||||
ManeuverDTO maneuverDAO = new ManeuverDTO(maneuver.getType(), maneuver.getNewTack(),
|
||||
new PositionDTO(maneuver.getPosition().getLatDeg(), maneuver.getPosition().getLngDeg()),
|
||||
maneuver.getTimePoint().asDate(),
|
||||
createSpeedWithBearingDAO(maneuver.getSpeedWithBearingBefore()),
|
||||
createSpeedWithBearingDAO(maneuver.getSpeedWithBearingAfter()),
|
||||
@@ -1542,11 +1542,11 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public CompetitorsAndTimePointsDAO getCompetitorsAndTimePoints(RaceIdentifier race, int steps) {
|
||||
CompetitorsAndTimePointsDAO competitorAndTimePointsDAO = new CompetitorsAndTimePointsDAO(steps);
|
||||
public CompetitorsAndTimePointsDTO getCompetitorsAndTimePoints(RaceIdentifier race, int steps) {
|
||||
CompetitorsAndTimePointsDTO competitorAndTimePointsDAO = new CompetitorsAndTimePointsDTO(steps);
|
||||
TrackedRace trackedRace = getExistingTrackedRace(race);
|
||||
if (trackedRace != null) {
|
||||
List<CompetitorDAO> competitors = new ArrayList<CompetitorDAO>();
|
||||
List<CompetitorDTO> competitors = new ArrayList<CompetitorDTO>();
|
||||
for (Competitor competitor : trackedRace.getRace().getCompetitors()) {
|
||||
NavigableSet<MarkPassing> markPassings = trackedRace.getMarkPassings(competitor);
|
||||
List<Pair<String, Long>> markPassingTimes = new ArrayList<Pair<String, Long>>();
|
||||
@@ -1560,7 +1560,7 @@ public class SailingServiceImpl extends RemoteServiceServlet implements SailingS
|
||||
competitorAndTimePointsDAO.setMarkPassings(getCompetitorDAO(competitor),
|
||||
markPassingTimes.toArray(new Pair[0]));
|
||||
}
|
||||
competitorAndTimePointsDAO.setCompetitor(competitors.toArray(new CompetitorDAO[0]));
|
||||
competitorAndTimePointsDAO.setCompetitor(competitors.toArray(new CompetitorDTO[0]));
|
||||
competitorAndTimePointsDAO.setStartTime(trackedRace.getStart().asMillis());
|
||||
competitorAndTimePointsDAO.setTimePointOfNewestEvent(trackedRace.getTimePointOfNewestEvent().asMillis());
|
||||
}
|
||||
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
package com.sap.sailing.gwt.ui.shared;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class BoatClassDAO extends NamedDAO implements IsSerializable {
|
||||
public BoatClassDAO() {}
|
||||
|
||||
public BoatClassDAO(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
package com.sap.sailing.gwt.ui.shared;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class BoatClassDTO extends NamedDTO implements IsSerializable {
|
||||
public BoatClassDTO() {}
|
||||
|
||||
public BoatClassDTO(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
}
|
||||
+4
-4
@@ -2,16 +2,16 @@ package com.sap.sailing.gwt.ui.shared;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class CompetitorDAO extends NamedDAO implements IsSerializable {
|
||||
public class CompetitorDTO extends NamedDTO implements IsSerializable {
|
||||
public String twoLetterIsoCountryCode;
|
||||
public String threeLetterIocCountryCode;
|
||||
public String countryName;
|
||||
public String sailID;
|
||||
public String id;
|
||||
|
||||
public CompetitorDAO() {}
|
||||
public CompetitorDTO() {}
|
||||
|
||||
public CompetitorDAO(String name, String twoLetterIsoCountryCode, String threeLetterIocCountryCode, String countryName, String sailID, String id) {
|
||||
public CompetitorDTO(String name, String twoLetterIsoCountryCode, String threeLetterIocCountryCode, String countryName, String sailID, String id) {
|
||||
super(name);
|
||||
this.twoLetterIsoCountryCode = twoLetterIsoCountryCode;
|
||||
this.threeLetterIocCountryCode = threeLetterIocCountryCode;
|
||||
@@ -36,7 +36,7 @@ public class CompetitorDAO extends NamedDAO implements IsSerializable {
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
CompetitorDAO other = (CompetitorDAO) obj;
|
||||
CompetitorDTO other = (CompetitorDTO) obj;
|
||||
if (id == null) {
|
||||
if (other.id != null)
|
||||
return false;
|
||||
-30
@@ -1,30 +0,0 @@
|
||||
package com.sap.sailing.gwt.ui.shared;
|
||||
|
||||
import java.util.HashMap;
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class CompetitorInRaceDAO implements IsSerializable {
|
||||
private HashMap<CompetitorDAO, Double[]> raceData;
|
||||
private HashMap<CompetitorDAO, Double[]> markPassings;
|
||||
|
||||
public CompetitorInRaceDAO(){
|
||||
raceData = new HashMap<CompetitorDAO, Double[]>();
|
||||
markPassings = new HashMap<CompetitorDAO, Double[]>();
|
||||
}
|
||||
|
||||
public void setRaceData(CompetitorDAO competitor, Double[] data){
|
||||
raceData.put(competitor, data);
|
||||
}
|
||||
|
||||
public void setMarkPassingData(CompetitorDAO competitor, Double[] data){
|
||||
markPassings.put(competitor, data);
|
||||
}
|
||||
|
||||
public Double[] getRaceData(CompetitorDAO competitor){
|
||||
return raceData.get(competitor);
|
||||
}
|
||||
|
||||
public Double[] getMarkPassings(CompetitorDAO competitor){
|
||||
return markPassings.get(competitor);
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.sap.sailing.gwt.ui.shared;
|
||||
|
||||
import java.util.HashMap;
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class CompetitorInRaceDTO implements IsSerializable {
|
||||
private HashMap<CompetitorDTO, Double[]> raceData;
|
||||
private HashMap<CompetitorDTO, Double[]> markPassings;
|
||||
|
||||
public CompetitorInRaceDTO(){
|
||||
raceData = new HashMap<CompetitorDTO, Double[]>();
|
||||
markPassings = new HashMap<CompetitorDTO, Double[]>();
|
||||
}
|
||||
|
||||
public void setRaceData(CompetitorDTO competitor, Double[] data){
|
||||
raceData.put(competitor, data);
|
||||
}
|
||||
|
||||
public void setMarkPassingData(CompetitorDTO competitor, Double[] data){
|
||||
markPassings.put(competitor, data);
|
||||
}
|
||||
|
||||
public Double[] getRaceData(CompetitorDTO competitor){
|
||||
return raceData.get(competitor);
|
||||
}
|
||||
|
||||
public Double[] getMarkPassings(CompetitorDTO competitor){
|
||||
return markPassings.get(competitor);
|
||||
}
|
||||
}
|
||||
+8
-8
@@ -5,18 +5,18 @@ import java.util.HashMap;
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
import com.sap.sailing.domain.common.impl.Util.Pair;
|
||||
|
||||
public class CompetitorsAndTimePointsDAO implements IsSerializable {
|
||||
public class CompetitorsAndTimePointsDTO implements IsSerializable {
|
||||
private static final long MILLISECONDS_BEFORE_RACE_TO_INCLUDE = 20000;
|
||||
|
||||
private CompetitorDAO[] competitors;
|
||||
private CompetitorDTO[] competitors;
|
||||
private HashMap<String, Pair<String, Long>[]> markPassings;
|
||||
private long startTime;
|
||||
private long timePointOfNewestEvent;
|
||||
private int steps;
|
||||
|
||||
CompetitorsAndTimePointsDAO() {}
|
||||
CompetitorsAndTimePointsDTO() {}
|
||||
|
||||
public CompetitorsAndTimePointsDAO(int steps) {
|
||||
public CompetitorsAndTimePointsDTO(int steps) {
|
||||
markPassings = new HashMap<String, Pair<String, Long>[]>();
|
||||
this.steps = steps;
|
||||
}
|
||||
@@ -31,11 +31,11 @@ public class CompetitorsAndTimePointsDAO implements IsSerializable {
|
||||
return result;
|
||||
}
|
||||
|
||||
public CompetitorDAO[] getCompetitor() {
|
||||
public CompetitorDTO[] getCompetitor() {
|
||||
return competitors;
|
||||
}
|
||||
|
||||
public void setCompetitor(CompetitorDAO[] competitors) {
|
||||
public void setCompetitor(CompetitorDTO[] competitors) {
|
||||
this.competitors = competitors;
|
||||
}
|
||||
|
||||
@@ -47,11 +47,11 @@ public class CompetitorsAndTimePointsDAO implements IsSerializable {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public Pair<String, Long>[] getMarkPassings(CompetitorDAO competitor) {
|
||||
public Pair<String, Long>[] getMarkPassings(CompetitorDTO competitor) {
|
||||
return markPassings.get(competitor.id);
|
||||
}
|
||||
|
||||
public void setMarkPassings(CompetitorDAO competitor, Pair<String, Long>[] markPassings) {
|
||||
public void setMarkPassings(CompetitorDTO competitor, Pair<String, Long>[] markPassings) {
|
||||
this.markPassings.put(competitor.id, markPassings);
|
||||
}
|
||||
|
||||
+8
-8
@@ -6,16 +6,16 @@ import java.util.List;
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
import com.sap.sailing.domain.common.RacePlaceOrder;
|
||||
|
||||
public class EventDAO extends NamedDAO implements IsSerializable {
|
||||
public List<RegattaDAO> regattas;
|
||||
public List<CompetitorDAO> competitors;
|
||||
public class EventDTO extends NamedDTO implements IsSerializable {
|
||||
public List<RegattaDTO> regattas;
|
||||
public List<CompetitorDTO> competitors;
|
||||
|
||||
public String locations;
|
||||
|
||||
public EventDAO() {
|
||||
public EventDTO() {
|
||||
}
|
||||
|
||||
public EventDAO(String name, List<RegattaDAO> regattas, List<CompetitorDAO> competitors) {
|
||||
public EventDTO(String name, List<RegattaDTO> regattas, List<CompetitorDTO> competitors) {
|
||||
super(name);
|
||||
this.name = name;
|
||||
this.regattas = regattas;
|
||||
@@ -29,8 +29,8 @@ public class EventDAO extends NamedDAO implements IsSerializable {
|
||||
boolean first = true;
|
||||
RacePlaceOrder previousOrder = null;
|
||||
locations = "";
|
||||
for (RegattaDAO regattaDAO : regattas) {
|
||||
for (RaceDAO raceDAO : regattaDAO.races) {
|
||||
for (RegattaDTO regattaDAO : regattas) {
|
||||
for (RaceDTO raceDAO : regattaDAO.races) {
|
||||
RacePlaceOrder order = raceDAO.racePlaces;
|
||||
if (order != null) {
|
||||
if (first) {
|
||||
@@ -52,7 +52,7 @@ public class EventDAO extends NamedDAO implements IsSerializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The start date of the first {@link RaceDAO Race} in the first {@link RegattaDAO Regatta}, or
|
||||
* @return The start date of the first {@link RaceDTO Race} in the first {@link RegattaDTO Regatta}, or
|
||||
* <code>null</code> if the start date isn't set
|
||||
*/
|
||||
public Date getStartDate() {
|
||||
+5
-5
@@ -6,10 +6,10 @@ import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
import com.sap.sailing.domain.common.LegType;
|
||||
import com.sap.sailing.domain.common.Tack;
|
||||
|
||||
public class GPSFixDAO implements IsSerializable {
|
||||
public class GPSFixDTO implements IsSerializable {
|
||||
public Date timepoint;
|
||||
public PositionDAO position;
|
||||
public SpeedWithBearingDAO speedWithBearing;
|
||||
public PositionDTO position;
|
||||
public SpeedWithBearingDTO speedWithBearing;
|
||||
|
||||
/**
|
||||
* tells if this fix was computed by extrapolation instead of having been captured by a device directly
|
||||
@@ -29,9 +29,9 @@ public class GPSFixDAO implements IsSerializable {
|
||||
*/
|
||||
public LegType legType;
|
||||
|
||||
public GPSFixDAO() {}
|
||||
public GPSFixDTO() {}
|
||||
|
||||
public GPSFixDAO(Date timepoint, PositionDAO position, SpeedWithBearingDAO speedWithBearing, Tack tack,
|
||||
public GPSFixDTO(Date timepoint, PositionDTO position, SpeedWithBearingDTO speedWithBearing, Tack tack,
|
||||
LegType legType, boolean extrapolated) {
|
||||
super();
|
||||
this.timepoint = timepoint;
|
||||
+49
-49
@@ -16,12 +16,12 @@ import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
* @author Axel Uhl (d043530)
|
||||
*
|
||||
*/
|
||||
public class LeaderboardDAO implements IsSerializable {
|
||||
public class LeaderboardDTO implements IsSerializable {
|
||||
public String name;
|
||||
public List<CompetitorDAO> competitors;
|
||||
private List<RaceInLeaderboardDAO> races;
|
||||
public Map<CompetitorDAO, String> competitorDisplayNames;
|
||||
public Map<CompetitorDAO, LeaderboardRowDAO> rows;
|
||||
public List<CompetitorDTO> competitors;
|
||||
private List<RaceInLeaderboardDTO> races;
|
||||
public Map<CompetitorDTO, String> competitorDisplayNames;
|
||||
public Map<CompetitorDTO, LeaderboardRowDTO> rows;
|
||||
public boolean hasCarriedPoints;
|
||||
public int[] discardThresholds;
|
||||
|
||||
@@ -29,13 +29,13 @@ public class LeaderboardDAO implements IsSerializable {
|
||||
|
||||
private final transient TotalRankingComparator totalRankingComparator;
|
||||
|
||||
public LeaderboardDAO() {
|
||||
public LeaderboardDTO() {
|
||||
totalRankingComparator = new TotalRankingComparator();
|
||||
competitorsOrderedAccordingToTotalRank = false;
|
||||
races = new ArrayList<RaceInLeaderboardDAO>();
|
||||
races = new ArrayList<RaceInLeaderboardDTO>();
|
||||
}
|
||||
|
||||
public String getDisplayName(CompetitorDAO competitor) {
|
||||
public String getDisplayName(CompetitorDTO competitor) {
|
||||
if (competitorDisplayNames == null || competitorDisplayNames.get(competitor) == null) {
|
||||
return competitor.name;
|
||||
} else {
|
||||
@@ -43,21 +43,21 @@ public class LeaderboardDAO implements IsSerializable {
|
||||
}
|
||||
}
|
||||
|
||||
public Comparator<LeaderboardRowDAO> getTotalRankingComparator() {
|
||||
public Comparator<LeaderboardRowDTO> getTotalRankingComparator() {
|
||||
return totalRankingComparator;
|
||||
}
|
||||
|
||||
public Comparator<LeaderboardRowDAO> getMedalRaceComparator(String medalRaceName) {
|
||||
public Comparator<LeaderboardRowDTO> getMedalRaceComparator(String medalRaceName) {
|
||||
return new MedalRaceComparator(medalRaceName);
|
||||
}
|
||||
|
||||
/**
|
||||
* If the race whose name is specified in <code>raceName</code> has any competitor who has valid {@link LeaderboardEntryDAO#legDetails}
|
||||
* If the race whose name is specified in <code>raceName</code> has any competitor who has valid {@link LeaderboardEntryDTO#legDetails}
|
||||
* for that race, the number of entries in the leg details is returned, telling the number of legs that the race has. Otherwise,
|
||||
* -1 is returned.
|
||||
*/
|
||||
public int getLegCount(String raceName) {
|
||||
for (LeaderboardRowDAO row : rows.values()) {
|
||||
for (LeaderboardRowDTO row : rows.values()) {
|
||||
if (row.fieldsByRaceName.get(raceName) != null && row.fieldsByRaceName.get(raceName).legDetails != null) {
|
||||
return row.fieldsByRaceName.get(raceName).legDetails.size();
|
||||
}
|
||||
@@ -69,9 +69,9 @@ public class LeaderboardDAO implements IsSerializable {
|
||||
* Tells if the <code>competitor</code> scored (and therefore presumably participated) in a medal race
|
||||
* represented in this leaderboard.
|
||||
*/
|
||||
public boolean scoredInMedalRace(CompetitorDAO competitor) {
|
||||
LeaderboardRowDAO row = rows.get(competitor);
|
||||
for (RaceInLeaderboardDAO race : races) {
|
||||
public boolean scoredInMedalRace(CompetitorDTO competitor) {
|
||||
LeaderboardRowDTO row = rows.get(competitor);
|
||||
for (RaceInLeaderboardDTO race : races) {
|
||||
if (race.isMedalRace() && row.fieldsByRaceName.get(race.getRaceColumnName()).totalPoints > 0) {
|
||||
return true;
|
||||
}
|
||||
@@ -79,17 +79,17 @@ public class LeaderboardDAO implements IsSerializable {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getTotalPoints(LeaderboardRowDAO object) {
|
||||
public int getTotalPoints(LeaderboardRowDTO object) {
|
||||
int totalPoints = object.carriedPoints==null?0:object.carriedPoints;
|
||||
for (LeaderboardEntryDAO e : object.fieldsByRaceName.values()) {
|
||||
for (LeaderboardEntryDTO e : object.fieldsByRaceName.values()) {
|
||||
totalPoints += e.totalPoints;
|
||||
}
|
||||
return totalPoints;
|
||||
}
|
||||
|
||||
private class TotalRankingComparator implements Comparator<LeaderboardRowDAO> {
|
||||
private class TotalRankingComparator implements Comparator<LeaderboardRowDTO> {
|
||||
@Override
|
||||
public int compare(LeaderboardRowDAO o1, LeaderboardRowDAO o2) {
|
||||
public int compare(LeaderboardRowDTO o1, LeaderboardRowDTO o2) {
|
||||
int result;
|
||||
if (o1 == null && o2 == null) {
|
||||
result = 0;
|
||||
@@ -137,7 +137,7 @@ public class LeaderboardDAO implements IsSerializable {
|
||||
}
|
||||
}
|
||||
|
||||
private class MedalRaceComparator implements Comparator<LeaderboardRowDAO> {
|
||||
private class MedalRaceComparator implements Comparator<LeaderboardRowDTO> {
|
||||
private final String medalRaceName;
|
||||
|
||||
public MedalRaceComparator(String medalRaceName) {
|
||||
@@ -145,7 +145,7 @@ public class LeaderboardDAO implements IsSerializable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(LeaderboardRowDAO o1, LeaderboardRowDAO o2) {
|
||||
public int compare(LeaderboardRowDTO o1, LeaderboardRowDTO o2) {
|
||||
int result;
|
||||
if (scoredInMedalRace(o1.competitor)) {
|
||||
if (scoredInMedalRace(o2.competitor)) {
|
||||
@@ -181,10 +181,10 @@ public class LeaderboardDAO implements IsSerializable {
|
||||
/**
|
||||
* Sums up the net points <code>competitor</code> scored in any medal races
|
||||
*/
|
||||
private int getMedalRaceScore(CompetitorDAO competitor) {
|
||||
private int getMedalRaceScore(CompetitorDTO competitor) {
|
||||
int result = 0;
|
||||
LeaderboardRowDAO row = rows.get(competitor);
|
||||
for (RaceInLeaderboardDAO race : races) {
|
||||
LeaderboardRowDTO row = rows.get(competitor);
|
||||
for (RaceInLeaderboardDTO race : races) {
|
||||
if (race.isMedalRace() && row.fieldsByRaceName.containsKey(race.getRaceColumnName())) {
|
||||
result += row.fieldsByRaceName.get(race.getRaceColumnName()).netPoints;
|
||||
}
|
||||
@@ -192,11 +192,11 @@ public class LeaderboardDAO implements IsSerializable {
|
||||
return result;
|
||||
}
|
||||
|
||||
public int getNetPoints(CompetitorDAO competitor, String nameOfLastRaceSoFar) {
|
||||
public int getNetPoints(CompetitorDTO competitor, String nameOfLastRaceSoFar) {
|
||||
int result = 0;
|
||||
LeaderboardRowDAO row = rows.get(competitor);
|
||||
LeaderboardRowDTO row = rows.get(competitor);
|
||||
if (row != null) {
|
||||
LeaderboardEntryDAO field = row.fieldsByRaceName.get(nameOfLastRaceSoFar);
|
||||
LeaderboardEntryDTO field = row.fieldsByRaceName.get(nameOfLastRaceSoFar);
|
||||
if (field != null) {
|
||||
result = field.netPoints;
|
||||
}
|
||||
@@ -208,12 +208,12 @@ public class LeaderboardDAO implements IsSerializable {
|
||||
* Find the name of the last race in {@link #raceNamesAndMedalRaceAndTracked}'s keys for which both, <code>c1</code> and
|
||||
* <code>c2</code> have been assigned a score.
|
||||
*/
|
||||
private String getNameOfLastRaceSoFar(CompetitorDAO c1, CompetitorDAO c2) {
|
||||
private String getNameOfLastRaceSoFar(CompetitorDTO c1, CompetitorDTO c2) {
|
||||
String nameOfLastRaceSoFar = null;
|
||||
for (RaceInLeaderboardDAO race : races) {
|
||||
for (LeaderboardRowDAO row : rows.values()) {
|
||||
for (RaceInLeaderboardDTO race : races) {
|
||||
for (LeaderboardRowDTO row : rows.values()) {
|
||||
if (row.competitor.equals(c1) || row.competitor.equals(c2)) {
|
||||
LeaderboardEntryDAO leaderboardEntryDAO = row.fieldsByRaceName.get(race.getRaceColumnName());
|
||||
LeaderboardEntryDTO leaderboardEntryDAO = row.fieldsByRaceName.get(race.getRaceColumnName());
|
||||
if (leaderboardEntryDAO != null && leaderboardEntryDAO.netPoints != 0) {
|
||||
nameOfLastRaceSoFar = race.getRaceColumnName();
|
||||
break;
|
||||
@@ -224,12 +224,12 @@ public class LeaderboardDAO implements IsSerializable {
|
||||
return nameOfLastRaceSoFar;
|
||||
}
|
||||
|
||||
private int getNumberOfRacesWon(CompetitorDAO competitor) {
|
||||
private int getNumberOfRacesWon(CompetitorDTO competitor) {
|
||||
int result = 0;
|
||||
LeaderboardRowDAO row = rows.get(competitor);
|
||||
LeaderboardRowDTO row = rows.get(competitor);
|
||||
if (row != null) {
|
||||
for (RaceInLeaderboardDAO race : races) {
|
||||
LeaderboardEntryDAO field = row.fieldsByRaceName.get(race.getRaceColumnName());
|
||||
for (RaceInLeaderboardDTO race : races) {
|
||||
LeaderboardEntryDTO field = row.fieldsByRaceName.get(race.getRaceColumnName());
|
||||
if (field != null && field.netPoints == 1) {
|
||||
result++;
|
||||
}
|
||||
@@ -238,11 +238,11 @@ public class LeaderboardDAO implements IsSerializable {
|
||||
return result;
|
||||
}
|
||||
|
||||
public int getRank(CompetitorDAO competitor) {
|
||||
public int getRank(CompetitorDTO competitor) {
|
||||
if (!competitorsOrderedAccordingToTotalRank) {
|
||||
Collections.sort(competitors, new Comparator<CompetitorDAO>() {
|
||||
Collections.sort(competitors, new Comparator<CompetitorDTO>() {
|
||||
@Override
|
||||
public int compare(CompetitorDAO o1, CompetitorDAO o2) {
|
||||
public int compare(CompetitorDTO o1, CompetitorDTO o2) {
|
||||
return getTotalRankingComparator().compare(rows.get(o1), rows.get(o2));
|
||||
}
|
||||
});
|
||||
@@ -252,7 +252,7 @@ public class LeaderboardDAO implements IsSerializable {
|
||||
};
|
||||
|
||||
public boolean raceIsTracked(String raceColumnName){
|
||||
for (RaceInLeaderboardDAO race : races){
|
||||
for (RaceInLeaderboardDTO race : races){
|
||||
if (race.getRaceColumnName().equals(raceColumnName)){
|
||||
return race.isTrackedRace();
|
||||
}
|
||||
@@ -266,7 +266,7 @@ public class LeaderboardDAO implements IsSerializable {
|
||||
}
|
||||
|
||||
public void addRace(String raceColumnName, boolean medalRace, boolean trackedRace){
|
||||
RaceInLeaderboardDAO raceInLeaderboardDAO = new RaceInLeaderboardDAO();
|
||||
RaceInLeaderboardDTO raceInLeaderboardDAO = new RaceInLeaderboardDTO();
|
||||
raceInLeaderboardDAO.setRaceColumnName(raceColumnName);
|
||||
raceInLeaderboardDAO.setMedalRace(medalRace);
|
||||
raceInLeaderboardDAO.setTrackedRace(trackedRace);
|
||||
@@ -274,7 +274,7 @@ public class LeaderboardDAO implements IsSerializable {
|
||||
}
|
||||
|
||||
public void addRaceAt(String raceColumnName, boolean medalRace, boolean trackedRace, int index){
|
||||
RaceInLeaderboardDAO raceInLeaderboardDAO = new RaceInLeaderboardDAO();
|
||||
RaceInLeaderboardDTO raceInLeaderboardDAO = new RaceInLeaderboardDTO();
|
||||
raceInLeaderboardDAO.setRaceColumnName(raceColumnName);
|
||||
raceInLeaderboardDAO.setMedalRace(medalRace);
|
||||
raceInLeaderboardDAO.setTrackedRace(trackedRace);
|
||||
@@ -286,12 +286,12 @@ public class LeaderboardDAO implements IsSerializable {
|
||||
}
|
||||
|
||||
public void renameRace(String oldName, String newName){
|
||||
RaceInLeaderboardDAO race = getRaceInLeaderboardByName(oldName);
|
||||
RaceInLeaderboardDTO race = getRaceInLeaderboardByName(oldName);
|
||||
race.setRaceColumnName(newName);
|
||||
}
|
||||
|
||||
private RaceInLeaderboardDAO getRaceInLeaderboardByName(String raceColumnName) {
|
||||
for (RaceInLeaderboardDAO race : races){
|
||||
private RaceInLeaderboardDTO getRaceInLeaderboardByName(String raceColumnName) {
|
||||
for (RaceInLeaderboardDTO race : races){
|
||||
if (race.getRaceColumnName().equals(raceColumnName)){
|
||||
return race;
|
||||
}
|
||||
@@ -301,17 +301,17 @@ public class LeaderboardDAO implements IsSerializable {
|
||||
|
||||
public List<String> getRaceColumnNameList(){
|
||||
List<String> raceColumnNames = new ArrayList<String>();
|
||||
for (RaceInLeaderboardDAO raceInLeaderboardDAO : races){
|
||||
for (RaceInLeaderboardDTO raceInLeaderboardDAO : races){
|
||||
raceColumnNames.add(raceInLeaderboardDAO.getRaceColumnName());
|
||||
}
|
||||
return raceColumnNames;
|
||||
}
|
||||
|
||||
public List<RaceInLeaderboardDAO> getRaceInLeaderboardList(){
|
||||
public List<RaceInLeaderboardDTO> getRaceInLeaderboardList(){
|
||||
return races;
|
||||
}
|
||||
|
||||
public List<RaceInLeaderboardDAO> getRaceList(){
|
||||
public List<RaceInLeaderboardDTO> getRaceList(){
|
||||
return races;
|
||||
}
|
||||
|
||||
@@ -320,7 +320,7 @@ public class LeaderboardDAO implements IsSerializable {
|
||||
}
|
||||
|
||||
public void moveRaceUp(String raceColumnName) {
|
||||
RaceInLeaderboardDAO race = getRaceInLeaderboardByName(raceColumnName);
|
||||
RaceInLeaderboardDTO race = getRaceInLeaderboardByName(raceColumnName);
|
||||
int index = races.indexOf(race);
|
||||
index--;
|
||||
if (index >= 0) {
|
||||
@@ -330,7 +330,7 @@ public class LeaderboardDAO implements IsSerializable {
|
||||
}
|
||||
|
||||
public void moveRaceDown(String raceColumnName) {
|
||||
RaceInLeaderboardDAO race = getRaceInLeaderboardByName(raceColumnName);
|
||||
RaceInLeaderboardDTO race = getRaceInLeaderboardByName(raceColumnName);
|
||||
int index = races.indexOf(race);
|
||||
if (index != -1) {
|
||||
index++;
|
||||
+3
-3
@@ -6,13 +6,13 @@ import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
/**
|
||||
* Holds a single competitor's scoring details for a single race. It may optionally contain
|
||||
* a list of {@link LegEntryDAO} objects providing details about the individual legs sailed
|
||||
* a list of {@link LegEntryDTO} objects providing details about the individual legs sailed
|
||||
* during the race.
|
||||
*
|
||||
* @author Axel Uhl (D043530)
|
||||
*
|
||||
*/
|
||||
public class LeaderboardEntryDAO implements IsSerializable {
|
||||
public class LeaderboardEntryDTO implements IsSerializable {
|
||||
/**
|
||||
* Either <code>null</code> in case no max points, or one of "DNS", "DNF", "OCS", "DND", "RAF", "BFD", "DNC", or "DSQ"
|
||||
*/
|
||||
@@ -29,6 +29,6 @@ public class LeaderboardEntryDAO implements IsSerializable {
|
||||
* haven't been requested from the server yet. Otherwise, the list holds one entry per {@link Leg} of the
|
||||
* {@link Course} being sailed in the race for which this object holds the scoring details.
|
||||
*/
|
||||
public List<LegEntryDAO> legDetails;
|
||||
public List<LegEntryDTO> legDetails;
|
||||
|
||||
}
|
||||
+4
-4
@@ -5,13 +5,13 @@ import java.util.Map;
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
/**
|
||||
* Holds data about one competitor and all races represented by the owning {@link LeaderboardDAO leaderboard}.
|
||||
* Holds data about one competitor and all races represented by the owning {@link LeaderboardDTO leaderboard}.
|
||||
*
|
||||
* @author Axel Uhl (D043530)
|
||||
*
|
||||
*/
|
||||
public class LeaderboardRowDAO implements IsSerializable {
|
||||
public CompetitorDAO competitor;
|
||||
public Map<String, LeaderboardEntryDAO> fieldsByRaceName;
|
||||
public class LeaderboardRowDTO implements IsSerializable {
|
||||
public CompetitorDTO competitor;
|
||||
public Map<String, LeaderboardEntryDTO> fieldsByRaceName;
|
||||
public Integer carriedPoints;
|
||||
}
|
||||
+2
-2
@@ -3,11 +3,11 @@ package com.sap.sailing.gwt.ui.shared;
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
/**
|
||||
* Represents the changes that can be used to update a {@link LeaderboardDAO} and its displays incrementally.
|
||||
* Represents the changes that can be used to update a {@link LeaderboardDTO} and its displays incrementally.
|
||||
*
|
||||
* @author Axel Uhl (D043530)
|
||||
*
|
||||
*/
|
||||
public class LeaderboardUpdateDAO implements IsSerializable {
|
||||
public class LeaderboardUpdateDTO implements IsSerializable {
|
||||
|
||||
}
|
||||
+3
-3
@@ -4,13 +4,13 @@ import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
/**
|
||||
* Holds data about one competitor's performance in one leg of one race represented in the
|
||||
* {@link LeaderboardDAO leaderboard} in which this object is (indirectly, via a
|
||||
* {@link LeaderboardRowDAO} instance) embedded.
|
||||
* {@link LeaderboardDTO leaderboard} in which this object is (indirectly, via a
|
||||
* {@link LeaderboardRowDTO} instance) embedded.
|
||||
*
|
||||
* @author Axel Uhl (D043530)
|
||||
*
|
||||
*/
|
||||
public class LegEntryDAO implements IsSerializable {
|
||||
public class LegEntryDTO implements IsSerializable {
|
||||
public Double distanceTraveledInMeters;
|
||||
public Double averageSpeedOverGroundInKnots;
|
||||
public Integer rank;
|
||||
+7
-7
@@ -6,25 +6,25 @@ import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
import com.sap.sailing.domain.common.ManeuverType;
|
||||
import com.sap.sailing.domain.common.Tack;
|
||||
|
||||
public class ManeuverDAO implements IsSerializable {
|
||||
public class ManeuverDTO implements IsSerializable {
|
||||
public ManeuverType type;
|
||||
|
||||
public Tack newTack;
|
||||
|
||||
public PositionDAO position;
|
||||
public PositionDTO position;
|
||||
|
||||
public Date timepoint;
|
||||
|
||||
public SpeedWithBearingDAO speedWithBearingBefore;
|
||||
public SpeedWithBearingDTO speedWithBearingBefore;
|
||||
|
||||
public SpeedWithBearingDAO speedWithBearingAfter;
|
||||
public SpeedWithBearingDTO speedWithBearingAfter;
|
||||
|
||||
public double directionChangeInDegrees;
|
||||
|
||||
public ManeuverDAO() {}
|
||||
public ManeuverDTO() {}
|
||||
|
||||
public ManeuverDAO(ManeuverType type, Tack newTack, PositionDAO position, Date timepoint, SpeedWithBearingDAO speedWithBearingBefore,
|
||||
SpeedWithBearingDAO speedWithBearingAfter, double directionChangeInDegrees) {
|
||||
public ManeuverDTO(ManeuverType type, Tack newTack, PositionDTO position, Date timepoint, SpeedWithBearingDTO speedWithBearingBefore,
|
||||
SpeedWithBearingDTO speedWithBearingAfter, double directionChangeInDegrees) {
|
||||
super();
|
||||
this.type = type;
|
||||
this.newTack = newTack;
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.sap.sailing.gwt.ui.shared;
|
||||
|
||||
public class MarkDAO extends NamedDAO {
|
||||
public PositionDAO position;
|
||||
|
||||
public MarkDAO() {}
|
||||
|
||||
public MarkDAO(String name, double latDeg, double lngDeg) {
|
||||
super(name);
|
||||
position = new PositionDAO(latDeg, lngDeg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return 98174 ^ name.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return name.equals(((MarkDAO) o).name);
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.sap.sailing.gwt.ui.shared;
|
||||
|
||||
public class MarkDTO extends NamedDTO {
|
||||
public PositionDTO position;
|
||||
|
||||
public MarkDTO() {}
|
||||
|
||||
public MarkDTO(String name, double latDeg, double lngDeg) {
|
||||
super(name);
|
||||
position = new PositionDTO(latDeg, lngDeg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return 98174 ^ name.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return name.equals(((MarkDTO) o).name);
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -2,12 +2,12 @@ package com.sap.sailing.gwt.ui.shared;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class NamedDAO implements IsSerializable {
|
||||
public class NamedDTO implements IsSerializable {
|
||||
public String name;
|
||||
|
||||
public NamedDAO() {}
|
||||
public NamedDTO() {}
|
||||
|
||||
public NamedDAO(String name) {
|
||||
public NamedDTO(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
+3
-3
@@ -2,13 +2,13 @@ package com.sap.sailing.gwt.ui.shared;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class PositionDAO implements IsSerializable {
|
||||
public class PositionDTO implements IsSerializable {
|
||||
public double latDeg;
|
||||
public double lngDeg;
|
||||
|
||||
public PositionDAO() {}
|
||||
public PositionDTO() {}
|
||||
|
||||
public PositionDAO(double latDeg, double lngDeg) {
|
||||
public PositionDTO(double latDeg, double lngDeg) {
|
||||
this.latDeg = latDeg;
|
||||
this.lngDeg = lngDeg;
|
||||
}
|
||||
+4
-4
@@ -2,14 +2,14 @@ package com.sap.sailing.gwt.ui.shared;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class QuickRankDAO implements IsSerializable {
|
||||
public CompetitorDAO competitor;
|
||||
public class QuickRankDTO implements IsSerializable {
|
||||
public CompetitorDTO competitor;
|
||||
public int rank;
|
||||
public int legNumber;
|
||||
|
||||
public QuickRankDAO() {}
|
||||
public QuickRankDTO() {}
|
||||
|
||||
public QuickRankDAO(CompetitorDAO competitorDAO, int rank, int legNumber) {
|
||||
public QuickRankDTO(CompetitorDTO competitorDAO, int rank, int legNumber) {
|
||||
this.competitor = competitorDAO;
|
||||
this.rank = rank;
|
||||
this.legNumber = legNumber;
|
||||
+4
-4
@@ -5,8 +5,8 @@ import java.util.Date;
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
import com.sap.sailing.domain.common.RacePlaceOrder;
|
||||
|
||||
public class RaceDAO extends NamedDAO implements IsSerializable {
|
||||
public Iterable<CompetitorDAO> competitors;
|
||||
public class RaceDTO extends NamedDTO implements IsSerializable {
|
||||
public Iterable<CompetitorDTO> competitors;
|
||||
|
||||
/**
|
||||
* Tells if this race is currently being tracked live, meaning that a {@link TracTracRaceTracker} is
|
||||
@@ -22,9 +22,9 @@ public class RaceDAO extends NamedDAO implements IsSerializable {
|
||||
|
||||
public RacePlaceOrder racePlaces = null;
|
||||
|
||||
public RaceDAO() {}
|
||||
public RaceDTO() {}
|
||||
|
||||
public RaceDAO(String name, Iterable<CompetitorDAO> competitors, boolean currentlyTracked) {
|
||||
public RaceDTO(String name, Iterable<CompetitorDTO> competitors, boolean currentlyTracked) {
|
||||
super(name);
|
||||
this.competitors = competitors;
|
||||
this.currentlyTracked = currentlyTracked;
|
||||
+1
-1
@@ -2,7 +2,7 @@ package com.sap.sailing.gwt.ui.shared;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class RaceInLeaderboardDAO implements IsSerializable {
|
||||
public class RaceInLeaderboardDTO implements IsSerializable {
|
||||
private String raceColumnName;
|
||||
private boolean medalRace;
|
||||
private boolean trackedRace;
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
package com.sap.sailing.gwt.ui.shared;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class RegattaDAO implements IsSerializable {
|
||||
public BoatClassDAO boatClass;
|
||||
public List<RaceDAO> races;
|
||||
|
||||
public RegattaDAO() {}
|
||||
|
||||
public RegattaDAO(BoatClassDAO boatClass, List<RaceDAO> races) {
|
||||
super();
|
||||
this.boatClass = boatClass;
|
||||
this.races = races;
|
||||
}
|
||||
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.sap.sailing.gwt.ui.shared;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class RegattaDTO implements IsSerializable {
|
||||
public BoatClassDTO boatClass;
|
||||
public List<RaceDTO> races;
|
||||
|
||||
public RegattaDTO() {}
|
||||
|
||||
public RegattaDTO(BoatClassDTO boatClass, List<RaceDTO> races) {
|
||||
super();
|
||||
this.boatClass = boatClass;
|
||||
this.races = races;
|
||||
}
|
||||
|
||||
}
|
||||
+3
-3
@@ -2,13 +2,13 @@ package com.sap.sailing.gwt.ui.shared;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class SpeedWithBearingDAO implements IsSerializable {
|
||||
public class SpeedWithBearingDTO implements IsSerializable {
|
||||
public double speedInKnots;
|
||||
public double bearingInDegrees;
|
||||
|
||||
public SpeedWithBearingDAO() {}
|
||||
public SpeedWithBearingDTO() {}
|
||||
|
||||
public SpeedWithBearingDAO(double speedInKnots, double bearingInDegrees) {
|
||||
public SpeedWithBearingDTO(double speedInKnots, double bearingInDegrees) {
|
||||
super();
|
||||
this.speedInKnots = speedInKnots;
|
||||
this.bearingInDegrees = bearingInDegrees;
|
||||
+3
-3
@@ -2,15 +2,15 @@ package com.sap.sailing.gwt.ui.shared;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class SwissTimingConfigurationDAO implements IsSerializable {
|
||||
public class SwissTimingConfigurationDTO implements IsSerializable {
|
||||
public String name;
|
||||
public String hostname;
|
||||
public int port;
|
||||
public boolean canSendRequests;
|
||||
|
||||
public SwissTimingConfigurationDAO() {}
|
||||
public SwissTimingConfigurationDTO() {}
|
||||
|
||||
public SwissTimingConfigurationDAO(String name, String hostname, int port, boolean canSendRequests) {
|
||||
public SwissTimingConfigurationDTO(String name, String hostname, int port, boolean canSendRequests) {
|
||||
super();
|
||||
this.name = name;
|
||||
this.hostname = hostname;
|
||||
+3
-3
@@ -4,14 +4,14 @@ import java.util.Date;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class SwissTimingRaceRecordDAO implements IsSerializable {
|
||||
public class SwissTimingRaceRecordDTO implements IsSerializable {
|
||||
public String ID;
|
||||
public String description;
|
||||
public Date raceStartTime;
|
||||
|
||||
public SwissTimingRaceRecordDAO() {}
|
||||
public SwissTimingRaceRecordDTO() {}
|
||||
|
||||
public SwissTimingRaceRecordDAO(String id, String description, Date raceStartTime) {
|
||||
public SwissTimingRaceRecordDTO(String id, String description, Date raceStartTime) {
|
||||
super();
|
||||
ID = id;
|
||||
this.description = description;
|
||||
+3
-3
@@ -2,15 +2,15 @@ package com.sap.sailing.gwt.ui.shared;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class TracTracConfigurationDAO implements IsSerializable {
|
||||
public class TracTracConfigurationDTO implements IsSerializable {
|
||||
public String name;
|
||||
public String jsonURL;
|
||||
public String liveDataURI;
|
||||
public String storedDataURI;
|
||||
|
||||
public TracTracConfigurationDAO() {}
|
||||
public TracTracConfigurationDTO() {}
|
||||
|
||||
public TracTracConfigurationDAO(String name, String jsonURL, String liveDataURI, String storedDataURI) {
|
||||
public TracTracConfigurationDTO(String name, String jsonURL, String liveDataURI, String storedDataURI) {
|
||||
super();
|
||||
this.name = name;
|
||||
this.jsonURL = jsonURL;
|
||||
+3
-3
@@ -4,7 +4,7 @@ import java.util.Date;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class TracTracRaceRecordDAO implements IsSerializable {
|
||||
public class TracTracRaceRecordDTO implements IsSerializable {
|
||||
public String eventName;
|
||||
public String name;
|
||||
public String replayURL;
|
||||
@@ -16,9 +16,9 @@ public class TracTracRaceRecordDAO implements IsSerializable {
|
||||
public Date trackingEndTime;
|
||||
public Date raceStartTime;
|
||||
|
||||
public TracTracRaceRecordDAO() {}
|
||||
public TracTracRaceRecordDTO() {}
|
||||
|
||||
public TracTracRaceRecordDAO(String id, String eventName, String name, String paramURL,
|
||||
public TracTracRaceRecordDTO(String id, String eventName, String name, String paramURL,
|
||||
String replayURL, String liveURI, String storedURI, Date trackingStartTime, Date trackingEndTime, Date raceStartTime) {
|
||||
super();
|
||||
this.eventName = eventName;
|
||||
+3
-3
@@ -2,7 +2,7 @@ package com.sap.sailing.gwt.ui.shared;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class WindDAO implements IsSerializable {
|
||||
public class WindDTO implements IsSerializable {
|
||||
public Double trueWindSpeedInMetersPerSecond;
|
||||
public Double trueWindSpeedInKnots;
|
||||
public Double trueWindBearingDeg;
|
||||
@@ -11,8 +11,8 @@ public class WindDAO implements IsSerializable {
|
||||
public Double dampenedTrueWindSpeedInKnots;
|
||||
public Double dampenedTrueWindBearingDeg;
|
||||
public Double dampenedTrueWindFromDeg;
|
||||
public PositionDAO position;
|
||||
public PositionDTO position;
|
||||
public Long timepoint;
|
||||
|
||||
public WindDAO() {}
|
||||
public WindDTO() {}
|
||||
}
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
package com.sap.sailing.gwt.ui.shared;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class WindInfoDAO implements IsSerializable {
|
||||
public List<WindInfoForRaceDAO> windInfoForRaces;
|
||||
|
||||
public WindInfoDAO() {}
|
||||
|
||||
public WindInfoDAO(List<WindInfoForRaceDAO> windInfoForRaces) {
|
||||
super();
|
||||
this.windInfoForRaces = windInfoForRaces;
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.sap.sailing.gwt.ui.shared;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class WindInfoDTO implements IsSerializable {
|
||||
public List<WindInfoForRaceDTO> windInfoForRaces;
|
||||
|
||||
public WindInfoDTO() {}
|
||||
|
||||
public WindInfoDTO(List<WindInfoForRaceDTO> windInfoForRaces) {
|
||||
super();
|
||||
this.windInfoForRaces = windInfoForRaces;
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -5,10 +5,10 @@ import java.util.Map;
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
import com.sap.sailing.domain.common.WindSource;
|
||||
|
||||
public class WindInfoForRaceDAO implements IsSerializable {
|
||||
public Map<WindSource, WindTrackInfoDAO> windTrackInfoByWindSource;
|
||||
public class WindInfoForRaceDTO implements IsSerializable {
|
||||
public Map<WindSource, WindTrackInfoDTO> windTrackInfoByWindSource;
|
||||
public WindSource selectedWindSource;
|
||||
public boolean raceIsKnownToStartUpwind;
|
||||
|
||||
public WindInfoForRaceDAO() {}
|
||||
public WindInfoForRaceDTO() {}
|
||||
}
|
||||
+3
-3
@@ -4,9 +4,9 @@ import java.util.List;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
public class WindTrackInfoDAO implements IsSerializable {
|
||||
public List<WindDAO> windFixes;
|
||||
public class WindTrackInfoDTO implements IsSerializable {
|
||||
public List<WindDTO> windFixes;
|
||||
public long dampeningIntervalInMilliseconds;
|
||||
|
||||
public WindTrackInfoDAO() {}
|
||||
public WindTrackInfoDTO() {}
|
||||
}
|
||||
+28
-28
@@ -34,7 +34,7 @@ import com.sap.sailing.gwt.ui.client.ErrorReporter;
|
||||
import com.sap.sailing.gwt.ui.client.EventRefresher;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDAO;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDTO;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -51,18 +51,18 @@ public class OverviewEventPanel extends AbstractEventPanel {
|
||||
|
||||
private CaptionPanel captionPanelEvents;
|
||||
private Button btnShowLeaderboards;
|
||||
private CellTable<EventDAO> eventTable;
|
||||
private ListDataProvider<EventDAO> eventTableProvider;
|
||||
private SingleSelectionModel<EventDAO> eventSelectionModel;
|
||||
private CellTable<EventDTO> eventTable;
|
||||
private ListDataProvider<EventDTO> eventTableProvider;
|
||||
private SingleSelectionModel<EventDTO> eventSelectionModel;
|
||||
|
||||
private CaptionPanel captionPanelLeaderboards;
|
||||
|
||||
private List<EventDAO> availableEvents;
|
||||
private List<EventDTO> availableEvents;
|
||||
|
||||
public OverviewEventPanel(SailingServiceAsync sailingService, EventRefresher eventRefresher,
|
||||
ErrorReporter errorReporter, final StringMessages stringConstants) {
|
||||
super(sailingService, eventRefresher, errorReporter, stringConstants);
|
||||
availableEvents = new ArrayList<EventDAO>();
|
||||
availableEvents = new ArrayList<EventDTO>();
|
||||
|
||||
VerticalPanel mainPanel = new VerticalPanel();
|
||||
this.setWidget(mainPanel);
|
||||
@@ -166,30 +166,30 @@ public class OverviewEventPanel extends AbstractEventPanel {
|
||||
|
||||
// Create event table
|
||||
{
|
||||
eventTable = new CellTable<EventDAO>();
|
||||
eventTable = new CellTable<EventDTO>();
|
||||
eventTable.setWidth("100%");
|
||||
|
||||
//Creating location column
|
||||
TextColumn<EventDAO> locationColumn = new TextColumn<EventDAO>() {
|
||||
TextColumn<EventDTO> locationColumn = new TextColumn<EventDTO>() {
|
||||
@Override
|
||||
public String getValue(EventDAO eventDAO) {
|
||||
public String getValue(EventDTO eventDAO) {
|
||||
String locations = eventDAO.locations;
|
||||
return locations != null ? locations : stringConstants.locationNotAvailable();
|
||||
}
|
||||
};
|
||||
locationColumn.setSortable(true);
|
||||
//Creating event name column
|
||||
TextColumn<EventDAO> nameColumn = new TextColumn<EventDAO>() {
|
||||
TextColumn<EventDTO> nameColumn = new TextColumn<EventDTO>() {
|
||||
@Override
|
||||
public String getValue(EventDAO eventDAO) {
|
||||
public String getValue(EventDTO eventDAO) {
|
||||
return eventDAO.name;
|
||||
}
|
||||
};
|
||||
nameColumn.setSortable(true);
|
||||
//Creating start date column
|
||||
TextColumn<EventDAO> startDateColumn = new TextColumn<EventDAO>() {
|
||||
TextColumn<EventDTO> startDateColumn = new TextColumn<EventDTO>() {
|
||||
@Override
|
||||
public String getValue(EventDAO eventDAO) {
|
||||
public String getValue(EventDTO eventDAO) {
|
||||
Date start = eventDAO.regattas.get(0).races.get(0).startOfRace;
|
||||
return start != null ? dateFormatter.render(start) : stringConstants.startDateNotAvailable();
|
||||
}
|
||||
@@ -201,13 +201,13 @@ public class OverviewEventPanel extends AbstractEventPanel {
|
||||
eventTable.addColumn(startDateColumn, stringConstants.startDate());
|
||||
|
||||
//Adding the data provider and creating the sort handler
|
||||
eventTableProvider = new ListDataProvider<EventDAO>();
|
||||
eventTableProvider = new ListDataProvider<EventDTO>();
|
||||
eventTableProvider.addDataDisplay(eventTable);
|
||||
Handler eventSortHandler = getEventSortHandler(eventTableProvider.getList(), locationColumn, nameColumn, startDateColumn);
|
||||
eventTable.addColumnSortHandler(eventSortHandler);
|
||||
|
||||
//Adding the selection model
|
||||
eventSelectionModel = new SingleSelectionModel<EventDAO>();
|
||||
eventSelectionModel = new SingleSelectionModel<EventDTO>();
|
||||
eventTable.setSelectionModel(eventSelectionModel);
|
||||
eventSelectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
|
||||
@Override
|
||||
@@ -257,12 +257,12 @@ public class OverviewEventPanel extends AbstractEventPanel {
|
||||
}
|
||||
|
||||
private void loadEvents(final Runnable actionAfterLoading) {
|
||||
sailingService.listEvents(true, new AsyncCallback<List<EventDAO>>() {
|
||||
sailingService.listEvents(true, new AsyncCallback<List<EventDTO>>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<EventDAO> result) {
|
||||
public void onSuccess(List<EventDTO> result) {
|
||||
if (result != null) {
|
||||
availableEvents = new ArrayList<EventDAO>(result);
|
||||
availableEvents = new ArrayList<EventDTO>(result);
|
||||
} else {
|
||||
availableEvents.clear();
|
||||
}
|
||||
@@ -318,29 +318,29 @@ public class OverviewEventPanel extends AbstractEventPanel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillEvents(List<EventDAO> result) {
|
||||
public void fillEvents(List<EventDTO> result) {
|
||||
|
||||
}
|
||||
|
||||
private ListHandler<EventDAO> getEventSortHandler(List<EventDAO> list, TextColumn<EventDAO> locationColumn,
|
||||
TextColumn<EventDAO> nameColumn, TextColumn<EventDAO> startDateColumn) {
|
||||
private ListHandler<EventDTO> getEventSortHandler(List<EventDTO> list, TextColumn<EventDTO> locationColumn,
|
||||
TextColumn<EventDTO> nameColumn, TextColumn<EventDTO> startDateColumn) {
|
||||
//TODO Check if comparators are correct
|
||||
ListHandler<EventDAO> sortHandler = new ListHandler<EventDAO>(list);
|
||||
sortHandler.setComparator(locationColumn, new Comparator<EventDAO>() {
|
||||
ListHandler<EventDTO> sortHandler = new ListHandler<EventDTO>(list);
|
||||
sortHandler.setComparator(locationColumn, new Comparator<EventDTO>() {
|
||||
@Override
|
||||
public int compare(EventDAO e1, EventDAO e2) {
|
||||
public int compare(EventDTO e1, EventDTO e2) {
|
||||
return e1.locations.compareTo(e2.locations);
|
||||
}
|
||||
});
|
||||
sortHandler.setComparator(nameColumn, new Comparator<EventDAO>() {
|
||||
sortHandler.setComparator(nameColumn, new Comparator<EventDTO>() {
|
||||
@Override
|
||||
public int compare(EventDAO e1, EventDAO e2) {
|
||||
public int compare(EventDTO e1, EventDTO e2) {
|
||||
return e1.name.compareTo(e2.name);
|
||||
}
|
||||
});
|
||||
sortHandler.setComparator(startDateColumn, new Comparator<EventDAO>() {
|
||||
sortHandler.setComparator(startDateColumn, new Comparator<EventDTO>() {
|
||||
@Override
|
||||
public int compare(EventDAO e1, EventDAO e2) {
|
||||
public int compare(EventDTO e1, EventDTO e2) {
|
||||
return e1.getStartDate().compareTo(e2.getStartDate());
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user