Package com.simsilica.lemur.core
Class GuiControl
- All Implemented Interfaces:
Savable
,Control
,JmeCloneable
,FocusTarget
,FocusTraversal
,Cloneable
public class GuiControl
extends AbstractNodeControl<GuiControl>
implements FocusTarget, FocusTraversal
Manages a component stack, the parent/child relationship, and other
standard GuiControl functionality.
-
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 TypeMethodDescription<T extends GuiComponent>
TaddComponent
(T c) void
void
void
protected void
attach()
protected void
controlUpdate
(float tpf) To be implemented in subclass.protected void
detach()
void
Notifies this focus target that is has gained focus.void
Notifies this focus target that is has lost focus.<T extends GuiComponent>
TgetComponent
(String key) int
Returns the focusable element that should receive focus when first entering this container level.<T extends GuiLayout>
TgetNode()
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.getSize()
protected boolean
void
protected boolean
isChild()
boolean
Returns true if this control is focusable, either because one of its child components/layout is focusable or because setFocusable(true) was called.boolean
Returns true if this focus target currently has the focus.boolean
Returns true if this is the root of a focus container hierarchy and navigation should not be permitted out of the container.boolean
<T extends GuiComponent>
TremoveComponent
(String key) void
void
void
protected void
<T extends GuiComponent>
TsetComponent
(String key, T component) Sets a new component to the specified layer and returns THAT component, not the previous value.void
setFocusable
(boolean b) Sets the focusable state to true for this control even if none of the child components are focusable.void
setLayerOrder
(String... layers) void
void
setPreferredSize
(Vector3f pref) void
Methods inherited from class com.simsilica.lemur.core.AbstractNodeControl
controlRender, setSpatial
Methods inherited from class com.jme3.scene.control.AbstractControl
cloneFields, cloneForSpatial, getSpatial, isEnabled, jmeClone, read, render, setEnabled, update, write
-
Constructor Details
-
GuiControl
-
GuiControl
-
-
Method Details
-
getNode
- Overrides:
getNode
in classAbstractNodeControl<GuiControl>
-
addListener
-
removeListener
-
addFocusChangeListener
-
removeFocusChangeListener
-
addUpdateListener
-
removeUpdateListener
-
isFocused
public boolean isFocused()Description copied from interface:FocusTarget
Returns true if this focus target currently has the focus.- Specified by:
isFocused
in interfaceFocusTarget
-
setFocusable
public void setFocusable(boolean b) Sets the focusable state to true for this control even if none of the child components are focusable. -
isFocusable
public boolean isFocusable()Returns true if this control is focusable, either because one of its child components/layout is focusable or because setFocusable(true) was called.- Specified by:
isFocusable
in interfaceFocusTarget
-
focusGained
public void focusGained()Description copied from interface:FocusTarget
Notifies this focus target that is has gained focus.- Specified by:
focusGained
in interfaceFocusTarget
-
focusLost
public void focusLost()Description copied from interface:FocusTarget
Notifies this focus target that is has lost focus.- Specified by:
focusLost
in interfaceFocusTarget
-
getDefaultFocus
Description copied from interface:FocusTraversal
Returns the focusable element that should receive focus when first entering this container level.- Specified by:
getDefaultFocus
in interfaceFocusTraversal
-
getRelativeFocus
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 interfaceFocusTraversal
-
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 interfaceFocusTraversal
-
setLayerOrder
-
setLayout
-
getLayout
-
setPreferredSize
-
getPreferredSize
-
setSize
-
getSize
-
getComponents
-
addComponent
-
getComponentIndex
-
setComponent
Sets a new component to the specified layer and returns THAT component, not the previous value. This is so that it works like addComponent() in that you can set it and grab it at the same time. -
getComponent
-
removeComponent
-
removeComponent
-
attach
protected void attach()- Specified by:
attach
in classAbstractNodeControl<GuiControl>
-
controlUpdate
protected void controlUpdate(float tpf) Description copied from class:AbstractControl
To be implemented in subclass.- Overrides:
controlUpdate
in classAbstractNodeControl<GuiControl>
- Parameters:
tpf
- time per frame (in seconds)
-
hasParent
protected boolean hasParent() -
isChild
protected boolean isChild() -
revalidate
protected void revalidate() -
invalidate
public void invalidate() -
detach
protected void detach()- Specified by:
detach
in classAbstractNodeControl<GuiControl>
-