All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.netopyr.reduxfx.component.impl.ReduxFXReadOnlyIntegerProperty Maven / Gradle / Ivy

package com.netopyr.reduxfx.component.impl;

import com.netopyr.reduxfx.component.command.IntegerChangedCommand;
import io.reactivex.Flowable;
import javafx.beans.property.ReadOnlyIntegerPropertyBase;
import org.reactivestreams.Publisher;

public final class ReduxFXReadOnlyIntegerProperty extends ReadOnlyIntegerPropertyBase {

    private final Object bean;
    private final String name;

    private int value;

    public ReduxFXReadOnlyIntegerProperty(Object bean, String name, Publisher receiver) {
        this.bean = bean;
        this.name = name;
        Flowable.fromPublisher(receiver).forEach(command -> {
            this.value = command.getNewValue();
            this.fireValueChangedEvent();
        });
    }

    @Override
    public Object getBean() {
        return bean;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public int get() {
        return value;
    }




}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy