diff --git a/desktop/src/main/java/bisq/desktop/components/chart/ChartView.java b/desktop/src/main/java/bisq/desktop/components/chart/ChartView.java index 517eaba82b..3812ca4539 100644 --- a/desktop/src/main/java/bisq/desktop/components/chart/ChartView.java +++ b/desktop/src/main/java/bisq/desktop/components/chart/ChartView.java @@ -73,7 +73,7 @@ import lombok.extern.slf4j.Slf4j; import static bisq.desktop.util.FormBuilder.getTopLabelWithVBox; @Slf4j -public abstract class ChartView extends ActivatableView { +public abstract class ChartView extends ActivatableView { private final Pane center; private final SplitPane splitPane; protected final NumberAxis xAxis; @@ -194,11 +194,11 @@ public abstract class ChartView extends ActivatableView node.setOnMouseReleased(null)); } - public void addListener(ChartModel.Listener listener) { + public void addListener(ChartViewModel.Listener listener) { model.addListener(listener); } - public void removeListener(ChartModel.Listener listener) { + public void removeListener(ChartViewModel.Listener listener) { model.removeListener(listener); } diff --git a/desktop/src/main/java/bisq/desktop/components/chart/ChartModel.java b/desktop/src/main/java/bisq/desktop/components/chart/ChartViewModel.java similarity index 97% rename from desktop/src/main/java/bisq/desktop/components/chart/ChartModel.java rename to desktop/src/main/java/bisq/desktop/components/chart/ChartViewModel.java index c97e01deaf..c563839220 100644 --- a/desktop/src/main/java/bisq/desktop/components/chart/ChartModel.java +++ b/desktop/src/main/java/bisq/desktop/components/chart/ChartViewModel.java @@ -30,7 +30,7 @@ import java.util.function.Predicate; import lombok.extern.slf4j.Slf4j; @Slf4j -public abstract class ChartModel extends ActivatableViewModel { +public abstract class ChartViewModel extends ActivatableViewModel { public interface Listener { /** * @param fromDate Epoch date in millis for earliest data @@ -44,7 +44,7 @@ public abstract class ChartModel extends ActivatableViewModel { private Predicate predicate = e -> true; - public ChartModel() { + public ChartViewModel() { } diff --git a/desktop/src/main/java/bisq/desktop/main/dao/economy/supply/SupplyView.java b/desktop/src/main/java/bisq/desktop/main/dao/economy/supply/SupplyView.java index b5118af604..bcc5c33cde 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/economy/supply/SupplyView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/economy/supply/SupplyView.java @@ -20,9 +20,9 @@ package bisq.desktop.main.dao.economy.supply; import bisq.desktop.common.view.ActivatableView; import bisq.desktop.common.view.FxmlView; import bisq.desktop.components.TitledGroupBg; -import bisq.desktop.components.chart.ChartModel; -import bisq.desktop.main.dao.economy.supply.daodata.DaoDataChartView; -import bisq.desktop.main.dao.economy.supply.daodata.DaoDataModel; +import bisq.desktop.components.chart.ChartViewModel; +import bisq.desktop.main.dao.economy.supply.daodata.DaoChartDataModel; +import bisq.desktop.main.dao.economy.supply.daodata.DaoChartView; import bisq.desktop.util.Layout; import bisq.core.dao.DaoFacade; @@ -49,11 +49,11 @@ import static bisq.desktop.util.FormBuilder.addTitledGroupBg; import static bisq.desktop.util.FormBuilder.addTopLabelReadOnlyTextField; @FxmlView -public class SupplyView extends ActivatableView implements DaoStateListener, ChartModel.Listener { +public class SupplyView extends ActivatableView implements DaoStateListener, ChartViewModel.Listener { private final DaoFacade daoFacade; - private final DaoDataChartView daoDataChartView; + private final DaoChartView daoChartView; // Shared model between SupplyView and RevenueChartModel - private final DaoDataModel daoDataModel; + private final DaoChartDataModel daoChartDataModel; private final BsqFormatter bsqFormatter; private TextField genesisIssueAmountTextField, compRequestIssueAmountTextField, reimbursementAmountTextField, @@ -69,12 +69,12 @@ public class SupplyView extends ActivatableView implements DaoSt @Inject private SupplyView(DaoFacade daoFacade, - DaoDataChartView daoDataChartView, - DaoDataModel daoDataModel, + DaoChartView daoChartView, + DaoChartDataModel daoChartDataModel, BsqFormatter bsqFormatter) { this.daoFacade = daoFacade; - this.daoDataChartView = daoDataChartView; - this.daoDataModel = daoDataModel; + this.daoChartView = daoChartView; + this.daoChartDataModel = daoChartDataModel; this.bsqFormatter = bsqFormatter; } @@ -94,16 +94,16 @@ public class SupplyView extends ActivatableView implements DaoSt updateWithBsqBlockChainData(); - daoDataChartView.activate(); - daoDataChartView.addListener(this); + daoChartView.activate(); + daoChartView.addListener(this); daoFacade.addBsqStateListener(this); } @Override protected void deactivate() { - daoDataChartView.removeListener(this); + daoChartView.removeListener(this); daoFacade.removeBsqStateListener(this); - daoDataChartView.deactivate(); + daoChartView.deactivate(); } @@ -134,11 +134,11 @@ public class SupplyView extends ActivatableView implements DaoSt private void createChart() { addTitledGroupBg(root, gridRow, 2, Res.get("dao.factsAndFigures.supply.issuedVsBurnt")); - daoDataChartView.initialize(); + daoChartView.initialize(); AnchorPane chartPane = new AnchorPane(); chartPane.getStyleClass().add("chart-pane"); - VBox chartContainer = daoDataChartView.getRoot(); + VBox chartContainer = daoChartView.getRoot(); AnchorPane.setTopAnchor(chartContainer, 15d); AnchorPane.setBottomAnchor(chartContainer, 10d); AnchorPane.setLeftAnchor(chartContainer, 25d); @@ -204,16 +204,16 @@ public class SupplyView extends ActivatableView implements DaoSt private void updateEconomicsData() { // We use the supplyDataProvider to get the adjusted data with static historical data as well to use the same // monthly scoped data. - Coin issuedAmountFromCompRequests = Coin.valueOf(daoDataModel.getCompensationAmount(fromDate, getToDate())); + Coin issuedAmountFromCompRequests = Coin.valueOf(daoChartDataModel.getCompensationAmount(fromDate, getToDate())); compRequestIssueAmountTextField.setText(bsqFormatter.formatAmountWithGroupSeparatorAndCode(issuedAmountFromCompRequests)); - Coin issuedAmountFromReimbursementRequests = Coin.valueOf(daoDataModel.getReimbursementAmount(fromDate, getToDate())); + Coin issuedAmountFromReimbursementRequests = Coin.valueOf(daoChartDataModel.getReimbursementAmount(fromDate, getToDate())); reimbursementAmountTextField.setText(bsqFormatter.formatAmountWithGroupSeparatorAndCode(issuedAmountFromReimbursementRequests)); - Coin totalBurntTradeFee = Coin.valueOf(daoDataModel.getBsqTradeFeeAmount(fromDate, getToDate())); + Coin totalBurntTradeFee = Coin.valueOf(daoChartDataModel.getBsqTradeFeeAmount(fromDate, getToDate())); totalBurntBsqTradeFeeTextField.setText(bsqFormatter.formatAmountWithGroupSeparatorAndCode(totalBurntTradeFee)); - Coin totalProofOfBurnAmount = Coin.valueOf(daoDataModel.getProofOfBurnAmount(fromDate, getToDate())); + Coin totalProofOfBurnAmount = Coin.valueOf(daoChartDataModel.getProofOfBurnAmount(fromDate, getToDate())); totalProofOfBurnAmountTextField.setText(bsqFormatter.formatAmountWithGroupSeparatorAndCode(totalProofOfBurnAmount)); } diff --git a/desktop/src/main/java/bisq/desktop/main/dao/economy/supply/daodata/DaoDataModel.java b/desktop/src/main/java/bisq/desktop/main/dao/economy/supply/daodata/DaoChartDataModel.java similarity index 98% rename from desktop/src/main/java/bisq/desktop/main/dao/economy/supply/daodata/DaoDataModel.java rename to desktop/src/main/java/bisq/desktop/main/dao/economy/supply/daodata/DaoChartDataModel.java index 51baf657fa..75c11d9c3f 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/economy/supply/daodata/DaoDataModel.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/economy/supply/daodata/DaoChartDataModel.java @@ -45,7 +45,7 @@ import lombok.extern.slf4j.Slf4j; @Slf4j @Singleton -public class DaoDataModel { +public class DaoChartDataModel { private final DaoStateService daoStateService; private final Function blockTimeOfIssuanceFunction; private final TemporalAdjusterModel temporalAdjusterModel; @@ -55,7 +55,7 @@ public class DaoDataModel { /////////////////////////////////////////////////////////////////////////////////////////// @Inject - public DaoDataModel(DaoStateService daoStateService, TemporalAdjusterModel temporalAdjusterModel) { + public DaoChartDataModel(DaoStateService daoStateService, TemporalAdjusterModel temporalAdjusterModel) { super(); this.daoStateService = daoStateService; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/economy/supply/daodata/DaoDataChartView.java b/desktop/src/main/java/bisq/desktop/main/dao/economy/supply/daodata/DaoChartView.java similarity index 98% rename from desktop/src/main/java/bisq/desktop/main/dao/economy/supply/daodata/DaoDataChartView.java rename to desktop/src/main/java/bisq/desktop/main/dao/economy/supply/daodata/DaoChartView.java index 75977cda65..7a31215cbe 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/economy/supply/daodata/DaoDataChartView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/economy/supply/daodata/DaoChartView.java @@ -51,7 +51,7 @@ import java.util.function.Predicate; import lombok.extern.slf4j.Slf4j; @Slf4j -public class DaoDataChartView extends ChartView { +public class DaoChartView extends ChartView { private static final DecimalFormat priceFormat = new DecimalFormat(",###"); private final BsqFormatter bsqFormatter; @@ -60,7 +60,7 @@ public class DaoDataChartView extends ChartView { private ListChangeListener nodeListChangeListener; @Inject - public DaoDataChartView(DaoDataChartModel model, BsqFormatter bsqFormatter) { + public DaoChartView(DaoChartViewModel model, BsqFormatter bsqFormatter) { super(model); this.bsqFormatter = bsqFormatter; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/economy/supply/daodata/DaoDataChartModel.java b/desktop/src/main/java/bisq/desktop/main/dao/economy/supply/daodata/DaoChartViewModel.java similarity index 71% rename from desktop/src/main/java/bisq/desktop/main/dao/economy/supply/daodata/DaoDataChartModel.java rename to desktop/src/main/java/bisq/desktop/main/dao/economy/supply/daodata/DaoChartViewModel.java index 2c0fb1f49b..f5e85bea0b 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/economy/supply/daodata/DaoDataChartModel.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/economy/supply/daodata/DaoChartViewModel.java @@ -17,7 +17,7 @@ package bisq.desktop.main.dao.economy.supply.daodata; -import bisq.desktop.components.chart.ChartModel; +import bisq.desktop.components.chart.ChartViewModel; import bisq.core.dao.state.DaoStateService; @@ -38,59 +38,59 @@ import java.util.stream.Collectors; import lombok.extern.slf4j.Slf4j; @Slf4j -public class DaoDataChartModel extends ChartModel { +public class DaoChartViewModel extends ChartViewModel { private final DaoStateService daoStateService; - private final DaoDataModel daoDataModel; + private final DaoChartDataModel daoChartDataModel; /////////////////////////////////////////////////////////////////////////////////////////// // Constructor /////////////////////////////////////////////////////////////////////////////////////////// @Inject - public DaoDataChartModel(DaoStateService daoStateService, DaoDataModel daoDataModel) { + public DaoChartViewModel(DaoStateService daoStateService, DaoChartDataModel daoChartDataModel) { super(); this.daoStateService = daoStateService; - this.daoDataModel = daoDataModel; + this.daoChartDataModel = daoChartDataModel; } @Override protected void applyTemporalAdjuster(TemporalAdjuster temporalAdjuster) { - daoDataModel.setTemporalAdjuster(temporalAdjuster); + daoChartDataModel.setTemporalAdjuster(temporalAdjuster); } @Override protected TemporalAdjuster getTemporalAdjuster() { - return daoDataModel.getTemporalAdjuster(); + return daoChartDataModel.getTemporalAdjuster(); } List> getBsqTradeFeeChartData(Predicate predicate) { - return toChartData(daoDataModel.getBurnedBsqByMonth(daoStateService.getTradeFeeTxs(), predicate)); + return toChartData(daoChartDataModel.getBurnedBsqByMonth(daoStateService.getTradeFeeTxs(), predicate)); } List> getCompensationChartData(Predicate predicate) { - return toChartData(daoDataModel.getMergedCompensationMap(predicate)); + return toChartData(daoChartDataModel.getMergedCompensationMap(predicate)); } List> getProofOfBurnChartData(Predicate predicate) { - return toChartData(daoDataModel.getBurnedBsqByMonth(daoStateService.getProofOfBurnTxs(), predicate)); + return toChartData(daoChartDataModel.getBurnedBsqByMonth(daoStateService.getProofOfBurnTxs(), predicate)); } List> getReimbursementChartData(Predicate predicate) { - return toChartData(daoDataModel.getMergedReimbursementMap(predicate)); + return toChartData(daoChartDataModel.getMergedReimbursementMap(predicate)); } List> getTotalIssuedChartData(Predicate predicate) { - Map compensationMap = daoDataModel.getMergedCompensationMap(predicate); - Map reimbursementMap = daoDataModel.getMergedReimbursementMap(predicate); - Map sum = daoDataModel.getMergedMap(compensationMap, reimbursementMap, Long::sum); + Map compensationMap = daoChartDataModel.getMergedCompensationMap(predicate); + Map reimbursementMap = daoChartDataModel.getMergedReimbursementMap(predicate); + Map sum = daoChartDataModel.getMergedMap(compensationMap, reimbursementMap, Long::sum); return toChartData(sum); } List> getTotalBurnedChartData(Predicate predicate) { - Map tradeFee = daoDataModel.getBurnedBsqByMonth(daoStateService.getTradeFeeTxs(), predicate); - Map proofOfBurn = daoDataModel.getBurnedBsqByMonth(daoStateService.getProofOfBurnTxs(), predicate); - Map sum = daoDataModel.getMergedMap(tradeFee, proofOfBurn, Long::sum); + Map tradeFee = daoChartDataModel.getBurnedBsqByMonth(daoStateService.getTradeFeeTxs(), predicate); + Map proofOfBurn = daoChartDataModel.getBurnedBsqByMonth(daoStateService.getProofOfBurnTxs(), predicate); + Map sum = daoChartDataModel.getMergedMap(tradeFee, proofOfBurn, Long::sum); return toChartData(sum); } @@ -104,7 +104,7 @@ public class DaoDataChartModel extends ChartModel { } long toTimeInterval(Instant ofEpochSecond) { - return daoDataModel.toTimeInterval(ofEpochSecond); + return daoChartDataModel.toTimeInterval(ofEpochSecond); } ///////////////////////////////////////////////////////////////////////////////////////////