From 28002fd32d34a932c2ab0754ce4315d4be90efc3 Mon Sep 17 00:00:00 2001 From: andrewlalis Date: Fri, 7 Jun 2024 08:55:31 -0400 Subject: [PATCH] Hide currency choice box when there's only one currency in use for the profile. --- .../perfin/view/component/module/PieChartModule.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/com/andrewlalis/perfin/view/component/module/PieChartModule.java b/src/main/java/com/andrewlalis/perfin/view/component/module/PieChartModule.java index 79fe381..b9b59ce 100644 --- a/src/main/java/com/andrewlalis/perfin/view/component/module/PieChartModule.java +++ b/src/main/java/com/andrewlalis/perfin/view/component/module/PieChartModule.java @@ -4,6 +4,7 @@ import com.andrewlalis.perfin.data.AccountRepository; import com.andrewlalis.perfin.data.TimestampRange; import com.andrewlalis.perfin.data.util.ColorUtil; import com.andrewlalis.perfin.model.Profile; +import com.andrewlalis.perfin.view.BindingUtil; import javafx.application.Platform; import javafx.collections.FXCollections; import javafx.collections.ObservableList; @@ -52,6 +53,7 @@ public abstract class PieChartModule extends DashboardModule { this.timeRangeChoiceBox.getItems().addAll(RANGE_CHOICES); this.timeRangeChoiceBox.getSelectionModel().select("All Time"); + this.currencyChoiceBox.managedProperty().bind(this.currencyChoiceBox.visibleProperty()); PieChart chart = new PieChart(chartData); chart.setLegendVisible(false); @@ -136,6 +138,7 @@ public abstract class PieChartModule extends DashboardModule { } else { currencyChoiceBox.getSelectionModel().selectFirst(); } + currencyChoiceBox.setVisible(orderedCurrencies.size() > 1); }); }); }