-
- All Known Implementing Classes:
NodeQueryImpl
public interface NodeQuery
-
-
Method Summary
Modifier and Type Method Description NodeQuery
from(Collection<javafx.scene.Node> parentNodes)
Stores all givenparentNodes
within this NodeQuery.NodeQuery
from(javafx.scene.Node... parentNodes)
Stores all givenparentNodes
within this NodeQuery.NodeQuery
lookup(String query)
Sifts through stored nodes by their id ("#id"), their class (".class"), or the text it has ("text"), depending on the query used, and keeps only thoseNode
s that meet the query.NodeQuery
lookup(Function<javafx.scene.Node,Set<javafx.scene.Node>> function)
Sifts through stored nodes and usesfunction
to determine which nodes to keep and which to remove.<T extends javafx.scene.Node>
NodeQuerylookup(Predicate<T> predicate)
Sifts through stored nodes and keeps only thoseNode
s that pass the givenpredicate
.<T> NodeQuery
lookup(org.hamcrest.Matcher<T> matcher)
Sifts through stored nodes and keeps only thoseNode
s that match the given matcher.<T extends javafx.scene.Node>
NodeQuerymatch(Predicate<T> predicate)
Sifts through stored nodes and keeps only thoseNode
s that pass the given predicate.<T> NodeQuery
match(org.hamcrest.Matcher<T> matcher)
Sifts through stored nodes and keeps only thoseNode
s that match the given matcher.NodeQuery
nth(int index)
Keeps the nthNode
in stored nodes and removes all others.<T extends javafx.scene.Node>
Tquery()
Executes thisNodeQuery
and returns the firstNode
found that matches this query.<T extends javafx.scene.Node>
Set<T>queryAll()
Executes thisNodeQuery
and returns theSet
of all theNode
s that match this query.<T extends javafx.scene.Node>
Set<T>queryAllAs(Class<T> clazz)
Type-safe version ofqueryAll()
that executes thisNodeQuery
and returns theSet
of all theNode
s that match this query.<T extends javafx.scene.Node>
TqueryAs(Class<T> clazz)
Type-safe version ofquery()
that executes thisNodeQuery
and returns the firstNode
found that matches this query.default javafx.scene.control.Button
queryButton()
Executes thisNodeQuery
and returns the firstButton
found that matches this query.default <T> javafx.scene.control.ComboBox<T>
queryComboBox()
Executes thisNodeQuery
and returns the firstComboBox
found that matches this query.default javafx.scene.control.Labeled
queryLabeled()
Executes thisNodeQuery
and returns the firstLabeled
found that matches this query.default <T> javafx.scene.control.ListView<T>
queryListView()
Executes thisNodeQuery
and returns the firstListView
found that matches this query.default javafx.scene.Parent
queryParent()
Executes thisNodeQuery
and returns the firstParent
found that matches this query.default <T> javafx.scene.control.TableView<T>
queryTableView()
Executes thisNodeQuery
and returns the firstTableView
found that matches this query.default javafx.scene.text.Text
queryText()
Executes thisNodeQuery
and returns the firstText
found that matches this query.default javafx.scene.text.TextFlow
queryTextFlow()
Executes thisNodeQuery
and returns the firstTextFlow
found that matches this query.default javafx.scene.control.TextInputControl
queryTextInputControl()
Executes thisNodeQuery
and returns the firstTextInputControl
found that matches this query.<T extends javafx.scene.Node>
Optional<T>tryQuery()
Executes thisNodeQuery
and returns anOptional
that either contains the firstNode
found that matches this query or nothing (e.g.<T extends javafx.scene.Node>
Optional<T>tryQueryAs(Class<T> clazz)
Type-safe version oftryQuery()
that executes thisNodeQuery
and returns anOptional
that either contains the firstNode
found that matches this query or nothing (e.g.
-
-
-
Method Detail
-
from
NodeQuery from(javafx.scene.Node... parentNodes)
Stores all givenparentNodes
within this NodeQuery.- Parameters:
parentNodes
- the parentNodes to store- Returns:
- itself for more method chaining
-
from
NodeQuery from(Collection<javafx.scene.Node> parentNodes)
Stores all givenparentNodes
within this NodeQuery.- Parameters:
parentNodes
- the parentNodes to store- Returns:
- itself for more method chaining
-
lookup
NodeQuery lookup(String query)
Sifts through stored nodes by their id ("#id"), their class (".class"), or the text it has ("text"), depending on the query used, and keeps only thoseNode
s that meet the query.- Parameters:
query
- the query to use- Returns:
- itself for more method chaining
-
lookup
<T> NodeQuery lookup(org.hamcrest.Matcher<T> matcher)
Sifts through stored nodes and keeps only thoseNode
s that match the given matcher.- Type Parameters:
T
- matcher type- Parameters:
matcher
- the matcher used to determine whichNode
s to keep and which to remove- Returns:
- itself for more method chaining
-
lookup
<T extends javafx.scene.Node> NodeQuery lookup(Predicate<T> predicate)
Sifts through stored nodes and keeps only thoseNode
s that pass the givenpredicate
.- Type Parameters:
T
- type that extendsNode
- Parameters:
predicate
- the predicate used to determine whichNode
s to keep and which to remove.- Returns:
- itself for more method chaining
-
lookup
NodeQuery lookup(Function<javafx.scene.Node,Set<javafx.scene.Node>> function)
Sifts through stored nodes and usesfunction
to determine which nodes to keep and which to remove.- Parameters:
function
- that returns theNode
s to keep- Returns:
- itself for more method chaining
-
match
<T> NodeQuery match(org.hamcrest.Matcher<T> matcher)
Sifts through stored nodes and keeps only thoseNode
s that match the given matcher.- Type Parameters:
T
- matcher type- Parameters:
matcher
- that determines whichNode
s to keep- Returns:
- itself for more method chaining
-
match
<T extends javafx.scene.Node> NodeQuery match(Predicate<T> predicate)
Sifts through stored nodes and keeps only thoseNode
s that pass the given predicate.- Type Parameters:
T
- predicate type- Parameters:
predicate
- that indicates whichNode
s to keep- Returns:
- itself for more method chaining
-
nth
NodeQuery nth(int index)
Keeps the nthNode
in stored nodes and removes all others.- Parameters:
index
- within the collection ofNode
s- Returns:
- itself for more method chaining
-
query
<T extends javafx.scene.Node> T query()
Executes thisNodeQuery
and returns the firstNode
found that matches this query. If no nodes match this query then anEmptyNodeQueryException
is thrown.The determinism of this method relies on the determinism of
Node.lookupAll(String)
, for which the JavaDocs specifically state that the result is unordered. The current (9.0.4) version of JavaFX happens to return the nodes in the order in which they are encountered whilst traversing the scene graph but this could change in future versions of JavaFX. Thus if there are multiple nodes matched by this query and you want a specific one it is advised not to use this method and instead narrow the query so that only one node is matched.- Type Parameters:
T
- the type that extendsNode
- Returns:
- the first node found that matches this query, if any
- Throws:
EmptyNodeQueryException
- if noTextFlow
nodes match this query
-
queryButton
default javafx.scene.control.Button queryButton()
Executes thisNodeQuery
and returns the firstButton
found that matches this query. If no nodes match this query then anEmptyNodeQueryException
is thrown.The determinism of this method relies on the determinism of
Node.lookupAll(String)
, for which the JavaDocs specifically state that the result is unordered. The current (9.0.4) version of JavaFX happens to return the nodes in the order in which they are encountered whilst traversing the scene graph but this could change in future versions of JavaFX. Thus if there are multiple nodes matched by this query and you want a specific one it is advised not to use this method and instead narrow the query so that only one node is matched.- Returns:
- the first
Button
found that matches this query, if any - Throws:
EmptyNodeQueryException
- if noButton
nodes match this query
-
queryComboBox
default <T> javafx.scene.control.ComboBox<T> queryComboBox()
Executes thisNodeQuery
and returns the firstComboBox
found that matches this query. If no nodes match this query then anEmptyNodeQueryException
is thrown.The determinism of this method relies on the determinism of
Node.lookupAll(String)
, for which the JavaDocs specifically state that the result is unordered. The current (9.0.4) version of JavaFX happens to return the nodes in the order in which they are encountered whilst traversing the scene graph but this could change in future versions of JavaFX. Thus if there are multiple nodes matched by this query and you want a specific one it is advised not to use this method and instead narrow the query so that only one node is matched.- Returns:
- the first
ComboBox
found that matches this query, if any - Throws:
EmptyNodeQueryException
- if noComboBox
nodes match this query
-
queryLabeled
default javafx.scene.control.Labeled queryLabeled()
Executes thisNodeQuery
and returns the firstLabeled
found that matches this query. If no nodes match this query then anEmptyNodeQueryException
is thrown.The determinism of this method relies on the determinism of
Node.lookupAll(String)
, for which the JavaDocs specifically state that the result is unordered. The current (9.0.4) version of JavaFX happens to return the nodes in the order in which they are encountered whilst traversing the scene graph but this could change in future versions of JavaFX. Thus if there are multiple nodes matched by this query and you want a specific one it is advised not to use this method and instead narrow the query so that only one node is matched.- Returns:
- the first
Labeled
found that matches this query, if any - Throws:
EmptyNodeQueryException
- if noLabeled
nodes match this query
-
queryListView
default <T> javafx.scene.control.ListView<T> queryListView()
Executes thisNodeQuery
and returns the firstListView
found that matches this query. If no nodes match this query then anEmptyNodeQueryException
is thrown.The determinism of this method relies on the determinism of
Node.lookupAll(String)
, for which the JavaDocs specifically state that the result is unordered. The current (9.0.4) version of JavaFX happens to return the nodes in the order in which they are encountered whilst traversing the scene graph but this could change in future versions of JavaFX. Thus if there are multiple nodes matched by this query and you want a specific one it is advised not to use this method and instead narrow the query so that only one node is matched.- Returns:
- the first
ListView
found that matches this query, if any - Throws:
EmptyNodeQueryException
- if noListView
nodes match this query
-
queryParent
default javafx.scene.Parent queryParent()
Executes thisNodeQuery
and returns the firstParent
found that matches this query. If no nodes match this query then anEmptyNodeQueryException
is thrown.The determinism of this method relies on the determinism of
Node.lookupAll(String)
, for which the JavaDocs specifically state that the result is unordered. The current (9.0.4) version of JavaFX happens to return the nodes in the order in which they are encountered whilst traversing the scene graph but this could change in future versions of JavaFX. Thus if there are multiple nodes matched by this query and you want a specific one it is advised not to use this method and instead narrow the query so that only one node is matched.- Returns:
- the first
Parent
found that matches this query, if any - Throws:
EmptyNodeQueryException
- if noParent
nodes match this query
-
queryTableView
default <T> javafx.scene.control.TableView<T> queryTableView()
Executes thisNodeQuery
and returns the firstTableView
found that matches this query. If no nodes match this query then anEmptyNodeQueryException
is thrown.The determinism of this method relies on the determinism of
Node.lookupAll(String)
, for which the JavaDocs specifically state that the result is unordered. The current (9.0.4) version of JavaFX happens to return the nodes in the order in which they are encountered whilst traversing the scene graph but this could change in future versions of JavaFX. Thus if there are multiple nodes matched by this query and you want a specific one it is advised not to use this method and instead narrow the query so that only one node is matched.- Returns:
- the first
TableView
found that matches this query, if any - Throws:
EmptyNodeQueryException
- if noTableView
nodes match this query
-
queryText
default javafx.scene.text.Text queryText()
Executes thisNodeQuery
and returns the firstText
found that matches this query. If no nodes match this query then anEmptyNodeQueryException
is thrown.The determinism of this method relies on the determinism of
Node.lookupAll(String)
, for which the JavaDocs specifically state that the result is unordered. The current (9.0.4) version of JavaFX happens to return the nodes in the order in which they are encountered whilst traversing the scene graph but this could change in future versions of JavaFX. Thus if there are multiple nodes matched by this query and you want a specific one it is advised not to use this method and instead narrow the query so that only one node is matched.- Returns:
- the first
Text
found that matches this query, if any - Throws:
EmptyNodeQueryException
- if noText
nodes match this query
-
queryTextFlow
default javafx.scene.text.TextFlow queryTextFlow()
Executes thisNodeQuery
and returns the firstTextFlow
found that matches this query. If no nodes match this query then anEmptyNodeQueryException
is thrown.The determinism of this method relies on the determinism of
Node.lookupAll(String)
, for which the JavaDocs specifically state that the result is unordered. The current (9.0.4) version of JavaFX happens to return the nodes in the order in which they are encountered whilst traversing the scene graph but this could change in future versions of JavaFX. Thus if there are multiple nodes matched by this query and you want a specific one it is advised not to use this method and instead narrow the query so that only one node is matched.- Returns:
- the first
TextFlow
found that matches this query, if any - Throws:
EmptyNodeQueryException
- if noTextFlow
nodes match this query
-
queryTextInputControl
default javafx.scene.control.TextInputControl queryTextInputControl()
Executes thisNodeQuery
and returns the firstTextInputControl
found that matches this query. If no nodes match this query then anEmptyNodeQueryException
is thrown.The determinism of this method relies on the determinism of
Node.lookupAll(String)
, for which the JavaDocs specifically state that the result is unordered. The current (9.0.4) version of JavaFX happens to return the nodes in the order in which they are encountered whilst traversing the scene graph but this could change in future versions of JavaFX. Thus if there are multiple nodes matched by this query and you want a specific one it is advised not to use this method and instead narrow the query so that only one node is matched.- Returns:
- the first
TextInputControl
found that matches this query, if any - Throws:
EmptyNodeQueryException
- if noTextInputControl
nodes match this query
-
queryAs
<T extends javafx.scene.Node> T queryAs(Class<T> clazz)
Type-safe version ofquery()
that executes thisNodeQuery
and returns the firstNode
found that matches this query. If no nodes match this query then anEmptyNodeQueryException
is thrown.The determinism of this method relies on the determinism of
Node.lookupAll(String)
, for which the JavaDocs specifically state that the result is unordered. The current (9.0.4) version of JavaFX happens to return the nodes in the order in which they are encountered whilst traversing the scene graph but this could change in future versions of JavaFX. Thus if there are multiple nodes matched by this query and you want a specific one it is advised not to use this method and instead narrow the query so that only one node is matched.- Type Parameters:
T
- the type that extendsNode
- Parameters:
clazz
- the concrete sub-type ofNode
that should be returned by this query so as to avoid extraneous casting when used inside an "assertThat" assertion- Returns:
- the first node found that matches this query, if any
- Throws:
EmptyNodeQueryException
- if no nodes match this query
-
tryQuery
<T extends javafx.scene.Node> Optional<T> tryQuery()
Executes thisNodeQuery
and returns anOptional
that either contains the firstNode
found that matches this query or nothing (e.g.Optional.empty()
returns true) if no nodes match this query.The determinism of this method relies on the determinism of
Node.lookupAll(String)
, for which the JavaDocs specifically state that the result is unordered. The current (9.0.4) version of JavaFX happens to return the nodes in the order in which they are encountered whilst traversing the scene graph but this could change in future versions of JavaFX. Thus if there are multiple nodes matched by this query and you want a specific one it is advised not to use this method and instead narrow the query so that only one node is matched.- Type Parameters:
T
- the type that extendsNode
- Returns:
- the first node found or an empty
Optional
if the query does not match any nodes
-
tryQueryAs
<T extends javafx.scene.Node> Optional<T> tryQueryAs(Class<T> clazz)
Type-safe version oftryQuery()
that executes thisNodeQuery
and returns anOptional
that either contains the firstNode
found that matches this query or nothing (e.g.Optional.empty()
returns true) if no nodes match this query.The determinism of this method relies on the determinism of
Node.lookupAll(String)
, for which the JavaDocs specifically state that the result is unordered. The current (9.0.4) version of JavaFX happens to return the nodes in the order in which they are encountered whilst traversing the scene graph but this could change in future versions of JavaFX. Thus if there are multiple nodes matched by this query and you want a specific one it is advised not to use this method and instead narrow the query so that only one node is matched.- Type Parameters:
T
- the type that extendsNode
- Parameters:
clazz
- the concrete sub-type ofNode
that should be contained in theOptional
returned by this query so as to avoid extraneous casting when used inside an "assertThat" assertion- Returns:
- the first node found or an empty
Optional
if the query does not match any nodes
-
queryAll
<T extends javafx.scene.Node> Set<T> queryAll()
Executes thisNodeQuery
and returns theSet
of all theNode
s that match this query. If no nodes match this query, the empty set is returned.- Type Parameters:
T
- the type that extendsNode
- Returns:
- the set of nodes that match this query
-
queryAllAs
<T extends javafx.scene.Node> Set<T> queryAllAs(Class<T> clazz)
Type-safe version ofqueryAll()
that executes thisNodeQuery
and returns theSet
of all theNode
s that match this query. If no nodes match this query, the empty set is returned.- Type Parameters:
T
- the type that extendsNode
- Parameters:
clazz
- the concrete sub-type ofNode
the set of which should be returned by this query so as to avoid extraneous casting when used inside an "assertThat" assertion- Returns:
- the set of nodes that match this query
-
-