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

com.netopyr.reduxfx.vscenegraph.impl.patcher.property.FocusedAccessor Maven / Gradle / Ivy

package com.netopyr.reduxfx.vscenegraph.impl.patcher.property;

import com.netopyr.reduxfx.vscenegraph.impl.patcher.NodeUtilities;
import javafx.beans.property.ReadOnlyProperty;
import javafx.scene.Node;

import java.util.function.Consumer;

public class FocusedAccessor extends AbstractNoConversionAccessor {

    public FocusedAccessor() {
        super(NodeUtilities.getPropertyGetter(Node.class, "focused").get());
    }

    @Override
    protected void setValue(Consumer dispatcher, ReadOnlyProperty property, Object value) {
        if (Boolean.TRUE.equals(value)) {
            ((Node) property.getBean()).requestFocus();
        }
    }
}