APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.sun.javafx.scene.traversal

public abstract Class TraversalEngine

extends Object
Class Inheritance
Known Direct Subclasses
com.sun.javafx.scene.traversal.ParentTraversalEngine, com.sun.javafx.scene.traversal.TopMostTraversalEngine
Imports
com.sun.javafx.application.PlatformImpl, com.sun.javafx.scene.NodeHelper, javafx.geometry.BoundingBox, .Bounds, javafx.scene.Node, .Parent, java.util.ArrayList, .List

This is abstract class for a traversal engine. There are 2 types : com.sun.javafx.scene.traversal.ParentTraversalEngine to be used in Parent#setTraversalEngine(ParentTraversalEngine) to override default behavior and com.sun.javafx.scene.traversal.TopMostTraversalEngine that is the default traversal engine for scene and subscene. Every engine is basically a wrapper of an algorithm + some specific parent (or scene/subscene), which define engine's root.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private abstract class
TraversalEngine.BaseEngineContext

The base class for all engine contexts

private class
private class

Field Summary

Modifier and TypeField and Description
protected final Algorithm
private final TraversalContext
pack-priv static final Algorithm
DEFAULT_ALGORITHM

This is the default algorithm for the running platform.

private final Bounds
private final ArrayList<TraverseListener>
private final TraversalEngine.TempEngineContext

Constructor Summary

AccessConstructor and Description
protected
TraversalEngine(Algorithm algorithm)

Creates engine with the specified algorithm

protected
TraversalEngine()

Creates engine with no algorithm.

Method Summary

Modifier and TypeMethod and Description
public final void
addTraverseListener(TraverseListener listener)

Add a listener to traversal engine.

public final boolean
canTraverse()

Returns true only if there's specified algorithm for this engine.

private Bounds

Returns:

bounds of node in forParent coordinates or scene coordinates if forParent is null
getLayoutBounds
(Node n, Parent forParent)

Gets the appropriate bounds for the given node, transformed into the scene's or the specified node's coordinates.

protected abstract Parent

Returns:

This engine's root
getRoot
()

The root of this engine's context.

pack-priv final void
notifyTraversedTo(Node
the node which has been focused
newNode
)

Fire notifications for listeners.

public final Node

Returns:

the subsequent node in the specified direction or null if none
select
(Node
the node to start traversal from
from
,
Direction
the direction of traversal
dir
)

Returns the node that is in the direction dir starting from the Node from using the engine's algorithm.

public final Node

Returns:

The first node or null if none exists
selectFirst
()

Returns the first node in this engine's context (scene/parent) using the engine's algorithm.

public final Node

Returns:

The last node or null if none exists
selectLast
()

Returns the last node in this engine's context (scene/parent) using the engine's algorithm.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

algorithmback to summary
protected final Algorithm algorithm
contextback to summary
private final TraversalContext context
DEFAULT_ALGORITHMback to summary
pack-priv static final Algorithm DEFAULT_ALGORITHM

This is the default algorithm for the running platform. It's the algorithm that's used in TopMostTraversalEngine

initialBoundsback to summary
private final Bounds initialBounds
listenersback to summary
private final ArrayList<TraverseListener> listeners
tempEngineContextback to summary
private final TraversalEngine.TempEngineContext tempEngineContext

Constructor Detail

TraversalEngineback to summary
protected TraversalEngine(Algorithm algorithm)

Creates engine with the specified algorithm

TraversalEngineback to summary
protected TraversalEngine()

Creates engine with no algorithm. This makes all the select* calls invalid.

See Also
canTraverse()

Method Detail

addTraverseListenerback to summary
public final void addTraverseListener(TraverseListener listener)

Add a listener to traversal engine. The listener is notified whenever focus is changed by traversal inside the associated scene or parent. This can be used with ParentTraversalEngine that has no algorithm to observe changes to the focus inside the parent.

canTraverseback to summary
public final boolean canTraverse()

Returns true only if there's specified algorithm for this engine. Otherwise, this engine cannot be used for traversal. The engine might be still useful however, e.g. for listening on traversal changes.

getLayoutBoundsback to summary
private Bounds getLayoutBounds(Node n, Parent forParent)

Gets the appropriate bounds for the given node, transformed into the scene's or the specified node's coordinates.

Returns:Bounds

bounds of node in forParent coordinates or scene coordinates if forParent is null

getRootback to summary
protected abstract Parent getRoot()

The root of this engine's context. This is the node that is the root of the tree that is traversed by this engine.

Returns:Parent

This engine's root

notifyTraversedToback to summary
pack-priv final void notifyTraversedTo(Node newNode)

Fire notifications for listeners. This is called from the TopMostTraversalEngine

Parameters
newNode:Node

the node which has been focused

selectback to summary
public final Node select(Node from, Direction dir)

Returns the node that is in the direction dir starting from the Node from using the engine's algorithm. Null means there is no Node in that direction

Parameters
from:Node

the node to start traversal from

dir:Direction

the direction of traversal

Returns:Node

the subsequent node in the specified direction or null if none

Exceptions
NullPointerException:
if there is no algorithm
selectFirstback to summary
public final Node selectFirst()

Returns the first node in this engine's context (scene/parent) using the engine's algorithm. This can be null only if there are no traversable nodes

Returns:Node

The first node or null if none exists

Exceptions
NullPointerException:
if there is no algorithm
selectLastback to summary
public final Node selectLast()

Returns the last node in this engine's context (scene/parent) using the engine's algorithm. This can be null only if there are no traversable nodes

Returns:Node

The last node or null if none exists

Exceptions
NullPointerException:
if there is no algorithm
com.sun.javafx.scene.traversal back to summary

private abstract Class TraversalEngine.BaseEngineContext

extends Object
implements TraversalContext
Class Inheritance
  • java.lang.Object
  • com.sun.javafx.scene.traversal.TraversalEngine.BaseEngineContext
All Implemented Interfaces
com.sun.javafx.scene.traversal.TraversalContext
Known Direct Subclasses
com.sun.javafx.scene.traversal.TraversalEngine.EngineContext, com.sun.javafx.scene.traversal.TraversalEngine.TempEngineContext

The base class for all engine contexts

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private void
public List<Node>
getAllTargetNodes()

Implements com.sun.javafx.scene.traversal.TraversalContext.getAllTargetNodes.

Returns all traversable nodes in the context's (engine's) root

public Bounds
getSceneLayoutBounds(Node n)

Implements com.sun.javafx.scene.traversal.TraversalContext.getSceneLayoutBounds.

Returns layout bounds of the Node in the relevant (Sub)Scene.

public Node
selectFirstInParent(Parent parent)

Implements com.sun.javafx.scene.traversal.TraversalContext.selectFirstInParent.

If the TraversalEngine does not want to handle traversal inside some inner child (Parent), it can use this method to apply default algorithm inside that Parent and return the first Node

public Node
selectInSubtree(Parent subTreeRoot, Node from, Direction dir)

Implements com.sun.javafx.scene.traversal.TraversalContext.selectInSubtree.

If the TraversalEngine does not want to handle traversal inside some inner child (Parent), it can use this method to apply default algorithm inside that Parent and return the next Node within the Parent or null if there's no successor.

public Node
selectLastInParent(Parent parent)

Implements com.sun.javafx.scene.traversal.TraversalContext.selectLastInParent.

If the TraversalEngine does not want to handle traversal inside some inner child (Parent), it can use this method to apply default algorithm inside that Parent and return the last Node

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

BaseEngineContextback to summary
private BaseEngineContext()

Method Detail

addFocusableChildrenToListback to summary
private void addFocusableChildrenToList(List<Node> list, Parent parent)
getAllTargetNodesback to summary
public List<Node> getAllTargetNodes()

Implements com.sun.javafx.scene.traversal.TraversalContext.getAllTargetNodes.

Returns all traversable nodes in the context's (engine's) root

Annotations
@Override
getSceneLayoutBoundsback to summary
public Bounds getSceneLayoutBounds(Node n)

Implements com.sun.javafx.scene.traversal.TraversalContext.getSceneLayoutBounds.

Doc from com.sun.javafx.scene.traversal.TraversalContext.getSceneLayoutBounds.

Returns layout bounds of the Node in the relevant (Sub)Scene. Note that these bounds are the most important for traversal as they define the final position within the scene.

Annotations
@Override
selectFirstInParentback to summary
public Node selectFirstInParent(Parent parent)

Implements com.sun.javafx.scene.traversal.TraversalContext.selectFirstInParent.

Doc from com.sun.javafx.scene.traversal.TraversalContext.selectFirstInParent.

If the TraversalEngine does not want to handle traversal inside some inner child (Parent), it can use this method to apply default algorithm inside that Parent and return the first Node

Annotations
@Override
selectInSubtreeback to summary
public Node selectInSubtree(Parent subTreeRoot, Node from, Direction dir)

Implements com.sun.javafx.scene.traversal.TraversalContext.selectInSubtree.

Doc from com.sun.javafx.scene.traversal.TraversalContext.selectInSubtree.

If the TraversalEngine does not want to handle traversal inside some inner child (Parent), it can use this method to apply default algorithm inside that Parent and return the next Node within the Parent or null if there's no successor.

Annotations
@Override
selectLastInParentback to summary
public Node selectLastInParent(Parent parent)

Implements com.sun.javafx.scene.traversal.TraversalContext.selectLastInParent.

Doc from com.sun.javafx.scene.traversal.TraversalContext.selectLastInParent.

If the TraversalEngine does not want to handle traversal inside some inner child (Parent), it can use this method to apply default algorithm inside that Parent and return the last Node

Annotations
@Override
com.sun.javafx.scene.traversal back to summary

private final Class TraversalEngine.EngineContext

extends BaseEngineContext
Class Inheritance

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public Parent
getRoot()

Implements com.sun.javafx.scene.traversal.TraversalContext.getRoot.

The root for this context, Traversal should be done only within the root

Inherited from com.sun.javafx.scene.traversal.TraversalEngine.BaseEngineContext:
getAllTargetNodesgetSceneLayoutBoundsselectFirstInParentselectInSubtreeselectLastInParent

Constructor Detail

EngineContextback to summary
private EngineContext()

Method Detail

getRootback to summary
public Parent getRoot()

Implements com.sun.javafx.scene.traversal.TraversalContext.getRoot.

Doc from com.sun.javafx.scene.traversal.TraversalContext.getRoot.

The root for this context, Traversal should be done only within the root

Annotations
@Override
com.sun.javafx.scene.traversal back to summary

private final Class TraversalEngine.TempEngineContext

extends BaseEngineContext
Class Inheritance

Field Summary

Modifier and TypeField and Description
private Parent

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public Parent
getRoot()

Implements com.sun.javafx.scene.traversal.TraversalContext.getRoot.

The root for this context, Traversal should be done only within the root

public void
Inherited from com.sun.javafx.scene.traversal.TraversalEngine.BaseEngineContext:
getAllTargetNodesgetSceneLayoutBoundsselectFirstInParentselectInSubtreeselectLastInParent

Field Detail

rootback to summary
private Parent root

Constructor Detail

TempEngineContextback to summary
private TempEngineContext()

Method Detail

getRootback to summary
public Parent getRoot()

Implements com.sun.javafx.scene.traversal.TraversalContext.getRoot.

Doc from com.sun.javafx.scene.traversal.TraversalContext.getRoot.

The root for this context, Traversal should be done only within the root

Annotations
@Override
setRootback to summary
public void setRoot(Parent root)