java.lang.Object
technology.sola.engine.graphics.gui.GuiDocument
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 Summary
ConstructorsConstructorDescriptionGuiDocument
(SolaPlatform platform, AssetLoaderProvider assetLoaderProvider, MouseInput mouseInput) Creates a new GuiDocument instance, registering listeners for key and mouse related events. -
Method Summary
Modifier and TypeMethodDescription<T extends GuiElement<?,
?>>
@Nullable TfindElementById
(String id, Class<T> elementClass) Searches the document for aGuiElement
with the desired id.boolean
isFocussed
(GuiElement<?, ?> guiElement) Checks to see if aGuiElement
currently has focus.boolean
void
Renders the root element to theRenderer
.void
requestFocus
(GuiElement<?, ?> guiElement) Gives the desiredGuiElement
focus.void
setRootElement
(GuiElement<?, ?> rootEle) Sets the current root element used for rendering and receiving events to the desiredGuiElement
.void
setVisible
(boolean isVisible) Sets whether theGuiDocument
will render or not.void
update()
Updates the GuiDocument's layout state.
-
Constructor Details
-
GuiDocument
public GuiDocument(SolaPlatform platform, AssetLoaderProvider assetLoaderProvider, MouseInput mouseInput) Creates a new GuiDocument instance, registering listeners for key and mouse related events.- Parameters:
platform
- theSolaPlatform
assetLoaderProvider
- theAssetLoaderProvider
mouseInput
- theMouseInput
-
-
Method Details
-
isVisible
public boolean isVisible()- Returns:
- Whether the
GuiDocument
will render or not
-
setVisible
public void setVisible(boolean isVisible) Sets whether theGuiDocument
will render or not.- Parameters:
isVisible
- the new visible state
-
setRootElement
Sets the current root element used for rendering and receiving events to the desiredGuiElement
. Also updates the currently focused element.- Parameters:
rootEle
- the new root element
-
findElementById
Searches the document for aGuiElement
with the desired id.- Type Parameters:
T
- the type of the element- Parameters:
id
- the id of the elementelementClass
- the class of the element- Returns:
- the element
-
isFocussed
Checks to see if aGuiElement
currently has focus.- Parameters:
guiElement
- the element to check- Returns:
- true if the element is currently focussed
-
requestFocus
Gives the desiredGuiElement
focus.- Parameters:
guiElement
- the new element to be focussed
-
update
public void update()Updates the GuiDocument's layout state. This is usually called viaGuiDocumentSystem
and should not be called manually. -
render
Renders the root element to theRenderer
.- Parameters:
renderer
- the renderer
-