bug 774: rounding of boat bubble popup

This commit is contained in:
Axel Uhl committed 2012-06-15 23:44:58 +02:00
1 parent e6d82bb13d
commit 027d33c333
2 files changed
+6 -14

No files matched your search

@@ -5,6 +5,7 @@ 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.client.NumberFormatterFactory;
import com.sap.sailing.gwt.ui.shared.LeaderboardDTO;
import com.sap.sailing.gwt.ui.shared.LeaderboardRowDTO;
@@ -16,14 +17,7 @@ public class FormattedDoubleLegDetailColumn extends LegDetailColumn<Double, Stri
com.sap.sailing.gwt.ui.leaderboard.LegDetailColumn.LegDetailField<Double> field, int decimals,
CellTable<LeaderboardRowDTO> leaderboardTable, String headerStyle, String columnStyle) {
super(title, unit, field, new TextCell(), leaderboardTable, headerStyle, columnStyle);
StringBuilder patternBuilder = new StringBuilder("0");
if (decimals > 0) {
patternBuilder.append('.');
}
for (int i = 0; i < decimals; i++) {
patternBuilder.append('0');
}
formatter = NumberFormat.getFormat(patternBuilder.toString());
formatter = NumberFormatterFactory.getDecimalFormat(decimals);
this.minMaxRenderer = new MinMaxRenderer(this, getComparator());
}
@@ -61,6 +61,7 @@ import com.sap.sailing.gwt.ui.actions.GetWindInfoAction;
import com.sap.sailing.gwt.ui.client.CompetitorSelectionChangeListener;
import com.sap.sailing.gwt.ui.client.CompetitorSelectionProvider;
import com.sap.sailing.gwt.ui.client.ErrorReporter;
import com.sap.sailing.gwt.ui.client.NumberFormatterFactory;
import com.sap.sailing.gwt.ui.client.RaceSelectionChangeListener;
import com.sap.sailing.gwt.ui.client.RaceTimesInfoProviderListener;
import com.sap.sailing.gwt.ui.client.RequiresDataInitialization;
@@ -995,16 +996,13 @@ public class RaceMap extends AbsolutePanel implements TimeListener, CompetitorSe
result.add(new Label(stringMessages.rank() + ": " + rank));
}
result.add(new Label(stringMessages.speed() + ": "
+ NumberFormat.getDecimalFormat().format(lastFix.speedWithBearing.speedInKnots) + " "+stringMessages.averageSpeedInKnotsUnit()));
+ NumberFormatterFactory.getDecimalFormat(1).format(lastFix.speedWithBearing.speedInKnots) + " "+stringMessages.averageSpeedInKnotsUnit()));
result.add(new Label(stringMessages.bearing() + ": "+ (int) lastFix.speedWithBearing.bearingInDegrees + " "+stringMessages.degreesShort()));
if (lastFix.wind != null) {
result.add(new Label(stringMessages.degreesBoatToTheWind() + ": " + NumberFormat.getDecimalFormat().format(Math.abs(
result.add(new Label(stringMessages.degreesBoatToTheWind() + ": " + (int) Math.abs(
new DegreeBearingImpl(lastFix.speedWithBearing.bearingInDegrees).getDifferenceTo(
new DegreeBearingImpl(lastFix.wind.dampenedTrueWindFromDeg)).getDegrees())) + " "+stringMessages.degreesShort() ));
new DegreeBearingImpl(lastFix.wind.dampenedTrueWindFromDeg)).getDegrees()) + " "+stringMessages.degreesShort()));
}
//TODO Introduce user role dependent view (Spectator, Admin). Comments underneath are necessary for other views
// result.add(new Label("" + lastFix.position));
// result.add(new Label("Tack: " + lastFix.tack.name()));
if (!selectedRaces.isEmpty()) {
RaceIdentifier race = selectedRaces.get(selectedRaces.size() - 1);
if (race != null) {