This commit is contained in:
Manfred Karrer 2014-09-16 23:41:54 +02:00
parent 24108cdcde
commit c5c9b14c31
13 changed files with 138 additions and 151 deletions

View File

@ -17,27 +17,64 @@
package io.bitsquare.gui.main.orders.pending;
import io.bitsquare.gui.main.trade.orderbook.OrderBookListItem;
import io.bitsquare.locale.Country;
import io.bitsquare.trade.Offer;
import io.bitsquare.trade.Trade;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
// TODO don't use inheritance
public class PendingTradesListItem extends OrderBookListItem {
public class PendingTradesListItem {
private static final Logger log = LoggerFactory.getLogger(PendingTradesListItem.class);
private final Offer offer;
private final ObjectProperty<Country> bankAccountCountry = new SimpleObjectProperty<>();
private final Trade trade;
///////////////////////////////////////////////////////////////////////////////////////////
// Constructor
///////////////////////////////////////////////////////////////////////////////////////////
public PendingTradesListItem(Trade trade) {
super(trade.getOffer(), trade.getOffer().getBankAccountCountry());
this.trade = trade;
this.offer = trade.getOffer();
setBankAccountCountry(offer.getBankAccountCountry());
}
///////////////////////////////////////////////////////////////////////////////////////////
// Setters
///////////////////////////////////////////////////////////////////////////////////////////
void setBankAccountCountry(Country bankAccountCountry) {
this.bankAccountCountry.set(bankAccountCountry);
}
///////////////////////////////////////////////////////////////////////////////////////////
// Getters
///////////////////////////////////////////////////////////////////////////////////////////
public Trade getTrade() {
return trade;
}
Offer getOffer() {
return offer;
}
Country getBankAccountCountry() {
return bankAccountCountry.get();
}
ObjectProperty<Country> bankAccountCountryProperty() {
return bankAccountCountry;
}
}

View File

@ -160,7 +160,7 @@ public class TradeViewCB extends CachedViewCB {
createOfferViewCB = loader.getController();
createOfferViewCB.setParent(this);
createOfferViewCB.initWithOrderBookInfo(orderBookInfo);
createOfferViewCB.setCloseListener(() -> onCreateOfferViewRemoved());
createOfferViewCB.setCloseListener(this::onCreateOfferViewRemoved);
final Tab tab = new Tab("Create offer");
tab.setContent(createOfferView);
tabPane.getTabs().add(tab);

View File

@ -272,6 +272,7 @@ public class CreateOfferModel extends UIModel {
return direction;
}
@SuppressWarnings("NullableProblems")
void setDirection(Direction direction) {
// direction can not be changed once it is initially set
checkArgument(this.direction == null);

View File

@ -36,7 +36,7 @@
AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
AnchorPane.bottomAnchor="0.0">
<GridPane fx:id="gridPane" hgap="5.0" vgap="5.0">
<GridPane hgap="5.0" vgap="5.0">
<padding>
<Insets bottom="-10.0" left="25.0" top="30.0" right="25"/>
</padding>
@ -65,7 +65,7 @@
<Insets right="10.0" top="20.0"/>
</GridPane.margin>
<VBox spacing="4">
<Label id="input-description-label" text="%createOffer.amountPriceBox.amountDescr"
<Label id="input-description-label" text="%createOffer.amountPriceBox.amountDescription"
prefWidth="170"/>
<HBox>
<InputTextField fx:id="amountTextField" id="text-input-with-currency-text-field"
@ -116,7 +116,7 @@
<GridPane.margin>
<Insets right="10.0" top="5.0" bottom="5.0"/>
</GridPane.margin>
<Label id="input-description-label" text="%createOffer.amountPriceBox.minAmountDescr"
<Label id="input-description-label" text="%createOffer.amountPriceBox.minAmountDescription"
prefWidth="170.0"/>
<HBox>
<InputTextField fx:id="minAmountTextField" id="text-input-with-currency-text-field"

View File

@ -364,10 +364,12 @@ public class CreateOfferViewCB extends CachedViewCB<CreateOfferPM> {
volumeDescriptionLabel.textProperty().bind(presentationModel.fiatCode);//Price per Bitcoin in EUR
priceDescriptionLabel.textProperty().bind(createStringBinding(() ->
BSResources.get("createOffer.amountPriceBox.priceDescr", presentationModel.fiatCode.get()),
BSResources.get("createOffer.amountPriceBox.priceDescription",
presentationModel.fiatCode.get()),
presentationModel.fiatCode));
volumeDescriptionLabel.textProperty().bind(createStringBinding(() ->
BSResources.get("createOffer.amountPriceBox.volumeDescr", presentationModel.fiatCode.get()),
BSResources.get("createOffer.amountPriceBox.volumeDescription",
presentationModel.fiatCode.get()),
presentationModel.fiatCode));
buyLabel.textProperty().bind(presentationModel.directionLabel);

View File

@ -31,6 +31,7 @@ import java.util.List;
import javax.inject.Inject;
import javafx.animation.AnimationTimer;
import javafx.beans.InvalidationListener;
import javafx.beans.value.ChangeListener;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
@ -42,7 +43,10 @@ import static com.google.common.base.Preconditions.checkArgument;
/**
* Holds and manages the unsorted and unfiltered orderbook list of both buy and sell offers.
* It is handled as singleton by Guice and is used by 2 instances of OrderBookModel (one for Buy one for Sell).
* As it is used only by the Buy and Sell UIs we treat it as local UI model.
* It also use OrderBookListener as the lists items class and we don't want to get any dependency out of the package
* for that.
*/
public class OrderBook {
@ -54,7 +58,7 @@ public class OrderBook {
private final ObservableList<OrderBookListItem> orderBookListItems = FXCollections.observableArrayList();
private final OrderBookListener orderBookListener;
private final ChangeListener<BankAccount> bankAccountChangeListener;
private final ChangeListener<Number> invalidationListener;
private final InvalidationListener invalidationListener;
private String fiatCode;
private AnimationTimer pollingTimer;
private Country country;
@ -66,16 +70,13 @@ public class OrderBook {
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
public OrderBook(MessageFacade messageFacade, User user) {
OrderBook(MessageFacade messageFacade, User user) {
this.messageFacade = messageFacade;
this.user = user;
bankAccountChangeListener = (observableValue, oldValue, newValue) -> setBankAccount(newValue);
invalidationListener = (ov, oldValue, newValue) -> {
log.debug("#### oldValue " + oldValue);
log.debug("#### newValue " + newValue);
requestOffers();
};
invalidationListener = (ov) -> requestOffers();
orderBookListener = new OrderBookListener() {
@Override
public void onOfferAdded(Offer offer) {
@ -141,14 +142,12 @@ public class OrderBook {
}
private void addListeners() {
log.trace("addListeners ");
user.currentBankAccountProperty().addListener(bankAccountChangeListener);
messageFacade.addOrderBookListener(orderBookListener);
messageFacade.invalidationTimestampProperty().addListener(invalidationListener);
}
private void removeListeners() {
log.trace("removeListeners ");
user.currentBankAccountProperty().removeListener(bankAccountChangeListener);
messageFacade.removeOrderBookListener(orderBookListener);
messageFacade.invalidationTimestampProperty().removeListener(invalidationListener);
@ -161,7 +160,6 @@ public class OrderBook {
}
private void requestOffers() {
log.debug("requestOffers");
messageFacade.getOffers(fiatCode);
}
@ -175,7 +173,7 @@ public class OrderBook {
addListeners();
setBankAccount(user.getCurrentBankAccount());
pollingTimer = Utilities.setInterval(1000, (animationTimer) -> {
messageFacade.getInvalidationTimeStamp(fiatCode);
messageFacade.requestInvalidationTimeStamp(fiatCode);
return null;
});

View File

@ -23,7 +23,7 @@ import io.bitsquare.trade.Offer;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
public class OrderBookListItem {
class OrderBookListItem {
private final Offer offer;
private final ObjectProperty<Country> bankAccountCountry = new SimpleObjectProperty<>();
@ -32,7 +32,7 @@ public class OrderBookListItem {
// Constructor
///////////////////////////////////////////////////////////////////////////////////////////
public OrderBookListItem(Offer offer, Country bankAccountCountry) {
OrderBookListItem(Offer offer, Country bankAccountCountry) {
this.offer = offer;
setBankAccountCountry(bankAccountCountry);
}
@ -42,7 +42,7 @@ public class OrderBookListItem {
// Setters
///////////////////////////////////////////////////////////////////////////////////////////
public void setBankAccountCountry(Country bankAccountCountry) {
void setBankAccountCountry(Country bankAccountCountry) {
this.bankAccountCountry.set(bankAccountCountry);
}
@ -51,15 +51,15 @@ public class OrderBookListItem {
// Getters
///////////////////////////////////////////////////////////////////////////////////////////
public Offer getOffer() {
Offer getOffer() {
return offer;
}
public Country getBankAccountCountry() {
Country getBankAccountCountry() {
return bankAccountCountry.get();
}
public ObjectProperty<Country> bankAccountCountryProperty() {
ObjectProperty<Country> bankAccountCountryProperty() {
return bankAccountCountry;
}

View File

@ -17,7 +17,6 @@
package io.bitsquare.gui.main.trade.orderbook;
import io.bitsquare.arbitrator.Arbitrator;
import io.bitsquare.bank.BankAccount;
import io.bitsquare.gui.UIModel;
import io.bitsquare.gui.main.trade.OrderBookInfo;
@ -37,8 +36,6 @@ import com.google.bitcoin.utils.Fiat;
import com.google.inject.Inject;
import java.util.Comparator;
import java.util.List;
import java.util.Locale;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
@ -53,7 +50,10 @@ import org.slf4j.LoggerFactory;
import static io.bitsquare.gui.util.BSFormatter.reduceTo4Decimals;
public class OrderBookModel extends UIModel {
/**
* It holds the scope specific domain data for either a buy or sell UI screen.
*/
class OrderBookModel extends UIModel {
private static final Logger log = LoggerFactory.getLogger(OrderBookModel.class);
private final User user;
@ -82,10 +82,10 @@ public class OrderBookModel extends UIModel {
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
public OrderBookModel(User user,
TradeManager tradeManager,
OrderBook orderBook,
Settings settings) {
OrderBookModel(User user,
TradeManager tradeManager,
OrderBook orderBook,
Settings settings) {
this.tradeManager = tradeManager;
this.user = user;
this.orderBook = orderBook;
@ -95,6 +95,7 @@ public class OrderBookModel extends UIModel {
sortedItems = new SortedList<>(filteredItems);
}
///////////////////////////////////////////////////////////////////////////////////////////
// Lifecycle
///////////////////////////////////////////////////////////////////////////////////////////
@ -180,49 +181,27 @@ public class OrderBookModel extends UIModel {
if (user.getCurrentBankAccount() == null)
return true;
boolean countryResult = offer.getAcceptedCountries().contains(user.getCurrentBankAccount().getCountry());
if (!countryResult)
restrictionsInfo.set("This offer requires that the payments account resides in one of those countries:\n" +
BSFormatter.countryLocalesToString(offer.getAcceptedCountries()) +
"\n\nThe country of your payments account (" + user.getCurrentBankAccount().getCountry().getName() +
") is not included in that list.");
//TODO
// One of the supported languages from the settings must match one of the offer languages (n to n)
/* boolean languageResult =
languagesInList(settings.getAcceptedLanguageLocales(), offer.getAcceptedLanguageLocales());
// TODO Leave that for now as it is not so clear how the restrictions will be handled
// we might get rid of languages (handles viy arbitrators)
/*
// disjoint returns true if the two specified collections have no elements in common.
boolean languageResult = !Collections.disjoint(settings.getAcceptedLanguageLocales(),
offer.getAcceptedLanguageLocales());
if (!languageResult)
restrictionsInfo.set("This offer requires that the payments account resides in one of those languages:\n" +
BSFormatter.languageLocalesToString(offer.getAcceptedLanguageLocales()) +
"\n\nThe country of your payments account (" + user.getCurrentBankAccount().getCountry().getName() +
") is not included in that list.");
// Apply applyFilter only if there is a valid value set
// The requested amount must be lower or equal then the offer amount
boolean amountResult = true;
if (orderBookInfo.getAmount() != null && orderBookInfo.getAmount().isPositive())
amountResult = orderBookInfo.getAmount().compareTo(offer.getAmount()) <= 0;
// Apply applyFilter only if there is a valid value set
boolean priceResult = true;
if (orderBookInfo.getPrice() != null && orderBookInfo.getPrice().isPositive()) {
if (offer.getDirection() == Direction.SELL)
priceResult = orderBookInfo.getPrice().compareTo(offer.getPrice()) >= 0;
else
priceResult = orderBookInfo.getPrice().compareTo(offer.getPrice()) <= 0;
}
// The arbitrator defined in the offer must match one of the accepted arbitrators defined in the settings
// (1 to n)
boolean arbitratorResult = arbitratorsInList(offer.getArbitrators(), settings.getAcceptedArbitrators());
boolean result = countryResult && languageResult && amountResult && priceResult && arbitratorResult;
log.debug("getPrice " + orderBookInfo.getPrice());
log.debug("getAmount " + orderBookInfo.getAmount());
log.debug("countryResult " + countryResult);
log.debug("languageResult " + languageResult);
log.debug("amountResult " + amountResult);
log.debug("priceResult " + priceResult);
log.debug("arbitratorResult " + arbitratorResult);
log.debug("Offer filter result " + result);*/
boolean arbitratorResult = !Collections.disjoint(settings.getAcceptedArbitrators(),
offer.getArbitrators());*/
return countryResult;
}
@ -250,6 +229,7 @@ public class OrderBookModel extends UIModel {
applyFilter();
}
///////////////////////////////////////////////////////////////////////////////////////////
// Getters
///////////////////////////////////////////////////////////////////////////////////////////
@ -263,8 +243,7 @@ public class OrderBookModel extends UIModel {
}
boolean isMyOffer(Offer offer) {
return offer.getMessagePublicKey() != null ?
offer.getMessagePublicKey().equals(user.getMessagePublicKey()) : false;
return offer.getMessagePublicKey() != null && offer.getMessagePublicKey().equals(user.getMessagePublicKey());
}
Coin getAmountAsCoin() {
@ -295,6 +274,7 @@ public class OrderBookModel extends UIModel {
return orderBookInfo;
}
///////////////////////////////////////////////////////////////////////////////////////////
// Private methods
///////////////////////////////////////////////////////////////////////////////////////////
@ -310,29 +290,6 @@ public class OrderBookModel extends UIModel {
}
}
private boolean languagesInList(List<Locale> list1, List<Locale> list2) {
for (Locale locale1 : list2) {
for (Locale locale2 : list1) {
if (locale1.getLanguage().equals(locale2.getLanguage())) {
return true;
}
}
}
return false;
}
private boolean arbitratorsInList(List<Arbitrator> list1, List<Arbitrator> list2) {
for (Arbitrator arbitrator1 : list2) {
for (Arbitrator arbitrator2 : list1) {
if (arbitrator1.getId().equals(arbitrator2.getId())) {
return true;
}
}
}
return false;
}
void applyFilter() {
filteredItems.setPredicate(orderBookListItem -> {
Offer offer = orderBookListItem.getOffer();
@ -351,12 +308,7 @@ public class OrderBookModel extends UIModel {
priceResult = orderBookInfo.getPrice().compareTo(offer.getPrice()) <= 0;
}
//TODO
return directionResult && amountResult && priceResult;
});
}
}

View File

@ -24,16 +24,11 @@ import io.bitsquare.gui.util.validation.InputValidator;
import io.bitsquare.gui.util.validation.OptionalBtcValidator;
import io.bitsquare.gui.util.validation.OptionalFiatValidator;
import io.bitsquare.locale.BSResources;
import io.bitsquare.locale.Country;
import io.bitsquare.trade.Direction;
import io.bitsquare.trade.Offer;
import com.google.inject.Inject;
import java.util.Comparator;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.collections.transformation.SortedList;
@ -43,7 +38,7 @@ import org.slf4j.LoggerFactory;
import static io.bitsquare.gui.util.BSFormatter.*;
public class OrderBookPM extends PresentationModel<OrderBookModel> {
class OrderBookPM extends PresentationModel<OrderBookModel> {
private static final Logger log = LoggerFactory.getLogger(OrderBookPM.class);
private final OptionalBtcValidator optionalBtcValidator;
@ -54,8 +49,6 @@ public class OrderBookPM extends PresentationModel<OrderBookModel> {
final StringProperty volume = new SimpleStringProperty();
final StringProperty btcCode = new SimpleStringProperty();
final StringProperty fiatCode = new SimpleStringProperty();
final ObjectProperty<Country> bankAccountCountry = new SimpleObjectProperty<>();
final ObjectProperty<Comparator<OrderBookListItem>> comparator = new SimpleObjectProperty<>();
final StringProperty restrictionsInfo = new SimpleStringProperty();
@ -64,9 +57,9 @@ public class OrderBookPM extends PresentationModel<OrderBookModel> {
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
public OrderBookPM(OrderBookModel model,
OptionalFiatValidator optionalFiatValidator,
OptionalBtcValidator optionalBtcValidator) {
OrderBookPM(OrderBookModel model,
OptionalFiatValidator optionalFiatValidator,
OptionalBtcValidator optionalBtcValidator) {
super(model);
this.optionalFiatValidator = optionalFiatValidator;
@ -84,9 +77,7 @@ public class OrderBookPM extends PresentationModel<OrderBookModel> {
btcCode.bind(model.btcCode);
fiatCode.bind(model.fiatCode);
bankAccountCountry.bind(model.bankAccountCountry);
restrictionsInfo.bind(model.restrictionsInfo);
comparator.bind(model.comparator);
// Bidirectional bindings are used for all input fields: amount, price and volume
// We do volume/amount calculation during input, so user has immediate feedback
@ -201,7 +192,7 @@ public class OrderBookPM extends PresentationModel<OrderBookModel> {
}
String getDirectionLabel(Offer offer) {
// mirror direction
// mirror direction!
Direction direction = offer.getDirection() == Direction.BUY ? Direction.SELL : Direction.BUY;
return BSFormatter.formatDirection(direction, true);
}

View File

@ -31,7 +31,7 @@
<Insets bottom="20.0" left="25.0" top="30.0" right="25"/>
</padding>
<TitledGroupBg fx:id="priceAmountPane" text="Order book filter" GridPane.rowIndex="0" GridPane.columnIndex="0"
<TitledGroupBg text="Order book filter" GridPane.rowIndex="0" GridPane.columnIndex="0"
GridPane.rowSpan="5" GridPane.columnSpan="2"/>
<Label text="Filter by amount or price:" GridPane.rowIndex="0" GridPane.valignment="TOP">

View File

@ -58,15 +58,19 @@ import org.slf4j.LoggerFactory;
import static javafx.beans.binding.Bindings.createStringBinding;
/**
* TODO: The advanced filters are not impl. yet
* The restrictions handling is open from the concept and is only implemented for countries yet.
*/
public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
private static final Logger log = LoggerFactory.getLogger(OrderBookViewCB.class);
private Navigation navigation;
private Navigation.Item navigationItem;
private OverlayManager overlayManager;
private OptionalBtcValidator optionalBtcValidator;
private OptionalFiatValidator optionalFiatValidator;
private final Navigation navigation;
private final OverlayManager overlayManager;
private final OptionalBtcValidator optionalBtcValidator;
private final OptionalFiatValidator optionalFiatValidator;
private Navigation.Item navigationItem;
private boolean detailsVisible;
private boolean advancedScreenInited;
@ -87,11 +91,11 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
private OrderBookViewCB(OrderBookPM presentationModel,
Navigation navigation,
OverlayManager overlayManager,
OptionalBtcValidator optionalBtcValidator,
OptionalFiatValidator optionalFiatValidator) {
OrderBookViewCB(OrderBookPM presentationModel,
Navigation navigation,
OverlayManager overlayManager,
OptionalBtcValidator optionalBtcValidator,
OptionalFiatValidator optionalFiatValidator) {
super(presentationModel);
this.navigation = navigation;
@ -215,7 +219,6 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
// Private methods
///////////////////////////////////////////////////////////////////////////////////////////
private void openSetupScreen() {
overlayManager.blurContent();
List<Action> actions = new ArrayList<>();
@ -264,7 +267,6 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
}
private void showDetailsScreen() {
log.debug("showDetailsScreen");
if (!advancedScreenInited) {
advancedScreenInited = true;
}
@ -274,7 +276,6 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
private void hideDetailsScreen() {
toggleDetailsScreen(false);
log.debug("hideDetailsScreen");
}
private void toggleDetailsScreen(boolean visible) {
@ -341,8 +342,13 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
.getBankAccountType()));
}
///////////////////////////////////////////////////////////////////////////////////////////
// CellFactories
///////////////////////////////////////////////////////////////////////////////////////////
private void setAmountColumnCellFactory() {
amountColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper(offer.getValue()));
amountColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue()));
amountColumn.setCellFactory(
new Callback<TableColumn<OrderBookListItem, OrderBookListItem>, TableCell<OrderBookListItem,
OrderBookListItem>>() {
@ -361,7 +367,7 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
}
private void setPriceColumnCellFactory() {
priceColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper(offer.getValue()));
priceColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue()));
priceColumn.setCellFactory(
new Callback<TableColumn<OrderBookListItem, OrderBookListItem>, TableCell<OrderBookListItem,
OrderBookListItem>>() {
@ -380,7 +386,7 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
}
private void setVolumeColumnCellFactory() {
volumeColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper(offer.getValue()));
volumeColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue()));
volumeColumn.setCellFactory(
new Callback<TableColumn<OrderBookListItem, OrderBookListItem>, TableCell<OrderBookListItem,
OrderBookListItem>>() {
@ -399,7 +405,7 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
}
private void setDirectionColumnCellFactory() {
directionColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper(offer.getValue()));
directionColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue()));
directionColumn.setCellFactory(
new Callback<TableColumn<OrderBookListItem, OrderBookListItem>, TableCell<OrderBookListItem,
OrderBookListItem>>() {
@ -483,7 +489,7 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
}
private void setCountryColumnCellFactory() {
countryColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper(offer.getValue()));
countryColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue()));
countryColumn.setCellFactory(
new Callback<TableColumn<OrderBookListItem, OrderBookListItem>, TableCell<OrderBookListItem,
OrderBookListItem>>() {
@ -518,7 +524,7 @@ public class OrderBookViewCB extends CachedViewCB<OrderBookPM> {
}
private void setBankAccountTypeColumnCellFactory() {
bankAccountTypeColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper(offer.getValue()));
bankAccountTypeColumn.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue()));
bankAccountTypeColumn.setCellFactory(
new Callback<TableColumn<OrderBookListItem, OrderBookListItem>, TableCell<OrderBookListItem,
OrderBookListItem>>() {

View File

@ -62,6 +62,8 @@ import net.tomp2p.peers.PeerAddress;
import net.tomp2p.storage.Data;
import net.tomp2p.utils.Utils;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -109,11 +111,11 @@ public class MessageFacade implements MessageBroker {
@Override
public void onSuccess(@Nullable PeerDHT result) {
log.debug("p2pNode.start success result = " + result);
Platform.runLater(() -> bootstrapListener.onCompleted());
Platform.runLater(bootstrapListener::onCompleted);
}
@Override
public void onFailure(Throwable t) {
public void onFailure(@NotNull Throwable t) {
log.error(t.toString());
Platform.runLater(() -> bootstrapListener.onFailed(t));
}
@ -144,7 +146,7 @@ public class MessageFacade implements MessageBroker {
Platform.runLater(() -> listener.onResult(peerAddress));
}
else {
Platform.runLater(() -> listener.onFailed());
Platform.runLater(listener::onFailed);
}
}
});
@ -323,16 +325,16 @@ public class MessageFacade implements MessageBroker {
@Override
public void operationComplete(BaseFuture future) throws Exception {
if (futureDirect.isSuccess()) {
Platform.runLater(() -> listener.onResult());
Platform.runLater(listener::onResult);
}
else {
Platform.runLater(() -> listener.onFailed());
Platform.runLater(listener::onFailed);
}
}
@Override
public void exceptionCaught(Throwable t) throws Exception {
Platform.runLater(() -> listener.onFailed());
Platform.runLater(listener::onFailed);
}
});
}
@ -362,9 +364,7 @@ public class MessageFacade implements MessageBroker {
}
}
});
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
} catch (IOException | ClassNotFoundException e) {
e.printStackTrace();
}
}
@ -448,7 +448,7 @@ public class MessageFacade implements MessageBroker {
// Polling
///////////////////////////////////////////////////////////////////////////////////////////
public void updateInvalidationTimestamp(Number160 locationKey) {
private void updateInvalidationTimestamp(Number160 locationKey) {
invalidationTimestamp.set(System.currentTimeMillis());
try {
FuturePut putFuture = p2pNode.putData(getInvalidatedLocationKey(locationKey),
@ -477,7 +477,7 @@ public class MessageFacade implements MessageBroker {
return invalidationTimestamp;
}
public void getInvalidationTimeStamp(String currencyCode) {
public void requestInvalidationTimeStamp(String currencyCode) {
Number160 locationKey = Number160.createHash(currencyCode);
try {
FutureGet getFuture = p2pNode.getData(getInvalidatedLocationKey(locationKey));
@ -490,8 +490,8 @@ public class MessageFacade implements MessageBroker {
final Object object = data.object();
Platform.runLater(() -> {
Long timeStamp = (Long) object;
log.trace("Get invalidationTimestamp from DHT was successful. TimeStamp=" +
timeStamp);
// log.trace("Get invalidationTimestamp from DHT was successful. TimeStamp=" +
// timeStamp);
invalidationTimestamp.set(timeStamp);
});
}

View File

@ -31,10 +31,10 @@ createOffer.minAmount.prompt=Enter min. amount
createOffer.amountPriceBox.title=Create your offer
createOffer.amountPriceBox.subTitle=Buy Bitcoin
createOffer.amountPriceBox.amountDescr=Amount of Bitcoin to buy
createOffer.amountPriceBox.priceDescr=Price per Bitcoin in {0}
createOffer.amountPriceBox.volumeDescr=Amount in {0} to spend
createOffer.amountPriceBox.minAmountDescr=Minimum amount of Bitcoin
createOffer.amountPriceBox.amountDescription=Amount of Bitcoin to buy
createOffer.amountPriceBox.priceDescription=Price per Bitcoin in {0}
createOffer.amountPriceBox.volumeDescription=Amount in {0} to spend
createOffer.amountPriceBox.minAmountDescription=Minimum amount of Bitcoin
createOffer.amountPriceBox.info=Define a price for which you want to byu Bitcoin and either enter the amount or the trade volume. With the minimum amount you can attract more potential traders with giving them more flexibility. But note that there is no automatic creation of a new offer for the remaining amount in the case that a trader takes your offer with a lower amount as defined in the amount field. Your offer will be removed from the orderbook once a trader has taken your offer.
createOffer.amountPriceBox.next=Next step
createOffer.amountPriceBox.warning.invalidBtcDecimalPlaces=The amount you have entered exceeds the number of allowed decimal places.\nThe amount has been adjusted to 4 decimal places.