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);
}
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);
}
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);
});
});
}
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);
});
});
}
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);
});
}
Aggregations