Search in sources :

Example 6 with IntegerProperty

use of javafx.beans.property.IntegerProperty 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 IntegerProperty

use of javafx.beans.property.IntegerProperty 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 IntegerProperty

use of javafx.beans.property.IntegerProperty 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 IntegerProperty

use of javafx.beans.property.IntegerProperty 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 IntegerProperty

use of javafx.beans.property.IntegerProperty 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

IntegerProperty (javafx.beans.property.IntegerProperty)23 SimpleIntegerProperty (javafx.beans.property.SimpleIntegerProperty)22 DoubleProperty (javafx.beans.property.DoubleProperty)12 ObjectProperty (javafx.beans.property.ObjectProperty)12 SimpleDoubleProperty (javafx.beans.property.SimpleDoubleProperty)12 SimpleObjectProperty (javafx.beans.property.SimpleObjectProperty)12 Dimension2D (javafx.geometry.Dimension2D)12 Color (javafx.scene.paint.Color)10 SimpleStringProperty (javafx.beans.property.SimpleStringProperty)9 StringProperty (javafx.beans.property.StringProperty)9 BooleanProperty (javafx.beans.property.BooleanProperty)8 SimpleBooleanProperty (javafx.beans.property.SimpleBooleanProperty)8 List (java.util.List)5 MockedProperty (com.canoo.dp.impl.remoting.MockedProperty)2 Binding (com.canoo.platform.core.functional.Binding)2 VisibleData (eu.hansolo.tilesfx.chart.SunburstChart.VisibleData)2 Scene (javafx.scene.Scene)2 Button (javafx.scene.control.Button)2 Test (org.testng.annotations.Test)2 Offer (bisq.core.offer.Offer)1