Example usage for javafx.beans.property Property isBound

List of usage examples for javafx.beans.property Property isBound

Introduction

In this page you can find the example usage for javafx.beans.property Property isBound.

Prototype

boolean isBound();

Source Link

Document

Can be used to check, if a Property is bound.

Usage

From source file:de.ks.binding.Binding.java

protected void resetProperties() {
    properties.entrySet().forEach(entry -> {
        @SuppressWarnings("unchecked")
        Property<Object> property = (Property<Object>) entry.getValue();
        if (!property.isBound()) {
            Object defaultValue = getDefaultValue(property);
            property.setValue(defaultValue);
        }/*from w  ww.j  a  va 2s.  c  o m*/
    });
}

From source file:de.ks.binding.Binding.java

@SuppressWarnings("unchecked")
protected void applyModelToProperties(Object model) {
    properties.entrySet().forEach(entry -> {
        Object value = entry.getKey().getValue(model);
        @SuppressWarnings("unchecked")
        Property<Object> property = (Property<Object>) entry.getValue();
        Pair<Function, Function> converter = converters.get(property);
        if (converter != null && value != null) {
            value = converter.getKey().apply(value);
        }//from  w  ww.j ava 2 s  .  c om
        if (!property.isBound()) {
            property.setValue(value);
        }
    });
}