mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Add coloring of decimal places with zero at the end of a number
This commit is contained in:
parent
022fbb53af
commit
578ab069d8
@ -177,6 +177,11 @@ bg color of non edit textFields: fafafa
|
||||
.warning {
|
||||
-fx-text-fill: -bs-yellow;
|
||||
}
|
||||
|
||||
.zero-decimals {
|
||||
-fx-fill: -bs-light-grey;
|
||||
}
|
||||
|
||||
/* Other UI Elements */
|
||||
|
||||
.separator {
|
||||
|
@ -0,0 +1,22 @@
|
||||
package io.bisq.gui.components;
|
||||
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.scene.text.TextAlignment;
|
||||
import javafx.scene.text.TextFlow;
|
||||
|
||||
public class ColoredDecimalPlacesWithZerosText extends TextFlow {
|
||||
|
||||
public ColoredDecimalPlacesWithZerosText(String number) {
|
||||
super();
|
||||
|
||||
String placesBeforeZero = number.split("0*$")[0];
|
||||
String zeroDecimalPlaces = number.substring(placesBeforeZero.length());
|
||||
Text first = new Text(placesBeforeZero);
|
||||
Text last = new Text(zeroDecimalPlaces);
|
||||
last.getStyleClass().add("zero-decimals");
|
||||
setTextAlignment(TextAlignment.CENTER);
|
||||
setPrefHeight(20);
|
||||
|
||||
getChildren().addAll(first, last);
|
||||
}
|
||||
}
|
@ -29,6 +29,7 @@ import io.bisq.gui.common.view.FxmlView;
|
||||
import io.bisq.gui.components.AutoTooltipButton;
|
||||
import io.bisq.gui.components.AutoTooltipLabel;
|
||||
import io.bisq.gui.components.AutoTooltipTableColumn;
|
||||
import io.bisq.gui.components.ColoredDecimalPlacesWithZerosText;
|
||||
import io.bisq.gui.main.MainView;
|
||||
import io.bisq.gui.main.offer.BuyOfferView;
|
||||
import io.bisq.gui.main.offer.SellOfferView;
|
||||
@ -54,6 +55,10 @@ import javafx.scene.image.ImageView;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.Priority;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.scene.text.TextAlignment;
|
||||
import javafx.scene.text.TextFlow;
|
||||
import javafx.util.Callback;
|
||||
import javafx.util.StringConverter;
|
||||
import org.fxmisc.easybind.EasyBind;
|
||||
@ -410,8 +415,9 @@ public class OfferBookChartView extends ActivatableViewAndModel<VBox, OfferBookC
|
||||
@Override
|
||||
public void updateItem(final OfferListItem offerListItem, boolean empty) {
|
||||
super.updateItem(offerListItem, empty);
|
||||
if (offerListItem != null && !empty)
|
||||
setText(formatter.formatCoin(offerListItem.offer.getAmount(),4));
|
||||
if (offerListItem != null && !empty) {
|
||||
setGraphic(new ColoredDecimalPlacesWithZerosText(formatter.formatCoin(offerListItem.offer.getAmount(), 4)));
|
||||
}
|
||||
else
|
||||
setText("");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user