Class GuiDocument

java.lang.Object
technology.sola.engine.graphics.gui.GuiDocument

@NullMarked public class GuiDocument extends Object
GuiDocument is a container for GuiElement that also handles passing various key and mouse events to the currently active root element set via setRootElement(GuiElement).
  • Constructor Details

  • Method Details

    • setRootElement

      public void setRootElement(GuiElement<?,?> rootEle)
      Sets the current root element that is used for rendering and receiving events to the desired GuiElement. Also updates the currently focussed element.
      Parameters:
      rootEle - the new root element
    • findElementById

      public <T extends GuiElement<?, ?>> T findElementById(String id, Class<T> elementClass)
      Searches the document for a GuiElement with the desired id.
      Type Parameters:
      T - the type of the element
      Parameters:
      id - the id of the element
      elementClass - the class of the element
      Returns:
      the element
    • isFocussed

      public boolean isFocussed(GuiElement<?,?> guiElement)
      Checks to see if a GuiElement currently has focus.
      Parameters:
      guiElement - the element to check
      Returns:
      true if the element is currently focussed
    • requestFocus

      public void requestFocus(GuiElement<?,?> guiElement)
      Gives the desired GuiElement focus.
      Parameters:
      guiElement - the new element to be focussed
    • render

      public void render(Renderer renderer)
      Renders the root element to the Renderer.
      Parameters:
      renderer - the renderer