From 3a95e51bc9693e99fa36e826039ea62fe6a0f57b Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Fri, 3 Apr 2015 13:14:18 +0200 Subject: [PATCH] Remove unneeded state handlers and views --- ...rAsBuyerSubView.java => BuyerSubView.java} | 15 +- .../pending/OffererAsBuyerSubView.java | 145 -------- .../pending/OffererAsSellerSubView.java | 158 -------- .../pending/PendingTradesDataModel.java | 29 +- .../portfolio/pending/PendingTradesView.java | 8 +- .../pending/PendingTradesViewModel.java | 343 +++++++++--------- ...sSellerSubView.java => SellerSubView.java} | 14 +- .../trade/BuyerAsOffererProtocol.java | 18 +- .../protocol/trade/SellerAsTakerProtocol.java | 16 +- 9 files changed, 207 insertions(+), 539 deletions(-) rename core/src/main/java/io/bitsquare/gui/main/portfolio/pending/{TakerAsBuyerSubView.java => BuyerSubView.java} (93%) delete mode 100644 core/src/main/java/io/bitsquare/gui/main/portfolio/pending/OffererAsBuyerSubView.java delete mode 100644 core/src/main/java/io/bitsquare/gui/main/portfolio/pending/OffererAsSellerSubView.java rename core/src/main/java/io/bitsquare/gui/main/portfolio/pending/{TakerAsSellerSubView.java => SellerSubView.java} (94%) diff --git a/core/src/main/java/io/bitsquare/gui/main/portfolio/pending/TakerAsBuyerSubView.java b/core/src/main/java/io/bitsquare/gui/main/portfolio/pending/BuyerSubView.java similarity index 93% rename from core/src/main/java/io/bitsquare/gui/main/portfolio/pending/TakerAsBuyerSubView.java rename to core/src/main/java/io/bitsquare/gui/main/portfolio/pending/BuyerSubView.java index 92cd9161cd..17bd86e42f 100644 --- a/core/src/main/java/io/bitsquare/gui/main/portfolio/pending/TakerAsBuyerSubView.java +++ b/core/src/main/java/io/bitsquare/gui/main/portfolio/pending/BuyerSubView.java @@ -28,9 +28,8 @@ import io.bitsquare.locale.BSResources; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class TakerAsBuyerSubView extends TradeSubView { - private static final Logger log = LoggerFactory.getLogger(TakerAsBuyerSubView.class); - +public class BuyerSubView extends TradeSubView { + private static final Logger log = LoggerFactory.getLogger(BuyerSubView.class); private TradeWizardItem waitTxInBlockchain; private TradeWizardItem startFiat; @@ -42,7 +41,7 @@ public class TakerAsBuyerSubView extends TradeSubView { // Constructor, Initialisation /////////////////////////////////////////////////////////////////////////////////////////// - public TakerAsBuyerSubView(PendingTradesViewModel model) { + public BuyerSubView(PendingTradesViewModel model) { super(model); } @@ -83,7 +82,7 @@ public class TakerAsBuyerSubView extends TradeSubView { switch (viewState) { case EMPTY: break; - case TAKER_BUYER_WAIT_TX_CONF: + case BUYER_WAIT_TX_CONF: showItem(waitTxInBlockchain); ((WaitTxInBlockchainView) tradeStepDetailsView).setInfoLabelText("Deposit transaction has been published. You need to wait for at least " + @@ -92,11 +91,11 @@ public class TakerAsBuyerSubView extends TradeSubView { " be sure that the deposit funding has not been double spent. For higher trade volumes we" + " recommend to wait up to 6 confirmations."); break; - case TAKER_BUYER_START_PAYMENT: + case BUYER_START_PAYMENT: waitTxInBlockchain.done(); showItem(startFiat); break; - case TAKER_BUYER_WAIT_CONFIRM_PAYMENT_RECEIVED: + case BUYER_WAIT_CONFIRM_PAYMENT_RECEIVED: waitTxInBlockchain.done(); startFiat.done(); showItem(waitFiatReceived); @@ -108,7 +107,7 @@ public class TakerAsBuyerSubView extends TradeSubView { "the Bitcoin sellers payment account, the payout transaction will be published.", model.getCurrencyCode())); break; - case TAKER_BUYER_COMPLETED: + case BUYER_COMPLETED: waitTxInBlockchain.done(); startFiat.done(); waitFiatReceived.done(); diff --git a/core/src/main/java/io/bitsquare/gui/main/portfolio/pending/OffererAsBuyerSubView.java b/core/src/main/java/io/bitsquare/gui/main/portfolio/pending/OffererAsBuyerSubView.java deleted file mode 100644 index 2dbf7d28f6..0000000000 --- a/core/src/main/java/io/bitsquare/gui/main/portfolio/pending/OffererAsBuyerSubView.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * This file is part of Bitsquare. - * - * Bitsquare is free software: you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at - * your option) any later version. - * - * Bitsquare is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public - * License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Bitsquare. If not, see . - */ - -package io.bitsquare.gui.main.portfolio.pending; - -import io.bitsquare.gui.components.Popups; -import io.bitsquare.gui.main.portfolio.pending.steps.CompletedView; -import io.bitsquare.gui.main.portfolio.pending.steps.StartFiatView; -import io.bitsquare.gui.main.portfolio.pending.steps.TradeWizardItem; -import io.bitsquare.gui.main.portfolio.pending.steps.WaitFiatReceivedView; -import io.bitsquare.gui.main.portfolio.pending.steps.WaitTxInBlockchainView; -import io.bitsquare.locale.BSResources; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class OffererAsBuyerSubView extends TradeSubView { - private static final Logger log = LoggerFactory.getLogger(OffererAsBuyerSubView.class); - - private TradeWizardItem waitTxInBlockchain; - private TradeWizardItem startFiat; - private TradeWizardItem waitFiatReceived; - private TradeWizardItem completed; - - - /////////////////////////////////////////////////////////////////////////////////////////// - // Constructor, Initialisation - /////////////////////////////////////////////////////////////////////////////////////////// - - public OffererAsBuyerSubView(PendingTradesViewModel model) { - super(model); - } - - @Override - public void activate() { - super.activate(); - } - - @Override - public void deactivate() { - super.deactivate(); - } - - @Override - protected void addWizards() { - waitTxInBlockchain = new TradeWizardItem(WaitTxInBlockchainView.class, "Wait for blockchain confirmation"); - startFiat = new TradeWizardItem(StartFiatView.class, "Start payment"); - waitFiatReceived = new TradeWizardItem(WaitFiatReceivedView.class, "Wait until payment has arrived"); - completed = new TradeWizardItem(CompletedView.class, "Completed"); - - leftVBox.getChildren().addAll(waitTxInBlockchain, startFiat, waitFiatReceived, completed); - } - - - /////////////////////////////////////////////////////////////////////////////////////////// - // State - /////////////////////////////////////////////////////////////////////////////////////////// - - @Override - protected void applyState(PendingTradesViewModel.ViewState viewState) { - log.debug("applyState " + viewState); - - waitTxInBlockchain.inactive(); - startFiat.inactive(); - waitFiatReceived.inactive(); - completed.inactive(); - - switch (viewState) { - case EMPTY: - break; - case OFFERER_BUYER_WAIT_TX_CONF: - showItem(waitTxInBlockchain); - - ((WaitTxInBlockchainView) tradeStepDetailsView).setInfoLabelText("Deposit transaction has been published. You need to wait for at least " + - "one block chain confirmation."); - ((WaitTxInBlockchainView) tradeStepDetailsView).setInfoDisplayField("You need to wait for at least one block chain confirmation to" + - " be sure that the deposit funding has not been double spent. For higher trade volumes we" + - " recommend to wait up to 6 confirmations."); - break; - case OFFERER_BUYER_START_PAYMENT: - waitTxInBlockchain.done(); - showItem(startFiat); - break; - case OFFERER_BUYER_WAIT_CONFIRM_PAYMENT_RECEIVED: - waitTxInBlockchain.done(); - startFiat.done(); - showItem(waitFiatReceived); - - ((WaitFiatReceivedView) tradeStepDetailsView).setInfoLabelText(BSResources.get("Waiting for the Bitcoin sellers confirmation " + - "that the {0} payment has arrived.", - model.getCurrencyCode())); - ((WaitFiatReceivedView) tradeStepDetailsView).setInfoDisplayField(BSResources.get("When the confirmation that the {0} payment arrived at " + - "the Bitcoin sellers payment account, the payout transaction will be published.", - model.getCurrencyCode())); - break; - case OFFERER_BUYER_COMPLETED: - waitTxInBlockchain.done(); - startFiat.done(); - waitFiatReceived.done(); - showItem(completed); - - CompletedView completedView = (CompletedView) tradeStepDetailsView; - completedView.setBtcTradeAmountLabelText("You have bought:"); - completedView.setFiatTradeAmountLabelText("You have paid:"); - completedView.setBtcTradeAmountTextFieldText(model.getTradeVolume()); - completedView.setFiatTradeAmountTextFieldText(model.getFiatVolume()); - completedView.setFeesTextFieldText(model.getTotalFees()); - completedView.setSecurityDepositTextFieldText(model.getSecurityDeposit()); - completedView.setSummaryInfoDisplayText("Your security deposit has been refunded to you. " + - "You can review the details to that trade any time in the closed trades screen."); - completedView.setWithdrawAmountTextFieldText(model.getPayoutAmount()); - break; - case MESSAGE_SENDING_FAILED: - Popups.openWarningPopup("Sending message to trading peer failed.", model.getErrorMessage()); - break; - case EXCEPTION: - if (model.getTradeException() != null) - Popups.openExceptionPopup(model.getTradeException()); - break; - default: - log.warn("unhandled viewState " + viewState); - break; - } - - if (tradeStepDetailsView != null) - tradeStepDetailsView.activate(); - } -} - - - diff --git a/core/src/main/java/io/bitsquare/gui/main/portfolio/pending/OffererAsSellerSubView.java b/core/src/main/java/io/bitsquare/gui/main/portfolio/pending/OffererAsSellerSubView.java deleted file mode 100644 index bdcb049177..0000000000 --- a/core/src/main/java/io/bitsquare/gui/main/portfolio/pending/OffererAsSellerSubView.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * This file is part of Bitsquare. - * - * Bitsquare is free software: you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at - * your option) any later version. - * - * Bitsquare is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public - * License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Bitsquare. If not, see . - */ - -package io.bitsquare.gui.main.portfolio.pending; - -import io.bitsquare.gui.components.Popups; -import io.bitsquare.gui.main.portfolio.pending.steps.CompletedView; -import io.bitsquare.gui.main.portfolio.pending.steps.ConfirmFiatReceivedView; -import io.bitsquare.gui.main.portfolio.pending.steps.TradeWizardItem; -import io.bitsquare.gui.main.portfolio.pending.steps.WaitTxInBlockchainView; -import io.bitsquare.locale.BSResources; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class OffererAsSellerSubView extends TradeSubView { - private static final Logger log = LoggerFactory.getLogger(OffererAsSellerSubView.class); - - private TradeWizardItem waitTxInBlockchain; - private TradeWizardItem waitFiatStarted; - private TradeWizardItem confirmFiatReceived; - private TradeWizardItem completed; - - - /////////////////////////////////////////////////////////////////////////////////////////// - // Constructor, Initialisation - /////////////////////////////////////////////////////////////////////////////////////////// - - public OffererAsSellerSubView(PendingTradesViewModel model) { - super(model); - } - - @Override - public void activate() { - super.activate(); - } - - @Override - public void deactivate() { - super.deactivate(); - } - - @Override - protected void addWizards() { - waitTxInBlockchain = new TradeWizardItem(WaitTxInBlockchainView.class, "Wait for blockchain confirmation"); - waitFiatStarted = new TradeWizardItem(WaitTxInBlockchainView.class, "Wait for payment started"); - confirmFiatReceived = new TradeWizardItem(ConfirmFiatReceivedView.class, "Confirm payment received"); - completed = new TradeWizardItem(CompletedView.class, "Completed"); - - leftVBox.getChildren().addAll(waitTxInBlockchain, waitFiatStarted, confirmFiatReceived, completed); - } - - - /////////////////////////////////////////////////////////////////////////////////////////// - // State - /////////////////////////////////////////////////////////////////////////////////////////// - - @Override - protected void applyState(PendingTradesViewModel.ViewState viewState) { - log.debug("applyState " + viewState); - - waitTxInBlockchain.inactive(); - waitFiatStarted.inactive(); - confirmFiatReceived.inactive(); - completed.inactive(); - - switch (viewState) { - case EMPTY: - break; - case OFFERER_SELLER_WAIT_TX_CONF: - showItem(waitTxInBlockchain); - - ((WaitTxInBlockchainView) tradeStepDetailsView).setInfoLabelText("Deposit transaction has been published. " + - "The Bitcoin buyer need to wait for at least one block chain confirmation."); - ((WaitTxInBlockchainView) tradeStepDetailsView).setInfoDisplayField(BSResources.get("The Bitcoin buyer needs to wait for at least one " + - "block chain confirmation before starting the {0} payment. " + - "That is needed to assure that the deposit input funding has not been " + - "double-spent. " + - "For higher trade volumes it is recommended to wait up to 6 confirmations.", - model.getCurrencyCode())); - break; - case OFFERER_SELLER_WAIT_PAYMENT_STARTED: - waitTxInBlockchain.done(); - showItem(waitFiatStarted); - - ((WaitTxInBlockchainView) tradeStepDetailsView).setInfoLabelText(BSResources.get("Deposit transaction has at least one block chain " + - "confirmation. " + - "Waiting that other trader starts the {0} payment.", - model.getCurrencyCode())); - ((WaitTxInBlockchainView) tradeStepDetailsView).setInfoDisplayField(BSResources.get("You will get informed when the other trader has " + - "indicated the {0} payment has been started.", - model.getCurrencyCode())); - break; - case OFFERER_SELLER_CONFIRM_RECEIVE_PAYMENT: - waitTxInBlockchain.done(); - waitFiatStarted.done(); - showItem(confirmFiatReceived); - - ((ConfirmFiatReceivedView) tradeStepDetailsView).setInfoLabelText(BSResources.get("The Bitcoin buyer has started the {0} payment." + - "Check your payments account and confirm when you have received the payment.", - model.getCurrencyCode())); - ((ConfirmFiatReceivedView) tradeStepDetailsView).setInfoDisplayField(BSResources.get("It is important that you confirm when you have " + - "received the {0} payment as this will publish the payout transaction where you get returned " + - "your security deposit and the Bitcoin buyer receive the Bitcoin amount you sold.", - model.getCurrencyCode())); - - break; - case OFFERER_SELLER_COMPLETED: - waitTxInBlockchain.done(); - waitFiatStarted.done(); - confirmFiatReceived.done(); - showItem(completed); - - CompletedView completedView = (CompletedView) tradeStepDetailsView; - completedView.setBtcTradeAmountLabelText("You have sold:"); - completedView.setFiatTradeAmountLabelText("You have received:"); - completedView.setBtcTradeAmountTextFieldText(model.getTradeVolume()); - completedView.setFiatTradeAmountTextFieldText(model.getFiatVolume()); - completedView.setFeesTextFieldText(model.getTotalFees()); - completedView.setSecurityDepositTextFieldText(model.getSecurityDeposit()); - completedView.setSummaryInfoDisplayText("Your security deposit has been refunded to you. " + - "You can review the details to that trade any time in the closed trades screen."); - - completedView.setWithdrawAmountTextFieldText(model.getPayoutAmount()); - break; - case MESSAGE_SENDING_FAILED: - Popups.openWarningPopup("Sending message to trading peer failed.", model.getErrorMessage()); - break; - case EXCEPTION: - if (model.getTradeException() != null) - Popups.openExceptionPopup(model.getTradeException()); - break; - default: - log.warn("unhandled viewState " + viewState); - break; - } - - if (tradeStepDetailsView != null) - tradeStepDetailsView.activate(); - } -} - - - diff --git a/core/src/main/java/io/bitsquare/gui/main/portfolio/pending/PendingTradesDataModel.java b/core/src/main/java/io/bitsquare/gui/main/portfolio/pending/PendingTradesDataModel.java index bba5ba2fec..12aeb330ac 100644 --- a/core/src/main/java/io/bitsquare/gui/main/portfolio/pending/PendingTradesDataModel.java +++ b/core/src/main/java/io/bitsquare/gui/main/portfolio/pending/PendingTradesDataModel.java @@ -23,12 +23,8 @@ import io.bitsquare.common.viewfx.model.Activatable; import io.bitsquare.common.viewfx.model.DataModel; import io.bitsquare.gui.components.Popups; import io.bitsquare.offer.Offer; -import io.bitsquare.trade.BuyerAsOffererTrade; -import io.bitsquare.trade.BuyerAsTakerTrade; import io.bitsquare.trade.BuyerTrade; import io.bitsquare.trade.Contract; -import io.bitsquare.trade.SellerAsOffererTrade; -import io.bitsquare.trade.SellerAsTakerTrade; import io.bitsquare.trade.SellerTrade; import io.bitsquare.trade.Trade; import io.bitsquare.trade.TradeManager; @@ -71,10 +67,8 @@ class PendingTradesDataModel implements Activatable, DataModel { final StringProperty txId = new SimpleStringProperty(); final IntegerProperty selectedIndex = new SimpleIntegerProperty(-1); - final ObjectProperty takerAsSellerProcessState = new SimpleObjectProperty<>(); - final ObjectProperty offererAsBuyerProcessState = new SimpleObjectProperty<>(); - final ObjectProperty takerAsBuyerProcessState = new SimpleObjectProperty<>(); - final ObjectProperty offererAsSellerProcessState = new SimpleObjectProperty<>(); + final ObjectProperty sellerProcessState = new SimpleObjectProperty<>(); + final ObjectProperty buyerProcessState = new SimpleObjectProperty<>(); final ObjectProperty currentTrade = new SimpleObjectProperty<>(); @@ -139,15 +133,10 @@ class PendingTradesDataModel implements Activatable, DataModel { Trade trade = item.getTrade(); isOfferer = trade.getOffer().getP2pSigPubKey().equals(user.getP2pSigPubKey()); - // TODO merge states - if (trade instanceof SellerAsTakerTrade) - takerAsSellerProcessState.bind(trade.processStateProperty()); - else if (trade instanceof BuyerAsOffererTrade) - offererAsBuyerProcessState.bind(trade.processStateProperty()); - else if (trade instanceof BuyerAsTakerTrade) - takerAsBuyerProcessState.bind(trade.processStateProperty()); - else if (trade instanceof SellerAsOffererTrade) - offererAsSellerProcessState.bind(trade.processStateProperty()); + if (trade instanceof SellerTrade) + sellerProcessState.bind(trade.processStateProperty()); + else if (trade instanceof BuyerTrade) + buyerProcessState.bind(trade.processStateProperty()); if (trade.getDepositTx() != null) txId.set(trade.getDepositTx().getHashAsString()); @@ -253,10 +242,8 @@ class PendingTradesDataModel implements Activatable, DataModel { } private void unbindStates() { - takerAsSellerProcessState.unbind(); - takerAsBuyerProcessState.unbind(); - offererAsBuyerProcessState.unbind(); - offererAsSellerProcessState.unbind(); + sellerProcessState.unbind(); + buyerProcessState.unbind(); } public Coin getPayoutAmount() { diff --git a/core/src/main/java/io/bitsquare/gui/main/portfolio/pending/PendingTradesView.java b/core/src/main/java/io/bitsquare/gui/main/portfolio/pending/PendingTradesView.java index 6974fc0fd0..da615bbb3f 100644 --- a/core/src/main/java/io/bitsquare/gui/main/portfolio/pending/PendingTradesView.java +++ b/core/src/main/java/io/bitsquare/gui/main/portfolio/pending/PendingTradesView.java @@ -129,15 +129,15 @@ public class PendingTradesView extends ActivatableViewAndModel updateTakerAsSellerState(); - this.offererAsBuyerStateListener = (ov) -> updateOffererAsBuyerState(); - this.takerAsBuyerStateListener = (ov) -> updateTakerAsBuyerState(); - this.offererAsSellerStateListener = (ov) -> updateOffererAsSellerState(); + this.sellerStateListener = (ov) -> updateSellerState(); + this.buyerStateListener = (ov) -> updateBuyerState(); } @Override @@ -116,15 +102,11 @@ public class PendingTradesViewModel extends ActivatableWithDataModel taskRunner = new TaskRunner<>(trade, @@ -188,7 +188,7 @@ public class BuyerAsOffererProtocol implements TradeProtocol { // Incoming message handling /////////////////////////////////////////////////////////////////////////////////////////// - private void handlePayoutTxPublishedMessage(PayoutTxPublishedMessage tradeMessage) { + private void handle(PayoutTxPublishedMessage tradeMessage) { processModel.setTradeMessage(tradeMessage); TaskRunner taskRunner = new TaskRunner<>(trade, @@ -217,16 +217,16 @@ public class BuyerAsOffererProtocol implements TradeProtocol { if (tradeMessage.tradeId.equals(trade.getId())) { if (tradeMessage instanceof RequestIsOfferAvailableMessage) { - handleRequestIsOfferAvailableMessage((RequestIsOfferAvailableMessage) tradeMessage, sender); + handle((RequestIsOfferAvailableMessage) tradeMessage, sender); } else if (tradeMessage instanceof RequestDepositTxInputsMessage) { - handleRequestDepositTxInputsMessage((RequestDepositTxInputsMessage) tradeMessage, sender); + handle((RequestDepositTxInputsMessage) tradeMessage, sender); } else if (tradeMessage instanceof RequestPublishDepositTxMessage) { - handleRequestPublishDepositTxMessage((RequestPublishDepositTxMessage) tradeMessage); + handle((RequestPublishDepositTxMessage) tradeMessage); } else if (tradeMessage instanceof PayoutTxPublishedMessage) { - handlePayoutTxPublishedMessage((PayoutTxPublishedMessage) tradeMessage); + handle((PayoutTxPublishedMessage) tradeMessage); } else { log.error("Incoming tradeMessage not supported. " + tradeMessage); diff --git a/core/src/main/java/io/bitsquare/trade/protocol/trade/SellerAsTakerProtocol.java b/core/src/main/java/io/bitsquare/trade/protocol/trade/SellerAsTakerProtocol.java index 86225285d8..a0206b7a88 100644 --- a/core/src/main/java/io/bitsquare/trade/protocol/trade/SellerAsTakerProtocol.java +++ b/core/src/main/java/io/bitsquare/trade/protocol/trade/SellerAsTakerProtocol.java @@ -86,10 +86,10 @@ public class SellerAsTakerProtocol implements TradeProtocol { if (processModel.getMailboxMessage() == null) { processModel.setMailboxMessage(mailboxMessage); if (mailboxMessage instanceof FiatTransferStartedMessage) { - handleFiatTransferStartedMessage((FiatTransferStartedMessage) mailboxMessage); + handle((FiatTransferStartedMessage) mailboxMessage); } else if (mailboxMessage instanceof DepositTxPublishedMessage) { - handleDepositTxPublishedMessage((DepositTxPublishedMessage) mailboxMessage); + handle((DepositTxPublishedMessage) mailboxMessage); } } } @@ -112,7 +112,7 @@ public class SellerAsTakerProtocol implements TradeProtocol { // Incoming message handling /////////////////////////////////////////////////////////////////////////////////////////// - private void handleRequestTakerDepositPaymentMessage(RequestPayDepositMessage tradeMessage) { + private void handle(RequestPayDepositMessage tradeMessage) { processModel.setTradeMessage(tradeMessage); TaskRunner taskRunner = new TaskRunner<>(trade, @@ -129,7 +129,7 @@ public class SellerAsTakerProtocol implements TradeProtocol { taskRunner.run(); } - private void handleDepositTxPublishedMessage(DepositTxPublishedMessage tradeMessage) { + private void handle(DepositTxPublishedMessage tradeMessage) { processModel.setTradeMessage(tradeMessage); TaskRunner taskRunner = new TaskRunner<>(trade, @@ -143,7 +143,7 @@ public class SellerAsTakerProtocol implements TradeProtocol { taskRunner.run(); } - private void handleFiatTransferStartedMessage(FiatTransferStartedMessage tradeMessage) { + private void handle(FiatTransferStartedMessage tradeMessage) { processModel.setTradeMessage(tradeMessage); TaskRunner taskRunner = new TaskRunner<>(trade, @@ -192,13 +192,13 @@ public class SellerAsTakerProtocol implements TradeProtocol { if (tradeMessage.tradeId.equals(processModel.getId())) { if (tradeMessage instanceof RequestPayDepositMessage) { - handleRequestTakerDepositPaymentMessage((RequestPayDepositMessage) tradeMessage); + handle((RequestPayDepositMessage) tradeMessage); } else if (tradeMessage instanceof DepositTxPublishedMessage) { - handleDepositTxPublishedMessage((DepositTxPublishedMessage) tradeMessage); + handle((DepositTxPublishedMessage) tradeMessage); } else if (tradeMessage instanceof FiatTransferStartedMessage) { - handleFiatTransferStartedMessage((FiatTransferStartedMessage) tradeMessage); + handle((FiatTransferStartedMessage) tradeMessage); } else { log.error("Incoming message not supported. " + tradeMessage);