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

de.factoryfx.javafx.data.widget.dataview.ReferenceAttributeDataView Maven / Gradle / Ivy

The newest version!
package de.factoryfx.javafx.data.widget.dataview;

import de.factoryfx.data.Data;
import de.factoryfx.data.attribute.*;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;

import java.util.List;

public class ReferenceAttributeDataView,A>> implements DataView{

    private final ReferenceListAttribute refList;
    private final AttributeChangeListener, A> listAttributeChangeListener;
    private final ObservableList list = FXCollections.observableArrayList();

    public ReferenceAttributeDataView(ReferenceListAttribute refList) {
        this.refList=refList;
        this.listAttributeChangeListener = (attribute, value) -> list.setAll(value);
        this.refList.internal_addListener(new WeakAttributeChangeListener<>(listAttributeChangeListener));
    }

    @Override
    public ObservableList dataList(){
        list.setAll(refList);
        return list;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy