mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-04-19 23:36:00 -04:00
display trade amount in table instead of payout amount. refactor method in trade
This commit is contained in:
parent
d5118b048b
commit
c43575073d
@ -18,22 +18,18 @@
|
||||
package io.bitsquare.trade;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.btc.FeePolicy;
|
||||
import io.bitsquare.p2p.NodeAddress;
|
||||
import io.bitsquare.storage.Storage;
|
||||
import io.bitsquare.trade.offer.Offer;
|
||||
import io.bitsquare.trade.protocol.trade.BuyerAsOffererProtocol;
|
||||
import io.bitsquare.trade.protocol.trade.OffererProtocol;
|
||||
import io.bitsquare.trade.protocol.trade.messages.TradeMessage;
|
||||
import org.bitcoinj.core.Coin;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public final class BuyerAsOffererTrade extends BuyerTrade implements OffererTrade {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
|
||||
@ -73,12 +69,4 @@ public final class BuyerAsOffererTrade extends BuyerTrade implements OffererTrad
|
||||
public void handleTakeOfferRequest(TradeMessage message, NodeAddress taker) {
|
||||
((OffererProtocol) tradeProtocol).handleTakeOfferRequest(message, taker);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Coin getPayoutAmount() {
|
||||
checkNotNull(getTradeAmount(), "Invalid state: getTradeAmount() = null");
|
||||
|
||||
return FeePolicy.getSecurityDeposit().add(getTradeAmount());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -18,7 +18,6 @@
|
||||
package io.bitsquare.trade;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.btc.FeePolicy;
|
||||
import io.bitsquare.p2p.NodeAddress;
|
||||
import io.bitsquare.storage.Storage;
|
||||
import io.bitsquare.trade.offer.Offer;
|
||||
@ -32,7 +31,6 @@ import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public final class BuyerAsTakerTrade extends BuyerTrade implements TakerTrade {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
@ -74,11 +72,4 @@ public final class BuyerAsTakerTrade extends BuyerTrade implements TakerTrade {
|
||||
checkArgument(tradeProtocol instanceof TakerProtocol, "tradeProtocol NOT instanceof TakerProtocol");
|
||||
((TakerProtocol) tradeProtocol).takeAvailableOffer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Coin getPayoutAmount() {
|
||||
checkNotNull(getTradeAmount(), "Invalid state: getTradeAmount() = null");
|
||||
|
||||
return FeePolicy.getSecurityDeposit().add(getTradeAmount());
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
package io.bitsquare.trade;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.btc.FeePolicy;
|
||||
import io.bitsquare.common.handlers.ErrorMessageHandler;
|
||||
import io.bitsquare.common.handlers.ResultHandler;
|
||||
import io.bitsquare.p2p.NodeAddress;
|
||||
@ -29,6 +30,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public abstract class BuyerTrade extends Trade {
|
||||
// That object is saved to disc. We need to take care of changes to not break deserialization.
|
||||
@ -63,7 +65,13 @@ public abstract class BuyerTrade extends Trade {
|
||||
log::warn);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Coin getPayoutAmount() {
|
||||
checkNotNull(getTradeAmount(), "Invalid state: getTradeAmount() = null");
|
||||
|
||||
return FeePolicy.getSecurityDeposit().add(getTradeAmount());
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Setter for Mutable objects
|
||||
|
@ -18,6 +18,7 @@
|
||||
package io.bitsquare.trade;
|
||||
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.btc.FeePolicy;
|
||||
import io.bitsquare.common.handlers.ErrorMessageHandler;
|
||||
import io.bitsquare.common.handlers.ResultHandler;
|
||||
import io.bitsquare.p2p.NodeAddress;
|
||||
@ -64,6 +65,11 @@ public abstract class SellerTrade extends Trade {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Coin getPayoutAmount() {
|
||||
return FeePolicy.getSecurityDeposit();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Setter for Mutable objects
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -24,7 +24,6 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||
import io.bitsquare.app.Log;
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.arbitration.ArbitratorManager;
|
||||
import io.bitsquare.btc.FeePolicy;
|
||||
import io.bitsquare.btc.TradeWalletService;
|
||||
import io.bitsquare.btc.WalletService;
|
||||
import io.bitsquare.common.crypto.KeyRing;
|
||||
@ -374,9 +373,7 @@ public abstract class Trade implements Tradable, Model {
|
||||
return offer;
|
||||
}
|
||||
|
||||
public Coin getPayoutAmount() {
|
||||
return FeePolicy.getSecurityDeposit();
|
||||
}
|
||||
abstract public Coin getPayoutAmount();
|
||||
|
||||
public ProcessModel getProcessModel() {
|
||||
return processModel;
|
||||
|
@ -336,7 +336,7 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
|
||||
public void updateItem(final PendingTradesListItem item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
if (item != null && !empty)
|
||||
setText(formatter.formatCoinWithCode(item.getTrade().getPayoutAmount()));
|
||||
setText(formatter.formatCoinWithCode(item.getTrade().getTradeAmount()));
|
||||
else
|
||||
setText(null);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user