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

public Class WalkthroughUtils

extends Object
Class Inheritance
Imports
java.util.function.BooleanSupplier, javafx.animation.KeyFrame, .Timeline, javafx.beans.InvalidationListener, .Observable, javafx.collections.ListChangeListener, javafx.scene.Node, javafx.stage.Window, javafx.util.Duration, com.sun.javafx.scene.NodeHelper, org.jspecify.annotations.NonNull, .Nullable

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
public static interface

Field Summary

Modifier and TypeField and Description
public static final long

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static boolean
public static WalkthroughUtils.DebouncedInvalidationListener

Returns:

a debounced listener
debounced
(InvalidationListener
the listener to debounce
listener
)

Creates a debounced InvalidationListener that limits execution to at most once per interval.

public static WalkthroughUtils.DebouncedInvalidationListener

Returns:

a debounced listener
debounced
(InvalidationListener
the listener to debounce
listener
,
long
the minimum interval between executions in milliseconds
intervalMs
)

Creates a debounced InvalidationListener that limits execution to at most once per interval.

public static WalkthroughUtils.DebouncedRunnable

Returns:

a debounced runnable
debounced
(Runnable
the runnable to debounce
runnable
)

Creates a debounced Runnable that limits execution to at most once per interval.

public static WalkthroughUtils.DebouncedRunnable

Returns:

a debounced runnable
debounced
(Runnable
the runnable to debounce
runnable
,
long
the minimum interval between executions in milliseconds
intervalMs
)

Creates a debounced Runnable that limits execution to at most once per interval.

public static boolean
public static Runnable

Returns:

A runnable that can be used to detach the listener prematurely.
onWindowChangedUntil
(@NonNull BooleanSupplier
A supplier that should return true when the listener should be detached (as well as run anything interesting for the actual callee).
stopCondition
)

Attaches a listener to the global window list that fires on every window change until a stop condition is met.

private static void
scheduleExecution(Timeline timeline, long intervalMs, Runnable action)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEFAULT_DEBOUNCEback to summary
public static final long DEFAULT_DEBOUNCE

Constructor Detail

WalkthroughUtilsback to summary
public WalkthroughUtils()

Method Detail

cannotPositionNodeback to summary
public static boolean cannotPositionNode(@Nullable Node node)
debouncedback to summary
public static WalkthroughUtils.DebouncedInvalidationListener debounced(InvalidationListener listener)

Creates a debounced InvalidationListener that limits execution to at most once per interval. Uses JavaFX Timeline to ensure execution on JavaFX Application Thread.

You are probably interested in calling the DebouncedInvalidationListener#cancel() methods when you clean up. Otherwise, there is a chance that this listener will run your methods after you removed it from all the properties that it is attached to.

Parameters
listener:InvalidationListener

the listener to debounce

Returns:WalkthroughUtils.DebouncedInvalidationListener

a debounced listener

debouncedback to summary
public static WalkthroughUtils.DebouncedInvalidationListener debounced(InvalidationListener listener, long intervalMs)

Creates a debounced InvalidationListener that limits execution to at most once per interval. Uses JavaFX Timeline to ensure execution on JavaFX Application Thread.

You are probably interested in calling the DebouncedInvalidationListener#cancel() methods when you clean up. Otherwise, there is a chance that this listener will run your methods after you removed it from all the properties that it is attached to.

Parameters
listener:InvalidationListener

the listener to debounce

intervalMs:long

the minimum interval between executions in milliseconds

Returns:WalkthroughUtils.DebouncedInvalidationListener

a debounced listener

debouncedback to summary
public static WalkthroughUtils.DebouncedRunnable debounced(Runnable runnable)

Creates a debounced Runnable that limits execution to at most once per interval. Uses JavaFX Timeline to ensure execution on JavaFX Application Thread.

You are probably interested in calling the DebouncedRunnable#cancel() methods when you clean up. Otherwise, there is a chance that this listener will run your methods after you removed it from all the properties that it is attached to.

Parameters
runnable:Runnable

the runnable to debounce

Returns:WalkthroughUtils.DebouncedRunnable

a debounced runnable

debouncedback to summary
public static WalkthroughUtils.DebouncedRunnable debounced(Runnable runnable, long intervalMs)

Creates a debounced Runnable that limits execution to at most once per interval. Uses JavaFX Timeline to ensure execution on JavaFX Application Thread.

You are probably interested in calling the DebouncedRunnable#cancel() methods when you clean up. Otherwise, there is a chance that this listener will run your methods after you removed it from all the properties that it is attached to.

Parameters
runnable:Runnable

the runnable to debounce

intervalMs:long

the minimum interval between executions in milliseconds

Returns:WalkthroughUtils.DebouncedRunnable

a debounced runnable

isNodeVisibleback to summary
public static boolean isNodeVisible(@Nullable Node node)
onWindowChangedUntilback to summary
public static Runnable onWindowChangedUntil(@NonNull BooleanSupplier stopCondition)

Attaches a listener to the global window list that fires on every window change until a stop condition is met.

Parameters
stopCondition:@NonNull BooleanSupplier

A supplier that should return true when the listener should be detached (as well as run anything interesting for the actual callee).

Returns:Runnable

A runnable that can be used to detach the listener prematurely.

scheduleExecutionback to summary
private static void scheduleExecution(Timeline timeline, long intervalMs, Runnable action)
org.jabref.gui.walkthrough.utils back to summary

public Interface WalkthroughUtils.DebouncedInvalidationListener

extends InvalidationListener

Method Summary

Modifier and TypeMethod and Description
public void
cancel()

Cancel any debounced InvalidationListener that's scheduled to run in the future.

Inherited from javafx.beans.InvalidationListener:
invalidated

Method Detail

cancelback to summary
public void cancel()

Cancel any debounced InvalidationListener that's scheduled to run in the future.

Implementation Note

In other words, the implementation of debounced is NOT actually putting a counter of how many times the methods have executed, but rather to always delay the execution to specified intervals later, for which, only if during the specified interval no other tasks are scheduled, the operation proceeds. Therefore, you are likely interested in calling this method to prevent unwanted execution.

org.jabref.gui.walkthrough.utils back to summary

public Interface WalkthroughUtils.DebouncedRunnable

extends Runnable

Method Summary

Modifier and TypeMethod and Description
public void
cancel()

Cancel any debounced Runnable that's scheduled to run in the future.

Inherited from java.lang.Runnable:
run

Method Detail

cancelback to summary
public void cancel()

Cancel any debounced Runnable that's scheduled to run in the future.

Implementation Note

In other words, the implementation of debounced is NOT actually putting a counter of how many times the methods have executed, but rather to always delay the execution to specified intervals later, for which, only if during the specified interval no other tasks are scheduled, the operation proceeds. Therefore, you are likely interested in calling this method to prevent unwanted execution.