refactorings on regatta overview code

This commit is contained in:
Armin Zamani committed 2013-05-26 15:35:06 +02:00
1 parent d57d41fe35
commit 7bb35a0e1a
4 files changed
+8 -13

No files matched your search

@@ -113,6 +113,7 @@ public class RegattaRaceStatesComponent extends SimplePanel implements Component
List<RegattaOverviewEntryDTO> filteredRegattaRaces = getFilteredRegattaRaces(allEntries);
Collections.sort(filteredRegattaRaces, new RegattaRaceStatesComparator()); //sort entries after filtering
List<RegattaOverviewEntryDTO> racesToBeShown = getRacesToBeShown(filteredRegattaRaces);
//TODO group races by same day
regattaOverviewDataProvider.getList().clear();
regattaOverviewDataProvider.getList().addAll(racesToBeShown);
// now sort again according to selected criterion
@@ -234,6 +235,7 @@ public class RegattaRaceStatesComponent extends SimplePanel implements Component
TextColumn<RegattaOverviewEntryDTO> fleetNameColumn = new TextColumn<RegattaOverviewEntryDTO>() {
@Override
public String getValue(RegattaOverviewEntryDTO entryDTO) {
//TODO Fleet column shall be not shown when the races of this event have no fleets
return entryDTO.raceInfo.fleetName.equals("Default") ? "-" : entryDTO.raceInfo.fleetName;
}
};
@@ -344,9 +346,6 @@ public class RegattaRaceStatesComponent extends SimplePanel implements Component
@Override
public String getValue(RegattaOverviewEntryDTO entryDTO) {
StringBuffer additionalInformation = new StringBuffer();
if (entryDTO.raceInfo.hasEvents && !isRaceActive(entryDTO.raceInfo.lastStatus)) {
additionalInformation.append("Race has been aborted before. ");
}
if (entryDTO.raceInfo.pathfinderId != null) {
additionalInformation.append("Pathfinder: " + entryDTO.raceInfo.pathfinderId);
}
@@ -368,6 +367,7 @@ public class RegattaRaceStatesComponent extends SimplePanel implements Component
table.addColumn(regattaNameColumn, stringMessages.regatta()); // For sailors the boat class also contains
// additional infos such as woman/man, e.g.
// Laser Radial Woman or Laser Radial Men
//TODO Show Series when available
table.addColumn(fleetNameColumn, stringMessages.fleet());
table.addColumn(raceNameColumn, stringMessages.race());
table.addColumn(raceStartTimeColumn, stringMessages.startTime());
@@ -31,6 +31,8 @@ public class RegattaRaceStatesSettingsDialogComponent implements SettingsDialogC
private final Map<String, CheckBox> courseAreaCheckBoxMap;
private final Map<String, CheckBox> regattaCheckBoxMap;
private final static String SETTINGS_DIALOG_COMPONENT = "SettingsDialogComponent";
public RegattaRaceStatesSettingsDialogComponent(RegattaRaceStatesSettings settings, StringMessages stringMessages,
List<CourseAreaDTO> courseAreas, List<String> regattaNames) {
this.stringMessages = stringMessages;
@@ -43,7 +45,7 @@ public class RegattaRaceStatesSettingsDialogComponent implements SettingsDialogC
private FlowPanel fillCourseAreaWidget(DataEntryDialog<?> dialog) {
FlowPanel flowPanel = new FlowPanel();
flowPanel.addStyleName("SettingsDialogComponent");
flowPanel.addStyleName(SETTINGS_DIALOG_COMPONENT);
flowPanel.add(dialog.createHeadline(stringMessages.showFollowingCourseAreas(), true));
FlowPanel courseAreaPanel = new FlowPanel();
flowPanel.add(courseAreaPanel);
@@ -76,7 +78,7 @@ public class RegattaRaceStatesSettingsDialogComponent implements SettingsDialogC
private FlowPanel fillRegattaNamesWidget(DataEntryDialog<?> dialog) {
FlowPanel flowPanel = new FlowPanel();
flowPanel.addStyleName("SettingsDialogComponent");
flowPanel.addStyleName(SETTINGS_DIALOG_COMPONENT);
flowPanel.add(dialog.createHeadline(stringMessages.showFollowingRegattas(), true));
FlowPanel regattaNamesPanel = new FlowPanel();
flowPanel.add(regattaNamesPanel);
@@ -121,7 +123,7 @@ public class RegattaRaceStatesSettingsDialogComponent implements SettingsDialogC
private Widget getAdditionalSettingsWidget(DataEntryDialog<?> dialog) {
FlowPanel flowPanel = new FlowPanel();
flowPanel.addStyleName("SettingsDialogComponent");
flowPanel.addStyleName(SETTINGS_DIALOG_COMPONENT);
flowPanel.add(dialog.createHeadline(stringMessages.additionalSettings(), true));
FlowPanel additionalSettingsPanel = new FlowPanel();
flowPanel.add(additionalSettingsPanel);
@@ -490,12 +490,6 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
RaceInfoDTO raceInfoDTO = new RaceInfoDTO();
RaceLog raceLog = raceColumn.getRaceLog(fleet);
if (raceLog != null) {
try {
raceLog.lockForRead();
raceInfoDTO.hasEvents = !Util.isEmpty(raceLog.getRawFixes());
} finally {
raceLog.unlockAfterRead();
}
StartTimeFinder startTimeFinder = new StartTimeFinder(raceLog);
if(startTimeFinder.getStartTime()!=null){
@@ -11,7 +11,6 @@ public class RaceInfoDTO implements IsSerializable {
public String raceName;
public String fleetName;
public int fleetOrdering;
public boolean hasEvents;
public Date startTime;
public RaceLogRaceStatus lastStatus;
public Flags lastUpperFlag;