public abstract class UiElement extends java.lang.Object implements Hoverable
Modifier and Type | Field and Description |
---|---|
protected java.util.Queue<java.lang.Runnable> |
deferredQueue |
protected java.util.Queue<UiEffect> |
effects |
protected java.lang.String |
styleId |
protected Visibility |
visibility |
protected int |
zIndex |
Constructor and Description |
---|
UiElement()
Constructor.
|
UiElement(java.lang.String id)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addEffectListener(UiEffectListener listener)
Adds a
UiEffectListener to this UiElement |
void |
addHoverListener(HoverListener listener)
Adds a
HoverListener to listen for hover events |
void |
applyEffect(UiEffect effect)
Applies a
UiEffect to this element |
abstract void |
attach(ParentRenderNode<?,?> parentRenderNode)
Attaches a
RenderNode for this element to a parent
RenderNode |
abstract void |
defer(java.lang.Runnable runnable)
Defers the execution of a
Runnable instance until the next frame update |
abstract void |
detach(ParentRenderNode<?,?> parentRenderNode)
Detaches this element's
RenderNode from a parent
RenderNode |
boolean |
equals(java.lang.Object obj) |
UiElement |
getElementById(java.lang.String id)
Searches the UI for a
UiElement with a given id. |
java.lang.String |
getId()
Returns the unique id
|
java.lang.String |
getStyleId()
Returns the current style id of this
UiElement |
Visibility |
getVisibility()
Returns the current
Visibility of this UiElement |
int |
getZIndex()
Returns the Z index of this
UiElement |
int |
hashCode() |
boolean |
isDebugEnabled() |
void |
notifyEffectListenersOnFinished(UiEffect effect)
Notifies all
UiEffectListener s of the finished event |
void |
notifyHoverListenersOnBeginHover()
Notifies all
HoverListener s of the begin hover event |
void |
notifyHoverListenersOnEndHover()
Notifies all
HoverListener s of the end hover event |
void |
removeEffectListener(UiEffectListener listener)
Removes a
UiEffectListener from this UiElement |
void |
removeHoverListener(HoverListener listener)
Removes a
HoverListener from this Hoverable |
void |
setDebugEnabled(boolean debugEnabled) |
abstract void |
setStyleId(java.lang.String styleId)
Sets the style if for this
UiElement |
abstract void |
setVisibility(Visibility visibility)
Sets the current
Visibility of this UiElement |
abstract void |
setZIndex(int zIndex)
Sets the Z index of this
UiElement . |
abstract void |
syncWithRenderNode()
Syncs data between the
UiElement and RenderNode |
protected final java.util.Queue<UiEffect> effects
protected final java.util.Queue<java.lang.Runnable> deferredQueue
protected Visibility visibility
protected java.lang.String styleId
protected int zIndex
public UiElement()
public UiElement(java.lang.String id)
id
- The unique ID for this elementpublic abstract void syncWithRenderNode()
UiElement
and RenderNode
public abstract void attach(ParentRenderNode<?,?> parentRenderNode)
RenderNode
for this element to a parent
RenderNode
parentRenderNode
- The parent RenderNode
to attach topublic abstract void detach(ParentRenderNode<?,?> parentRenderNode)
RenderNode
from a parent
RenderNode
parentRenderNode
- The parent RenderNode
to detach frompublic void applyEffect(UiEffect effect)
UiEffect
to this elementeffect
- The UiEffect
to be appliedpublic abstract void defer(java.lang.Runnable runnable)
Runnable
instance until the next frame updaterunnable
- The Runnable
to executepublic java.lang.String getId()
Hoverable
public Visibility getVisibility()
Visibility
of this UiElement
public abstract void setVisibility(Visibility visibility)
Visibility
of this UiElement
visibility
- The Visibility
to setpublic java.lang.String getStyleId()
UiElement
UiTheme.DEFAULT_STYLE_ID
by defaultpublic abstract void setStyleId(java.lang.String styleId)
UiElement
styleId
- The style id to setpublic int getZIndex()
UiElement
public abstract void setZIndex(int zIndex)
UiElement
. Elements will be rendered on
different Z layers in ascending Z order (negatives values first, positive values last)zIndex
- The Z indexpublic void addHoverListener(HoverListener listener)
Hoverable
HoverListener
to listen for hover eventsaddHoverListener
in interface Hoverable
listener
- The HoverListener
to addpublic void removeHoverListener(HoverListener listener)
Hoverable
HoverListener
from this Hoverable
removeHoverListener
in interface Hoverable
listener
- The HoverListener
to removepublic void notifyHoverListenersOnBeginHover()
HoverListener
s of the begin hover eventnotifyHoverListenersOnBeginHover
in interface Hoverable
public void addEffectListener(UiEffectListener listener)
UiEffectListener
to this UiElement
listener
- The UiEffectListener
to addpublic void removeEffectListener(UiEffectListener listener)
UiEffectListener
from this UiElement
listener
- The UiEffectListener
to removepublic void notifyHoverListenersOnEndHover()
HoverListener
s of the end hover eventnotifyHoverListenersOnEndHover
in interface Hoverable
public void notifyEffectListenersOnFinished(UiEffect effect)
UiEffectListener
s of the finished eventeffect
- The UiEffect
that finishedpublic UiElement getElementById(java.lang.String id)
UiElement
with a given id. Warning: This
can be an expensive operation for complex UIs. It is recommended you
cache results.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public boolean isDebugEnabled()
public void setDebugEnabled(boolean debugEnabled)