Regatta Progress - Added tooltip in case of multiple fleets

This commit is contained in:
Benjamin Barth committed 2015-07-29 12:59:44 +02:00
1 parent da44da507e
commit a57dd44fe8
2 files changed
+19

No files matched your search

@@ -20,6 +20,7 @@ import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.shared.dispatch.regatta.RegattaProgressFleetDTO;
import com.sap.sailing.gwt.ui.shared.dispatch.regatta.RegattaProgressSeriesDTO;
import com.sap.sailing.gwt.ui.shared.race.FleetMetadataDTO;
import com.sap.sse.common.Util;
public class MultiRegattaListStepsBody extends UIObject implements RequiresResize {
@@ -49,6 +50,7 @@ public class MultiRegattaListStepsBody extends UIObject implements RequiresResiz
seriesProgress.getProgressRaceCount(), seriesProgress.getTotalRaceCount()));
}
addFleetProgresses(seriesProgress.getFleetState(), seriesProgress.getTotalRaceCount());
setFleetsTooltip(seriesProgress.getFleetNames());
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
@@ -68,6 +70,14 @@ public class MultiRegattaListStepsBody extends UIObject implements RequiresResiz
}
}
private void setFleetsTooltip(String[] fleetNames) {
if (fleetNames.length > 1) {
String fleetCount = String.valueOf(fleetNames.length);
String fleetNameList = "(" + Util.join(", ", fleetNames) + ")";
fleetsContainerUi.setTitle(Util.join(" ", fleetCount, I18N.fleets(), fleetNameList));
}
}
private void renderNames() {
if (getElement().getOffsetWidth() < nameUi.getOffsetWidth() + checkUi.getOffsetWidth()
+ progressUi.getOffsetWidth()) {
@@ -36,6 +36,15 @@ public class RegattaProgressSeriesDTO implements DTO {
fleetState.put(fleet, stats);
}
public String[] getFleetNames() {
String[] fleetNames = new String[fleetState.size()];
int i = 0;
for (FleetMetadataDTO fleet : fleetState.keySet()) {
fleetNames[i++] = fleet.getFleetName();
}
return fleetNames;
}
public boolean isCompleted() {
for (RegattaProgressFleetDTO stats : fleetState.values()) {
if (stats.getFinishedRaceCount() < totalRaceCount) {