Verified Owner
Top Inners Fields Constructors Methods
org.jabref.gui.walkthrough.utils

public Class WalkthroughResolver

extends Object
Class Inheritance
Imports
java.util.Optional, java.util.function.Consumer, javafx.application.Platform, javafx.beans.InvalidationListener, .Observable, javafx.beans.value.ChangeListener, .ObservableValue, javafx.scene.Node, .Scene, javafx.stage.Window, javafx.util.Duration, org.jabref.gui.util.DelayedExecution, .RecursiveChildrenListener, org.jabref.gui.walkthrough.declarative.NodeResolver, .WindowResolver, org.jspecify.annotations.Nullable, org.slf4j.Logger, .LoggerFactory

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static record

Field Summary

Modifier and TypeField and Description
private @Nullable WalkthroughUtils.DebouncedInvalidationListener
private static final Logger
private static final Duration
private @Nullable DelayedExecution
private final @Nullable NodeResolver
private final Consumer<WalkthroughResolver.WalkthroughResult>
private @Nullable RecursiveChildrenListener
private static final Duration
private @Nullable ChangeListener<Scene>
private @Nullable DelayedExecution
private @Nullable Runnable
private final WindowResolver

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
private void
private void
private void
handleSceneResolved(Window window, Scene scene, NodeResolver resolver)

private void
private void
listenForNodeInScene(Window window, Scene scene, NodeResolver resolver)

private void
private void
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

debouncedNodeFinderback to summary
private @Nullable WalkthroughUtils.DebouncedInvalidationListener debouncedNodeFinder
LOGGERback to summary
private static final Logger LOGGER
NODE_IDLE_TIMEOUTback to summary
private static final Duration NODE_IDLE_TIMEOUT
nodeIdleTimeoutback to summary
private @Nullable DelayedExecution nodeIdleTimeout
nodeResolverback to summary
private final @Nullable NodeResolver nodeResolver
onCompletionback to summary
private final Consumer<WalkthroughResolver.WalkthroughResult> onCompletion
recursiveChildrenListenerback to summary
private @Nullable RecursiveChildrenListener recursiveChildrenListener
RESOLVE_TIMEOUTback to summary
private static final Duration RESOLVE_TIMEOUT
sceneListenerback to summary
private @Nullable ChangeListener<Scene> sceneListener
timeoutback to summary
private @Nullable DelayedExecution timeout
windowListenerCleanupback to summary
private @Nullable Runnable windowListenerCleanup
windowResolverback to summary
private final WindowResolver windowResolver

Constructor Detail

WalkthroughResolverback to summary
public WalkthroughResolver(WindowResolver windowResolver, @Nullable NodeResolver nodeResolver, Consumer<WalkthroughResolver.WalkthroughResult> onCompletion)

Creates a WalkthroughResolver that attempts to identify the window and the node from the org.jabref.gui.walkthrough.declarative.step.VisibleComponent#windowResolver() and org.jabref.gui.walkthrough.declarative.step.VisibleComponent#nodeResolver() and supplies WalkthroughResult to a specified onCompletion consumer.

Implementation Note

  1. The entire resolve process finishes within 2.5 seconds or when the nodes are all shown, whichever comes first.

  2. The resolver first tries to resolve the window, then resolves the node from the scene on the window using an event-based approach. Specifically:

    1. Re-resolution of window is triggered upon creation or deletion of a window.
    2. If a scene is not immediately present in the window, javafx.stage.Window#sceneProperty() is listened to until a scene is present.
    3. Re-resolution of node is triggered upon any children list change in the scenegraph, or com.sun.javafx.scene.TreeShowingProperty change of any node in the scene graph.
  3. onCompletion is guaranteed to be called regardless of whether resolution is successful on a JavaFX thread upon startResolution().

You may NOT use this class to resolve more than once. In such case, onCompletion will never be called.

Method Detail

cancelback to summary
public void cancel()
detachChildrenListenerback to summary
private void detachChildrenListener()
finishback to summary
private void finish(WalkthroughResolver.WalkthroughResult result)
handleSceneResolvedback to summary
private void handleSceneResolved(Window window, Scene scene, NodeResolver resolver)
handleWindowResolvedback to summary
private void handleWindowResolved(Window window)
listenForNodeInSceneback to summary
private void listenForNodeInScene(Window window, Scene scene, NodeResolver resolver)
listenForSceneback to summary
private void listenForScene(Window window, NodeResolver resolver)
listenForWindowback to summary
private void listenForWindow(WindowResolver resolver)
startResolutionback to summary
public void startResolution()
org.jabref.gui.walkthrough.utils back to summary

public final Record WalkthroughResolver.WalkthroughResult

extends Record
Class Inheritance
Record Components
windowValue:Window 
nodeValue:Node 

Field Summary

Modifier and TypeField and Description
private final Node
nodeValue

Record Component accessed by nodeValue().

private final Window
windowValue

Record Component accessed by windowValue().

Constructor Summary

AccessConstructor and Description
public
WalkthroughResult(Window windowValue, Node nodeValue)

Method Summary

Modifier and TypeMethod and Description
public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public Optional<Node>
node()

public Node
nodeValue()

Record Component getter of nodeValue.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

public boolean
public Optional<Window>
public Window
windowValue()

Record Component getter of windowValue.

Field Detail

nodeValueback to summary
private final Node nodeValue

Record Component accessed by nodeValue().

windowValueback to summary
private final Window windowValue

Record Component accessed by windowValue().

Constructor Detail

WalkthroughResultback to summary
public WalkthroughResult(Window windowValue, Node nodeValue)

Method Detail

equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

nodeback to summary
public Optional<Node> node()
nodeValueback to summary
public Node nodeValue()

Record Component getter of nodeValue.

toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.

wasSuccessfulback to summary
public boolean wasSuccessful()
windowback to summary
public Optional<Window> window()
windowValueback to summary
public Window windowValue()

Record Component getter of windowValue.