Add number formatting to columns

This commit is contained in:
Christoph Atteneder 2018-02-19 10:09:17 +01:00
parent a02f586a7e
commit fd2f2aa33a
No known key found for this signature in database
GPG Key ID: CD5DC1C529CDFD3B

View File

@ -30,6 +30,7 @@ import io.bisq.gui.common.view.FxmlView;
import io.bisq.gui.components.AutoTooltipLabel;
import io.bisq.gui.components.AutoTooltipTableColumn;
import io.bisq.gui.components.AutoTooltipToggleButton;
import io.bisq.gui.components.ColoredDecimalPlacesWithZerosText;
import io.bisq.gui.main.market.trades.charts.price.CandleStickChart;
import io.bisq.gui.main.market.trades.charts.volume.VolumeChart;
import io.bisq.gui.util.BSFormatter;
@ -468,10 +469,11 @@ public class TradesChartsView extends ActivatableViewAndModel<VBox, TradesCharts
// date
TableColumn<TradeStatistics2, TradeStatistics2> dateColumn = new AutoTooltipTableColumn<TradeStatistics2, TradeStatistics2>(Res.get("shared.dateTime")) {
{
setMinWidth(190);
setMaxWidth(190);
setMinWidth(240);
setMaxWidth(240);
}
};
dateColumn.getStyleClass().add("number-column");
dateColumn.setCellValueFactory((tradeStatistics) -> new ReadOnlyObjectWrapper<>(tradeStatistics.getValue()));
dateColumn.setCellFactory(
new Callback<TableColumn<TradeStatistics2, TradeStatistics2>, TableCell<TradeStatistics2,
@ -525,6 +527,7 @@ public class TradesChartsView extends ActivatableViewAndModel<VBox, TradesCharts
// price
priceColumn = new TableColumn<>();
priceColumn.getStyleClass().add("number-column");
priceColumn.setCellValueFactory((tradeStatistics) -> new ReadOnlyObjectWrapper<>(tradeStatistics.getValue()));
priceColumn.setCellFactory(
new Callback<TableColumn<TradeStatistics2, TradeStatistics2>, TableCell<TradeStatistics2,
@ -549,6 +552,7 @@ public class TradesChartsView extends ActivatableViewAndModel<VBox, TradesCharts
// amount
TableColumn<TradeStatistics2, TradeStatistics2> amountColumn = new AutoTooltipTableColumn<>(Res.get("shared.amountWithCur", Res.getBaseCurrencyCode()));
amountColumn.getStyleClass().add("number-column");
amountColumn.setCellValueFactory((tradeStatistics) -> new ReadOnlyObjectWrapper<>(tradeStatistics.getValue()));
amountColumn.setCellFactory(
new Callback<TableColumn<TradeStatistics2, TradeStatistics2>, TableCell<TradeStatistics2,
@ -561,7 +565,7 @@ public class TradesChartsView extends ActivatableViewAndModel<VBox, TradesCharts
public void updateItem(final TradeStatistics2 item, boolean empty) {
super.updateItem(item, empty);
if (item != null)
setText(formatter.formatCoinWithCode(item.getTradeAmount()));
setGraphic(new ColoredDecimalPlacesWithZerosText(formatter.formatCoin(item.getTradeAmount(),4)));
else
setText("");
}
@ -573,6 +577,7 @@ public class TradesChartsView extends ActivatableViewAndModel<VBox, TradesCharts
// volume
volumeColumn = new TableColumn<>();
volumeColumn.getStyleClass().add("number-column");
volumeColumn.setCellValueFactory((tradeStatistics) -> new ReadOnlyObjectWrapper<>(tradeStatistics.getValue()));
volumeColumn.setCellFactory(
new Callback<TableColumn<TradeStatistics2, TradeStatistics2>, TableCell<TradeStatistics2,
@ -603,6 +608,7 @@ public class TradesChartsView extends ActivatableViewAndModel<VBox, TradesCharts
// paymentMethod
TableColumn<TradeStatistics2, TradeStatistics2> paymentMethodColumn = new AutoTooltipTableColumn<>(Res.get("shared.paymentMethod"));
paymentMethodColumn.getStyleClass().add("number-column");
paymentMethodColumn.setCellValueFactory((tradeStatistics) -> new ReadOnlyObjectWrapper<>(tradeStatistics.getValue()));
paymentMethodColumn.setCellFactory(
new Callback<TableColumn<TradeStatistics2, TradeStatistics2>, TableCell<TradeStatistics2,
@ -627,6 +633,7 @@ public class TradesChartsView extends ActivatableViewAndModel<VBox, TradesCharts
// direction
TableColumn<TradeStatistics2, TradeStatistics2> directionColumn = new AutoTooltipTableColumn<>(Res.get("shared.offerType"));
directionColumn.getStyleClass().add("number-column");
directionColumn.setCellValueFactory((tradeStatistics) -> new ReadOnlyObjectWrapper<>(tradeStatistics.getValue()));
directionColumn.setCellFactory(
new Callback<TableColumn<TradeStatistics2, TradeStatistics2>, TableCell<TradeStatistics2,