Search in sources :

Example 6 with SimpleIntegerProperty

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

the class FXBinderTest method testJavaFXIntegerBidirectional.

@Test
public void testJavaFXIntegerBidirectional() {
    Property<Integer> integerDolphinProperty = new MockedProperty<>();
    Property<Number> numberDolphinProperty = new MockedProperty<>();
    IntegerProperty integerJavaFXProperty = new SimpleIntegerProperty();
    integerDolphinProperty.set(47);
    assertNotEquals(integerJavaFXProperty.get(), 47);
    Binding binding = FXBinder.bind(integerJavaFXProperty).bidirectionalToNumeric(integerDolphinProperty);
    assertEquals(integerJavaFXProperty.get(), 47);
    integerDolphinProperty.set(100);
    assertEquals(integerJavaFXProperty.get(), 100);
    integerDolphinProperty.set(null);
    assertEquals(integerJavaFXProperty.get(), 0);
    integerJavaFXProperty.set(12);
    assertEquals(integerDolphinProperty.get().intValue(), 12);
    integerJavaFXProperty.setValue(null);
    assertEquals(integerDolphinProperty.get().intValue(), 0);
    binding.unbind();
    integerDolphinProperty.set(100);
    assertEquals(integerJavaFXProperty.get(), 0);
    numberDolphinProperty.set(12);
    binding = FXBinder.bind(integerJavaFXProperty).bidirectionalTo(numberDolphinProperty);
    assertEquals(integerJavaFXProperty.get(), 12);
    numberDolphinProperty.set(null);
    assertEquals(integerJavaFXProperty.get(), 0);
    integerJavaFXProperty.set(12);
    assertEquals(numberDolphinProperty.get().intValue(), 12);
    integerJavaFXProperty.setValue(null);
    assertEquals(numberDolphinProperty.get().intValue(), 0);
    binding.unbind();
    numberDolphinProperty.set(100);
    assertEquals(integerJavaFXProperty.get(), 0);
}
Also used : Binding(com.canoo.platform.core.functional.Binding) IntegerProperty(javafx.beans.property.IntegerProperty) SimpleIntegerProperty(javafx.beans.property.SimpleIntegerProperty) MockedProperty(com.canoo.dp.impl.remoting.MockedProperty) SimpleIntegerProperty(javafx.beans.property.SimpleIntegerProperty) Test(org.testng.annotations.Test)

Example 7 with SimpleIntegerProperty

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

the class FXBinderTest method testJavaFXIntegerUnidirectional.

@Test
public void testJavaFXIntegerUnidirectional() {
    Property<Integer> integerDolphinProperty = new MockedProperty<>();
    Property<Number> numberDolphinProperty = new MockedProperty<>();
    IntegerProperty integerJavaFXProperty = new SimpleIntegerProperty();
    WritableIntegerValue writableIntegerValue = new SimpleIntegerProperty();
    integerDolphinProperty.set(47);
    assertNotEquals(integerJavaFXProperty.doubleValue(), 47);
    Binding binding = FXBinder.bind(integerJavaFXProperty).to(integerDolphinProperty);
    assertEquals(integerJavaFXProperty.get(), 47);
    integerDolphinProperty.set(100);
    assertEquals(integerJavaFXProperty.get(), 100);
    integerDolphinProperty.set(null);
    assertEquals(integerJavaFXProperty.get(), 0);
    binding.unbind();
    integerDolphinProperty.set(100);
    assertEquals(integerJavaFXProperty.get(), 0);
    numberDolphinProperty.set(12);
    binding = FXBinder.bind(integerJavaFXProperty).to(numberDolphinProperty);
    assertEquals(integerJavaFXProperty.get(), 12);
    numberDolphinProperty.set(null);
    assertEquals(integerJavaFXProperty.get(), 0);
    binding.unbind();
    numberDolphinProperty.set(100);
    assertEquals(integerJavaFXProperty.get(), 0);
    integerDolphinProperty.set(47);
    binding = FXBinder.bind(writableIntegerValue).to(integerDolphinProperty);
    assertEquals(writableIntegerValue.get(), 47);
    integerDolphinProperty.set(100);
    assertEquals(writableIntegerValue.get(), 100);
    integerDolphinProperty.set(null);
    assertEquals(writableIntegerValue.get(), 0);
    binding.unbind();
    integerDolphinProperty.set(100);
    assertEquals(writableIntegerValue.get(), 0);
}
Also used : Binding(com.canoo.platform.core.functional.Binding) IntegerProperty(javafx.beans.property.IntegerProperty) SimpleIntegerProperty(javafx.beans.property.SimpleIntegerProperty) MockedProperty(com.canoo.dp.impl.remoting.MockedProperty) WritableIntegerValue(javafx.beans.value.WritableIntegerValue) SimpleIntegerProperty(javafx.beans.property.SimpleIntegerProperty) Test(org.testng.annotations.Test)

Example 8 with SimpleIntegerProperty

use of javafx.beans.property.SimpleIntegerProperty in project latexdraw by arnobl.

the class UpdateToGrid method redo.

@Override
public void redo() {
    shape.ifPresent(gp -> {
        final IntegerProperty i = new SimpleIntegerProperty();
        final IntegerProperty j = new SimpleIntegerProperty();
        gp.getShapes().forEach(sh -> {
            j.set(0);
            sh.getPoints().forEach(pt -> {
                pt.setPoint(grid.getTransformedPointToGrid(pt.toPoint3D()));
                j.set(j.get() + 1);
            });
            i.set(i.get() + 1);
            sh.setModified(true);
        });
    });
}
Also used : SimpleIntegerProperty(javafx.beans.property.SimpleIntegerProperty) IntegerProperty(javafx.beans.property.IntegerProperty) SimpleIntegerProperty(javafx.beans.property.SimpleIntegerProperty)

Example 9 with SimpleIntegerProperty

use of javafx.beans.property.SimpleIntegerProperty in project latexdraw by arnobl.

the class UpdateToGrid method undo.

@Override
public void undo() {
    shape.ifPresent(gp -> {
        final IntegerProperty i = new SimpleIntegerProperty();
        final IntegerProperty j = new SimpleIntegerProperty();
        gp.getShapes().forEach(sh -> {
            j.set(0);
            sh.getPoints().forEach(pt -> {
                pt.setPoint(listPts.get(i.get()).get(j.get()).getX(), listPts.get(i.get()).get(j.get()).getY());
                j.setValue(j.getValue() + 1);
            });
            i.set(i.get() + 1);
            sh.setModified(true);
        });
    });
}
Also used : SimpleIntegerProperty(javafx.beans.property.SimpleIntegerProperty) IntegerProperty(javafx.beans.property.IntegerProperty) SimpleIntegerProperty(javafx.beans.property.SimpleIntegerProperty)

Example 10 with SimpleIntegerProperty

use of javafx.beans.property.SimpleIntegerProperty in project latexdraw by arnobl.

the class MoveBackForegroundShapes method undo.

@Override
public void undo() {
    drawing.ifPresent(dr -> {
        if (foreground) {
            final IntegerProperty i = new SimpleIntegerProperty(formerId.length - 1);
            sortedSh.stream().sorted(Collections.reverseOrder()).forEach(sh -> {
                dr.removeShape(sh);
                dr.addShape(sh, formerId[i.get()]);
                i.set(i.get() - 1);
            });
        } else {
            final IntegerProperty i = new SimpleIntegerProperty(0);
            sortedSh.forEach(sh -> {
                dr.removeShape(sh);
                dr.addShape(sh, formerId[i.get()]);
                i.set(i.get() + 1);
            });
        }
        dr.setModified(true);
    });
}
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