Package com.simsilica.lemur.focus
Class DefaultFocusTraversalControl
java.lang.Object
com.jme3.scene.control.AbstractControl
com.simsilica.lemur.focus.DefaultFocusTraversalControl
- All Implemented Interfaces:
Savable
,Control
,JmeCloneable
,FocusTraversal
,Cloneable
A default implementation of the FocusTraversal interface that
is a control providing direct access to any child spatials
that have FocusTarget controls that are "focusable". This is
useful for managing the focus navigation of regular Spatials
that are not standard Lemur GUI elements. It provides only
the most basic next/previous navigation based on the order of
the children as up/down/left/right direction doesn't make any sense
out of context.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.simsilica.lemur.focus.FocusTraversal
FocusTraversal.TraversalDirection
-
Field Summary
Fields inherited from class com.jme3.scene.control.AbstractControl
enabled, spatial
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
controlRender
(RenderManager rm, ViewPort vp) To be implemented in subclass.protected void
controlUpdate
(float f) To be implemented in subclass.Returns the focusable element that should receive focus when first entering this container level.protected Spatial
protected Spatial
protected Spatial
getNextFocus
(Spatial from) protected Spatial
getPreviousFocus
(Spatial from) getRelativeFocus
(Spatial from, FocusTraversal.TraversalDirection direction) Returns the relative focusable element from the specified element in the specified direction as defined by this focus container's implementation of that direction's policy.boolean
Returns true if this is the root of a focus container hierarchy and navigation should not be permitted out of the container.void
setFocusRoot
(boolean f) void
toString()
Methods inherited from class com.jme3.scene.control.AbstractControl
cloneFields, cloneForSpatial, getSpatial, isEnabled, jmeClone, read, render, setEnabled, update, write
-
Constructor Details
-
DefaultFocusTraversalControl
public DefaultFocusTraversalControl() -
DefaultFocusTraversalControl
public DefaultFocusTraversalControl(boolean focusRoot)
-
-
Method Details
-
setSpatial
- Specified by:
setSpatial
in interfaceControl
- Overrides:
setSpatial
in classAbstractControl
- Parameters:
s
- the spatial to be controlled. This should not be called from user code.
-
getDefaultFocus
Description copied from interface:FocusTraversal
Returns the focusable element that should receive focus when first entering this container level.- Specified by:
getDefaultFocus
in interfaceFocusTraversal
-
getRelativeFocus
Description copied from interface:FocusTraversal
Returns the relative focusable element from the specified element in the specified direction as defined by this focus container's implementation of that direction's policy.- Specified by:
getRelativeFocus
in interfaceFocusTraversal
-
setFocusRoot
public void setFocusRoot(boolean f) -
isFocusRoot
public boolean isFocusRoot()Description copied from interface:FocusTraversal
Returns true if this is the root of a focus container hierarchy and navigation should not be permitted out of the container. This is commonly used for root-level windows are any container where the user must initiate a specific action to change contexts.- Specified by:
isFocusRoot
in interfaceFocusTraversal
-
getFirstFocus
-
getLastFocus
-
getNextFocus
-
getPreviousFocus
-
controlUpdate
protected void controlUpdate(float f) Description copied from class:AbstractControl
To be implemented in subclass.- Specified by:
controlUpdate
in classAbstractControl
- Parameters:
f
- time per frame (in seconds)
-
controlRender
Description copied from class:AbstractControl
To be implemented in subclass.- Specified by:
controlRender
in classAbstractControl
- Parameters:
rm
- the RenderManager rendering the controlled Spatial (not null)vp
- the ViewPort being rendered (not null)
-
toString
-