Do not floor percentage in progress bars
Closes #2614 Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
@@ -42,7 +42,7 @@ public class ProgressBarComponent implements LayoutableRenderableEntity
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("0.0");
|
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("0.0");
|
||||||
private static final DecimalFormat DECIMAL_FORMAT2 = new DecimalFormat("#0");
|
private static final DecimalFormat DECIMAL_FORMAT_ABS = new DecimalFormat("#0");
|
||||||
private long minimum;
|
private long minimum;
|
||||||
private long maximum = 100;
|
private long maximum = 100;
|
||||||
private double value;
|
private double value;
|
||||||
@@ -68,10 +68,10 @@ public class ProgressBarComponent implements LayoutableRenderableEntity
|
|||||||
switch (labelDisplayMode)
|
switch (labelDisplayMode)
|
||||||
{
|
{
|
||||||
case PERCENTAGE:
|
case PERCENTAGE:
|
||||||
textToWrite = DECIMAL_FORMAT.format(Math.floor(pc * 100d)) + "%";
|
textToWrite = DECIMAL_FORMAT.format(pc * 100d) + "%";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
textToWrite = DECIMAL_FORMAT2.format(Math.floor(currentValue)) + "/" + maximum;
|
textToWrite = DECIMAL_FORMAT_ABS.format(Math.floor(currentValue)) + "/" + maximum;
|
||||||
}
|
}
|
||||||
|
|
||||||
final int width = preferredSize.width;
|
final int width = preferredSize.width;
|
||||||
|
|||||||
Reference in New Issue
Block a user