Add window icon, change texts, remove balance display

This commit is contained in:
Manfred Karrer 2014-09-28 03:31:27 +02:00
parent 4b117b2e84
commit d2b1c5f37c
22 changed files with 68 additions and 88 deletions

View file

@ -22,6 +22,7 @@ import io.bitsquare.di.BitSquareModule;
import io.bitsquare.gui.AWTSystemTray;
import io.bitsquare.gui.Navigation;
import io.bitsquare.gui.components.Popups;
import io.bitsquare.gui.util.ImageUtil;
import io.bitsquare.gui.util.Profiler;
import io.bitsquare.msg.MessageFacade;
import io.bitsquare.persistence.Persistence;
@ -40,6 +41,7 @@ import java.util.Arrays;
import javafx.application.Application;
import javafx.scene.*;
import javafx.scene.image.*;
import javafx.scene.input.*;
import javafx.stage.Stage;
@ -110,6 +112,12 @@ public class BitSquare extends Application {
settings.applyPersistedSettings((Settings) persistence.read(settings.getClass().getName()));
primaryStage.setTitle("BitSquare (" + APP_NAME + ")");
if (ImageUtil.isRetina())
primaryStage.getIcons().add(new Image(BitSquare.class.getResourceAsStream
("/images/window_icon@2x.png")));
else
primaryStage.getIcons().add(new Image(BitSquare.class.getResourceAsStream
("/images/window_icon.png")));
ViewLoader.setInjector(injector);
@ -136,8 +144,6 @@ public class BitSquare extends Application {
Profiler.initScene(primaryStage.getScene());
// primaryStage.setOnCloseRequest(observable -> stop());
primaryStage.show();
} catch (IOException e) {
log.error(e.getMessage());

View file

@ -35,24 +35,24 @@ public class BankAccount implements Serializable {
private final String accountSecondaryID; // like BIC
private final String accountHolderName;
private final Country country; // where bank is registered
private final String nameOfBank;
// The main currency if account support multiple currencies.
// The user can create multiple bank accounts with same bank account but other currency if his bank account
// support that.
private final Currency currency;
private final String accountTitle;
///////////////////////////////////////////////////////////////////////////////////////////
// Constructor
///////////////////////////////////////////////////////////////////////////////////////////
public BankAccount(BankAccountType bankAccountType, Currency currency, Country country, String accountTitle,
public BankAccount(BankAccountType bankAccountType, Currency currency, Country country, String nameOfBank,
String accountHolderName, String accountPrimaryID, String accountSecondaryID) {
this.bankAccountType = bankAccountType;
this.currency = currency;
this.country = country;
this.accountTitle = accountTitle;
this.nameOfBank = nameOfBank;
this.accountHolderName = accountHolderName;
this.accountPrimaryID = accountPrimaryID;
this.accountSecondaryID = accountSecondaryID;
@ -89,11 +89,11 @@ public class BankAccount implements Serializable {
// we use the accountTitle as unique id
public String getUid() {
return accountTitle;
return nameOfBank;
}
public String getAccountTitle() {
return accountTitle;
public String getNameOfBank() {
return nameOfBank;
}
@ -103,7 +103,7 @@ public class BankAccount implements Serializable {
@Override
public int hashCode() {
return Objects.hashCode(accountTitle);
return Objects.hashCode(nameOfBank);
}
@Override
@ -112,7 +112,7 @@ public class BankAccount implements Serializable {
if (obj == this) return true;
final BankAccount other = (BankAccount) obj;
return accountTitle.equals(other.getUid());
return nameOfBank.equals(other.getUid());
}
@Override
@ -124,7 +124,7 @@ public class BankAccount implements Serializable {
", accountHolderName='" + accountHolderName + '\'' +
", country=" + country +
", currency=" + currency +
", accountTitle='" + accountTitle + '\'' +
", accountTitle='" + nameOfBank + '\'' +
'}';
}
}

View file

@ -97,20 +97,6 @@ public class AWTSystemTray {
}
}
public static void setAlertIcon() {
if (ImageUtil.isRetina())
trayIcon.setImage(getImage(ImageUtil.SYS_TRAY_ALERT_HI_RES));
else
trayIcon.setImage(getImage(ImageUtil.SYS_TRAY_ALERT));
}
public static void setIcon() {
if (ImageUtil.isRetina())
trayIcon.setImage(getImage(ImageUtil.SYS_TRAY_HI_RES));
else
trayIcon.setImage(getImage(ImageUtil.SYS_TRAY));
}
public static void setStageHidden() {
stage.hide();
isStageVisible = false;

View file

@ -154,6 +154,7 @@ public class InfoDisplay extends Parent {
public void setText(String text) {
this.text.set(text);
layout();
}
public void setGridPane(GridPane gridPane) {

View file

@ -19,7 +19,6 @@ package io.bitsquare.gui.main;
import io.bitsquare.bank.BankAccount;
import io.bitsquare.btc.WalletFacade;
import io.bitsquare.btc.listeners.BalanceListener;
import io.bitsquare.gui.UIModel;
import io.bitsquare.gui.util.Profiler;
import io.bitsquare.msg.MessageFacade;
@ -29,8 +28,6 @@ import io.bitsquare.trade.Trade;
import io.bitsquare.trade.TradeManager;
import io.bitsquare.user.User;
import com.google.bitcoin.core.Coin;
import com.google.inject.Inject;
import javafx.beans.property.BooleanProperty;
@ -40,7 +37,6 @@ 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;
@ -62,7 +58,7 @@ class MainModel extends UIModel {
final BooleanProperty backendInited = new SimpleBooleanProperty();
final DoubleProperty networkSyncProgress = new SimpleDoubleProperty();
final BooleanProperty networkSyncComplete = new SimpleBooleanProperty();
final ObjectProperty<Coin> balance = new SimpleObjectProperty<>();
// final ObjectProperty<Coin> balance = new SimpleObjectProperty<>();
final IntegerProperty numPendingTrades = new SimpleIntegerProperty(0);
///////////////////////////////////////////////////////////////////////////////////////////
@ -122,13 +118,13 @@ class MainModel extends UIModel {
onFacadesInitialised();
walletFacade.addBalanceListener(new BalanceListener() {
/* walletFacade.addBalanceListener(new BalanceListener() {
@Override
public void onBalanceChanged(Coin balance) {
updateBalance(balance);
}
});
updateBalance(walletFacade.getWalletBalance());
updateBalance(walletFacade.getWalletBalance());*/
});
}
@ -185,7 +181,7 @@ class MainModel extends UIModel {
numPendingTrades.set(tradeManager.getPendingTrades().size());
}
private void updateBalance(Coin balance) {
/* private void updateBalance(Coin balance) {
this.balance.set(balance);
}
}*/
}

View file

@ -41,7 +41,7 @@ class MainPM extends PresentationModel<MainModel> {
private static final Logger log = LoggerFactory.getLogger(MainPM.class);
final BooleanProperty backendInited = new SimpleBooleanProperty();
final StringProperty balance = new SimpleStringProperty();
// final StringProperty balance = new SimpleStringProperty();
final StringProperty bankAccountsComboBoxPrompt = new SimpleStringProperty();
final BooleanProperty bankAccountsComboBoxDisable = new SimpleBooleanProperty();
final StringProperty splashScreenInfoText = new SimpleStringProperty();
@ -84,8 +84,8 @@ class MainPM extends PresentationModel<MainModel> {
});
model.balance.addListener((ov, oldValue, newValue) -> balance.set(formatter.formatCoinWithCode
(newValue)));
/*model.balance.addListener((ov, oldValue, newValue) -> balance.set(formatter.formatCoinWithCode
(newValue)));*/
model.getBankAccounts().addListener((ListChangeListener<BankAccount>) change -> {
bankAccountsComboBoxDisable.set(change.getList().isEmpty());
@ -136,7 +136,7 @@ class MainPM extends PresentationModel<MainModel> {
return new StringConverter<BankAccount>() {
@Override
public String toString(BankAccount bankAccount) {
return bankAccount.getAccountTitle();
return bankAccount.getNameOfBank();
}
@Override

View file

@ -354,10 +354,10 @@ public class MainViewCB extends ViewCB<MainPM> {
fundsButton = addNavButton(leftNavPane, "Funds", Navigation.Item.FUNDS);
final Pane msgButtonHolder = new Pane();
msgButton = addNavButton(msgButtonHolder, "Message", Navigation.Item.MSG);
msgButton = addNavButton(msgButtonHolder, "Messages", Navigation.Item.MSG);
leftNavPane.getChildren().add(msgButtonHolder);
addBalanceInfo(rightNavPane);
//addBalanceInfo(rightNavPane);
addBankAccountComboBox(rightNavPane);
@ -404,7 +404,7 @@ public class MainViewCB extends ViewCB<MainPM> {
return toggleButton;
}
private void addBalanceInfo(Pane parent) {
/*private void addBalanceInfo(Pane parent) {
final TextField balanceTextField = new TextField();
balanceTextField.setEditable(false);
balanceTextField.setPrefWidth(110);
@ -424,7 +424,7 @@ public class MainViewCB extends ViewCB<MainPM> {
vBox.getChildren().setAll(balanceTextField, titleLabel);
vBox.setAlignment(Pos.CENTER);
parent.getChildren().add(vBox);
}
}*/
private void addBankAccountComboBox(Pane parent) {
final ComboBox<BankAccount> comboBox = new ComboBox<>(presentationModel.getBankAccounts());

View file

@ -144,9 +144,12 @@ public class AccountViewCB extends CachedViewCB<AccountPM> {
case ACCOUNT_SETTINGS:
tab = accountSettingsTab;
tab.setText("Account settings");
arbitratorSettingsTab.setDisable(false);
break;
case ACCOUNT_SETUP:
tab = accountSettingsTab;
tab.setText("Account setup");
arbitratorSettingsTab.setDisable(true);
break;
case ARBITRATOR_SETTINGS:
tab = arbitratorSettingsTab;

View file

@ -151,7 +151,7 @@ class FiatAccountModel extends UIModel {
persistence.write(user);
if (bankAccount != null) {
title.set(bankAccount.getAccountTitle());
title.set(bankAccount.getNameOfBank());
holderName.set(bankAccount.getAccountHolderName());
primaryID.set(bankAccount.getAccountPrimaryID());
secondaryID.set(bankAccount.getAccountSecondaryID());

View file

@ -170,7 +170,7 @@ class FiatAccountPm extends PresentationModel<FiatAccountModel> {
return new StringConverter<BankAccount>() {
@Override
public String toString(BankAccount bankAccount) {
return bankAccount.getAccountTitle();
return bankAccount.getNameOfBank();
}
@Override

View file

@ -47,31 +47,31 @@
</GridPane.margin>
</ComboBox>
<Label text="Account name:" GridPane.rowIndex="1"/>
<InputTextField fx:id="titleTextField" GridPane.columnIndex="1" GridPane.rowIndex="1"/>
<Label text="Name of Bank:" GridPane.rowIndex="1"/>
<InputTextField fx:id="nameOfBankTextField" GridPane.columnIndex="1" GridPane.rowIndex="1"/>
<Label text="Holder name:" GridPane.rowIndex="2"/>
<InputTextField fx:id="holderNameTextField" GridPane.columnIndex="1" GridPane.rowIndex="2"/>
<Label text="Primary ID:" GridPane.rowIndex="3"/>
<InputTextField fx:id="primaryIDTextField" GridPane.columnIndex="1" GridPane.rowIndex="3"/>
<Label text="Secondary ID:" GridPane.rowIndex="4"/>
<InputTextField fx:id="secondaryIDTextField" GridPane.columnIndex="1" GridPane.rowIndex="4"/>
<Label text="Currency:" GridPane.rowIndex="5"/>
<ComboBox fx:id="currencyComboBox" promptText="Select currency"
onAction="#onSelectCurrency" GridPane.columnIndex="1"
GridPane.rowIndex="5"/>
<Label text="Country of payments account:" GridPane.rowIndex="6"/>
<HBox GridPane.columnIndex="1" GridPane.rowIndex="6" spacing="10">
<Label text="Location of Bank:" GridPane.rowIndex="2"/>
<HBox GridPane.columnIndex="1" GridPane.rowIndex="2" spacing="10">
<ComboBox fx:id="regionComboBox" promptText="Select region"
onAction="#onSelectRegion" prefWidth="150.0"/>
<ComboBox fx:id="countryComboBox" promptText="Select country" onAction="#onSelectCountry"
visible="false" prefWidth="150.0"/>
</HBox>
<Label text="Your name:" GridPane.rowIndex="3"/>
<InputTextField fx:id="holderNameTextField" GridPane.columnIndex="1" GridPane.rowIndex="3"/>
<Label text="IBAN:" GridPane.rowIndex="4"/>
<InputTextField fx:id="primaryIDTextField" GridPane.columnIndex="1" GridPane.rowIndex="4"/>
<Label text="BIC:" GridPane.rowIndex="5"/>
<InputTextField fx:id="secondaryIDTextField" GridPane.columnIndex="1" GridPane.rowIndex="5"/>
<Label text="Currency:" GridPane.rowIndex="6"/>
<ComboBox fx:id="currencyComboBox" promptText="Select currency"
onAction="#onSelectCurrency" GridPane.columnIndex="1"
GridPane.rowIndex="6"/>
<InfoDisplay gridPane="$root" onAction="#onOpenSetupHelp" rowIndex="7"
text="The payments account data will be saved in a encrypted form to the Bitcoin block chain and will be used in the trade process for account verification."/>

View file

@ -59,7 +59,7 @@ public class FiatAccountViewCB extends CachedViewCB<FiatAccountPm> implements Co
@FXML HBox buttonsHBox;
@FXML ComboBox<Region> regionComboBox;
@FXML ComboBox<Country> countryComboBox;
@FXML InputTextField titleTextField, holderNameTextField, primaryIDTextField, secondaryIDTextField;
@FXML InputTextField nameOfBankTextField, holderNameTextField, primaryIDTextField, secondaryIDTextField;
@FXML Button saveButton, completedButton, removeBankAccountButton;
@FXML ComboBox<BankAccount> selectionComboBox;
@FXML ComboBox<BankAccountType> typesComboBox;
@ -91,7 +91,7 @@ public class FiatAccountViewCB extends CachedViewCB<FiatAccountPm> implements Co
regionComboBox.setConverter(presentationModel.getRegionConverter());
countryComboBox.setConverter(presentationModel.getCountryConverter());
titleTextField.setValidator(presentationModel.getBankAccountNumberValidator());
nameOfBankTextField.setValidator(presentationModel.getBankAccountNumberValidator());
holderNameTextField.setValidator(presentationModel.getBankAccountNumberValidator());
primaryIDTextField.setValidator(presentationModel.getBankAccountNumberValidator());
secondaryIDTextField.setValidator(presentationModel.getBankAccountNumberValidator());
@ -252,7 +252,7 @@ public class FiatAccountViewCB extends CachedViewCB<FiatAccountPm> implements Co
private void setupBindings() {
// input
titleTextField.textProperty().bindBidirectional(presentationModel.title);
nameOfBankTextField.textProperty().bindBidirectional(presentationModel.title);
holderNameTextField.textProperty().bindBidirectional(presentationModel.holderName);
primaryIDTextField.textProperty().bindBidirectional(presentationModel.primaryID);
secondaryIDTextField.textProperty().bindBidirectional(presentationModel.secondaryID);

View file

@ -121,10 +121,10 @@ public class AccountSetupViewCB extends ViewCB implements MultiStepNavigation {
"Define your preferences with whom you want to trade",
Navigation.Item.RESTRICTIONS);
fiatAccount = new WizardItem(this, " Setup Payments account(s)",
"You need to add a payments account to your trading account",
"You need to setup at least one payment account",
Navigation.Item.FIAT_ACCOUNT);
registration = new WizardItem(this, "Register your account",
"Pay in the registration fee of 0.0002 BTC and store your account in the BTC block chain",
"The registration in the Blockchain requires a payment of 0.0002 BTC",
Navigation.Item.REGISTRATION);
leftVBox.getChildren().addAll(seedWords, password, restrictions, fiatAccount, registration);

View file

@ -271,10 +271,9 @@ public class PendingTradesViewCB extends CachedViewCB<PendingTradesPM> {
statusTextField.setText("Deposit transaction has been published. You need to wait for at least " +
"one block chain confirmation.");
infoDisplay.setText("The Bitcoin buyer needs to wait for at least one block chain confirmation to" +
infoDisplay.setText("You need to wait for at least one block chain confirmation to" +
" be sure that the deposit funding has not been double spent. For higher trade volumes we" +
" recommend to wait up to 6 confirmations.");
infoDisplay.layout();
break;
case OFFERER_BUYER_START_PAYMENT:
processBar.setSelectedIndex(1);
@ -285,7 +284,6 @@ public class PendingTradesViewCB extends CachedViewCB<PendingTradesPM> {
"Please start now the payment.");
infoDisplay.setText("You are now safe to start the payment. You can wait for up to 6 block chain " +
"confirmations if you want more security.");
infoDisplay.layout();
paymentMethodTextField.setText(presentationModel.getPaymentMethod());
holderNameTextField.setText(presentationModel.getHolderName());
@ -296,7 +294,6 @@ public class PendingTradesViewCB extends CachedViewCB<PendingTradesPM> {
"payment account. When the transfer is completed inform the other trader by " +
"clicking the button below.",
presentationModel.getCurrencyCode()));
paymentsInfoDisplay.layout();
break;
case OFFERER_BUYER_WAIT_CONFIRM_PAYMENT_RECEIVED:
processBar.setSelectedIndex(2);
@ -307,7 +304,6 @@ public class PendingTradesViewCB extends CachedViewCB<PendingTradesPM> {
infoDisplay.setText(BSResources.get("When the confirmation that the {0} payment arrived at the " +
"Bitcoin sellers payment account, the payout transaction will be published.",
presentationModel.getCurrencyCode()));
infoDisplay.layout();
break;
case OFFERER_BUYER_COMPLETED:
processBar.setSelectedIndex(3);
@ -327,9 +323,8 @@ public class PendingTradesViewCB extends CachedViewCB<PendingTradesPM> {
fiatTextField.setText(presentationModel.getFiatVolume());
feesTextField.setText(presentationModel.getTotalFees());
collateralTextField.setText(presentationModel.getCollateral());
summaryInfoDisplay.setText("Your trade bond has been refunded to you. " +
summaryInfoDisplay.setText("Your security deposit has been refunded to you. " +
"You can review the details to that trade any time in the closed trades section.");
summaryInfoDisplay.layout();
break;
}
}
@ -356,7 +351,6 @@ public class PendingTradesViewCB extends CachedViewCB<PendingTradesPM> {
"double-spent. " +
"For higher trade volumes it is recommended to wait up to 6 confirmations.",
presentationModel.getCurrencyCode()));
infoDisplay.layout();
break;
case TAKER_SELLER_WAIT_PAYMENT_STARTED:
processBar.setSelectedIndex(1);
@ -368,7 +362,6 @@ public class PendingTradesViewCB extends CachedViewCB<PendingTradesPM> {
infoDisplay.setText(BSResources.get("You will get informed when the other trader has indicated " +
"the {0} payment has been started.",
presentationModel.getCurrencyCode()));
infoDisplay.layout();
break;
case TAKER_SELLER_CONFIRM_RECEIVE_PAYMENT:
processBar.setSelectedIndex(2);
@ -380,9 +373,8 @@ public class PendingTradesViewCB extends CachedViewCB<PendingTradesPM> {
presentationModel.getCurrencyCode()));
infoDisplay.setText(BSResources.get("It is important that you confirm when you have received the " +
"{0} payment as this will publish the payout transaction where you get returned " +
"your trade bond and the Bitcoin buyer receive the Bitcoin amount you sold.",
"your security deposit and the Bitcoin buyer receive the Bitcoin amount you sold.",
presentationModel.getCurrencyCode()));
infoDisplay.layout();
break;
case TAKER_SELLER_COMPLETED:
@ -393,10 +385,9 @@ public class PendingTradesViewCB extends CachedViewCB<PendingTradesPM> {
statusTextField.setText("Congratulations! Trade has successfully completed.");
infoDisplay.setText("The trade is now completed and you can withdraw the refunded Bitcoin from " +
"the trade bond to any external wallet. " +
"the security deposit to any external wallet. " +
"To protect your privacy you should take care that your coins are not merged in " +
"that external wallet. For more information about privacy see our help pages.");
infoDisplay.layout();
btcLabel.setText("You have sold:");
fiatLabel.setText("You have received:");
@ -404,9 +395,8 @@ public class PendingTradesViewCB extends CachedViewCB<PendingTradesPM> {
fiatTextField.setText(presentationModel.getFiatVolume());
feesTextField.setText(presentationModel.getTotalFees());
collateralTextField.setText(presentationModel.getCollateral());
summaryInfoDisplay.setText("Your trade bond has been refunded to you. " +
summaryInfoDisplay.setText("Your security deposit has been refunded to you. " +
"You can review the details to that trade any time in the closed trades section.");
summaryInfoDisplay.layout();
break;
}
}

View file

@ -33,8 +33,6 @@ public class ImageUtil {
// System tray use AWT and there is no CSS support for loading retina supported images
public static final String SYS_TRAY = "/images/system_tray_icon.png";
public static final String SYS_TRAY_HI_RES = "/images/system_tray_icon@2x.png";
public static final String SYS_TRAY_ALERT = "/images/system_tray_icon_alert.png";
public static final String SYS_TRAY_ALERT_HI_RES = "/images/system_tray_icon_alert@2x.png";
public static final String REMOVE_ICON = "image-remove";

View file

@ -50,9 +50,9 @@ createOffer.fundsBox.totalsNeeded.prompt=Will be calculated from the Bitcoin amo
createOffer.fundsBox.address=Trade wallet address:
createOffer.fundsBox.balance=Trade wallet balance:
createOffer.fundsBox.info=For every offer there is a dedicated trade wallet. You need to fund that trade wallet with the necessary Bitcoin amount. Those funds are reserved and will be used in the case that your offer gets executed. If you cancel your offer you can withdraw your funds from that trading wallet. The only payment which will be done now when placing the offer is the offer fee payment.
createOffer.fundsBox.collateral=Trade bond ({0}):
createOffer.fundsBox.collateral=Security deposit ({0}):
createOffer.fundsBox.offerFee=Offer fee:
createOffer.fundsBox.networkFee=Bitcoin network fee:
createOffer.fundsBox.networkFee=Mining fee:
createOffer.fundsBox.total=Total:
createOffer.fundsBox.showAdvanced=Show advanced settings
createOffer.fundsBox.hideAdvanced=Hide advanced settings
@ -99,9 +99,9 @@ takeOffer.fundsBox.address=Trade wallet address:
takeOffer.fundsBox.balance=Trade wallet balance:
takeOffer.fundsBox.info=For every offer there is a dedicated trade wallet. You need to fund that trade wallet with the necessary Bitcoin amount. Those funds will be paid in to a locked deposit address. At the end of a successful trade you will get back your collateral and the Bitcoin amount you sold will be transferred to the buyer.
takeOffer.fundsBox.amount=Amount to sell:
takeOffer.fundsBox.collateral=Trade bond ({0}):
takeOffer.fundsBox.collateral=Security deposit ({0}):
takeOffer.fundsBox.offerFee=Offer fee:
takeOffer.fundsBox.networkFee=Bitcoin network fee:
takeOffer.fundsBox.networkFee=Mining fee:
takeOffer.fundsBox.total=Total:
takeOffer.fundsBox.showAdvanced=Show advanced settings
takeOffer.fundsBox.hideAdvanced=Hide advanced settings

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5 KiB

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB