Class DefaultFocusTraversalControl

java.lang.Object
com.jme3.scene.control.AbstractControl
com.simsilica.lemur.focus.DefaultFocusTraversalControl
All Implemented Interfaces:
Savable, Control, JmeCloneable, FocusTraversal, Cloneable

public class DefaultFocusTraversalControl extends AbstractControl implements FocusTraversal
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.
  • Constructor Details

    • DefaultFocusTraversalControl

      public DefaultFocusTraversalControl()
    • DefaultFocusTraversalControl

      public DefaultFocusTraversalControl(boolean focusRoot)
  • Method Details

    • setSpatial

      public void setSpatial(Spatial s)
      Specified by:
      setSpatial in interface Control
      Overrides:
      setSpatial in class AbstractControl
      Parameters:
      s - the spatial to be controlled. This should not be called from user code.
    • getDefaultFocus

      public Spatial getDefaultFocus()
      Description copied from interface: FocusTraversal
      Returns the focusable element that should receive focus when first entering this container level.
      Specified by:
      getDefaultFocus in interface FocusTraversal
    • getRelativeFocus

      public Spatial getRelativeFocus(Spatial from, FocusTraversal.TraversalDirection direction)
      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 interface FocusTraversal
    • 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 interface FocusTraversal
    • getFirstFocus

      protected Spatial getFirstFocus()
    • getLastFocus

      protected Spatial getLastFocus()
    • getNextFocus

      protected Spatial getNextFocus(Spatial from)
    • getPreviousFocus

      protected Spatial getPreviousFocus(Spatial from)
    • controlUpdate

      protected void controlUpdate(float f)
      Description copied from class: AbstractControl
      To be implemented in subclass.
      Specified by:
      controlUpdate in class AbstractControl
      Parameters:
      f - time per frame (in seconds)
    • controlRender

      protected void controlRender(RenderManager rm, ViewPort vp)
      Description copied from class: AbstractControl
      To be implemented in subclass.
      Specified by:
      controlRender in class AbstractControl
      Parameters:
      rm - the RenderManager rendering the controlled Spatial (not null)
      vp - the ViewPort being rendered (not null)
    • toString

      public String toString()
      Overrides:
      toString in class Object