mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-14 08:11:00 +00:00
added basic filtering of races to regattaoverview and removed unnecessary flag display arrows from flag cell.
This commit is contained in:
1 parent
ae02beffd4
commit
7410197d33
3 files changed
+22
-34
No files matched your search
-31
@@ -1,31 +0,0 @@
|
||||
package com.sap.sailing.gwt.ui.regattaoverview;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.text.shared.SafeHtmlRenderer;
|
||||
import com.sap.sailing.gwt.ui.adminconsole.ImagesBarCell;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
|
||||
public class FlagImageCell extends ImagesBarCell {
|
||||
static final String ACTION_EDIT = "ACTION_EDIT";
|
||||
private final StringMessages stringMessages;
|
||||
private static RegattaOverviewResources resources = GWT.create(RegattaOverviewResources.class);
|
||||
|
||||
public FlagImageCell(StringMessages stringConstants) {
|
||||
super();
|
||||
this.stringMessages = stringConstants;
|
||||
}
|
||||
|
||||
public FlagImageCell(SafeHtmlRenderer<String> renderer, StringMessages stringMessages) {
|
||||
super();
|
||||
this.stringMessages = stringMessages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Iterable<ImageSpec> getImageSpecs() {
|
||||
return Arrays.asList(
|
||||
new ImageSpec(ACTION_EDIT, stringMessages.actionEdit(), makeImagePrototype(resources.flagAP())),
|
||||
new ImageSpec(ACTION_EDIT, stringMessages.actionEdit(), makeImagePrototype(resources.arrowUp())));
|
||||
}
|
||||
}
|
||||
+18
-2
@@ -1,6 +1,7 @@
|
||||
package com.sap.sailing.gwt.ui.regattaoverview;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -110,10 +111,22 @@ public class RegattaOverviewTableComposite extends Composite {
|
||||
@Override
|
||||
protected void handleSuccess(List<RegattaOverviewEntryDTO> result) {
|
||||
regattaOverviewDataProvider.getList().clear();
|
||||
regattaOverviewDataProvider.getList().addAll(result);
|
||||
regattaOverviewDataProvider.getList().addAll(filter(result));
|
||||
// now sort again according to selected criterion
|
||||
ColumnSortEvent.fire(regattaOverviewTable, regattaOverviewTable.getColumnSortList());
|
||||
}
|
||||
|
||||
private Collection<? extends RegattaOverviewEntryDTO> filter(List<RegattaOverviewEntryDTO> unfilteredRaceList) {
|
||||
List<RegattaOverviewEntryDTO> filterResult = new ArrayList<RegattaOverviewEntryDTO>();
|
||||
for (RegattaOverviewEntryDTO entry : unfilteredRaceList) {
|
||||
if (entry.raceInfo.lastStatus != RaceLogRaceStatus.UNKNOWN
|
||||
&& entry.raceInfo.lastStatus != RaceLogRaceStatus.UNSCHEDULED
|
||||
&& entry.raceInfo.lastStatus != RaceLogRaceStatus.FINISHED) {
|
||||
filterResult.add(entry);
|
||||
}
|
||||
}
|
||||
return filterResult;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -248,7 +261,10 @@ public class RegattaOverviewTableComposite extends Composite {
|
||||
Column<RegattaOverviewEntryDTO, ImageResource> lastFlagDirectionColumn = new Column<RegattaOverviewEntryDTO, ImageResource>(new ImageResourceCell()) {
|
||||
@Override
|
||||
public ImageResource getValue(RegattaOverviewEntryDTO entryDTO) {
|
||||
return flagImageResolver.resolveFlagDirectionToImage(entryDTO.raceInfo.displayed);
|
||||
if(entryDTO.raceInfo.lastFlag != null)
|
||||
return flagImageResolver.resolveFlagDirectionToImage(entryDTO.raceInfo.displayed);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user