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

项目:MacroIIDiscrete    文件:LaborMarketForOilUpdater.java   
/**
 * creates the listener (and automatically starts listening to them!)
 * @param laborSupplySlope the slope of the curve
 * @param laborSupplyIntercept the intercept of the curve
 * @param totalNumberOfWorkers the total number of workers to build
 * @param model a reference to the model, to register as deactivable and schedule updates
 */
public LaborMarketForOilUpdater(ObservableIntegerValue laborSupplySlope,
                                ObservableIntegerValue laborSupplyIntercept,
                                ObservableIntegerValue totalNumberOfWorkers,
                                MacroII model, Market laborMarket) {
    this.laborSupplySlope = laborSupplySlope;
    this.laborSupplyIntercept = laborSupplyIntercept;
    this.totalNumberOfWorkers = totalNumberOfWorkers;
    this.laborMarket = laborMarket;
    Preconditions.checkArgument(laborMarket.getGoodType().isLabor());

    //start listening to these
    this.laborSupplySlope.addListener(this);
    this.laborSupplyIntercept.addListener(this);
    this.totalNumberOfWorkers.addListener(this);

    //remember the model reference
    this.model = model;
    model.registerDeactivable(this);


}
项目:LoliXL    文件:TileManagementPresenter.java   
@Override
protected void initializePresenter() {
    tilesMapping = new MappedObservableList<>(tileService.getTiles(StackingStatus.SHOWN, StackingStatus.HIDDEN), this::createTile);
    tileContainerElements = new ListBinding<Node>() {

        ObservableIntegerValue maxShownTiles = tileService.maxShownTilesProperty();

        {
            bind(tilesMapping, maxShownTiles);
        }

        @Override
        protected ObservableList<Node> computeValue() {
            List<Node> elements = new ArrayList<>();
            int maxShown = maxShownTiles.get();
            if (maxShown > 0 && elements.size() > 0) {
                elements.add(view.shownTilesLabel);
            }
            int i = 0;
            for (Tile tile : tilesMapping) {
                if (i == maxShown) {
                    elements.add(view.hiddenTileLabel);
                }
                elements.add(tile);
                i++;
            }
            return FXCollections.observableList(elements);
        }
    };
    Bindings.bindContent(view.tilesContainer.getChildren(), tileContainerElements);

    bindManagementTile();
}
项目:speedment    文件:DefaultSpinnerItem.java   
private static void setSpinnerBehaviour(
    final IntegerSpinnerValueFactory svf,
    final boolean useDefaultValue,
    final ObservableIntegerValue defaultValue,
    final ObjectProperty<Integer> customValue
) {
    if (useDefaultValue) {
        svf.valueProperty().unbindBidirectional(customValue);
        svf.setValue(defaultValue.get());
    } else {
        svf.setValue(customValue.getValue());
        svf.valueProperty().bindBidirectional(customValue);
    }
}
项目:assertj-javafx    文件:IntegerTest.java   
@Test
public void testObservableIntegerValue(){
    ObservableIntegerValue actual = new SimpleIntegerProperty(10);

    assertThat(actual).hasValue(10);

    assertThat(actual).hasSameValue(actual);
}
项目:assertj-javafx    文件:ObservableValueAssertions_hasValue_integer_Test.java   
@Test
public void should_fail_if_actual_has_wrong_value(){
    try{
        ObservableIntegerValue actual = new SimpleIntegerProperty(10);

        new ObservableValueAssertions<>(actual).hasValue(8);
        fail("Should throw an AssertionError");
    }catch(AssertionError error){
        assertThat(error).hasMessageContaining("<8> but was <10>");
    }
}
项目:fx-animation-editor    文件:ChainedBindingFunctions.java   
public IntegerBinding selectInteger(Function<S, ? extends ObservableIntegerValue> childPropertyAccessor) {
    return selectInteger(childPropertyAccessor, 0);
}
项目:fx-animation-editor    文件:ChainedBindingFunctions.java   
public IntegerBinding selectInteger(Function<S, ? extends ObservableIntegerValue> childPropertyAccessor, int defaultValue) {
    return new IntegerBindingAdapter(new ChainBinding<>(rootProperty, childPropertyAccessor), defaultValue);
}
项目:qupath    文件:PathIconFactory.java   
PathIcons(String code, ObservableIntegerValue observableColor) {
    this.code = code;
    this.observableColor = observableColor;
}
项目:VocabHunter    文件:FilterGridModel.java   
@Override
protected ObservableIntegerValue countValue() {
    return count;
}
项目:speedment    文件:DefaultSpinnerItem.java   
/**
 * Creates a new DefaultSpinnerItem. 
 * <p>
 * While the CheckBox is checked, the Spinner will be disabled, 
 * and the property will always have the default value. <br>
 * While the CheckBox is un-checked, the Spinner will be enabled, 
 * and the property will always have the Spinner's current value.
 * <p>
 * Upon construction, the editor decides whether to check the default box
 * by comparing the property value to the default value. If they match, or
 * the property value is {@code null}, the CheckBox will be checked.
 * 
 * @param label         the label text
 * @param defaultValue  the default value 
 * @param value         the property to be edited
 * @param tooltip       the tooltip
 * @param min           the minimum spinner value
 * @param max           the maximum spinner value
 * @param decorator     the editor decorator
 */
public DefaultSpinnerItem(
    final String label,
    final ObservableIntegerValue defaultValue,
    final IntegerProperty value,
    final String tooltip,
    final int min,
    final int max,
    final UnaryOperator<Node> decorator
) {
    super(label, tooltip, decorator);

    this.defaultValue = requireNonNull(defaultValue);
    this.value = requireNonNull(value).asObject();
    this.customValue = new SimpleIntegerProperty().asObject();
    this.min = min;
    this.max = max;
}
项目:assertj-javafx    文件:ObservableValueAssertions_hasValue_integer_Test.java   
@Test
public void should_pass_if_actual_has_given_value(){
    ObservableIntegerValue actual = new SimpleIntegerProperty(10);

    new ObservableValueAssertions<>(actual).hasValue(10);
}
项目:speedment    文件:DefaultSpinnerItem.java   
/**
 * Creates a new DefaultSpinnerItem. 
 * <p>
 * While the CheckBox is checked, the Spinner will be disabled, 
 * and the property will always have the default value. <br>
 * While the CheckBox is un-checked, the Spinner will be enabled, 
 * and the property will always have the Spinner's current value.
 * <p>
 * Upon construction, the editor decides whether to check the default box
 * by comparing the property value to the default value. If they match, or
 * the property value is {@code null}, the CheckBox will be checked.
 * 
 * @param label         the label text
 * @param defaultValue  the default value 
 * @param value         the property to be edited
 * @param tooltip       the tooltip
 */
public DefaultSpinnerItem(
    final String label,
    final ObservableIntegerValue defaultValue,
    final IntegerProperty value,
    final String tooltip
) {
    this(label, defaultValue, value, tooltip, Integer.MIN_VALUE, Integer.MAX_VALUE);
}
项目:speedment    文件:DefaultSpinnerItem.java   
/**
 * Creates a new DefaultSpinnerItem. 
 * <p>
 * While the CheckBox is checked, the Spinner will be disabled, 
 * and the property will always have the default value. <br>
 * While the CheckBox is un-checked, the Spinner will be enabled, 
 * and the property will always have the Spinner's current value.
 * <p>
 * Upon construction, the editor decides whether to check the default box
 * by comparing the property value to the default value. If they match, or
 * the property value is {@code null}, the CheckBox will be checked.
 * 
 * @param label         the label text
 * @param defaultValue  the default value 
 * @param value         the property to be edited
 * @param tooltip       the tooltip
 * @param decorator     the editor decorator
 */
public DefaultSpinnerItem(
    final String label,
    final ObservableIntegerValue defaultValue,
    final IntegerProperty value,
    final String tooltip,
    final UnaryOperator<Node> decorator
) {
    this(label, defaultValue, value, tooltip, Integer.MIN_VALUE, Integer.MAX_VALUE, decorator);
}
项目:speedment    文件:DefaultSpinnerItem.java   
/**
 * Creates a new DefaultSpinnerItem. 
 * <p>
 * While the CheckBox is checked, the Spinner will be disabled, 
 * and the property will always have the default value. <br>
 * While the CheckBox is un-checked, the Spinner will be enabled, 
 * and the property will always have the Spinner's current value.
 * <p>
 * Upon construction, the editor decides whether to check the default box
 * by comparing the property value to the default value. If they match, or
 * the property value is {@code null}, the CheckBox will be checked.
 * 
 * @param label         the label text
 * @param defaultValue  the default value 
 * @param value         the property to be edited
 * @param tooltip       the tooltip
 * @param min           the minimum spinner value
 * @param max           the maximum spinner value
 */
public DefaultSpinnerItem(
    final String label,
    final ObservableIntegerValue defaultValue,
    final IntegerProperty value,
    final String tooltip,
    final int min,
    final int max
) {
    this(label, defaultValue, value, tooltip, min, max, NO_DECORATOR);
}
项目:advanced-bindings    文件:MathBindingsTest.java   
@SuppressWarnings("unchecked")
@Test
public void testScalb(){

    MathBindingsTestHelper.<Float, Integer, ObservableFloatValue, ObservableIntegerValue, Number>
        testTwoArgBinding1(MathBindings::scalb, Math::scalb, new Args<>(12f, 12), new Args<>(Float.NaN, 12), new Args<>(Float.POSITIVE_INFINITY, 3), new Args<>(0f, 3));

    MathBindingsTestHelper.<Float, Integer,  ObservableIntegerValue, Number>
        testTwoArgBinding2(MathBindings::scalb, Math::scalb, new Args<>(12f, 12), new Args<>(Float.NaN, 12), new Args<>(Float.POSITIVE_INFINITY, 3), new Args<>(0f, 3));

    MathBindingsTestHelper.<Float, Integer,  ObservableFloatValue, Number>
        testTwoArgBinding3(MathBindings::scalb, Math::scalb, new Args<>(12f, 12), new Args<>(Float.NaN, 12), new Args<>(Float.POSITIVE_INFINITY, 3), new Args<>(0f, 3));



    MathBindingsTestHelper.<Double, Integer, ObservableDoubleValue, ObservableIntegerValue, Number>
        testTwoArgBinding1(MathBindings::scalb, Math::scalb, new Args<>(12d, 12), new Args<>(Double.NaN, 12), new Args<>(Double.POSITIVE_INFINITY, 3), new Args<>(0d, 3));

    MathBindingsTestHelper.<Double, Integer,  ObservableIntegerValue, Number>
        testTwoArgBinding2(MathBindings::scalb, Math::scalb, new Args<>(12d, 12), new Args<>(Double.NaN, 12), new Args<>(Double.POSITIVE_INFINITY, 3), new Args<>(0d, 3));

    MathBindingsTestHelper.<Double, Integer,  ObservableDoubleValue, Number>
        testTwoArgBinding3(MathBindings::scalb, Math::scalb, new Args<>(12d, 12), new Args<>(Double.NaN, 12), new Args<>(Double.POSITIVE_INFINITY, 3), new Args<>(0d, 3));



}
项目:advanced-bindings    文件:MathBindings.java   
/**
 * Binding for {@link java.lang.Math#abs(int)}
 *
 * @param   a   the argument whose absolute value is to be determined
 * @return  the absolute value of the argument.
 */
public static IntegerBinding abs(final ObservableIntegerValue a) {
    return createIntegerBinding(() -> Math.abs(a.get()), a);
}
项目:advanced-bindings    文件:MathBindings.java   
/**
 * Binding for {@link java.lang.Math#addExact(int, int)}
 *
 * @param x the first value
 * @param y the second value
 * @return the result
 * @throws ArithmeticException if the result overflows an int
 */
public static IntegerBinding addExact(final ObservableIntegerValue x, final ObservableIntegerValue y) {
    return createIntegerBinding(() -> Math.addExact(x.get(), y.get()), x, y);
}
项目:advanced-bindings    文件:MathBindings.java   
/**
 * Binding for {@link java.lang.Math#addExact(int, int)}
 *
 *  @param x the first value
 * @param y the second value
 * @return the result
 * @throws ArithmeticException if the result overflows an int
 */
public static IntegerBinding addExact(final int x, final ObservableIntegerValue y) {
    return createIntegerBinding(() -> Math.addExact(x, y.get()), y);
}
项目:advanced-bindings    文件:MathBindings.java   
/**
 * Binding for {@link java.lang.Math#addExact(int, int)}
 *
 *  @param x the first value
 * @param y the second value
 * @return the result
 * @throws ArithmeticException if the result overflows an int
 */
public static IntegerBinding addExact(final ObservableIntegerValue x, final int y) {
    return createIntegerBinding(() -> Math.addExact(x.get(), y), x);
}
项目:advanced-bindings    文件:MathBindings.java   
/**
 * Binding for {@link java.lang.Math#decrementExact(int)}
 *
 *  @param a the value to decrement
 * @return the result
 * @throws ArithmeticException if the result overflows an int
 */
public static IntegerBinding decrementExact(final ObservableIntegerValue a) {
    return createIntegerBinding(() -> Math.decrementExact(a.get()), a);
}
项目:advanced-bindings    文件:MathBindings.java   
/**
 * Binding for {@link java.lang.Math#floorDiv(int, int)}
 *
 * @param x the dividend
 * @param y the divisor
 * @return the largest (closest to positive infinity)
 * {@code int} value that is less than or equal to the algebraic quotient.
 * @throws ArithmeticException if the divisor {@code y} is zero
 */
public static IntegerBinding floorDiv(final ObservableIntegerValue x, final ObservableIntegerValue y) {
    return createIntegerBinding(() -> Math.floorDiv(x.get(), y.get()), x, y);
}
项目:advanced-bindings    文件:MathBindings.java   
/**
 * Binding for {@link java.lang.Math#floorDiv(int, int)}
 *
 * @param x the dividend
 * @param y the divisor
 * @return the largest (closest to positive infinity)
 * {@code int} value that is less than or equal to the algebraic quotient.
 * @throws ArithmeticException if the divisor {@code y} is zero
 */
public static IntegerBinding floorDiv(final int x, final ObservableIntegerValue y) {
    return createIntegerBinding(() -> Math.floorDiv(x, y.get()), y);
}
项目:advanced-bindings    文件:MathBindings.java   
/**
 * Binding for {@link java.lang.Math#floorDiv(int, int)}
 *
 * @param x the dividend
 * @param y the divisor
 * @return the largest (closest to positive infinity)
 * {@code int} value that is less than or equal to the algebraic quotient.
 * @throws ArithmeticException if the divisor {@code y} is zero
 */
public static IntegerBinding floorDiv(final ObservableIntegerValue x, final int y) {
    return createIntegerBinding(() -> Math.floorDiv(x.get(), y), x);
}
项目:advanced-bindings    文件:MathBindings.java   
/**
 * Binding for {@link java.lang.Math#floorMod(int, int)}
 *
 * @param x the dividend
 * @param y the divisor
 * @return the floor modulus {@code x - (floorDiv(x, y) * y)}
 * @throws ArithmeticException if the divisor {@code y} is zero
 */
public static IntegerBinding floorMod(final ObservableIntegerValue x, final ObservableIntegerValue y) {
    return createIntegerBinding(() -> Math.floorMod(x.get(), y.get()), x, y);
}
项目:advanced-bindings    文件:MathBindings.java   
/**
 * Binding for {@link java.lang.Math#floorMod(int, int)}
 *
 * @param x the dividend
 * @param y the divisor
 * @return the floor modulus {@code x - (floorDiv(x, y) * y)}
 * @throws ArithmeticException if the divisor {@code y} is zero
 */
public static IntegerBinding floorMod(final int x, final ObservableIntegerValue y) {
    return createIntegerBinding(() -> Math.floorMod(x, y.get()), y);
}
项目:advanced-bindings    文件:MathBindings.java   
/**
 * Binding for {@link java.lang.Math#floorMod(int, int)}
 *
 * @param x the dividend
 * @param y the divisor
 * @return the floor modulus {@code x - (floorDiv(x, y) * y)}
 * @throws ArithmeticException if the divisor {@code y} is zero
 */
public static IntegerBinding floorMod(final ObservableIntegerValue x, final int y) {
    return createIntegerBinding(() -> Math.floorMod(x.get(), y), x);
}
项目:advanced-bindings    文件:MathBindings.java   
/**
 * Binding for {@link java.lang.Math#incrementExact(int)}
 *
 * @param a the value to increment
 * @return the result
 * @throws ArithmeticException if the result overflows an int
 */
public static IntegerBinding incrementExact(final ObservableIntegerValue a) {
    return createIntegerBinding(() -> Math.incrementExact(a.get()), a);
}
项目:advanced-bindings    文件:MathBindings.java   
/**
 * Binding for {@link java.lang.Math#max(int, int)}
 *
 * @param   a   an argument.
 * @param   b   another argument.
 * @return  the larger of {@code a} and {@code b}.
 */
public static IntegerBinding max(final ObservableIntegerValue a, final ObservableIntegerValue b) {
    return createIntegerBinding(() -> Math.max(a.get(), b.get()), a, b);
}
项目:advanced-bindings    文件:MathBindings.java   
/**
 * Binding for {@link java.lang.Math#max(int, int)}
 *
 * @param   a   an argument.
 * @param   b   another argument.
 * @return  the larger of {@code a} and {@code b}.
 */
public static IntegerBinding max(final int a, final ObservableIntegerValue b) {
    return createIntegerBinding(() -> Math.max(a, b.get()), b);
}
项目:advanced-bindings    文件:MathBindings.java   
/**
 * Binding for {@link java.lang.Math#max(int, int)}
 *
 * @param   a   an argument.
 * @param   b   another argument.
 * @return  the larger of {@code a} and {@code b}.
 */
public static IntegerBinding max(final ObservableIntegerValue a, final int b) {
    return createIntegerBinding(() -> Math.max(a.get(), b), a);
}
项目:advanced-bindings    文件:MathBindings.java   
/**
 * Binding for {@link java.lang.Math#min(int, int)}
 *
 * @param   a   an argument.
 * @param   b   another argument.
 * @return  the smaller of {@code a} and {@code b}.
 */
public static IntegerBinding min(final ObservableIntegerValue a, final ObservableIntegerValue b) {
    return createIntegerBinding(() -> Math.min(a.get(), b.get()), a, b);
}
项目:advanced-bindings    文件:MathBindings.java   
/**
 * Binding for {@link java.lang.Math#min(int, int)}
 *
 * @param   a   an argument.
 * @param   b   another argument.
 * @return  the smaller of {@code a} and {@code b}.
 */
public static IntegerBinding min(final int a, final ObservableIntegerValue b) {
    return createIntegerBinding(() -> Math.min(a, b.get()), b);
}
项目:advanced-bindings    文件:MathBindings.java   
/**
 * Binding for {@link java.lang.Math#min(int, int)}
 *
 * @param   a   an argument.
 * @param   b   another argument.
 * @return  the smaller of {@code a} and {@code b}.
 */
public static IntegerBinding min(final ObservableIntegerValue a, final int b) {
    return createIntegerBinding(() -> Math.min(a.get(), b), a);
}
项目:advanced-bindings    文件:MathBindings.java   
/**
 * Binding for {@link java.lang.Math#multiplyExact(int, int)}
 *
 * @param x the first value
 * @param y the second value
 * @return the result
 * @throws ArithmeticException if the result overflows an int
 */
public static IntegerBinding multiplyExact(final ObservableIntegerValue x, final ObservableIntegerValue y) {
    return createIntegerBinding(() -> Math.multiplyExact(x.get(), y.get()), x, y);
}
项目:advanced-bindings    文件:MathBindings.java   
/**
 * Binding for {@link java.lang.Math#multiplyExact(int, int)}
 *
 * @param x the first value
 * @param y the second value
 * @return the result
 * @throws ArithmeticException if the result overflows an int
 */
public static IntegerBinding multiplyExact(final int x, final ObservableIntegerValue y) {
    return createIntegerBinding(() -> Math.multiplyExact(x, y.get()), y);
}
项目:advanced-bindings    文件:MathBindings.java   
/**
 * Binding for {@link java.lang.Math#multiplyExact(int, int)}
 *
 * @param x the first value
 * @param y the second value
 * @return the result
 * @throws ArithmeticException if the result overflows an int
 */
public static IntegerBinding multiplyExact(final ObservableIntegerValue x, final int y) {
    return createIntegerBinding(() -> Math.multiplyExact(x.get(), y), x);
}
项目:advanced-bindings    文件:MathBindings.java   
/**
 * Binding for {@link java.lang.Math#negateExact(int)}
 *
 *  @param a the value to negate
 * @return the result
 * @throws ArithmeticException if the result overflows an int
 */
public static IntegerBinding negateExact(final ObservableIntegerValue a) {
    return createIntegerBinding(() -> Math.negateExact(a.get()), a);
}
项目:advanced-bindings    文件:MathBindings.java   
/**
 * Binding for {@link java.lang.Math#scalb(double, int)}
 *
 * @param d number to be scaled by a power of two.
 * @param scaleFactor power of 2 used to scale {@code d}
 * @return {@code d} &times; 2<sup>{@code scaleFactor}</sup>
 */
public static DoubleBinding scalb(final ObservableDoubleValue d, final ObservableIntegerValue scaleFactor) {
    return createDoubleBinding(()->Math.scalb(d.get(), scaleFactor.get()), d, scaleFactor);
}
项目:advanced-bindings    文件:MathBindings.java   
/**
 * Binding for {@link java.lang.Math#scalb(double, int)}
 *
 * @param d number to be scaled by a power of two.
 * @param scaleFactor power of 2 used to scale {@code d}
 * @return {@code d} &times; 2<sup>{@code scaleFactor}</sup>
 */
public static DoubleBinding scalb(final double d, final ObservableIntegerValue scaleFactor) {
    return createDoubleBinding(()->Math.scalb(d, scaleFactor.get()), scaleFactor);
}
项目:advanced-bindings    文件:MathBindings.java   
/**
 * Binding for {@link java.lang.Math#scalb(float, int)}
 *
 * @param f number to be scaled by a power of two.
 * @param scaleFactor power of 2 used to scale {@code f}
 * @return {@code f} &times; 2<sup>{@code scaleFactor}</sup>
 */
public static FloatBinding scalb(final ObservableFloatValue f, final ObservableIntegerValue scaleFactor) {
    return createFloatBinding(()->Math.scalb(f.get(), scaleFactor.get()),f, scaleFactor);
}