Example usage for javafx.beans.value ObservableValue addListener

List of usage examples for javafx.beans.value ObservableValue addListener

Introduction

In this page you can find the example usage for javafx.beans.value ObservableValue addListener.

Prototype

void addListener(ChangeListener<? super T> listener);

Source Link

Document

Adds a ChangeListener which will be notified whenever the value of the ObservableValue changes.

Usage

From source file:acmi.l2.clientmod.xdat.Controller.java

private TreeView<Object> createTreeView(Field listField, ObservableValue<String> filter) {
    TreeView<Object> elements = new TreeView<>();
    elements.setShowRoot(false);/*ww w .ja  v  a 2  s  .c  o  m*/
    elements.setContextMenu(createContextMenu(elements));

    InvalidationListener treeInvalidation = (observable) -> buildTree(editor.xdatObjectProperty().get(),
            listField, elements, filter.getValue());
    editor.xdatObjectProperty().addListener(treeInvalidation);
    xdatListeners.add(treeInvalidation);

    filter.addListener(treeInvalidation);

    return elements;
}