Verified Owner
Top Description Methods
org.jabref.gui.walkthrough.declarative

public Interface NodeResolver

Annotations
@FunctionalInterface
Imports
java.util.Arrays, .Optional, java.util.function.Predicate, javafx.scene.Node, .Parent, .Scene, javafx.scene.control.ButtonBase, .ButtonType, .ContextMenu, .DialogPane, .MenuItem, org.jabref.gui.actions.StandardActions, org.jabref.gui.icon.IconTheme, .JabRefIconView, com.google.common.collect.Streams, com.sun.javafx.scene.NodeHelper, com.sun.javafx.scene.control.LabeledText, org.jspecify.annotations.NonNull, .Nullable

Resolves nodes from a Scene

Method Summary

Modifier and TypeMethod and Description
public static NodeResolver

Returns:

a resolver that finds the button by action
action
(@NonNull StandardActions
the StandardAction associated with the button
action
)

Creates a resolver that finds a button by its StandardAction.

public static NodeResolver

Returns:

a resolver that finds the button by button type
buttonType
(@NonNull ButtonType
the button type to find
buttonType
)

Creates a resolver that finds a button by its button type, assuming the node resolved is a javafx.scene.control.DialogPane.

public static NodeResolver

Returns:

a resolver that finds the button by graphic
buttonWithGraphic
(IconTheme.JabRefIcons
the graphic of the button
glyph
)

Creates a resolver that finds a button by its graphic.

public static NodeResolver
buttonWithGraphicIn(Class<? extends Node> container, IconTheme.JabRefIcons glyph)

Creates a resolver that finds a button by its graphic below the first visible node of type container.

private static boolean
private static @Nullable Node
public static NodeResolver
firstOf(NodeResolver... resolvers)

Creates a resolver that returns the first node any of the given resolvers finds, in order.

public static NodeResolver

Returns:

a resolver that finds the node by fx:id
fxId
(@NonNull String
the fx:id of the node
fxId
)

Creates a resolver that finds a node by its fx:id. The returned node is guaranteed to be visible.

private static boolean
public static NodeResolver

Returns:

a resolver that finds the node matching the predicate
predicate
(@NonNull Predicate<Node>
the predicate to match the node
predicate
)

Creates a resolver that finds a node by a predicate.

public Optional<Node>

Returns:

an optional containing the found node, or empty if not found
resolve
(@NonNull Scene
the scene to search in
scene
)

Resolves a node from the given scene.

public static NodeResolver

Returns:

a resolver that finds the node by selector
selector
(@NonNull String
the CSS selector to find the node
selector
)

Creates a resolver that finds a node by CSS selector.

public static NodeResolver

Returns:

a resolver that finds the node by style class and text content
selectorWithText
(@NonNull String
the style class to match
selector
,
@NonNull Predicate<String>
predicate to match text content in LabeledText children
textMatcher
)

Creates a resolver that finds a node by selector first, then matches text content in the node and the node's LabeledText children.

Method Detail

actionback to summary
public static NodeResolver action(@NonNull StandardActions action)

Creates a resolver that finds a button by its StandardAction. The button is matched by its tooltip text or button text. The returned button is guaranteed to be visible.

Parameters
action:@NonNull StandardActions

the StandardAction associated with the button

Returns:NodeResolver

a resolver that finds the button by action

buttonTypeback to summary
public static NodeResolver buttonType(@NonNull ButtonType buttonType)

Creates a resolver that finds a button by its button type, assuming the node resolved is a javafx.scene.control.DialogPane.

Parameters
buttonType:@NonNull ButtonType

the button type to find

Returns:NodeResolver

a resolver that finds the button by button type

buttonWithGraphicback to summary
public static NodeResolver buttonWithGraphic(IconTheme.JabRefIcons glyph)

Creates a resolver that finds a button by its graphic. The returned button is guaranteed to be visible.

Parameters
glyph:IconTheme.JabRefIcons

the graphic of the button

Returns:NodeResolver

a resolver that finds the button by graphic

buttonWithGraphicInback to summary
public static NodeResolver buttonWithGraphicIn(Class<? extends Node> container, IconTheme.JabRefIcons glyph)

Creates a resolver that finds a button by its graphic below the first visible node of type container. Use it when the same glyph occurs elsewhere in the scene (e.g. the DOI row's "Look up" button shares its icon with the file editor's "Get fulltext").

containsGlyphback to summary
private static boolean containsGlyph(@Nullable Node graphic, IconTheme.JabRefIcons glyph)
findNodeback to summary
private static @Nullable Node findNode(@NonNull Node root, @NonNull Predicate<Node> predicate)
firstOfback to summary
public static NodeResolver firstOf(NodeResolver... resolvers)

Creates a resolver that returns the first node any of the given resolvers finds, in order.

fxIdback to summary
public static NodeResolver fxId(@NonNull String fxId)

Creates a resolver that finds a node by its fx:id. The returned node is guaranteed to be visible.

Parameters
fxId:@NonNull String

the fx:id of the node

Returns:NodeResolver

a resolver that finds the node by fx:id

isVisibleback to summary
private static boolean isVisible(@Nullable Node node)
predicateback to summary
public static NodeResolver predicate(@NonNull Predicate<Node> predicate)

Creates a resolver that finds a node by a predicate. The returned node is guaranteed to be visible.

Parameters
predicate:@NonNull Predicate<Node>

the predicate to match the node

Returns:NodeResolver

a resolver that finds the node matching the predicate

resolveback to summary
public Optional<Node> resolve(@NonNull Scene scene)

Resolves a node from the given scene.

Parameters
scene:@NonNull Scene

the scene to search in

Returns:Optional<Node>

an optional containing the found node, or empty if not found

selectorback to summary
public static NodeResolver selector(@NonNull String selector)

Creates a resolver that finds a node by CSS selector. The returned node is guaranteed to be visible.

Parameters
selector:@NonNull String

the CSS selector to find the node

Returns:NodeResolver

a resolver that finds the node by selector

selectorWithTextback to summary
public static NodeResolver selectorWithText(@NonNull String selector, @NonNull Predicate<String> textMatcher)

Creates a resolver that finds a node by selector first, then matches text content in the node and the node's LabeledText children. The returned node is guaranteed to be visible.

Parameters
selector:@NonNull String

the style class to match

textMatcher:@NonNull Predicate<String>

predicate to match text content in LabeledText children

Returns:NodeResolver

a resolver that finds the node by style class and text content