Java 类javafx.beans.value.ObservableNumberValue 实例源码

项目:qupath    文件:HistogramPanelFX.java   
/**
         * Note: xAxis and yAxis must be instances of NumberAxis.
         * 
         * @param chart
         */
        public ThresholdedChartWrapper(final XYChart<Number, Number> chart) {
            this.chart = chart;
            this.xAxis = (NumberAxis)chart.getXAxis();
            this.yAxis = (NumberAxis)chart.getYAxis();
            pane.getChildren().add(chart);
            chart.prefWidthProperty().bind(pane.widthProperty());
            chart.prefHeightProperty().bind(pane.heightProperty());

            thresholds.addListener(new ListChangeListener<ObservableNumberValue>() {

                @Override
                public void onChanged(ListChangeListener.Change<? extends ObservableNumberValue> c) {
                    while (c.next()) {
                        if (c.wasPermutated()) {
                            continue;
                        } else {
                            for (ObservableNumberValue removedItem : c.getRemoved()) {
                                pane.getChildren().remove(vLines.remove(removedItem));
                            }
//                          pane.getChildren().removeAll(c.getRemoved());
//                          for (ObservableNumberValue addedItem : c.getAddedSubList()) {
//                              addThreshold(addedItem.getValue().doubleValue());
//                          }
                        }
                    }
                }
            });

        }
项目:qupath    文件:HistogramPanelFX.java   
public void setColor(final ObservableNumberValue val, final Color color) {
    Line line = vLines.get(val);
    if (line == null) {
        logger.warn("No threshold line found for {}", val);
        return;
    }
    line.setStroke(color);
}
项目:VocabHunter    文件:AbstractFilterModel.java   
protected void bindValues() {
    ObservableNumberValue count = countValue();
    StringBinding countText = Bindings.createStringBinding(() -> formatTotalWords(count), count);
    StringBinding filenameText = Bindings.createStringBinding(() -> filename(file.get()), file);

    error.bind(Bindings.equal(count, 0));
    countDescription.bind(Bindings.when(error).then(ERROR).otherwise(countText));
    filename.bind(filenameText);
}
项目:assertj-javafx    文件:FloatTest.java   
@Test
public void testObservableNumberValue(){
    ObservableNumberValue actual = new SimpleFloatProperty(10f);

    assertThat(actual).hasValue(10f);

    assertThat(actual).hasSameValue(actual);
}
项目:assertj-javafx    文件:IntegerTest.java   
@Test
public void testObservableNumberValue(){
    ObservableNumberValue actual = new SimpleIntegerProperty(10);

    assertThat(actual).hasValue(10);

    assertThat(actual).hasSameValue(actual);
}
项目:assertj-javafx    文件:LongTest.java   
@Test
public void testObservableNumberValue(){
    ObservableNumberValue actual = new SimpleLongProperty(10l);

    assertThat(actual).hasValue(10l);

    assertThat(actual).hasSameValue(actual);
}
项目:assertj-javafx    文件:DoubleTest.java   
@Test
public void testObservableNumberValue(){
    ObservableNumberValue actual = new SimpleDoubleProperty(10.2);

    assertThat(actual).hasValue(10.2);

    assertThat(actual).hasSameValue(actual);
}
项目:assertj-javafx    文件:ObservableValueAssertions_hasValue_number_Test.java   
@Test
public void should_pass_if_actual_has_given_value(){
    ObservableNumberValue actual = new SimpleDoubleProperty(10.123);

    Number expected = 10.123;

    new ObservableValueAssertions<>(actual).hasValue(expected);
}
项目:assertj-javafx    文件:ObservableValueAssertions_hasValue_number_Test.java   
@Test
public void should_fail_if_expectedValue_is_null(){
    try{
        ObservableNumberValue actual = new SimpleDoubleProperty(10.123);

        new ObservableValueAssertions<>(actual).hasValue(null);
        fail("Should throw an AssertionError");
    }catch(AssertionError error){
        assertThat(error).hasMessageContaining("expected value may not be null");
    }
}
项目:assertj-javafx    文件:ObservableNumberValueAssertions_hasValue_double_with_offset_Test.java   
@Test
public void should_fail_if_actual_has_wrong_value(){
    try{
        ObservableNumberValue actual = new SimpleDoubleProperty(10.123);

        new ObservableNumberValueAssertions(actual).hasValue(10.12, offset(0.001));
        fail("Should throw an AssertionError");
    }catch(AssertionError error){
        assertThat(error).hasMessageContaining("less than <0.001> but difference was <0.0030");
    }
}
项目:assertj-javafx    文件:ObservableNumberValueAssertions_hasValue_double_with_offset_Test.java   
@Test
public void should_fail_if_offset_is_null(){
    try{
        ObservableNumberValue actual = new SimpleDoubleProperty(10.123);
        new ObservableNumberValueAssertions(actual).hasValue(10.123, null);

        fail("Should throw an AssertionError");
    }catch(NullPointerException error){
        assertThat(error).hasMessageContaining("offset may not be null");
    }
}
项目:qupath    文件:HistogramPanelFX.java   
public ObservableList<ObservableNumberValue> getThresholds() {
    return thresholds;
}
项目:qupath    文件:HistogramPanelFX.java   
public ObservableNumberValue addThreshold(final double x) {
    return addThreshold(x, null);
}
项目:qupath    文件:HistogramPanelFX.java   
public ObservableNumberValue addThreshold(final double x, final Color color) {
    return addThreshold(new SimpleDoubleProperty(x), color);
}
项目:truffle-hog    文件:MyBindings.java   
public static DoubleBinding divideIntToDouble(ObservableNumberValue divisor, ObservableNumberValue divider) {
    return new DivideIntToDoubleBinding(divisor, divider);
}
项目:truffle-hog    文件:MyBindings.java   
private SqrtBinding(ObservableNumberValue value) {
    super.bind(value);
    this.value = value;
}
项目:truffle-hog    文件:MyBindings.java   
private Pow2Binding(ObservableNumberValue value) {
    super.bind(value);
    this.value = value;
}
项目:truffle-hog    文件:MyBindings.java   
private DivideIntToDoubleBinding(ObservableNumberValue divisor, ObservableNumberValue divider) {
    super.bind(divisor, divider);
    this.divisor = divisor;
    this.divider = divider;
}
项目:VocabHunter    文件:ProgressController.java   
private void bindValueLabel(final Label valueLabel, final ObservableNumberValue property) {
    StringBinding binding = Bindings.createStringBinding(() -> formatWords(property), property);

    valueLabel.textProperty().bind(binding);
}
项目:VocabHunter    文件:ProgressController.java   
private String formatWords(final ObservableNumberValue property) {
    return MessageFormat.format("{0} {0,choice,0#Words|1#Word|1<Words}", property.intValue());
}
项目:VocabHunter    文件:ProgressController.java   
private void bindPercentLabel(final Label valueLabel, final ObservableNumberValue property) {
    valueLabel.textProperty().bind(Bindings.format("%.0f%%", property));
}
项目:VocabHunter    文件:AbstractFilterModel.java   
private String formatTotalWords(final ObservableNumberValue count) {
    return NumberFormat.getIntegerInstance(CoreConstants.LOCALE).format(count.getValue());
}
项目:VocabHunter    文件:FilterSessionModel.java   
@Override
protected ObservableNumberValue countValue() {
    return Bindings.when(includeUnknown).then(seenCount).otherwise(knownCount);
}
项目:assertj-javafx    文件:ObservableNumberValueAssert.java   
protected ObservableNumberValueAssert(ObservableNumberValue actual) {
    super(actual, ObservableNumberValueAssert.class);
}
项目:assertj-javafx    文件:ObservableNumberValueAssertions.java   
public ObservableNumberValueAssertions(ObservableNumberValue actual) {
    super(actual, ObservableNumberValueAssertions.class);
}
项目:assertj-javafx    文件:NumberTest.java   
@Test
public void testNumberBinding(){

    IntegerProperty valueA = new SimpleIntegerProperty(10);
    IntegerProperty valueB = new SimpleIntegerProperty(20);

    final NumberBinding binding = valueA.add(valueB);


    assertThat(binding).hasValue(30);

    assertThat(binding).dependsOn(valueA);

    ObservableNumberValue expectedValueObservable = new SimpleIntegerProperty(30);

    assertThat(binding).hasSameValue(expectedValueObservable);

}
项目:assertj-javafx    文件:ObservableNumberValueAssertions_hasValue_double_with_offset_Test.java   
@Test
public void should_pass_if_actual_has_given_value_with_offset(){
    ObservableNumberValue actual = new SimpleDoubleProperty(18509.64945984806);

    new ObservableNumberValueAssertions(actual).hasValue(18509.6494, offset(0.001));
}
项目:truffle-hog    文件:MyBindings.java   
public static DoubleBinding sqrt(ObservableNumberValue value) {

        return new SqrtBinding(value);

    }
项目:truffle-hog    文件:MyBindings.java   
public static DoubleBinding pow2(ObservableNumberValue value) {

        return new Pow2Binding(value);
    }
项目:assertj-javafx    文件:ObservableNumberValueAssert.java   
/**
 * Verifies that the actual observable has the same value as the given observable.
 *
 * @param expectedValue the observable value to compare with the actual observables current value.
 *
 * @return {@code this} assertion instance.
 */
public ObservableNumberValueAssert hasSameValue(ObservableNumberValue expectedValue) {
    new ObservableValueAssertions<>(actual).hasSameValue(expectedValue);
    return this;
}
项目:assertj-javafx    文件:IntegerBindingAssert.java   
/**
 * Verifies that the actual observable has the same value as the given observable.
 *
 * @param expectedValue the observable value to compare with the actual observables current value.
 *
 * @return {@code this} assertion instance.
 */
public IntegerBindingAssert hasSameValue(ObservableNumberValue expectedValue) {
    new ObservableValueAssertions<>(actual).hasSameValue(expectedValue);
    return this;
}
项目:assertj-javafx    文件:DoublePropertyAssert.java   
/**
 * Verifies that the actual observable has the same value as the given observable.
 *
 * @param expectedValue the observable value to compare with the actual observables current value.
 *
 * @return {@code this} assertion instance.
 */
public DoublePropertyAssert hasSameValue(ObservableNumberValue expectedValue) {
    new ObservableValueAssertions<>(actual).hasSameValue(expectedValue);
    return this;
}
项目:assertj-javafx    文件:NumberBindingAssert.java   
/**
 * Verifies that the actual observable has the same value as the given observable.
 *
 * @param expectedValue the observable value to compare with the actual observables current value.
 *
 * @return {@code this} assertion instance.
 */
public NumberBindingAssert hasSameValue(ObservableNumberValue expectedValue) {
    new ObservableValueAssertions<>(actual).hasSameValue(expectedValue);
    return this;
}
项目:assertj-javafx    文件:LongBindingAssert.java   
/**
 * Verifies that the actual observable has the same value as the given observable.
 *
 * @param expectedValue the observable value to compare with the actual observables current value.
 *
 * @return {@code this} assertion instance.
 */
public LongBindingAssert hasSameValue(ObservableNumberValue expectedValue) {
    new ObservableValueAssertions<>(actual).hasSameValue(expectedValue);
    return this;
}
项目:assertj-javafx    文件:ReadOnlyDoublePropertyAssert.java   
/**
 * Verifies that the actual observable has the same value as the given observable.
 *
 * @param expectedValue the observable value to compare with the actual observables current value.
 *
 * @return {@code this} assertion instance.
 */
public ReadOnlyDoublePropertyAssert hasSameValue(ObservableNumberValue expectedValue) {
    new ObservableValueAssertions<>(actual).hasSameValue(expectedValue);
    return this;
}
项目:assertj-javafx    文件:DoubleBindingAssert.java   
/**
 * Verifies that the actual observable has the same value as the given observable.
 *
 * @param expectedValue the observable value to compare with the actual observables current value.
 *
 * @return {@code this} assertion instance.
 */
public DoubleBindingAssert hasSameValue(ObservableNumberValue expectedValue) {
    new ObservableValueAssertions<>(actual).hasSameValue(expectedValue);
    return this;
}
项目:assertj-javafx    文件:FloatBindingAssert.java   
/**
 * Verifies that the actual observable has the same value as the given observable.
 *
 * @param expectedValue the observable value to compare with the actual observables current value.
 *
 * @return {@code this} assertion instance.
 */
public FloatBindingAssert hasSameValue(ObservableNumberValue expectedValue) {
    new ObservableValueAssertions<>(actual).hasSameValue(expectedValue);
    return this;
}
项目:assertj-javafx    文件:ReadOnlyIntegerPropertyAssert.java   
/**
 * Verifies that the actual observable has the same value as the given observable.
 *
 * @param expectedValue the observable value to compare with the actual observables current value.
 *
 * @return {@code this} assertion instance.
 */
public ReadOnlyIntegerPropertyAssert hasSameValue(ObservableNumberValue expectedValue) {
    new ObservableValueAssertions<>(actual).hasSameValue(expectedValue);
    return this;
}
项目:assertj-javafx    文件:IntegerPropertyAssert.java   
/**
 * Verifies that the actual observable has the same value as the given observable.
 *
 * @param expectedValue the observable value to compare with the actual observables current value.
 *
 * @return {@code this} assertion instance.
 */
public IntegerPropertyAssert hasSameValue(ObservableNumberValue expectedValue) {
    new ObservableValueAssertions<>(actual).hasSameValue(expectedValue);
    return this;
}
项目:assertj-javafx    文件:FloatPropertyAssert.java   
/**
 * Verifies that the actual observable has the same value as the given observable.
 *
 * @param expectedValue the observable value to compare with the actual observables current value.
 *
 * @return {@code this} assertion instance.
 */
public FloatPropertyAssert hasSameValue(ObservableNumberValue expectedValue) {
    new ObservableValueAssertions<>(actual).hasSameValue(expectedValue);
    return this;
}