Package javafx.beans.property

Examples of javafx.beans.property.BooleanProperty


public class SuspendWhenTest {

    @Test
    public void test() {
        Property<Integer> p = new SimpleObjectProperty<>(0);
        BooleanProperty suspended = new SimpleBooleanProperty(true);
        List<Integer> emitted = new ArrayList<>();
        SuspendableEventStream<Integer> pausable = EventStreams.valuesOf(p).pausable();
        Subscription sub = pausable.suspendWhen(suspended).subscribe(emitted::add);

        // test that the stream started suspended
        assertEquals(Arrays.asList(), emitted);

        suspended.set(false);
        assertEquals(Arrays.asList(0), emitted);

        p.setValue(1);
        assertEquals(Arrays.asList(0, 1), emitted);

        suspended.set(true);
        p.setValue(2);
        p.setValue(3);
        p.setValue(4);
        assertEquals(Arrays.asList(0, 1), emitted);

        List<Integer> emitted2 = new ArrayList<>();
        pausable.subscribe(emitted2::add);
        assertEquals(Arrays.asList(), emitted2);

        suspended.set(false);
        assertEquals(Arrays.asList(0, 1, 2, 3, 4), emitted);
        assertEquals(Arrays.asList(2, 3, 4), emitted2);

        suspended.set(true);
        p.setValue(5);
        p.setValue(6);
        assertEquals(Arrays.asList(2, 3, 4), emitted2);
        sub.unsubscribe(); // testing resume on unsubscribe
        assertEquals(Arrays.asList(0, 1, 2, 3, 4), emitted);
View Full Code Here




    @Override
    public void initialize(URL url, ResourceBundle resourceBundle) {
        BooleanProperty urlEntered = new SimpleBooleanProperty();
        urlEntered.bind(urlTextField.textProperty().isNotEmpty());
        BooleanProperty userNameEntered = new SimpleBooleanProperty();
        userNameEntered.bind(urlTextField.textProperty().isNotEmpty());
        BooleanProperty passwordEntered = new SimpleBooleanProperty();
        passwordEntered.bind(passwordTextField.textProperty().isNotEmpty());
        saveButton.disableProperty().bind(urlEntered.and(userNameEntered).and(passwordEntered).not());
    }
View Full Code Here

        App.getInstance().replaceStageContent(view.getView());
    }

    @Override
    public void initialize(URL url, ResourceBundle resourceBundle) {
        BooleanProperty masterPasswordEntered = new SimpleBooleanProperty();
        masterPasswordEntered.bind(masterPasswordField.textProperty().length().greaterThan(3));
        loginButton.disableProperty().bind(masterPasswordEntered.not());
    }
View Full Code Here

    }
  }

  public static GridPane createOptionGridPane(Carousel<?> carousel) {
    final DoubleProperty alignment = new SimpleDoubleProperty(0.8);
    final BooleanProperty reflectionEnabled = new SimpleBooleanProperty(true);
    final BooleanProperty clipReflections = new SimpleBooleanProperty(true);
    final DoubleProperty fieldOfViewRatio = new SimpleDoubleProperty(0.5);
    final DoubleProperty radiusRatio = new SimpleDoubleProperty(0.5);
    final DoubleProperty viewDistanceRatio = new SimpleDoubleProperty(0.5);
    final DoubleProperty density = new SimpleDoubleProperty(0.01);
    final DoubleProperty cellSizeRatio = new SimpleDoubleProperty(0.6);
View Full Code Here

    }

    @Test(timeout=1000)
    public void waitFor_with_booleanValue() throws Exception {
        // given:
        BooleanProperty property = new SimpleBooleanProperty(false);
        RunWaitUtils.runOutside(() -> {
            RunWaitUtils.sleep(50, MILLISECONDS);
            property.set(true);
        });

        // expect:
        RunWaitUtils.waitFor(250, MILLISECONDS, property);
    }
View Full Code Here

    }

    @Test(timeout=1000)
    public void waitFor_with_booleanValue_with_false() throws Exception {
        // given:
        BooleanProperty property = new SimpleBooleanProperty(false);
        RunWaitUtils.runOutside(() -> {
            RunWaitUtils.sleep(50, MILLISECONDS);
            property.set(false);
        });

        // expect:
        thrown.expect(TimeoutException.class);
        RunWaitUtils.waitFor(250, MILLISECONDS, property);
View Full Code Here

  }

  private void initialize() {
    final DoubleProperty frameWidthProperty = getSkinnable().frameWidthProperty();
    final DoubleProperty scopeLineWidthProperty = getSkinnable().scopeLineWidthProperty();
    final BooleanProperty scopeLinesVisibleProperty = getSkinnable().scopeLinesVisibleProperty();

    // Adding listener to control "radiusProperty" to add the value to "localRadius".
    getSkinnable().radiusProperty().addListener(new InvalidationListener() {
      @Override
      public void invalidated(Observable arg0) {
View Full Code Here

TOP

Related Classes of javafx.beans.property.BooleanProperty

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.