Modifier and Type | Field and Description |
---|---|
protected java.util.Queue<UiElement> |
asyncAddQueue |
protected java.util.concurrent.atomic.AtomicBoolean |
asyncRemoveAll |
protected java.util.Queue<UiElement> |
asyncRemoveQueue |
protected java.util.List<UiElement> |
children |
protected ParentRenderNode<?,?> |
renderNode |
deferredQueue, effects, styleId, visibility, zIndex
Constructor and Description |
---|
ParentUiElement()
Constructor.
|
ParentUiElement(java.lang.String id)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
UiElement element)
Inserts a
UiElement at a specific index into this ParentUiElement
's child elements |
void |
add(UiElement element)
Adds a
UiElement to this ParentUiElement |
void |
addAsync(UiElement element)
Adds a
UiElement safely from a non-OpenGL thread |
void |
attach(ParentRenderNode<?,?> parentRenderNode)
Attaches a
RenderNode for this element to a parent
RenderNode |
protected abstract ParentRenderNode<?,?> |
createRenderNode(ParentRenderNode<?,?> parent)
Creates the
ParentRenderNode for this UiElement |
void |
defer(java.lang.Runnable runnable)
Defers the execution of a
Runnable instance until the next frame update |
void |
detach(ParentRenderNode<?,?> parentRenderNode)
Detaches this element's
RenderNode from a parent
RenderNode |
UiElement |
getElementById(java.lang.String id)
Searches the UI for a
UiElement with a given id. |
FlexDirection |
getFlexDirection()
Returns the
FlexDirection of this element |
java.lang.String |
getLayout()
Returns the current layout
|
int |
getTotalChildren()
Returns the total number of child elements for this element
|
UiElement |
remove(int index)
Removes a child
UiElement at a specific index |
boolean |
remove(UiElement element)
Removes a
UiElement from this ParentUiElement |
void |
removeAll()
Removes all children from this
ParentUiElement |
void |
removeAllAsync()
Removes all children safely from a non-OpenGL thread
|
void |
removeAsync(UiElement element)
Removes a
UiElement safely from a non-OpenGL thread |
void |
setFlexDirection(FlexDirection flexDirection)
Sets the
FlexDirection of this element |
void |
setLayout(java.lang.String layout)
Sets the current layout
|
void |
setStyleId(java.lang.String styleId)
Sets the style if for this
UiElement |
void |
setVisibility(Visibility visibility)
Sets the current
Visibility of this UiElement |
void |
setZIndex(int zIndex)
Sets the Z index of this
UiElement . |
void |
syncWithRenderNode()
Syncs data between the
UiElement and RenderNode |
addEffectListener, addHoverListener, applyEffect, equals, getId, getStyleId, getVisibility, getZIndex, hashCode, isDebugEnabled, notifyEffectListenersOnFinished, notifyHoverListenersOnBeginHover, notifyHoverListenersOnEndHover, removeEffectListener, removeHoverListener, setDebugEnabled
protected final java.util.List<UiElement> children
protected final java.util.Queue<UiElement> asyncAddQueue
protected final java.util.Queue<UiElement> asyncRemoveQueue
protected final java.util.concurrent.atomic.AtomicBoolean asyncRemoveAll
protected ParentRenderNode<?,?> renderNode
public ParentUiElement()
ParentUiElement
public ParentUiElement(java.lang.String id)
id
- The unique ID for this ParentUiElement
protected abstract ParentRenderNode<?,?> createRenderNode(ParentRenderNode<?,?> parent)
ParentRenderNode
for this UiElement
parent
- The parent of this nodeParentRenderNode
public void add(UiElement element)
UiElement
to this ParentUiElement
element
- The UiElement
to be addedpublic void add(int index, UiElement element)
UiElement
at a specific index into this ParentUiElement
's child elementsindex
- The index to insert atelement
- The UiElement
to be insertedpublic void addAsync(UiElement element)
UiElement
safely from a non-OpenGL threadelement
- The UiElement
to be addedpublic boolean remove(UiElement element)
UiElement
from this ParentUiElement
element
- The UiElement
to be removedParentUiElement
contained the UiElement
public void removeAsync(UiElement element)
UiElement
safely from a non-OpenGL threadelement
- The UiElement
to be removepublic UiElement remove(int index)
UiElement
at a specific indexindex
- The index to remove atUiElement
that was removedpublic void removeAll()
ParentUiElement
public void removeAllAsync()
public void attach(ParentRenderNode<?,?> parentRenderNode)
UiElement
RenderNode
for this element to a parent
RenderNode
attach
in class UiElement
parentRenderNode
- The parent RenderNode
to attach topublic void detach(ParentRenderNode<?,?> parentRenderNode)
UiElement
RenderNode
from a parent
RenderNode
detach
in class UiElement
parentRenderNode
- The parent RenderNode
to detach frompublic java.lang.String getLayout()
public void setLayout(java.lang.String layout)
layout
- public void setVisibility(Visibility visibility)
UiElement
Visibility
of this UiElement
setVisibility
in class UiElement
visibility
- The Visibility
to setpublic void defer(java.lang.Runnable runnable)
UiElement
Runnable
instance until the next frame updatepublic void syncWithRenderNode()
UiElement
UiElement
and RenderNode
syncWithRenderNode
in class UiElement
public void setStyleId(java.lang.String styleId)
UiElement
UiElement
setStyleId
in class UiElement
styleId
- The style id to setpublic void setZIndex(int zIndex)
UiElement
UiElement
. Elements will be rendered on
different Z layers in ascending Z order (negatives values first, positive values last)public int getTotalChildren()
public UiElement getElementById(java.lang.String id)
UiElement
UiElement
with a given id. Warning: This
can be an expensive operation for complex UIs. It is recommended you
cache results.getElementById
in class UiElement
id
- The UiElement
identifier to search forUiElement
with the given idpublic FlexDirection getFlexDirection()
FlexDirection
of this elementFlexDirection
- defaults to FlexDirection.COLUMN
public void setFlexDirection(FlexDirection flexDirection)
FlexDirection
of this elementflexDirection
- The FlexDirection
to set