Verified Owner
Top Fields Constructors Methods
org.jabref.gui.util

public Class RecursiveChildrenListener

extends Object
Class Inheritance
Imports
java.util.HashMap, .Map, javafx.beans.InvalidationListener, javafx.beans.value.ChangeListener, javafx.collections.ListChangeListener, .ObservableList, javafx.scene.Node, .Parent, .Scene, org.jspecify.annotations.NonNull, .Nullable

Field Summary

Modifier and TypeField and Description
private @Nullable Parent
private @Nullable Scene
private final @NonNull Map<Parent, ListChangeListener<Node>>
private final InvalidationListener
private @Nullable ChangeListener<Parent>

Constructor Summary

AccessConstructor and Description
public
RecursiveChildrenListener(@NonNull InvalidationListener
the listener to be called when children change
listener
)

Creates a new RecursiveChildrenListener that will recursively monitor changes in the children of all parent nodes in a scene graph.

Method Summary

Modifier and TypeMethod and Description
private void
public void
attachToNode(@NonNull Node
the node to attach to
node
)

Attaches the listener directly to a node and all its descendants.

public void
attachToScene(@NonNull Scene
the scene to attach to
scene
)

Attaches the listener to a scene, monitoring its root and all descendants.

public void
detach()

Detaches all listeners from the scene or node hierarchy.

private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

attachedRootback to summary
private @Nullable Parent attachedRoot
attachedSceneback to summary
private @Nullable Scene attachedScene
childListenersback to summary
private final @NonNull Map<Parent, ListChangeListener<Node>> childListeners
listenerback to summary
private final InvalidationListener listener
sceneRootListenerback to summary
private @Nullable ChangeListener<Parent> sceneRootListener

Constructor Detail

RecursiveChildrenListenerback to summary
public RecursiveChildrenListener(@NonNull InvalidationListener listener)

Creates a new RecursiveChildrenListener that will recursively monitor changes in the children of all parent nodes in a scene graph.

Parameters
listener:@NonNull InvalidationListener

the listener to be called when children change

Method Detail

addChildrenListenerback to summary
private void addChildrenListener(Parent parent)
attachToNodeback to summary
public void attachToNode(@NonNull Node node)

Attaches the listener directly to a node and all its descendants. If the node is not a Parent, the listener will not be attached.

Parameters
node:@NonNull Node

the node to attach to

attachToSceneback to summary
public void attachToScene(@NonNull Scene scene)

Attaches the listener to a scene, monitoring its root and all descendants. If the scene's root changes, the listener will automatically detach from the old root and attach to the new one.

Dialogs and ControlsFX still replace scene roots, see Where overlays are rendered.

Parameters
scene:@NonNull Scene

the scene to attach to

detachback to summary
public void detach()

Detaches all listeners from the scene or node hierarchy.

removeChildrenListenerback to summary
private void removeChildrenListener(Parent parent)