Fix trade state update bug

This commit is contained in:
Manfred Karrer 2014-11-18 19:52:46 +01:00
parent b87a27922a
commit f9859b3a13
3 changed files with 5 additions and 7 deletions

View File

@ -163,9 +163,6 @@ class PendingTradesModel extends UIModel {
if (selectedItem != null) {
isOfferer = getTrade().getOffer().getMessagePublicKey().equals(user.getMessagePublicKey());
// we want to re-trigger a change if the state is the same but different trades
tradeState.set(null);
Trade trade = getTrade();
if (trade.getDepositTx() != null)
txId.set(trade.getDepositTx().getHashAsString());

View File

@ -122,6 +122,7 @@ public class PendingTradesPM extends PresentationModel<PendingTradesModel> {
void selectTrade(PendingTradesListItem item) {
model.selectTrade(item);
updateState();
}
void fiatPaymentStarted() {
@ -250,6 +251,7 @@ public class PendingTradesPM extends PresentationModel<PendingTradesModel> {
private void updateState() {
if (model.tradeState.get() != null) {
log.debug("tradeState " + model.tradeState.get());
switch (model.tradeState.get()) {
case DEPOSIT_PUBLISHED:
state.set(model.isOfferer() ? State.OFFERER_BUYER_WAIT_TX_CONF : State.TAKER_SELLER_WAIT_TX_CONF);

View File

@ -133,11 +133,10 @@ public class PendingTradesViewCB extends CachedViewCB<PendingTradesPM> {
txIdTextField.setup(presentationModel.getWalletService(), newValue);
selectedItemChangeListener = (obsValue, oldValue, newValue) -> {
if (oldValue != null && newValue != null)
if (oldValue != null && newValue != null) {
presentationModel.selectTrade(newValue);
// TODO only clearSelection when there are more at least one remaining trades
/* else if (newValue == null)
table.getSelectionModel().clearSelection();*/
updateScreen();
}
};
listChangeListener = change -> {