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 voidcontrolRender(RenderManager rm, ViewPort vp) To be implemented in subclass.protected voidcontrolUpdate(float f) To be implemented in subclass.Returns the focusable element that should receive focus when first entering this container level.protected Spatialprotected Spatialprotected SpatialgetNextFocus(Spatial from) protected SpatialgetPreviousFocus(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.booleanReturns true if this is the root of a focus container hierarchy and navigation should not be permitted out of the container.voidsetFocusRoot(boolean f) voidtoString()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:
setSpatialin interfaceControl- Overrides:
setSpatialin classAbstractControl- Parameters:
s- the spatial to be controlled. This should not be called from user code.
-
getDefaultFocus
Description copied from interface:FocusTraversalReturns the focusable element that should receive focus when first entering this container level.- Specified by:
getDefaultFocusin interfaceFocusTraversal
-
getRelativeFocus
Description copied from interface:FocusTraversalReturns 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:
getRelativeFocusin interfaceFocusTraversal
-
setFocusRoot
public void setFocusRoot(boolean f) -
isFocusRoot
public boolean isFocusRoot()Description copied from interface:FocusTraversalReturns 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:
isFocusRootin interfaceFocusTraversal
-
getFirstFocus
-
getLastFocus
-
getNextFocus
-
getPreviousFocus
-
controlUpdate
protected void controlUpdate(float f) Description copied from class:AbstractControlTo be implemented in subclass.- Specified by:
controlUpdatein classAbstractControl- Parameters:
f- time per frame (in seconds)
-
controlRender
Description copied from class:AbstractControlTo be implemented in subclass.- Specified by:
controlRenderin classAbstractControl- Parameters:
rm- the RenderManager rendering the controlled Spatial (not null)vp- the ViewPort being rendered (not null)
-
toString
-