de.factoryfx.javafx.widget.dataview.ReferenceAttributeDataView Maven / Gradle / Ivy
package de.factoryfx.javafx.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> listAAttributeChangeListener;
private final ObservableList list = FXCollections.observableArrayList();
public ReferenceAttributeDataView(ReferenceListAttribute refList) {
this.refList=refList;
listAAttributeChangeListener = (attribute, value) -> list.setAll(value);
this.refList.internal_addListener(new WeakAttributeChangeListener<>(listAAttributeChangeListener));
}
@Override
public ObservableList dataList(){
list.setAll(refList);
return list;
}
}