Update 2 to new trade process UI

This commit is contained in:
Manfred Karrer 2014-09-24 00:58:25 +02:00
parent f80758ca34
commit 1e692ec8c4
21 changed files with 215 additions and 157 deletions

View File

@ -85,12 +85,6 @@ lower gradient color on tab: dddddd
-fx-fill: -fx-accent;
}
#nav-alert-button {
-fx-background-color: transparent;
-fx-cursor: hand;
-fx-border-style: none;
}
#nav-button-label {
-fx-font-size: 10;
}
@ -99,7 +93,11 @@ lower gradient color on tab: dddddd
-fx-font-weight: bold;
-fx-alignment: center;
}
#nav-alert-label {
-fx-font-weight: bold;
-fx-font-size: 11;
-fx-text-fill: white;
}
.text-field:readonly {
-fx-text-fill: #000000;
-fx-background-color: #FAFAFA;
@ -302,10 +300,6 @@ textfield */
-fx-background-insets: 0 0 0 0,0,1;
}
#content-pane-label {
-fx-font-size: 14;
-fx-text-fill: black;
}
#info-icon-label {
-fx-font-size:16;
-fx-text-fill: #333000;
@ -356,22 +350,22 @@ textfield */
#wizard-title-active {
-fx-font-weight: bold;
-fx-font-size: 16;
-fx-text-fill: black;
-fx-text-fill: #333333;
}
#wizard-title-completed {
-fx-font-weight: bold;
-fx-font-size: 16;
-fx-text-fill: black;
-fx-text-fill: #333333;
}
#wizard-sub-title-deactivated {
-fx-text-fill: #CCCCCC;
}
#wizard-sub-title-active {
-fx-text-fill: black;
-fx-text-fill: #333333;
}
#wizard-sub-title-completed {
-fx-text-fill: black;
-fx-text-fill: #333333;
}
#wizard-item-background-deactivated {
@ -417,7 +411,7 @@ textfield */
#wizard-title-active {
-fx-font-weight: bold;
-fx-font-size: 16;
-fx-text-fill: black;
-fx-text-fill: #333333;
}
#wizard-title-selected {
-fx-font-weight: bold;

View File

@ -42,8 +42,8 @@ public class BalanceTextField extends AnchorPane {
private final Tooltip progressIndicatorTooltip;
private final ConfidenceProgressIndicator progressIndicator;
private final Effect fundedEffect = new DropShadow(BlurType.GAUSSIAN, Color.GREEN, 4, 0.0, 0, 0);
private final Effect notFundedEffect = new DropShadow(BlurType.GAUSSIAN, Color.ORANGERED, 4, 0.0, 0, 0);
private final Effect fundedEffect = new DropShadow(BlurType.THREE_PASS_BOX, Color.GREEN, 4, 0.0, 0, 0);
private final Effect notFundedEffect = new DropShadow(BlurType.THREE_PASS_BOX, Color.ORANGERED, 4, 0.0, 0, 0);
///////////////////////////////////////////////////////////////////////////////////////////

View File

@ -50,7 +50,7 @@ import org.slf4j.LoggerFactory;
public class InputTextField extends TextField {
private static final Logger log = LoggerFactory.getLogger(InputTextField.class);
private final Effect invalidEffect = new DropShadow(BlurType.GAUSSIAN, Color.RED, 4, 0.0, 0, 0);
private final Effect invalidEffect = new DropShadow(BlurType.THREE_PASS_BOX, Color.RED, 4, 0.0, 0, 0);
private final ObjectProperty<InputValidator.ValidationResult> validationResult = new SimpleObjectProperty<>
(new InputValidator.ValidationResult(true));

View File

@ -55,7 +55,7 @@ public class ValidatedTextField extends TextField {
private final IntegerProperty minLength;
private final IntegerProperty maxLength;
private Effect invalidEffect = new DropShadow(BlurType.GAUSSIAN, Color.RED, 4, 0.0, 0, 0);
private Effect invalidEffect = new DropShadow(BlurType.THREE_PASS_BOX, Color.RED, 4, 0.0, 0, 0);
public ValidatedTextField() {
super();

View File

@ -71,6 +71,10 @@ public class ProcessStepBar<T> extends Control {
((ProcessStepBarSkin) getSkin()).setSelectedIndex(selectedIndex);
}
public void reset() {
if (getSkin() != null)
((ProcessStepBarSkin) getSkin()).reset();
}
///////////////////////////////////////////////////////////////////////////////////////////
// Getters
@ -86,4 +90,6 @@ public class ProcessStepBar<T> extends Control {
public IntegerProperty selectedIndexProperty() {
return selectedIndex;
}
}

View File

@ -60,6 +60,19 @@ class ProcessStepBarSkin<T> extends BehaviorSkinBase<ProcessStepBar<T>, Behavior
}
///////////////////////////////////////////////////////////////////////////////////////////
// Methods
///////////////////////////////////////////////////////////////////////////////////////////
public void reset() {
prevLabelWithBorder = null;
for (int i = 0; i < labelWithBorders.size(); i++) {
currentLabelWithBorder = labelWithBorders.get(i);
currentLabelWithBorder.open();
}
}
///////////////////////////////////////////////////////////////////////////////////////////
// Setters
///////////////////////////////////////////////////////////////////////////////////////////
@ -79,22 +92,21 @@ class ProcessStepBarSkin<T> extends BehaviorSkinBase<ProcessStepBar<T>, Behavior
i++;
}
currentLabelWithBorder.select();
currentLabelWithBorder.current();
}
}
public void setSelectedIndex(int index) {
this.index = index;
if (index < labelWithBorders.size()) {
for (int i = 0; i <= index; i++) {
if (prevLabelWithBorder != null)
prevLabelWithBorder.deSelect();
prevLabelWithBorder.past();
currentLabelWithBorder = labelWithBorders.get(i);
currentLabelWithBorder.select();
currentLabelWithBorder.current();
prevLabelWithBorder = currentLabelWithBorder;
}
@ -121,7 +133,6 @@ class ProcessStepBarSkin<T> extends BehaviorSkinBase<ProcessStepBar<T>, Behavior
}
}
public static class LabelWithBorder extends Label {
final double borderWidth = 1;
private final double arrowWidth = 10;
@ -144,13 +155,18 @@ class ProcessStepBarSkin<T> extends BehaviorSkinBase<ProcessStepBar<T>, Behavior
this.setShape(createButtonShape());
open();
}
public void open() {
log.debug("select " + processStepItem.getLabel());
BorderStroke borderStroke = new BorderStroke(Colors.LIGHT_GREY, BorderStrokeStyle.SOLID, null,
new BorderWidths(borderWidth, borderWidth, borderWidth, borderWidth), Insets.EMPTY);
this.setBorder(new Border(borderStroke));
setTextFill(Colors.LIGHT_GREY);
}
public void select() {
public void current() {
log.debug("select " + processStepItem.getLabel());
BorderStroke borderStroke = new BorderStroke(Colors.BLUE, BorderStrokeStyle.SOLID, null,
new BorderWidths(borderWidth, borderWidth, borderWidth, borderWidth), Insets.EMPTY);
@ -158,12 +174,12 @@ class ProcessStepBarSkin<T> extends BehaviorSkinBase<ProcessStepBar<T>, Behavior
setTextFill(Colors.BLUE);
}
public void deSelect() {
public void past() {
log.debug("deSelect " + processStepItem.getLabel());
BorderStroke borderStroke = new BorderStroke(Colors.GREEN, BorderStrokeStyle.SOLID, null,
BorderStroke borderStroke = new BorderStroke(Colors.DARK_GREY, BorderStrokeStyle.SOLID, null,
new BorderWidths(borderWidth, borderWidth, borderWidth, borderWidth), Insets.EMPTY);
this.setBorder(new Border(borderStroke));
setTextFill(Colors.GREEN);
setTextFill(Colors.DARK_GREY);
}
public double getArrowWidth() {

View File

@ -25,6 +25,7 @@ import io.bitsquare.gui.util.Profiler;
import io.bitsquare.msg.MessageFacade;
import io.bitsquare.msg.listeners.BootstrapListener;
import io.bitsquare.persistence.Persistence;
import io.bitsquare.trade.Trade;
import io.bitsquare.trade.TradeManager;
import io.bitsquare.user.User;
@ -34,10 +35,13 @@ import com.google.inject.Inject;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.collections.MapChangeListener;
import javafx.collections.ObservableList;
import org.slf4j.Logger;
@ -58,9 +62,8 @@ class MainModel extends UIModel {
final BooleanProperty backendInited = new SimpleBooleanProperty();
final DoubleProperty networkSyncProgress = new SimpleDoubleProperty();
final BooleanProperty networkSyncComplete = new SimpleBooleanProperty();
final BooleanProperty takeOfferRequested = new SimpleBooleanProperty();
final ObjectProperty<Coin> balance = new SimpleObjectProperty<>();
final IntegerProperty numPendingTrades = new SimpleIntegerProperty(0);
///////////////////////////////////////////////////////////////////////////////////////////
// Constructor
@ -171,11 +174,16 @@ class MainModel extends UIModel {
}
});
tradeManager.addTakeOfferRequestListener((offerId, sender) -> takeOfferRequested.set(true));
tradeManager.getTrades().addListener((MapChangeListener<String, Trade>) change -> updateNumPendingTrades());
updateNumPendingTrades();
backendInited.set(true);
}
private void updateNumPendingTrades() {
numPendingTrades.set(tradeManager.getTrades().size());
}
private void updateBalance(Coin balance) {
this.balance.set(balance);
}

View File

@ -24,8 +24,10 @@ import io.bitsquare.gui.util.BSFormatter;
import com.google.inject.Inject;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.collections.ListChangeListener;
@ -44,7 +46,7 @@ class MainPM extends PresentationModel<MainModel> {
final BooleanProperty bankAccountsComboBoxDisable = new SimpleBooleanProperty();
final StringProperty splashScreenInfoText = new SimpleStringProperty();
final BooleanProperty networkSyncComplete = new SimpleBooleanProperty();
final BooleanProperty takeOfferRequested = new SimpleBooleanProperty();
final IntegerProperty numPendingTrades = new SimpleIntegerProperty();
///////////////////////////////////////////////////////////////////////////////////////////
@ -68,7 +70,7 @@ class MainPM extends PresentationModel<MainModel> {
backendInited.bind(model.backendInited);
networkSyncComplete.bind(model.networkSyncComplete);
takeOfferRequested.bind(model.takeOfferRequested);
numPendingTrades.bind(model.numPendingTrades);
model.networkSyncProgress.addListener((ov, oldValue, newValue) -> {
if ((double) newValue > 0)

View File

@ -42,8 +42,10 @@ import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.*;
import javafx.scene.control.*;
import javafx.scene.effect.*;
import javafx.scene.image.*;
import javafx.scene.layout.*;
import javafx.scene.paint.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -64,6 +66,7 @@ public class MainViewCB extends ViewCB<MainPM> {
private ToggleButton buyButton, sellButton, homeButton, msgButton, ordersButton, fundsButton, settingsButton,
accountButton;
private Pane ordersButtonButtonPane;
private Label numPendingTradesLabel;
///////////////////////////////////////////////////////////////////////////////////////////
@ -179,25 +182,44 @@ public class MainViewCB extends ViewCB<MainPM> {
addMainNavigation();
}
private void applyPendingTradesInfoIcon(int numPendingTrades) {
log.debug("numPendingTrades " + numPendingTrades);
if (numPendingTrades > 0) {
if (ordersButtonButtonPane.getChildren().size() == 1) {
ImageView icon = new ImageView();
icon.setLayoutX(0.5);
icon.setId("image-alert-round");
numPendingTradesLabel = new Label(String.valueOf(numPendingTrades));
numPendingTradesLabel.relocate(5, 1);
numPendingTradesLabel.setId("nav-alert-label");
Pane alert = new Pane();
alert.relocate(30, 9);
alert.setMouseTransparent(true);
alert.setEffect(new DropShadow(4, 1, 2, Color.GREY));
alert.getChildren().addAll(icon, numPendingTradesLabel);
ordersButtonButtonPane.getChildren().add(alert);
AWTSystemTray.setAlertIcon();
}
else {
numPendingTradesLabel.setText(String.valueOf(numPendingTrades));
}
}
else {
if (ordersButtonButtonPane.getChildren().size() > 1)
ordersButtonButtonPane.getChildren().remove(1);
AWTSystemTray.setIcon();
}
}
private void onMainNavigationAdded() {
Profiler.printMsgWithTime("MainController.ondMainNavigationAdded");
presentationModel.takeOfferRequested.addListener((ov, olaValue, newValue) -> {
ImageView icon = new ImageView();
icon.setId("image-alert-round");
final Button alertButton = new Button("", icon);
alertButton.setId("nav-alert-button");
alertButton.relocate(30, 9);
alertButton.setOnAction((e) ->
navigation.navigationTo(Navigation.Item.MAIN,
Navigation.Item.ORDERS,
Navigation.Item.PENDING_TRADES));
Tooltip.install(alertButton, new Tooltip("Your offer has been accepted"));
ordersButtonButtonPane.getChildren().add(alertButton);
AWTSystemTray.setAlertIcon();
});
presentationModel.numPendingTrades.addListener((ov, olaValue, newValue) -> applyPendingTradesInfoIcon((int)
newValue));
applyPendingTradesInfoIcon(presentationModel.numPendingTrades.get());
navigation.navigateToLastStoredItem();
onContentAdded();
}

View File

@ -109,6 +109,7 @@ public class AccountSetupViewCB extends ViewCB implements MultiStepNavigation {
// triggers navigationTo
childController = seedWords.show();
}
@Override
@ -230,6 +231,7 @@ class WizardItem extends HBox {
imageView.setId("image-arrow-blue");
titleLabel.setId("wizard-title-active");
subTitleLabel.setId("wizard-sub-title-active");
return childController;
}

View File

@ -35,6 +35,8 @@ import javafx.beans.property.IntegerProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.collections.FXCollections;
import javafx.collections.MapChangeListener;
import javafx.collections.ObservableList;
@ -55,6 +57,7 @@ public class PendingTradesModel extends UIModel {
final ObjectProperty<Trade.State> tradeState = new SimpleObjectProperty<>();
final ObjectProperty<Throwable> fault = new SimpleObjectProperty<>();
final StringProperty txId = new SimpleStringProperty();
///////////////////////////////////////////////////////////////////////////////////////////
@ -121,6 +124,9 @@ public class PendingTradesModel extends UIModel {
currentItem = item;
isOfferer = tradeManager.isTradeMyOffer(currentItem.getTrade());
// we want to re-trigger a change if the state is the same but different trades
tradeState.set(null);
selectedIndex.set(pendingTrades.indexOf(item));
Trade currentTrade = currentItem.getTrade();
if (currentTrade.getDepositTx() != null) {
@ -135,6 +141,11 @@ public class PendingTradesModel extends UIModel {
.getHashAsString()));
}
if (currentItem.getTrade().getDepositTx() != null)
txId.set(currentItem.getTrade().getDepositTx().getHashAsString());
else
txId.set("");
currentTrade.stateProperty().addListener((ov, oldValue, newValue) -> tradeState.set(newValue));
tradeState.set(currentTrade.stateProperty().get());
@ -172,13 +183,6 @@ public class PendingTradesModel extends UIModel {
return currentItem.getTrade();
}
public String getTxID() {
if (currentItem.getTrade().getDepositTx() != null)
return currentItem.getTrade().getDepositTx().getHashAsString();
else
return null;
}
public Coin getTotalFees() {
Coin tradeFee = isOfferer() ? FeePolicy.CREATE_OFFER_FEE : FeePolicy.TAKE_OFFER_FEE;
return tradeFee.add(FeePolicy.TX_FEE);
@ -193,7 +197,9 @@ public class PendingTradesModel extends UIModel {
///////////////////////////////////////////////////////////////////////////////////////////
private void updateConfidence(TransactionConfidence confidence) {
if (confidence != null && confidence.getConfidenceType() == TransactionConfidence.ConfidenceType.BUILDING)
if (confidence != null &&
confidence.getConfidenceType() == TransactionConfidence.ConfidenceType.BUILDING
&& currentItem.getTrade().getState() == Trade.State.DEPOSIT_PUBLISHED)
currentItem.getTrade().setState(Trade.State.DEPOSIT_CONFIRMED);
}

View File

@ -63,6 +63,7 @@ public class PendingTradesPM extends PresentationModel<PendingTradesModel> {
final ObjectProperty<State> state = new SimpleObjectProperty<>();
final ObjectProperty<Trade.State> tradeState = new SimpleObjectProperty<>();
final ObjectProperty<Throwable> fault = new SimpleObjectProperty<>();
final StringProperty txId = new SimpleStringProperty();
///////////////////////////////////////////////////////////////////////////////////////////
// Constructor
@ -83,12 +84,12 @@ public class PendingTradesPM extends PresentationModel<PendingTradesModel> {
@Override
public void initialize() {
selectedIndex.bind(model.selectedIndex);
tradeState.addListener((ov, oldValue, newValue) -> {
txId.bind(model.txId);
model.tradeState.addListener((ov, oldValue, newValue) -> {
updateState();
});
fault.bind(model.fault);
super.initialize();
}
@ -143,10 +144,6 @@ public class PendingTradesPM extends PresentationModel<PendingTradesModel> {
return model.isOfferer();
}
public String getTxID() {
return model.getTxID();
}
public WalletFacade getWalletFacade() {
return model.getWalletFacade();
}
@ -245,6 +242,9 @@ public class PendingTradesPM extends PresentationModel<PendingTradesModel> {
break;
}
}
else {
state.set(null);
}
}
}

View File

@ -140,8 +140,8 @@
</GridPane.margin>
</TitledGroupBg>
<Label fx:id="btcLabel" text="You have bought:" GridPane.rowIndex="5" visible="false">
<GridPane.margin>
<Label fx:id="btcLabel" GridPane.rowIndex="5" visible="false">
<GridPane.margin>
<Insets top="60.0"/>
</GridPane.margin>
</Label>
@ -152,7 +152,7 @@
</GridPane.margin>
</TextField>
<Label fx:id="fiatLabel" text="You have paid:" GridPane.rowIndex="6" visible="false"/>
<Label fx:id="fiatLabel" GridPane.rowIndex="6" visible="false"/>
<TextField fx:id="fiatTextField" GridPane.rowIndex="6" GridPane.columnIndex="1" editable="false" visible="false"/>
<Label fx:id="feesLabel" text="Total fees paid:" GridPane.rowIndex="7" visible="false"/>

View File

@ -127,10 +127,31 @@ public class PendingTradesViewCB extends CachedViewCB<PendingTradesPM> {
super.activate();
if (!presentationModel.getPendingTrades().isEmpty()) {
titledGroupBg.setVisible(true);
processBar.setVisible(true);
statusLabel.setVisible(true);
statusTextField.setVisible(true);
txIdLabel.setVisible(true);
txIdTextField.setVisible(true);
infoDisplay.setVisible(true);
if (presentationModel.isOfferer())
setupScreenForOfferer();
else
setupScreenForTaker();
presentationModel.txId.addListener((ov, oldValue, newValue) ->
txIdTextField.setup(presentationModel.getWalletFacade(), newValue));
txIdTextField.setup(presentationModel.getWalletFacade(), presentationModel.txId.get());
}
else {
titledGroupBg.setVisible(false);
processBar.setVisible(false);
statusLabel.setVisible(false);
statusTextField.setVisible(false);
txIdLabel.setVisible(false);
txIdTextField.setVisible(false);
infoDisplay.setVisible(false);
}
}
@ -185,15 +206,6 @@ public class PendingTradesViewCB extends CachedViewCB<PendingTradesPM> {
private void setupScreenForOfferer() {
log.debug("setupScreenForOfferer");
titledGroupBg.setVisible(true);
processBar.setVisible(true);
statusLabel.setVisible(true);
statusTextField.setVisible(true);
txIdLabel.setVisible(true);
txIdTextField.setVisible(true);
infoDisplay.setVisible(true);
log.debug("setupScreenForTaker");
if (processBar.getProcessStepItems() == null) {
List<ProcessStepItem> items = new ArrayList<>();
items.add(new ProcessStepItem("Wait for block chain confirmation"));
@ -203,38 +215,35 @@ public class PendingTradesViewCB extends CachedViewCB<PendingTradesPM> {
processBar.setProcessStepItems(items);
}
txIdTextField.setup(presentationModel.getWalletFacade(), presentationModel.getTxID());
presentationModel.state.addListener((ov, oldValue, newValue) -> applyOffererState(newValue));
applyOffererState(presentationModel.state.get());
}
private void applyOffererState(PendingTradesPM.State state) {
paymentsGroupBg.setVisible(false);
paymentMethodLabel.setVisible(false);
holderNameLabel.setVisible(false);
primaryIdLabel.setVisible(false);
secondaryIdLabel.setVisible(false);
paymentMethodTextField.setVisible(false);
paymentsInfoDisplay.setVisible(false);
paymentsButton.setVisible(false);
holderNameTextField.setVisible(false);
primaryIdTextField.setVisible(false);
secondaryIdTextField.setVisible(false);
summaryGroupBg.setVisible(false);
btcLabel.setVisible(false);
btcTextField.setVisible(false);
fiatLabel.setVisible(false);
fiatTextField.setVisible(false);
feesLabel.setVisible(false);
feesTextField.setVisible(false);
collateralLabel.setVisible(false);
collateralTextField.setVisible(false);
summaryInfoDisplay.setVisible(false);
if (state != null) {
paymentsGroupBg.setVisible(false);
paymentMethodLabel.setVisible(false);
holderNameLabel.setVisible(false);
primaryIdLabel.setVisible(false);
secondaryIdLabel.setVisible(false);
paymentMethodTextField.setVisible(false);
paymentsInfoDisplay.setVisible(false);
paymentsButton.setVisible(false);
holderNameTextField.setVisible(false);
primaryIdTextField.setVisible(false);
secondaryIdTextField.setVisible(false);
summaryGroupBg.setVisible(false);
btcLabel.setVisible(false);
btcTextField.setVisible(false);
fiatLabel.setVisible(false);
fiatTextField.setVisible(false);
feesLabel.setVisible(false);
feesTextField.setVisible(false);
collateralLabel.setVisible(false);
collateralTextField.setVisible(false);
summaryInfoDisplay.setVisible(false);
switch (state) {
case OFFERER_BUYER_WAIT_TX_CONF:
processBar.setSelectedIndex(0);
@ -300,6 +309,8 @@ public class PendingTradesViewCB extends CachedViewCB<PendingTradesPM> {
collateralTextField.setVisible(true);
summaryInfoDisplay.setVisible(true);
btcLabel.setText("You have bought:");
fiatLabel.setText("You have paid:");
btcTextField.setText(presentationModel.getTradeVolume());
fiatTextField.setText(presentationModel.getFiatVolume());
feesTextField.setText(presentationModel.getTotalFees());
@ -308,16 +319,30 @@ public class PendingTradesViewCB extends CachedViewCB<PendingTradesPM> {
break;
}
}
else {
processBar.reset();
}
}
private void setupScreenForTaker() {
titledGroupBg.setVisible(true);
processBar.setVisible(true);
statusLabel.setVisible(true);
statusTextField.setVisible(true);
txIdLabel.setVisible(true);
txIdTextField.setVisible(true);
infoDisplay.setVisible(true);
log.debug("setupScreenForTaker");
if (processBar.getProcessStepItems() == null) {
List<ProcessStepItem> items = new ArrayList<>();
items.add(new ProcessStepItem("Wait for block chain confirmation"));
items.add(new ProcessStepItem("Wait for payment started"));
items.add(new ProcessStepItem("Confirm payment"));
items.add(new ProcessStepItem("Trade successful completed"));
processBar.setProcessStepItems(items);
}
presentationModel.state.addListener((ov, oldValue, newValue) -> applyTakerState(newValue));
applyTakerState(presentationModel.state.get());
}
private void applyTakerState(PendingTradesPM.State state) {
log.debug("#### state " + state);
confirmPaymentReceiptButton.setVisible(false);
summaryGroupBg.setVisible(false);
btcLabel.setVisible(false);
@ -330,26 +355,7 @@ public class PendingTradesViewCB extends CachedViewCB<PendingTradesPM> {
collateralTextField.setVisible(false);
summaryInfoDisplay.setVisible(false);
log.debug("setupScreenForTaker");
if (processBar.getProcessStepItems() == null) {
List<ProcessStepItem> items = new ArrayList<>();
items.add(new ProcessStepItem("Wait for block chain confirmation"));
items.add(new ProcessStepItem("Wait for payment started"));
items.add(new ProcessStepItem("Confirm payment"));
items.add(new ProcessStepItem("Trade successful completed"));
processBar.setProcessStepItems(items);
}
txIdTextField.setup(presentationModel.getWalletFacade(), presentationModel.getTxID());
presentationModel.state.addListener((ov, oldValue, newValue) -> applyTakerState(newValue));
applyTakerState(presentationModel.state.get());
}
private void applyTakerState(PendingTradesPM.State state) {
log.debug("#### state " + state);
if (state != null) {
confirmPaymentReceiptButton.setVisible(false);
switch (state) {
case TAKER_SELLER_WAIT_TX_CONF:
processBar.setSelectedIndex(0);
@ -392,6 +398,8 @@ public class PendingTradesViewCB extends CachedViewCB<PendingTradesPM> {
collateralTextField.setVisible(true);
summaryInfoDisplay.setVisible(true);
btcLabel.setText("You have sold:");
fiatLabel.setText("You have received:");
btcTextField.setText(presentationModel.getTradeVolume());
fiatTextField.setText(presentationModel.getFiatVolume());
feesTextField.setText(presentationModel.getTotalFees());
@ -400,6 +408,9 @@ public class PendingTradesViewCB extends CachedViewCB<PendingTradesPM> {
break;
}
}
else {
processBar.reset();
}
}

View File

@ -69,11 +69,12 @@ public class BSFormatter {
// no way to remove grouping separator). It seems to be not optimal for user input formatting.
private static CoinFormat coinFormat = CoinFormat.BTC.repeatOptionalDecimals(2, 1);
// format is like: 1,00 never more then 2 decimals
private static final CoinFormat fiatFormat = CoinFormat.FIAT.repeatOptionalDecimals(0, 0);
private static String currencyCode = Currency.getInstance(Locale.getDefault()).getCurrencyCode();
// format is like: 1,00 never more then 2 decimals
private static final CoinFormat fiatFormat = CoinFormat.FIAT.repeatOptionalDecimals(0, 0).code(0, currencyCode);
@Inject
public BSFormatter(User user) {
if (user.currentBankAccountProperty().get() == null)
@ -115,6 +116,7 @@ public class BSFormatter {
public static void setFiatCurrencyCode(String currencyCode) {
BSFormatter.currencyCode = currencyCode;
fiatFormat.code(0, currencyCode);
}

View File

@ -29,7 +29,7 @@ import javafx.scene.paint.*;
//TODO to be removed
@Deprecated
public class BitSquareValidator {
private static final Effect invalidEffect = new DropShadow(BlurType.GAUSSIAN, Color.RED, 4, 0.0, 0, 0);
private static final Effect invalidEffect = new DropShadow(BlurType.THREE_PASS_BOX, Color.RED, 4, 0.0, 0, 0);
private static final String invalidStyle = "-fx-border-color: red";
public static boolean tradeAmountOutOfRange(Coin tradeAmount, Offer offer) {

View File

@ -21,9 +21,9 @@ import javafx.scene.paint.*;
public class Colors {
public static final Paint BLUE = Color.valueOf("#0f87c3");
public static final Paint LIGHT_GREY = Color.valueOf("#AAAAAA");
public static final Paint LIGHT_GREY = Color.valueOf("#CCCCCC");
public static final Paint MID_GREY = Color.valueOf("#666666");
public static final Paint DARK_GREY = Color.valueOf("#333333");
public static final Paint GREEN = Color.valueOf("#00AA00");
public static final Paint GREEN = Color.valueOf("#009900");
}

View File

@ -87,7 +87,7 @@ public class Transitions {
darken.setBrightness(0.0);
blur.setInput(darken);
KeyValue kv2 = new KeyValue(darken.brightnessProperty(), -0.3);
KeyValue kv2 = new KeyValue(darken.brightnessProperty(), -0.1);
KeyFrame kf2 = new KeyFrame(Duration.millis(duration), kv2);
timeline.getKeyFrames().addAll(kf1, kf2);
}

View File

@ -20,8 +20,8 @@ package io.bitsquare.trade;
import io.bitsquare.btc.BlockChainFacade;
import io.bitsquare.btc.WalletFacade;
import io.bitsquare.crypto.CryptoFacade;
import io.bitsquare.gui.components.Popups;
import io.bitsquare.msg.MessageFacade;
import io.bitsquare.msg.listeners.TakeOfferRequestListener;
import io.bitsquare.persistence.Persistence;
import io.bitsquare.settings.Settings;
import io.bitsquare.trade.handlers.ErrorMessageHandler;
@ -48,9 +48,7 @@ import com.google.bitcoin.utils.Fiat;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.inject.Inject;
@ -80,8 +78,6 @@ public class TradeManager {
private final WalletFacade walletFacade;
private final CryptoFacade cryptoFacade;
private final List<TakeOfferRequestListener> takeOfferRequestListeners = new ArrayList<>();
//TODO store TakerAsSellerProtocol in trade
private final Map<String, SellerTakesOfferProtocol> takerAsSellerProtocolMap = new HashMap<>();
private final Map<String, BuyerAcceptsOfferProtocol> offererAsBuyerProtocolMap = new HashMap<>();
@ -132,19 +128,6 @@ public class TradeManager {
}
///////////////////////////////////////////////////////////////////////////////////////////
// Event Listeners
///////////////////////////////////////////////////////////////////////////////////////////
public void addTakeOfferRequestListener(TakeOfferRequestListener listener) {
takeOfferRequestListeners.add(listener);
}
public void removeTakeOfferRequestListener(TakeOfferRequestListener listener) {
takeOfferRequestListeners.remove(listener);
}
///////////////////////////////////////////////////////////////////////////////////////////
// Manage offers
///////////////////////////////////////////////////////////////////////////////////////////
@ -404,9 +387,16 @@ public class TradeManager {
// If the user has shut down the app we lose the offererAsBuyerProtocolMap
// Also we don't support yet offline messaging (mail box)
public void bankTransferInited(String tradeId) {
offererAsBuyerProtocolMap.get(tradeId).onUIEventBankTransferInited();
trades.get(tradeId).setState(Trade.State.PAYMENT_STARTED);
persistTrades();
if (offererAsBuyerProtocolMap.get(tradeId) != null) {
offererAsBuyerProtocolMap.get(tradeId).onUIEventBankTransferInited();
trades.get(tradeId).setState(Trade.State.PAYMENT_STARTED);
persistTrades();
}
else {
// For usability tests we don't want to crash
Popups.openWarningPopup("Sorry, you cannot continue. You have restarted the application in the meantime. " +
"Interruption of the trade process is not supported yet. Will need more time to be implemented.");
}
}
public void onFiatReceived(String tradeId) {
@ -428,7 +418,6 @@ public class TradeManager {
if (tradeMessage instanceof RequestTakeOfferMessage) {
createOffererAsBuyerProtocol(tradeId, sender);
takeOfferRequestListeners.stream().forEach(e -> e.onTakeOfferRequested(tradeId, sender));
}
else if (tradeMessage instanceof RespondToTakeOfferRequestMessage) {
takerAsSellerProtocolMap.get(tradeId).onRespondToTakeOfferRequestMessage(

Binary file not shown.

Before

Width:  |  Height:  |  Size: 360 B

After

Width:  |  Height:  |  Size: 895 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 557 B

After

Width:  |  Height:  |  Size: 2.5 KiB