use of io.bitsquare.locale.TradeCurrency in project bitsquare by bitsquare.
the class GUIUtil method getCurrencyListItemConverter.
public static StringConverter<CurrencyListItem> getCurrencyListItemConverter(String postFix, Preferences preferences) {
return new StringConverter<CurrencyListItem>() {
@Override
public String toString(CurrencyListItem item) {
TradeCurrency tradeCurrency = item.tradeCurrency;
String code = tradeCurrency.getCode();
if (code.equals(GUIUtil.SHOW_ALL_FLAG))
return "▶ Show all";
else if (code.equals(GUIUtil.EDIT_FLAG))
return "▼ Edit currency list";
else {
String displayString = CurrencyUtil.getNameByCode(code) + " (" + code + ")";
if (preferences.getSortMarketCurrenciesNumerically())
displayString += " - " + item.numTrades + " " + postFix;
return tradeCurrency.getDisplayPrefix() + displayString;
}
}
@Override
public CurrencyListItem fromString(String s) {
return null;
}
};
}
use of io.bitsquare.locale.TradeCurrency in project bitsquare by bitsquare.
the class AltCoinAccountsView method onSaveNewAccount.
///////////////////////////////////////////////////////////////////////////////////////////
// UI actions
///////////////////////////////////////////////////////////////////////////////////////////
private void onSaveNewAccount(PaymentAccount paymentAccount) {
TradeCurrency selectedTradeCurrency = paymentAccount.getSelectedTradeCurrency();
String code = selectedTradeCurrency.getCode();
if (selectedTradeCurrency instanceof CryptoCurrency && ((CryptoCurrency) selectedTradeCurrency).isAsset()) {
new Popup().information("Please be sure that you follow the requirements for the usage of " + selectedTradeCurrency.getCodeAndName() + " wallets as described on the " + selectedTradeCurrency.getName() + " web page.\n" + "Using wallets from centralized exchanges where you don't have your keys under your control or " + "using a not compatible wallet software can lead to loss of the traded funds!\n" + "The arbitrator is not a " + selectedTradeCurrency.getName() + " specialist and cannot help in such cases.").closeButtonText("I understand and confirm that I know which wallet I need to use.").show();
}
if (code.equals("XMR")) {
new Popup().information("If you want to trade XMR on Bitsquare please be sure you understand and fulfill " + "the following requirements:\n\n" + "For sending XMR you need to use the Monero simple wallet with the " + "store-tx-info flag enabled (default in new versions).\n" + "Please be sure that you can access the tx key (use the get_tx_key command in simplewallet) as that " + "would be required in case of a dispute to enable the arbitrator to verify the XMR transfer with " + "the XMR checktx tool (http://xmr.llcoins.net/checktx.html).\n" + "At normal block explorers the transfer is not verifiable.\n\n" + "You need to provide the arbitrator the following data in case of a dispute:\n" + "- The tx private key\n" + "- The transaction hash\n" + "- The recipient's public address\n\n" + "If you cannot provide the above data or if you used an incompatible wallet it would result in losing the " + "dispute case. The XMR sender is responsible to be able to verify the XMR transfer to the " + "arbitrator in case of a dispute.\n\n" + "There is no payment ID required, just the normal public address.\n\n" + "If you are not sure about that process visit the Monero forum (https://forum.getmonero.org) to find more information.").closeButtonText("I understand").show();
} else if (code.equals("ZEC")) {
new Popup().information("When using ZEC you can only use the transparent addresses (starting with t) not " + "the z-addresses, because the arbitrator would not be able to verify the transaction with z-addresses.").closeButtonText("I understand").show();
} else if (code.equals("XZC")) {
new Popup().information("When using XZC you can only use the transparent transactions not " + "the private transactions, because the arbitrator would not be able to verify the private transactions.").closeButtonText("I understand").show();
}
if (!model.getPaymentAccounts().stream().filter(e -> {
if (e.getAccountName() != null)
return e.getAccountName().equals(paymentAccount.getAccountName());
else
return false;
}).findAny().isPresent()) {
model.onSaveNewAccount(paymentAccount);
removeNewAccountForm();
} else {
new Popup().warning("That account name is already used in a saved account.\n" + "Please use another name.").show();
}
}
use of io.bitsquare.locale.TradeCurrency in project bitsquare by bitsquare.
the class FiatAccountsDataModel method onSaveNewAccount.
///////////////////////////////////////////////////////////////////////////////////////////
// UI actions
///////////////////////////////////////////////////////////////////////////////////////////
public void onSaveNewAccount(PaymentAccount paymentAccount) {
user.addPaymentAccount(paymentAccount);
TradeCurrency singleTradeCurrency = paymentAccount.getSingleTradeCurrency();
List<TradeCurrency> tradeCurrencies = paymentAccount.getTradeCurrencies();
if (singleTradeCurrency != null) {
if (singleTradeCurrency instanceof FiatCurrency)
preferences.addFiatCurrency((FiatCurrency) singleTradeCurrency);
else
preferences.addCryptoCurrency((CryptoCurrency) singleTradeCurrency);
} else if (tradeCurrencies != null && !tradeCurrencies.isEmpty()) {
tradeCurrencies.stream().forEach(tradeCurrency -> {
if (tradeCurrency instanceof FiatCurrency)
preferences.addFiatCurrency((FiatCurrency) tradeCurrency);
else
preferences.addCryptoCurrency((CryptoCurrency) tradeCurrency);
});
}
}
use of io.bitsquare.locale.TradeCurrency in project bitsquare by bitsquare.
the class AltCoinAccountsDataModel method onSaveNewAccount.
///////////////////////////////////////////////////////////////////////////////////////////
// UI actions
///////////////////////////////////////////////////////////////////////////////////////////
public void onSaveNewAccount(PaymentAccount paymentAccount) {
user.addPaymentAccount(paymentAccount);
TradeCurrency singleTradeCurrency = paymentAccount.getSingleTradeCurrency();
List<TradeCurrency> tradeCurrencies = paymentAccount.getTradeCurrencies();
if (singleTradeCurrency != null) {
if (singleTradeCurrency instanceof FiatCurrency)
preferences.addFiatCurrency((FiatCurrency) singleTradeCurrency);
else
preferences.addCryptoCurrency((CryptoCurrency) singleTradeCurrency);
} else if (tradeCurrencies != null && !tradeCurrencies.isEmpty()) {
tradeCurrencies.stream().forEach(tradeCurrency -> {
if (tradeCurrency instanceof FiatCurrency)
preferences.addFiatCurrency((FiatCurrency) tradeCurrency);
else
preferences.addCryptoCurrency((CryptoCurrency) tradeCurrency);
});
}
}
use of io.bitsquare.locale.TradeCurrency in project bitsquare by bitsquare.
the class OfferView method loadView.
private void loadView(Class<? extends View> viewClass) {
TabPane tabPane = root;
View view;
boolean isBuy = direction == Offer.Direction.BUY;
if (viewClass == OfferBookView.class && offerBookView == null) {
view = viewLoader.load(viewClass);
// Offerbook must not be cached by ViewLoader as we use 2 instances for sell and buy screens.
offerBookTab = new Tab(isBuy ? "Buy bitcoin" : "Sell bitcoin");
offerBookTab.setClosable(false);
offerBookTab.setContent(view.getRoot());
tabPane.getTabs().add(offerBookTab);
offerBookView = (OfferBookView) view;
offerBookView.onTabSelected(true);
OfferActionHandler offerActionHandler = new OfferActionHandler() {
@Override
public void onCreateOffer(TradeCurrency tradeCurrency) {
if (!createOfferViewOpen) {
OfferView.this.createOfferViewOpen = true;
OfferView.this.tradeCurrency = tradeCurrency;
OfferView.this.navigation.navigateTo(MainView.class, OfferView.this.getClass(), CreateOfferView.class);
} else {
new Popup().information("You have already a \"Create offer\" tab open.").show();
}
}
@Override
public void onTakeOffer(Offer offer) {
if (!takeOfferViewOpen) {
OfferView.this.takeOfferViewOpen = true;
OfferView.this.offer = offer;
OfferView.this.navigation.navigateTo(MainView.class, OfferView.this.getClass(), TakeOfferView.class);
} else {
new Popup().information("You have already a \"Take offer\" tab open.").show();
}
}
};
offerBookView.setOfferActionHandler(offerActionHandler);
offerBookView.setDirection(direction);
} else if (viewClass == CreateOfferView.class && createOfferView == null) {
view = viewLoader.load(viewClass);
// CreateOffer and TakeOffer must not be cached by ViewLoader as we cannot use a view multiple times
// in different graphs
createOfferView = (CreateOfferView) view;
createOfferView.initWithData(direction, tradeCurrency);
createOfferPane = createOfferView.getRoot();
createOfferTab = new Tab(getCreateOfferTabName());
// close handler from close on create offer action
createOfferView.setCloseHandler(() -> tabPane.getTabs().remove(createOfferTab));
createOfferTab.setContent(createOfferPane);
tabPane.getTabs().add(createOfferTab);
tabPane.getSelectionModel().select(createOfferTab);
} else if (viewClass == TakeOfferView.class && takeOfferView == null && offer != null) {
view = viewLoader.load(viewClass);
// CreateOffer and TakeOffer must not be cached by ViewLoader as we cannot use a view multiple times
// in different graphs
takeOfferView = (TakeOfferView) view;
takeOfferView.initWithData(offer);
takeOfferPane = ((TakeOfferView) view).getRoot();
takeOfferTab = new Tab(getTakeOfferTabName());
// close handler from close on take offer action
takeOfferView.setCloseHandler(() -> tabPane.getTabs().remove(takeOfferTab));
takeOfferTab.setContent(takeOfferPane);
tabPane.getTabs().add(takeOfferTab);
tabPane.getSelectionModel().select(takeOfferTab);
}
}
Aggregations