public abstract class TraversalEngine
extends java.lang.Object
ParentTraversalEngine
to be used in Parent.setImpl_traversalEngine(ParentTraversalEngine)
to override default behavior
and 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.Modifier and Type | Class and Description |
---|---|
private class |
TraversalEngine.BaseEngineContext
The base class for all engine contexts
|
private class |
TraversalEngine.EngineContext |
private class |
TraversalEngine.TempEngineContext |
Modifier and Type | Field and Description |
---|---|
protected Algorithm |
algorithm |
private TraversalContext |
context |
(package private) static Algorithm |
DEFAULT_ALGORITHM
This is the default algorithm for the running platform.
|
private Bounds |
initialBounds |
private java.util.ArrayList<TraverseListener> |
listeners |
private TraversalEngine.TempEngineContext |
tempEngineContext |
Modifier | Constructor and Description |
---|---|
protected |
TraversalEngine()
Creates engine with no algorithm.
|
protected |
TraversalEngine(Algorithm algorithm)
Creates engine with the specified algorithm
|
Modifier and Type | Method and Description |
---|---|
void |
addTraverseListener(TraverseListener listener)
Add a listener to traversal engine.
|
boolean |
canTraverse()
Returns true only if there's specified algorithm for this engine.
|
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.
|
protected abstract Parent |
getRoot()
The root of this engine's context.
|
(package private) void |
notifyTraversedTo(Node newNode)
Fire notifications for listeners.
|
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. |
Node |
selectFirst()
Returns the first node in this engine's context (scene/parent) using the engine's algorithm.
|
Node |
selectLast()
Returns the last node in this engine's context (scene/parent) using the engine's algorithm.
|
static final Algorithm DEFAULT_ALGORITHM
private final TraversalContext context
private final TraversalEngine.TempEngineContext tempEngineContext
protected final Algorithm algorithm
private final Bounds initialBounds
private final java.util.ArrayList<TraverseListener> listeners
protected TraversalEngine(Algorithm algorithm)
algorithm
- protected TraversalEngine()
canTraverse()
public final void addTraverseListener(TraverseListener listener)
listener
- final void notifyTraversedTo(Node newNode)
newNode
- the node which has been focusedpublic final Node select(Node from, Direction dir)
dir
starting from the Node from
using the engine's algorithm.
Null means there is no Node in that directionfrom
- the node to start traversal fromdir
- the direction of traversaljava.lang.NullPointerException
- if there is no algorithmpublic final Node selectFirst()
java.lang.NullPointerException
- if there is no algorithmpublic final Node selectLast()
java.lang.NullPointerException
- if there is no algorithmprotected abstract Parent getRoot()
public final boolean canTraverse()