From fb5b56d03c8c2102c9ce4580e54578fae7f5f85a Mon Sep 17 00:00:00 2001 From: HenrikJannsen Date: Mon, 10 Apr 2023 14:38:37 +0700 Subject: [PATCH 1/4] Add processBurningManAccountingData field to preferences Signed-off-by: HenrikJannsen --- core/src/main/java/bisq/core/user/Preferences.java | 13 +++++++++++++ .../java/bisq/core/user/PreferencesPayload.java | 9 +++++++-- proto/src/main/proto/pb.proto | 1 + 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/bisq/core/user/Preferences.java b/core/src/main/java/bisq/core/user/Preferences.java index 82670c0e0c1..6a312de449a 100644 --- a/core/src/main/java/bisq/core/user/Preferences.java +++ b/core/src/main/java/bisq/core/user/Preferences.java @@ -846,6 +846,11 @@ public void setUserDefinedTradeLimit(long value) { requestPersistence(); } + public void setProcessBurningManAccountingData(boolean processBurningManAccountingData) { + prefPayload.setProcessBurningManAccountingData(processBurningManAccountingData); + requestPersistence(); + } + /////////////////////////////////////////////////////////////////////////////////////////// // Getter @@ -1012,6 +1017,10 @@ public List getDefaultTxBroadcastServices() { } } + public boolean isProcessBurningManAccountingData() { + return prefPayload.isProcessBurningManAccountingData(); + } + /////////////////////////////////////////////////////////////////////////////////////////// // Private @@ -1132,6 +1141,8 @@ private interface ExcludesDelegateMethods { double getBuyerSecurityDepositAsPercent(); + boolean isProcessBurningManAccountingData(); + void setDaoFullNode(boolean value); void setRpcUser(String value); @@ -1175,5 +1186,7 @@ private interface ExcludesDelegateMethods { void setUserDefinedTradeLimit(long userDefinedTradeLimit); void setUserHasRaisedTradeLimit(boolean userHasRaisedTradeLimit); + + void setProcessBurningManAccountingData(boolean processBurningManAccountingData); } } diff --git a/core/src/main/java/bisq/core/user/PreferencesPayload.java b/core/src/main/java/bisq/core/user/PreferencesPayload.java index 11e7562761d..eb74be1b6ef 100644 --- a/core/src/main/java/bisq/core/user/PreferencesPayload.java +++ b/core/src/main/java/bisq/core/user/PreferencesPayload.java @@ -145,6 +145,9 @@ public final class PreferencesPayload implements PersistableEnvelope { private long userDefinedTradeLimit = Preferences.INITIAL_TRADE_LIMIT; private boolean userHasRaisedTradeLimit = false; + // Added at 1.9.11 + private boolean processBurningManAccountingData = false; + /////////////////////////////////////////////////////////////////////////////////////////// // Constructor /////////////////////////////////////////////////////////////////////////////////////////// @@ -216,7 +219,8 @@ public Message toProtoMessage() { .setUseFullModeDaoMonitor(useFullModeDaoMonitor) .setUseBitcoinUrisInQrCodes(useBitcoinUrisInQrCodes) .setUserDefinedTradeLimit(userDefinedTradeLimit) - .setUserHasRaisedTradeLimit(userHasRaisedTradeLimit); + .setUserHasRaisedTradeLimit(userHasRaisedTradeLimit) + .setProcessBurningManAccountingData(processBurningManAccountingData); Optional.ofNullable(backupDirectory).ifPresent(builder::setBackupDirectory); Optional.ofNullable(preferredTradeCurrency).ifPresent(e -> builder.setPreferredTradeCurrency((protobuf.TradeCurrency) e.toProtoMessage())); @@ -323,7 +327,8 @@ public static PreferencesPayload fromProto(protobuf.PreferencesPayload proto, Co proto.getUseFullModeDaoMonitor(), proto.getUseBitcoinUrisInQrCodes(), proto.getUserHasRaisedTradeLimit() ? proto.getUserDefinedTradeLimit() : Preferences.INITIAL_TRADE_LIMIT, - proto.getUserHasRaisedTradeLimit() + proto.getUserHasRaisedTradeLimit(), + proto.getProcessBurningManAccountingData() ); } } diff --git a/proto/src/main/proto/pb.proto b/proto/src/main/proto/pb.proto index d56eebae434..2d276a327a4 100644 --- a/proto/src/main/proto/pb.proto +++ b/proto/src/main/proto/pb.proto @@ -1971,6 +1971,7 @@ message PreferencesPayload { bool use_bitcoin_uris_in_qr_codes = 66; int64 user_defined_trade_limit = 67; bool user_has_raised_trade_limit = 68; + bool process_burning_man_accounting_data = 69; } message AutoConfirmSettings { From cec05e13f9f797bc74e66dd14bcd133a0524e025 Mon Sep 17 00:00:00 2001 From: HenrikJannsen Date: Mon, 10 Apr 2023 14:49:47 +0700 Subject: [PATCH 2/4] Add toggle to PreferencesView Add popup when selecting a burningman to ask for enabling processing Signed-off-by: HenrikJannsen --- .../resources/i18n/displayStrings.properties | 6 ++++ .../burnbsq/burningman/BurningManView.java | 27 +++++++++++++++-- .../settings/preferences/PreferencesView.java | 30 +++++++++++++++---- 3 files changed, 56 insertions(+), 7 deletions(-) diff --git a/core/src/main/resources/i18n/displayStrings.properties b/core/src/main/resources/i18n/displayStrings.properties index 8a3e4e280dc..2e83b85bd64 100644 --- a/core/src/main/resources/i18n/displayStrings.properties +++ b/core/src/main/resources/i18n/displayStrings.properties @@ -1399,6 +1399,7 @@ setting.preferences.dao.resyncFromGenesis.popup=A resync from genesis transactio the seed nodes and the BSQ consensus state will be rebuilt from the genesis transaction. setting.preferences.dao.resyncFromGenesis.resync=Resync from genesis and shutdown setting.preferences.dao.isDaoFullNode=Run Bisq as DAO full node +setting.preferences.dao.processBurningManAccountingData=Process Burningman accounting data setting.preferences.dao.fullModeDaoMonitor=Full-mode DAO state monitoring setting.preferences.dao.fullModeDaoMonitor.popup=If full-mode DAO state monitoring is activated the DAO state \ @@ -2355,6 +2356,11 @@ dao.burningman.table.balanceEntry.revenue=Revenue dao.burningman.table.balanceEntry.price=BSQ/BTC price dao.burningman.table.balanceEntry.type=Type +dao.burningman.accounting.popup=To display accounting data of a burningman you need to enable the 'process burningman accounting data' option in settings.\n\ + Do you want to do that now?\n\ + It will require to restart Bisq to apply that change.\n\n\ + If you cancel, the displayed accounting data are not up-to-date. + # From BalanceEntry.Type enum names dao.burningman.balanceEntry.type.UNDEFINED=Undefined dao.burningman.balanceEntry.type.BTC_TRADE_FEE_TX=Trade fee 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 8504f6453b0..f9d4a0e08e4 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 @@ -17,6 +17,7 @@ package bisq.desktop.main.dao.burnbsq.burningman; +import bisq.desktop.app.BisqApp; import bisq.desktop.common.view.ActivatableView; import bisq.desktop.common.view.FxmlView; import bisq.desktop.components.AutoTooltipButton; @@ -51,11 +52,13 @@ import bisq.core.dao.state.model.blockchain.Block; import bisq.core.locale.Res; import bisq.core.monetary.Price; +import bisq.core.user.Preferences; import bisq.core.util.FormattingUtils; import bisq.core.util.ParsingUtils; import bisq.core.util.coin.BsqFormatter; import bisq.core.util.coin.CoinFormatter; +import bisq.common.UserThread; import bisq.common.app.DevEnv; import bisq.common.util.DateUtil; import bisq.common.util.Tuple2; @@ -113,6 +116,7 @@ import java.util.Locale; import java.util.Map; import java.util.Set; +import java.util.concurrent.TimeUnit; import java.util.function.Predicate; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -187,7 +191,8 @@ private BurningManView(DaoFacade daoFacade, BsqWalletService bsqWalletService, BsqFormatter bsqFormatter, @Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter btcFormatter, - BsqValidator bsqValidator) { + BsqValidator bsqValidator, + Preferences preferences) { this.daoFacade = daoFacade; this.burningManPresentationService = burningManPresentationService; this.burningManAccountingService = burningManAccountingService; @@ -235,7 +240,25 @@ private BurningManView(DaoFacade daoFacade, selectedContributorAddressBox.setManaged(isValueSet); selectedContributorAddressBox.setVisible(isValueSet); if (isValueSet) { - onBurningManSelected(newValue); + if (preferences.isProcessBurningManAccountingData()) { + onBurningManSelected(newValue); + } else { + String key = "processBurningManAccountingData"; + if (preferences.showAgain(key)) { + new Popup().information(Res.get("dao.burningman.accounting.popup")) + .actionButtonText(Res.get("shared.applyAndShutDown")) + .onAction(() -> { + preferences.setProcessBurningManAccountingData(true); + UserThread.runAfter(BisqApp.getShutDownHandler(), 500, TimeUnit.MILLISECONDS); + }) + .closeButtonText(Res.get("shared.cancel")) + .onClose(() -> onBurningManSelected(newValue)) + .dontShowAgainId(key) + .show(); + } else { + onBurningManSelected(newValue); + } + } } else { selectedContributorNameField.clear(); selectedContributorTotalRevenueField.clear(); diff --git a/desktop/src/main/java/bisq/desktop/main/settings/preferences/PreferencesView.java b/desktop/src/main/java/bisq/desktop/main/settings/preferences/PreferencesView.java index aee7ced1e78..b3c640df040 100644 --- a/desktop/src/main/java/bisq/desktop/main/settings/preferences/PreferencesView.java +++ b/desktop/src/main/java/bisq/desktop/main/settings/preferences/PreferencesView.java @@ -131,7 +131,7 @@ public class PreferencesView extends ActivatableViewAndModel { + boolean selected = processBurningManAccountingDataToggleButton.isSelected(); + if (selected != preferences.isProcessBurningManAccountingData()) { + new Popup().information(Res.get("settings.net.needRestart")) + .actionButtonText(Res.get("shared.applyAndShutDown")) + .onAction(() -> { + preferences.setProcessBurningManAccountingData(selected); + UserThread.runAfter(BisqApp.getShutDownHandler(), 500, TimeUnit.MILLISECONDS); + }) + .closeButtonText(Res.get("shared.cancel")) + .onClose(() -> processBurningManAccountingDataToggleButton.setSelected(!selected)) + .show(); + } + }); + fullModeDaoMonitorToggleButton.setSelected(preferences.isUseFullModeDaoMonitor()); fullModeDaoMonitorToggleButton.setOnAction(e -> { preferences.setUseFullModeDaoMonitor(fullModeDaoMonitorToggleButton.isSelected()); @@ -1221,7 +1240,7 @@ private void activateTradeLimitPreferences() { private void updateDaoFields() { boolean isDaoFullNode = isDaoFullNodeToggleButton.isSelected(); - GridPane.setRowSpan(daoOptionsTitledGroupBg, isDaoFullNode ? 8 : 5); + GridPane.setRowSpan(daoOptionsTitledGroupBg, isDaoFullNode ? 9 : 6); rpcUserTextField.setVisible(isDaoFullNode); rpcUserTextField.setManaged(isDaoFullNode); rpcPwTextField.setVisible(isDaoFullNode); @@ -1284,6 +1303,7 @@ private void deactivateDisplayPreferences() { } private void deactivateDaoPreferences() { + processBurningManAccountingDataToggleButton.setOnAction(null); fullModeDaoMonitorToggleButton.setOnAction(null); resyncDaoFromResourcesButton.setOnAction(null); resyncDaoFromGenesisButton.setOnAction(null); From 25fa962e5eb3bf42c59a13cc71ec199c96daafc8 Mon Sep 17 00:00:00 2001 From: HenrikJannsen Date: Mon, 10 Apr 2023 14:52:45 +0700 Subject: [PATCH 3/4] Enable processing of accounting data only if option in preferences is set. Signed-off-by: HenrikJannsen --- .../accounting/node/AccountingNode.java | 15 +++++++++++++-- .../accounting/node/InActiveAccountingNode.java | 7 +++++-- .../accounting/node/full/AccountingFullNode.java | 13 +++++-------- .../accounting/node/lite/AccountingLiteNode.java | 11 ++++------- 4 files changed, 27 insertions(+), 19 deletions(-) diff --git a/core/src/main/java/bisq/core/dao/burningman/accounting/node/AccountingNode.java b/core/src/main/java/bisq/core/dao/burningman/accounting/node/AccountingNode.java index 411fe17afe2..ef0b790e38c 100644 --- a/core/src/main/java/bisq/core/dao/burningman/accounting/node/AccountingNode.java +++ b/core/src/main/java/bisq/core/dao/burningman/accounting/node/AccountingNode.java @@ -23,6 +23,7 @@ import bisq.core.dao.burningman.accounting.node.full.AccountingBlockParser; import bisq.core.dao.state.DaoStateListener; import bisq.core.dao.state.DaoStateService; +import bisq.core.user.Preferences; import bisq.network.p2p.BootstrapListener; import bisq.network.p2p.P2PService; @@ -119,6 +120,7 @@ private static Set getPermittedPubKeys(boolean useDevPrivilegeKeys) { private final DaoStateService daoStateService; protected final BurningManAccountingService burningManAccountingService; protected final AccountingBlockParser accountingBlockParser; + private final Preferences preferences; @Nullable protected Consumer errorMessageHandler; @@ -132,11 +134,13 @@ private static Set getPermittedPubKeys(boolean useDevPrivilegeKeys) { public AccountingNode(P2PService p2PService, DaoStateService daoStateService, BurningManAccountingService burningManAccountingService, - AccountingBlockParser accountingBlockParser) { + AccountingBlockParser accountingBlockParser, + Preferences preferences) { this.p2PService = p2PService; this.daoStateService = daoStateService; this.burningManAccountingService = burningManAccountingService; this.accountingBlockParser = accountingBlockParser; + this.preferences = preferences; } @@ -160,6 +164,10 @@ public void onParseBlockChainComplete() { @Override public void addListeners() { + if (!preferences.isProcessBurningManAccountingData()) { + return; + } + if (daoStateService.isParseBlockChainComplete()) { log.info("daoStateService.isParseBlockChainComplete is already true, " + "we call onInitialDaoBlockParsingComplete directly"); @@ -182,7 +190,10 @@ public void onUpdatedDataReceived() { } @Override - public abstract void start(); + public void start() { + // We do not start yet but wait until DAO block parsing is complete to not interfere with + // that higher priority activity. + } /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/core/src/main/java/bisq/core/dao/burningman/accounting/node/InActiveAccountingNode.java b/core/src/main/java/bisq/core/dao/burningman/accounting/node/InActiveAccountingNode.java index a5c2604b344..7cf7ac6ff71 100644 --- a/core/src/main/java/bisq/core/dao/burningman/accounting/node/InActiveAccountingNode.java +++ b/core/src/main/java/bisq/core/dao/burningman/accounting/node/InActiveAccountingNode.java @@ -20,6 +20,7 @@ import bisq.core.dao.burningman.accounting.BurningManAccountingService; import bisq.core.dao.burningman.accounting.node.full.AccountingBlockParser; import bisq.core.dao.state.DaoStateService; +import bisq.core.user.Preferences; import bisq.network.p2p.P2PService; @@ -34,8 +35,10 @@ class InActiveAccountingNode extends AccountingNode { public InActiveAccountingNode(P2PService p2PService, DaoStateService daoStateService, BurningManAccountingService burningManAccountingService, - AccountingBlockParser accountingBlockParser) { - super(p2PService, daoStateService, burningManAccountingService, accountingBlockParser); + AccountingBlockParser accountingBlockParser, + Preferences preferences) { + super(p2PService, daoStateService, burningManAccountingService, + accountingBlockParser, preferences); } @Override diff --git a/core/src/main/java/bisq/core/dao/burningman/accounting/node/full/AccountingFullNode.java b/core/src/main/java/bisq/core/dao/burningman/accounting/node/full/AccountingFullNode.java index 3ee9cbef464..67fd912c63e 100644 --- a/core/src/main/java/bisq/core/dao/burningman/accounting/node/full/AccountingFullNode.java +++ b/core/src/main/java/bisq/core/dao/burningman/accounting/node/full/AccountingFullNode.java @@ -28,6 +28,7 @@ import bisq.core.dao.node.full.rpc.NotificationHandlerException; import bisq.core.dao.node.full.rpc.dto.RawDtoBlock; import bisq.core.dao.state.DaoStateService; +import bisq.core.user.Preferences; import bisq.network.p2p.P2PService; @@ -65,8 +66,10 @@ public AccountingFullNode(P2PService p2PService, BurningManAccountingService burningManAccountingService, AccountingBlockParser accountingBlockParser, AccountingFullNodeNetworkService accountingFullNodeNetworkService, - RpcService rpcService) { - super(p2PService, daoStateService, burningManAccountingService, accountingBlockParser); + RpcService rpcService, + Preferences preferences) { + super(p2PService, daoStateService, burningManAccountingService, + accountingBlockParser, preferences); this.rpcService = rpcService; this.accountingFullNodeNetworkService = accountingFullNodeNetworkService; @@ -77,12 +80,6 @@ public AccountingFullNode(P2PService p2PService, // Public methods /////////////////////////////////////////////////////////////////////////////////////////// - @Override - public void start() { - // We do not start yes but wait until DAO block parsing is complete to not interfere with - // that higher priority activity. - } - @Override public void shutDown() { accountingFullNodeNetworkService.shutDown(); diff --git a/core/src/main/java/bisq/core/dao/burningman/accounting/node/lite/AccountingLiteNode.java b/core/src/main/java/bisq/core/dao/burningman/accounting/node/lite/AccountingLiteNode.java index 19ba34481d0..bf2b0d8222c 100644 --- a/core/src/main/java/bisq/core/dao/burningman/accounting/node/lite/AccountingLiteNode.java +++ b/core/src/main/java/bisq/core/dao/burningman/accounting/node/lite/AccountingLiteNode.java @@ -29,6 +29,7 @@ import bisq.core.dao.burningman.accounting.node.messages.GetAccountingBlocksResponse; import bisq.core.dao.burningman.accounting.node.messages.NewAccountingBlockBroadcastMessage; import bisq.core.dao.state.DaoStateService; +import bisq.core.user.Preferences; import bisq.network.p2p.P2PService; import bisq.network.p2p.network.ConnectionState; @@ -76,8 +77,10 @@ public AccountingLiteNode(P2PService p2PService, WalletsSetup walletsSetup, BsqWalletService bsqWalletService, AccountingLiteNodeNetworkService accountingLiteNodeNetworkService, + Preferences preferences, @Named(Config.USE_DEV_PRIVILEGE_KEYS) boolean useDevPrivilegeKeys) { - super(p2PService, daoStateService, burningManAccountingService, accountingBlockParser); + super(p2PService, daoStateService, burningManAccountingService, + accountingBlockParser, preferences); this.walletsSetup = walletsSetup; this.bsqWalletService = bsqWalletService; @@ -96,12 +99,6 @@ public AccountingLiteNode(P2PService p2PService, // Public methods /////////////////////////////////////////////////////////////////////////////////////////// - @Override - public void start() { - // We do not start yes but wait until DAO block parsing is complete to not interfere with - // that higher priority activity. - } - @Override public void shutDown() { accountingLiteNodeNetworkService.shutDown(); From 795964f06bc0f6b2aa89dc4f924b506f57da148b Mon Sep 17 00:00:00 2001 From: HenrikJannsen Date: Mon, 10 Apr 2023 16:01:13 +0700 Subject: [PATCH 4/4] Add info if burningman accounting data processing is disabled or if it is in progress. We use a postfix to the header title and not a busy animation, as the busy animation is quite CPU intense. Signed-off-by: HenrikJannsen --- .../accounting/BurningManAccountingService.java | 9 ++++++++- .../resources/i18n/displayStrings.properties | 2 ++ .../dao/burnbsq/burningman/BurningManView.java | 17 ++++++++++++++++- 3 files changed, 26 insertions(+), 2 deletions(-) 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();