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

org.reactfx.value.ValWrapper Maven / Gradle / Ivy

There is a newer version: 1.11
Show newest version
package org.reactfx.value;

import javafx.beans.InvalidationListener;
import javafx.beans.value.ObservableValue;

import org.reactfx.Subscription;

class ValWrapper> extends ValBase {
    private final D delegate;

    ValWrapper(D delegate) {
        this.delegate = delegate;
    }

    D getDelegate() {
        return delegate;
    }

    @Override
    protected Subscription connect() {
        InvalidationListener listener = obs -> invalidate();
        delegate.addListener(listener);
        return () -> delegate.removeListener(listener);
    }

    @Override
    protected T computeValue() {
        return delegate.getValue();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy