Search in sources :

Example 21 with SimpleIntegerProperty

use of javafx.beans.property.SimpleIntegerProperty in project bisq-desktop by bisq-network.

the class OfferBookChartViewModelTest method testMaxCharactersForSellPriceWithOfflinePriceFeedService.

@Test
public void testMaxCharactersForSellPriceWithOfflinePriceFeedService() {
    OfferBook offerBook = mock(OfferBook.class);
    PriceFeedService priceFeedService = mock(PriceFeedService.class);
    final ObservableList<OfferBookListItem> offerBookListItems = FXCollections.observableArrayList();
    final OfferBookListItem item = make(OfferBookListItemMaker.btcSellItem.but(with(OfferBookListItemMaker.useMarketBasedPrice, true)));
    item.getOffer().setPriceFeedService(priceFeedService);
    offerBookListItems.addAll(item);
    when(priceFeedService.getMarketPrice(anyString())).thenReturn(null);
    when(priceFeedService.updateCounterProperty()).thenReturn(new SimpleIntegerProperty());
    when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems);
    final OfferBookChartViewModel model = new OfferBookChartViewModel(offerBook, empty, priceFeedService, null, new BSFormatter());
    model.activate();
    assertEquals(0, model.maxPlacesForSellPrice.intValue());
}
Also used : OfferBook(bisq.desktop.main.offer.offerbook.OfferBook) OfferBookListItem(bisq.desktop.main.offer.offerbook.OfferBookListItem) PriceFeedService(bisq.core.provider.price.PriceFeedService) BSFormatter(bisq.desktop.util.BSFormatter) SimpleIntegerProperty(javafx.beans.property.SimpleIntegerProperty) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 22 with SimpleIntegerProperty

use of javafx.beans.property.SimpleIntegerProperty in project bisq-desktop by bisq-network.

the class CreateOfferViewModelTest method setUp.

@Before
public void setUp() {
    final CryptoCurrency btc = new CryptoCurrency("BTC", "bitcoin");
    GlobalSettings.setDefaultTradeCurrency(btc);
    Res.setBaseCurrencyCode(btc.getCode());
    Res.setBaseCurrencyName(btc.getName());
    final BSFormatter bsFormatter = new BSFormatter();
    final BtcValidator btcValidator = new BtcValidator(bsFormatter);
    final AltcoinValidator altcoinValidator = new AltcoinValidator();
    final FiatPriceValidator fiatPriceValidator = new FiatPriceValidator();
    FeeService feeService = mock(FeeService.class);
    AddressEntry addressEntry = mock(AddressEntry.class);
    BtcWalletService btcWalletService = mock(BtcWalletService.class);
    PriceFeedService priceFeedService = mock(PriceFeedService.class);
    User user = mock(User.class);
    PaymentAccount paymentAccount = mock(PaymentAccount.class);
    BsqWalletService bsqWalletService = mock(BsqWalletService.class);
    SecurityDepositValidator securityDepositValidator = mock(SecurityDepositValidator.class);
    when(btcWalletService.getOrCreateAddressEntry(anyString(), any())).thenReturn(addressEntry);
    when(btcWalletService.getBalanceForAddress(any())).thenReturn(Coin.valueOf(1000L));
    when(priceFeedService.updateCounterProperty()).thenReturn(new SimpleIntegerProperty());
    when(priceFeedService.getMarketPrice(anyString())).thenReturn(new MarketPrice("USD", 12684.0450, Instant.now().getEpochSecond(), true));
    when(feeService.getTxFee(anyInt())).thenReturn(Coin.valueOf(1000L));
    when(user.findFirstPaymentAccountWithCurrency(any())).thenReturn(paymentAccount);
    when(user.getPaymentAccountsAsObservable()).thenReturn(FXCollections.observableSet());
    when(securityDepositValidator.validate(any())).thenReturn(new InputValidator.ValidationResult(false));
    CreateOfferDataModel dataModel = new CreateOfferDataModel(null, btcWalletService, bsqWalletService, empty, user, null, null, priceFeedService, null, null, null, feeService, bsFormatter);
    dataModel.initWithData(OfferPayload.Direction.BUY, new CryptoCurrency("BTC", "bitcoin"));
    dataModel.activate();
    model = new CreateOfferViewModel(dataModel, null, fiatPriceValidator, altcoinValidator, btcValidator, null, securityDepositValidator, null, null, priceFeedService, null, null, bsFormatter, null);
    model.activate();
}
Also used : BtcValidator(bisq.desktop.util.validation.BtcValidator) FiatPriceValidator(bisq.desktop.util.validation.FiatPriceValidator) User(bisq.core.user.User) AddressEntry(bisq.core.btc.AddressEntry) PaymentAccount(bisq.core.payment.PaymentAccount) FeeService(bisq.core.provider.fee.FeeService) BSFormatter(bisq.desktop.util.BSFormatter) AltcoinValidator(bisq.desktop.util.validation.AltcoinValidator) CryptoCurrency(bisq.core.locale.CryptoCurrency) SecurityDepositValidator(bisq.desktop.util.validation.SecurityDepositValidator) MarketPrice(bisq.core.provider.price.MarketPrice) InputValidator(bisq.core.util.validation.InputValidator) BtcWalletService(bisq.core.btc.wallet.BtcWalletService) PriceFeedService(bisq.core.provider.price.PriceFeedService) BsqWalletService(bisq.core.btc.wallet.BsqWalletService) SimpleIntegerProperty(javafx.beans.property.SimpleIntegerProperty) Before(org.junit.Before)

Example 23 with SimpleIntegerProperty

use of javafx.beans.property.SimpleIntegerProperty in project tilesfx by HanSolo.

the class TileBuilder method matrixSize.

public final B matrixSize(final int COLS, final int ROWS) {
    properties.put("matrixSize", null);
    properties.put("matrixColumns", new SimpleIntegerProperty(COLS));
    properties.put("matrixRows", new SimpleIntegerProperty(ROWS));
    return (B) this;
}
Also used : SimpleIntegerProperty(javafx.beans.property.SimpleIntegerProperty)

Example 24 with SimpleIntegerProperty

use of javafx.beans.property.SimpleIntegerProperty in project tilesfx by HanSolo.

the class PixelMatrixBuilder method colsAndRows.

public final B colsAndRows(final int COLS, final int ROWS) {
    properties.put("cols", new SimpleIntegerProperty(COLS));
    properties.put("rows", new SimpleIntegerProperty(ROWS));
    return (B) this;
}
Also used : SimpleIntegerProperty(javafx.beans.property.SimpleIntegerProperty)

Example 25 with SimpleIntegerProperty

use of javafx.beans.property.SimpleIntegerProperty in project dolphin-platform by canoo.

the class FXWrapper method wrapIntProperty.

/**
 * Create a JavaFX {@link javafx.beans.property.IntegerProperty} as a wrapper for a dolphin platform property
 *
 * @param dolphinProperty the dolphin platform property
 * @return the JavaFX property
 */
public static IntegerProperty wrapIntProperty(final Property<Integer> dolphinProperty) {
    Assert.requireNonNull(dolphinProperty, "dolphinProperty");
    final IntegerProperty property = new SimpleIntegerProperty();
    FXBinder.bind(property).bidirectionalToNumeric(dolphinProperty);
    return property;
}
Also used : IntegerProperty(javafx.beans.property.IntegerProperty) SimpleIntegerProperty(javafx.beans.property.SimpleIntegerProperty) SimpleIntegerProperty(javafx.beans.property.SimpleIntegerProperty)

Aggregations

SimpleIntegerProperty (javafx.beans.property.SimpleIntegerProperty)25 IntegerProperty (javafx.beans.property.IntegerProperty)9 PriceFeedService (bisq.core.provider.price.PriceFeedService)4 BSFormatter (bisq.desktop.util.BSFormatter)4 SimpleStringProperty (javafx.beans.property.SimpleStringProperty)4 FXML (javafx.fxml.FXML)4 ChunkWrapper (com.kyj.fx.voeditor.visual.diff.ChunkWrapper)3 CompareResult (com.kyj.fx.voeditor.visual.diff.CompareResult)3 Chunk (difflib.Chunk)3 Delta (difflib.Delta)3 TYPE (difflib.Delta.TYPE)3 IOException (java.io.IOException)3 StringProperty (javafx.beans.property.StringProperty)3 ObservableValue (javafx.beans.value.ObservableValue)3 CellDataFeatures (javafx.scene.control.TableColumn.CellDataFeatures)3 ImageView (javafx.scene.image.ImageView)3 OfferBook (bisq.desktop.main.offer.offerbook.OfferBook)2 OfferBookListItem (bisq.desktop.main.offer.offerbook.OfferBookListItem)2 MockedProperty (com.canoo.dp.impl.remoting.MockedProperty)2 Binding (com.canoo.platform.core.functional.Binding)2