diff --git a/src/main/java/io/bitsquare/gui/bitsquare.css b/src/main/java/io/bitsquare/gui/bitsquare.css index 56e259fce0..480f873dbc 100644 --- a/src/main/java/io/bitsquare/gui/bitsquare.css +++ b/src/main/java/io/bitsquare/gui/bitsquare.css @@ -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; diff --git a/src/main/java/io/bitsquare/gui/components/BalanceTextField.java b/src/main/java/io/bitsquare/gui/components/BalanceTextField.java index f5042f850d..ca70d4298c 100644 --- a/src/main/java/io/bitsquare/gui/components/BalanceTextField.java +++ b/src/main/java/io/bitsquare/gui/components/BalanceTextField.java @@ -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); /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/main/java/io/bitsquare/gui/components/InputTextField.java b/src/main/java/io/bitsquare/gui/components/InputTextField.java index cb4de52f3c..027c286508 100644 --- a/src/main/java/io/bitsquare/gui/components/InputTextField.java +++ b/src/main/java/io/bitsquare/gui/components/InputTextField.java @@ -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 validationResult = new SimpleObjectProperty<> (new InputValidator.ValidationResult(true)); diff --git a/src/main/java/io/bitsquare/gui/components/ValidatedTextField.java b/src/main/java/io/bitsquare/gui/components/ValidatedTextField.java index 464074039d..81dac71137 100644 --- a/src/main/java/io/bitsquare/gui/components/ValidatedTextField.java +++ b/src/main/java/io/bitsquare/gui/components/ValidatedTextField.java @@ -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(); diff --git a/src/main/java/io/bitsquare/gui/components/processbar/ProcessStepBar.java b/src/main/java/io/bitsquare/gui/components/processbar/ProcessStepBar.java index c9fb087fa7..5d1d100611 100644 --- a/src/main/java/io/bitsquare/gui/components/processbar/ProcessStepBar.java +++ b/src/main/java/io/bitsquare/gui/components/processbar/ProcessStepBar.java @@ -71,6 +71,10 @@ public class ProcessStepBar extends Control { ((ProcessStepBarSkin) getSkin()).setSelectedIndex(selectedIndex); } + public void reset() { + if (getSkin() != null) + ((ProcessStepBarSkin) getSkin()).reset(); + } /////////////////////////////////////////////////////////////////////////////////////////// // Getters @@ -86,4 +90,6 @@ public class ProcessStepBar extends Control { public IntegerProperty selectedIndexProperty() { return selectedIndex; } + + } diff --git a/src/main/java/io/bitsquare/gui/components/processbar/ProcessStepBarSkin.java b/src/main/java/io/bitsquare/gui/components/processbar/ProcessStepBarSkin.java index 7cc89db43e..7e076b0159 100644 --- a/src/main/java/io/bitsquare/gui/components/processbar/ProcessStepBarSkin.java +++ b/src/main/java/io/bitsquare/gui/components/processbar/ProcessStepBarSkin.java @@ -60,6 +60,19 @@ class ProcessStepBarSkin extends BehaviorSkinBase, 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 extends BehaviorSkinBase, 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 extends BehaviorSkinBase, Behavior } } - public static class LabelWithBorder extends Label { final double borderWidth = 1; private final double arrowWidth = 10; @@ -144,13 +155,18 @@ class ProcessStepBarSkin extends BehaviorSkinBase, 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 extends BehaviorSkinBase, 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() { diff --git a/src/main/java/io/bitsquare/gui/main/MainModel.java b/src/main/java/io/bitsquare/gui/main/MainModel.java index 87a8ca1596..965ea67a61 100644 --- a/src/main/java/io/bitsquare/gui/main/MainModel.java +++ b/src/main/java/io/bitsquare/gui/main/MainModel.java @@ -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 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) change -> updateNumPendingTrades()); + updateNumPendingTrades(); backendInited.set(true); } + private void updateNumPendingTrades() { + numPendingTrades.set(tradeManager.getTrades().size()); + } + private void updateBalance(Coin balance) { this.balance.set(balance); } diff --git a/src/main/java/io/bitsquare/gui/main/MainPM.java b/src/main/java/io/bitsquare/gui/main/MainPM.java index fa11e7c8d8..c8fb6a723d 100644 --- a/src/main/java/io/bitsquare/gui/main/MainPM.java +++ b/src/main/java/io/bitsquare/gui/main/MainPM.java @@ -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 { 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 { 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) diff --git a/src/main/java/io/bitsquare/gui/main/MainViewCB.java b/src/main/java/io/bitsquare/gui/main/MainViewCB.java index 0a4a3844b2..35f8d8b491 100644 --- a/src/main/java/io/bitsquare/gui/main/MainViewCB.java +++ b/src/main/java/io/bitsquare/gui/main/MainViewCB.java @@ -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 { 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 { 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(); } diff --git a/src/main/java/io/bitsquare/gui/main/account/setup/AccountSetupViewCB.java b/src/main/java/io/bitsquare/gui/main/account/setup/AccountSetupViewCB.java index 332be64d41..2026c2a625 100644 --- a/src/main/java/io/bitsquare/gui/main/account/setup/AccountSetupViewCB.java +++ b/src/main/java/io/bitsquare/gui/main/account/setup/AccountSetupViewCB.java @@ -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; } diff --git a/src/main/java/io/bitsquare/gui/main/orders/pending/PendingTradesModel.java b/src/main/java/io/bitsquare/gui/main/orders/pending/PendingTradesModel.java index 909490acb8..4f88f7599e 100644 --- a/src/main/java/io/bitsquare/gui/main/orders/pending/PendingTradesModel.java +++ b/src/main/java/io/bitsquare/gui/main/orders/pending/PendingTradesModel.java @@ -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 tradeState = new SimpleObjectProperty<>(); final ObjectProperty 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); } diff --git a/src/main/java/io/bitsquare/gui/main/orders/pending/PendingTradesPM.java b/src/main/java/io/bitsquare/gui/main/orders/pending/PendingTradesPM.java index 4215a5c927..dc742d868a 100644 --- a/src/main/java/io/bitsquare/gui/main/orders/pending/PendingTradesPM.java +++ b/src/main/java/io/bitsquare/gui/main/orders/pending/PendingTradesPM.java @@ -63,6 +63,7 @@ public class PendingTradesPM extends PresentationModel { final ObjectProperty state = new SimpleObjectProperty<>(); final ObjectProperty tradeState = new SimpleObjectProperty<>(); final ObjectProperty fault = new SimpleObjectProperty<>(); + final StringProperty txId = new SimpleStringProperty(); /////////////////////////////////////////////////////////////////////////////////////////// // Constructor @@ -83,12 +84,12 @@ public class PendingTradesPM extends PresentationModel { @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 { return model.isOfferer(); } - public String getTxID() { - return model.getTxID(); - } - public WalletFacade getWalletFacade() { return model.getWalletFacade(); } @@ -245,6 +242,9 @@ public class PendingTradesPM extends PresentationModel { break; } } + else { + state.set(null); + } } } diff --git a/src/main/java/io/bitsquare/gui/main/orders/pending/PendingTradesView.fxml b/src/main/java/io/bitsquare/gui/main/orders/pending/PendingTradesView.fxml index 0fbceec04f..8127523af5 100644 --- a/src/main/java/io/bitsquare/gui/main/orders/pending/PendingTradesView.fxml +++ b/src/main/java/io/bitsquare/gui/main/orders/pending/PendingTradesView.fxml @@ -140,8 +140,8 @@ -