Class FocusTraversalAdapter

java.lang.Object
com.simsilica.lemur.core.FocusTraversalAdapter
All Implemented Interfaces:
FocusTraversal

public class FocusTraversalAdapter extends Object implements FocusTraversal
Wraps a standard GuiLayout to provide basic default focus navigation support. Essentially, things like Left, Right, Up, Down are directly wired to Next, Previous and the GuiLayout's child list is used for ordering.
  • Constructor Details

    • FocusTraversalAdapter

      public FocusTraversalAdapter(GuiLayout layout)
  • Method Details

    • setLayout

      public void setLayout(GuiLayout layout)
    • getLayout

      public GuiLayout getLayout()
    • 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 b)
    • 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
    • getFirst

      protected Spatial getFirst()
    • getLast

      protected Spatial getLast()
    • getNext

      protected Spatial getNext(Spatial from)
    • getPrevious

      protected Spatial getPrevious(Spatial from)