mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-23 23:06:39 +01:00
Improve layout to prevent truncation in most common use-cases
This commit is contained in:
parent
3630abdeb8
commit
ad374bd6ec
3 changed files with 14 additions and 5 deletions
|
@ -211,6 +211,10 @@ public class FormattingUtils {
|
||||||
return formatToPercent(value) + "%";
|
return formatToPercent(value) + "%";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String formatToRoundedPercentWithSymbol(double value) {
|
||||||
|
return formatToPercent(value, new DecimalFormat("#")) + "%";
|
||||||
|
}
|
||||||
|
|
||||||
public static String formatPercentagePrice(double value) {
|
public static String formatPercentagePrice(double value) {
|
||||||
return formatToPercentWithSymbol(value);
|
return formatToPercentWithSymbol(value);
|
||||||
}
|
}
|
||||||
|
@ -219,6 +223,11 @@ public class FormattingUtils {
|
||||||
DecimalFormat decimalFormat = new DecimalFormat("#.##");
|
DecimalFormat decimalFormat = new DecimalFormat("#.##");
|
||||||
decimalFormat.setMinimumFractionDigits(2);
|
decimalFormat.setMinimumFractionDigits(2);
|
||||||
decimalFormat.setMaximumFractionDigits(2);
|
decimalFormat.setMaximumFractionDigits(2);
|
||||||
|
|
||||||
|
return formatToPercent(value, decimalFormat);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String formatToPercent(double value, DecimalFormat decimalFormat) {
|
||||||
return decimalFormat.format(MathUtils.roundDouble(value * 100.0, 2)).replace(",", ".");
|
return decimalFormat.format(MathUtils.roundDouble(value * 100.0, 2)).replace(",", ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -934,7 +934,7 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
|
||||||
Res.get("offerbook.deposit"),
|
Res.get("offerbook.deposit"),
|
||||||
Res.get("offerbook.deposit.help")) {
|
Res.get("offerbook.deposit.help")) {
|
||||||
{
|
{
|
||||||
setMinWidth(80);
|
setMinWidth(70);
|
||||||
setSortable(true);
|
setSortable(true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -977,7 +977,7 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
|
||||||
private TableColumn<OfferBookListItem, OfferBookListItem> getActionColumn() {
|
private TableColumn<OfferBookListItem, OfferBookListItem> getActionColumn() {
|
||||||
TableColumn<OfferBookListItem, OfferBookListItem> column = new AutoTooltipTableColumn<>(Res.get("shared.actions")) {
|
TableColumn<OfferBookListItem, OfferBookListItem> column = new AutoTooltipTableColumn<>(Res.get("shared.actions")) {
|
||||||
{
|
{
|
||||||
setMinWidth(200);
|
setMinWidth(180);
|
||||||
setSortable(false);
|
setSortable(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1194,8 +1194,8 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
|
||||||
private AutoTooltipTableColumn<OfferBookListItem, OfferBookListItem> getAvatarColumn() {
|
private AutoTooltipTableColumn<OfferBookListItem, OfferBookListItem> getAvatarColumn() {
|
||||||
AutoTooltipTableColumn<OfferBookListItem, OfferBookListItem> column = new AutoTooltipTableColumn<>(Res.get("offerbook.trader")) {
|
AutoTooltipTableColumn<OfferBookListItem, OfferBookListItem> column = new AutoTooltipTableColumn<>(Res.get("offerbook.trader")) {
|
||||||
{
|
{
|
||||||
setMinWidth(80);
|
setMinWidth(60);
|
||||||
setMaxWidth(80);
|
setMaxWidth(60);
|
||||||
setSortable(true);
|
setSortable(true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -645,7 +645,7 @@ class OfferBookViewModel extends ActivatableViewModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String formatDepositString(Coin deposit, long amount) {
|
public String formatDepositString(Coin deposit, long amount) {
|
||||||
var percentage = FormattingUtils.formatToPercentWithSymbol(deposit.getValue() / (double) amount);
|
var percentage = FormattingUtils.formatToRoundedPercentWithSymbol(deposit.getValue() / (double) amount);
|
||||||
return btcFormatter.formatCoin(deposit) + " (" + percentage + ")";
|
return btcFormatter.formatCoin(deposit) + " (" + percentage + ")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue