diff --git a/core/src/main/java/bisq/core/dao/burningman/accounting/BurningManAccountingService.java b/core/src/main/java/bisq/core/dao/burningman/accounting/BurningManAccountingService.java index 0624968a685..6346ecb4b1d 100644 --- a/core/src/main/java/bisq/core/dao/burningman/accounting/BurningManAccountingService.java +++ b/core/src/main/java/bisq/core/dao/burningman/accounting/BurningManAccountingService.java @@ -43,6 +43,9 @@ import javax.inject.Inject; import javax.inject.Singleton; +import javafx.beans.property.BooleanProperty; +import javafx.beans.property.SimpleBooleanProperty; + import java.util.Arrays; import java.util.Calendar; import java.util.Date; @@ -82,6 +85,8 @@ public class BurningManAccountingService implements DaoSetupService { private final Map averageBsqPriceByMonth = new HashMap<>(getHistoricalAverageBsqPriceByMonth()); @Getter private final Map balanceModelByBurningManName = new HashMap<>(); + @Getter + private BooleanProperty isProcessing = new SimpleBooleanProperty(); @Inject public BurningManAccountingService(BurningManAccountingStoreService burningManAccountingStoreService, @@ -105,6 +110,7 @@ public void addListeners() { @Override public void start() { + UserThread.execute(() -> isProcessing.set(true)); // Create the map from now back to the last entry of the historical data (April 2019-Nov. 2022). averageBsqPriceByMonth.putAll(getAverageBsqPriceByMonth(new Date(), 2022, 10)); @@ -125,6 +131,7 @@ public void start() { public void onInitialBlockRequestsComplete() { updateBalanceModelByAddress(); burningManAccountingStoreService.forEachBlock(this::addAccountingBlockToBalanceModel); + UserThread.execute(() -> isProcessing.set(false)); } public void onNewBlockReceived(AccountingBlock accountingBlock) { @@ -133,7 +140,7 @@ public void onNewBlockReceived(AccountingBlock accountingBlock) { } public void addBlock(AccountingBlock block) throws BlockHashNotConnectingException, BlockHeightNotConnectingException { - burningManAccountingStoreService.addIfNewBlock(block); + burningManAccountingStoreService.addIfNewBlock(block); } public int getBlockHeightOfLastBlock() { diff --git a/core/src/main/resources/i18n/displayStrings.properties b/core/src/main/resources/i18n/displayStrings.properties index 2e83b85bd64..57a3d86dddb 100644 --- a/core/src/main/resources/i18n/displayStrings.properties +++ b/core/src/main/resources/i18n/displayStrings.properties @@ -2324,6 +2324,8 @@ dao.burningman.daoBalance=Balance for DAO dao.burningman.daoBalanceTotalBurned=Total amount of burned BSQ dao.burningman.daoBalanceTotalDistributed=Total amount of distributed BTC / BSQ dao.burningman.selectedContributor=Selected contributor +dao.burningman.selectedContributor.disabledAccounting=(accounting data not updated) +dao.burningman.selectedContributor.processing=(still processing data...) dao.burningman.selectedContributorName=Contributor name dao.burningman.selectedContributorTotalReceived=Total received dao.burningman.selectedContributorTotalRevenue=Total revenue diff --git a/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/burningman/BurningManView.java b/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/burningman/BurningManView.java index f9d4a0e08e4..754762ce3d6 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/burningman/BurningManView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/burningman/BurningManView.java @@ -154,7 +154,6 @@ public class BurningManView extends ActivatableView implements private TableView compensationsTableView; private TableView reimbursementsTableView; - private final ObservableList burningManObservableList = FXCollections.observableArrayList(); private final FilteredList burningManFilteredList = new FilteredList<>(burningManObservableList); private final SortedList burningManSortedList = new SortedList<>(burningManFilteredList); @@ -174,6 +173,7 @@ public class BurningManView extends ActivatableView implements private final ChangeListener filterListener; private final ChangeListener contributorsListener; private final ChangeListener balanceEntryToggleListener; + private final ChangeListener isProcessingListener; private int gridRow = 0; private boolean showMonthlyBalanceEntries = true; @@ -243,6 +243,7 @@ private BurningManView(DaoFacade daoFacade, if (preferences.isProcessBurningManAccountingData()) { onBurningManSelected(newValue); } else { + selectedContributorTitledGroupBg.setText(Res.get("dao.burningman.selectedContributor") + " " + Res.get("dao.burningman.selectedContributor.disabledAccounting")); String key = "processBurningManAccountingData"; if (preferences.showAgain(key)) { new Popup().information(Res.get("dao.burningman.accounting.popup")) @@ -280,6 +281,16 @@ private BurningManView(DaoFacade daoFacade, } }; balanceEntryToggleListener = (observable, oldValue, newValue) -> onTypeChanged(); + + isProcessingListener = (observable, oldValue, newValue) -> { + if (preferences.isProcessBurningManAccountingData()) { + if (newValue) { + selectedContributorTitledGroupBg.setText(Res.get("dao.burningman.selectedContributor") + " " + Res.get("dao.burningman.selectedContributor.processing")); + } else { + selectedContributorTitledGroupBg.setText(Res.get("dao.burningman.selectedContributor")); + } + } + }; } @@ -576,6 +587,8 @@ protected void activate() { balanceEntryToggleGroup.selectedToggleProperty().addListener(balanceEntryToggleListener); + burningManAccountingService.getIsProcessing().addListener(isProcessingListener); + burningManSortedList.comparatorProperty().bind(burningManTableView.comparatorProperty()); burnOutputsSortedList.comparatorProperty().bind(burnOutputsTableView.comparatorProperty()); balanceEntrySortedList.comparatorProperty().bind(balanceEntryTableView.comparatorProperty()); @@ -615,6 +628,8 @@ protected void deactivate() { balanceEntryToggleGroup.selectedToggleProperty().removeListener(balanceEntryToggleListener); + burningManAccountingService.getIsProcessing().removeListener(isProcessingListener); + burningManSortedList.comparatorProperty().unbind(); burnOutputsSortedList.comparatorProperty().unbind(); balanceEntrySortedList.comparatorProperty().unbind();