Fix bugs with dispute msg, fix styles

This commit is contained in:
Manfred Karrer 2016-02-15 12:03:26 +01:00
parent 2049e384dc
commit 54a0fe9cc0
14 changed files with 82 additions and 42 deletions

View File

@ -166,6 +166,8 @@ public class DisputeManager {
onDisputeResultMessage((DisputeResultMessage) message);
else if (message instanceof PeerPublishedPayoutTxMessage)
onDisputedPayoutTxMessage((PeerPublishedPayoutTxMessage) message);
else
log.warn("Unsupported message at dispatchMessage.\nmessage=" + message);
}
public void sendOpenNewDisputeMessage(Dispute dispute) {

View File

@ -860,7 +860,7 @@ textfield */
-fx-text-fill: #3c3c3c;
-fx-background-color: linear-gradient(to bottom, #fcfcfc, #e5e5e5);
-fx-background-radius: 5 5 5 5;
-fx-background-insets: 10;
-fx-effect: dropshadow(gaussian, #434343, 10, 0, 0, 0);
-fx-background-insets: 5 5 20 20;
-fx-effect: dropshadow(gaussian, #000000, 15, 0, 2, 2);
}

View File

@ -221,15 +221,6 @@ public class MainViewModel implements ViewModel {
}
///////////////////////////////////////////////////////////////////////////////////////////
// UI handlers
///////////////////////////////////////////////////////////////////////////////////////////
void onSplashScreenRemoved() {
isSplashScreenRemoved.set(true);
}
///////////////////////////////////////////////////////////////////////////////////////////
// Initialisation
///////////////////////////////////////////////////////////////////////////////////////////
@ -419,13 +410,25 @@ public class MainViewModel implements ViewModel {
setupMarketPriceFeed();
tacPopup.showIfNeeded();
notificationCenter.onAllServicesInitialized();
// now show app
showAppScreen.set(true);
}
///////////////////////////////////////////////////////////////////////////////////////////
// UI handlers
///////////////////////////////////////////////////////////////////////////////////////////
// After showAppScreen is set and splash screen is faded out
void onSplashScreenRemoved() {
isSplashScreenRemoved.set(true);
// Delay that as we want to know what is the current path of the navigation which is set
// in MainView showAppScreen handler
notificationCenter.onAllServicesAndViewsInitialized();
}
///////////////////////////////////////////////////////////////////////////////////////////
// States
///////////////////////////////////////////////////////////////////////////////////////////

View File

@ -56,9 +56,11 @@ public class TransactionsListItem {
Coin valueSentToMe = transaction.getValueSentToMe(walletService.getWallet());
Coin valueSentFromMe = transaction.getValueSentFromMe(walletService.getWallet());
Coin amountAsCoin;
Address address = null;
if (valueSentToMe.isZero()) {
amount.set("-" + formatter.formatCoin(valueSentFromMe));
amountAsCoin = valueSentFromMe;
amount.set("-" + formatter.formatCoin(amountAsCoin));
for (TransactionOutput transactionOutput : transaction.getOutputs()) {
if (!transactionOutput.isMine(walletService.getWallet())) {
@ -72,7 +74,8 @@ public class TransactionsListItem {
}
}
} else if (valueSentFromMe.isZero()) {
amount.set(formatter.formatCoin(valueSentToMe));
amountAsCoin = valueSentToMe;
amount.set(formatter.formatCoin(amountAsCoin));
direction = "Received with:";
received = true;
@ -86,7 +89,8 @@ public class TransactionsListItem {
}
}
} else {
amount.set(formatter.formatCoin(valueSentToMe.subtract(valueSentFromMe)));
amountAsCoin = valueSentToMe.subtract(valueSentFromMe);
amount.set(formatter.formatCoin(amountAsCoin));
boolean outgoing = false;
for (TransactionOutput transactionOutput : transaction.getOutputs()) {
if (!transactionOutput.isMine(walletService.getWallet())) {
@ -126,7 +130,10 @@ public class TransactionsListItem {
trade.getPayoutTx().getHashAsString().equals(txId)) {
details = "MultiSig payout: " + tradable.getShortId();
} else if (trade.getDisputeState() == Trade.DisputeState.DISPUTE_CLOSED) {
details = "Payout after dispute: " + tradable.getShortId();
if (valueSentToMe.isPositive())
details = "Refund from dispute: " + tradable.getShortId();
else
details = "Nothing refunded from dispute: " + tradable.getShortId();
} else {
details = "Unknown reason: " + tradable.getShortId();
}
@ -139,7 +146,15 @@ public class TransactionsListItem {
addressEntryOptional.get().getContext() == AddressEntry.Context.ARBITRATOR)
details = received ? "Received funds" : "Withdrawn from wallet";
else*/
details = received ? "Received funds" : "Withdrawn from wallet";
if (amountAsCoin.isZero()) {
details = "No refund from dispute";
} else {
details = received ? "Received funds" : "Withdrawn from wallet";
}
if (received)
details = amountAsCoin.isPositive() ? "Received funds" : "No refund from dispute";
else
details = amountAsCoin.isNegative() ? "Withdrawn from wallet" : "No refund from dispute";
}
date.set(formatter.formatDateTime(transaction.getUpdateTime()));

View File

@ -168,11 +168,11 @@ public class TransactionsView extends ActivatableView<VBox, Void> {
Stream<Tradable> concat1 = Stream.concat(openOfferManager.getOpenOffers().stream(), tradeManager.getTrades().stream());
Stream<Tradable> concat2 = Stream.concat(concat1, closedTradableManager.getClosedTrades().stream());
Stream<Tradable> concat3 = Stream.concat(concat2, failedTradesManager.getFailedTrades().stream());
Set<Tradable> concated = concat3.collect(Collectors.toSet());
Set<Tradable> all = concat3.collect(Collectors.toSet());
List<TransactionsListItem> listItems = walletService.getWallet().getRecentTransactions(1000, true).stream()
.map(transaction -> {
Optional<Tradable> tradableOptional = concated.stream()
Optional<Tradable> tradableOptional = all.stream()
.filter(e -> {
String txId = transaction.getHashAsString();
if (e instanceof OpenOffer)

View File

@ -21,7 +21,7 @@ public class Notification extends Popup {
private boolean hasBeenDisplayed;
public Notification() {
width = 320;
width = 345; // 320 visible bg because of insets
NotificationCenter.add(this);
}
@ -123,7 +123,7 @@ public class Notification extends Popup {
@Override
protected void createGridPane() {
super.createGridPane();
gridPane.setPadding(new Insets(20, 20, 20, 20));
gridPane.setPadding(new Insets(15, 15, 30, 30));
}
@Override

View File

@ -6,6 +6,8 @@ import io.bitsquare.arbitration.DisputeManager;
import io.bitsquare.common.UserThread;
import io.bitsquare.gui.Navigation;
import io.bitsquare.gui.main.MainView;
import io.bitsquare.gui.main.disputes.DisputesView;
import io.bitsquare.gui.main.disputes.trader.TraderDisputeView;
import io.bitsquare.gui.main.portfolio.PortfolioView;
import io.bitsquare.gui.main.portfolio.pendingtrades.PendingTradesView;
import io.bitsquare.trade.Trade;
@ -71,7 +73,7 @@ public class NotificationCenter {
EasyBind.subscribe(preferences.useAnimationsProperty(), useAnimations -> NotificationCenter.useAnimations = useAnimations);
}
public void onAllServicesInitialized() {
public void onAllServicesAndViewsInitialized() {
tradeManager.getTrades().addListener((ListChangeListener<Trade>) change -> {
change.next();
if (change.wasRemoved()) {
@ -200,27 +202,31 @@ public class NotificationCenter {
private void onDisputeStateChanged(Trade trade, Trade.DisputeState disputeState) {
Log.traceCall(disputeState.toString());
String message = null;
switch (disputeState) {
case NONE:
break;
case DISPUTE_REQUESTED:
break;
case DISPUTE_STARTED_BY_PEER:
if (disputeManager.findOwnDispute(trade.getId()).isPresent()) {
if (disputeManager.findOwnDispute(trade.getId()).get().isSupportTicket())
message = "Your trading peer has encountered technical problems and requested support for trade with ID " + trade.getShortId() + ".\n" +
"Please await further instructions from the arbitrator.\n" +
"Your funds are safe and will be refunded as soon the problem is resolved.";
else
message = "Your trading peer has requested a dispute for trade with ID " + trade.getShortId() + ".";
if (disputeManager.findOwnDispute(trade.getId()).isPresent()) {
boolean supportTicket = disputeManager.findOwnDispute(trade.getId()).get().isSupportTicket();
switch (disputeState) {
case NONE:
break;
case DISPUTE_REQUESTED:
break;
case DISPUTE_STARTED_BY_PEER:
message = supportTicket ? "Your trading peer has opened a support ticket." : "Your trading peer has requested a dispute.";
break;
case DISPUTE_CLOSED:
message = supportTicket ? "The support ticket hase been closed." : "The dispute has been closed.";
break;
}
if (message != null) {
Notification notification = new Notification().disputeHeadLine(trade.getShortId()).message(message);
if (navigation.getCurrentPath() != null && !navigation.getCurrentPath().contains(TraderDisputeView.class)) {
notification.actionButtonText("Go to \"Support\"")
.onAction(() -> navigation.navigateTo(MainView.class, DisputesView.class, TraderDisputeView.class))
.show();
} else {
notification.show();
}
break;
case DISPUTE_CLOSED:
message = "A support ticket for trade with ID " + trade.getShortId() + " has been closed.";
break;
}
}
if (message != null)
new Notification().tradeHeadLine(trade.getShortId()).message(message).show();
}
}

View File

@ -52,7 +52,9 @@ public class DisplayAlertMessagePopup extends Popup {
headLine = "Important information!";
createGridPane();
addHeadLine();
addSeparator();
addContent();
applyStyles();
PopupManager.queueForDisplay(this);
}

View File

@ -71,7 +71,9 @@ public class EmptyWalletPopup extends Popup {
width = 700;
createGridPane();
addHeadLine();
addSeparator();
addContent();
applyStyles();
PopupManager.queueForDisplay(this);
}

View File

@ -64,8 +64,10 @@ public class EnterPrivKeyPopup extends Popup {
createGridPane();
addHeadLine();
addSeparator();
addInputFields();
addButtons();
applyStyles();
PopupManager.queueForDisplay(this);
}

View File

@ -49,7 +49,9 @@ public class OpenEmergencyTicketPopup extends Popup {
width = 700;
createGridPane();
addHeadLine();
addSeparator();
addContent();
applyStyles();
PopupManager.queueForDisplay(this);
}

View File

@ -58,8 +58,10 @@ public class SelectDepositTxPopup extends Popup {
width = 700;
createGridPane();
addHeadLine();
addSeparator();
addContent();
addCloseButton();
applyStyles();
PopupManager.queueForDisplay(this);
}

View File

@ -68,7 +68,9 @@ public class SendAlertMessagePopup extends Popup {
width = 600;
createGridPane();
addHeadLine();
addSeparator();
addContent();
applyStyles();
PopupManager.queueForDisplay(this);
}

View File

@ -83,8 +83,10 @@ public class WalletPasswordPopup extends Popup {
createGridPane();
addHeadLine();
addSeparator();
addInputFields();
addButtons();
applyStyles();
PopupManager.queueForDisplay(this);
}