public abstract class UiElement extends java.lang.Object implements Hoverable
| Modifier and Type | Field and Description |
|---|---|
protected java.util.List<DeferredRunnable> |
deferred |
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 |
DeferredRunnable |
defer(java.lang.Runnable runnable)
Defers the execution of a
Runnable instance until the next frame update |
DeferredRunnable |
defer(java.lang.Runnable runnable,
float duration)
Defers the execution of a
Runnable instance for a period of time |
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
UiEffectListeners of the finished event |
void |
notifyHoverListenersOnBeginHover()
Notifies all
HoverListeners of the begin hover event |
void |
notifyHoverListenersOnEndHover()
Notifies all
HoverListeners of the end hover event |
protected void |
processDeferred()
Processes all deferred actions
|
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.List<DeferredRunnable> deferred
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 RenderNodepublic abstract void attach(ParentRenderNode<?,?> parentRenderNode)
RenderNode for this element to a parent
RenderNodeparentRenderNode - The parent RenderNode to attach topublic abstract void detach(ParentRenderNode<?,?> parentRenderNode)
RenderNode from a parent
RenderNodeparentRenderNode - The parent RenderNode to detach frompublic void applyEffect(UiEffect effect)
UiEffect to this elementeffect - The UiEffect to be appliedpublic DeferredRunnable defer(java.lang.Runnable runnable)
Runnable instance until the next frame updaterunnable - The Runnable to executeDeferredRunnable that can be cancelledpublic DeferredRunnable defer(java.lang.Runnable runnable, float duration)
Runnable instance for a period of timerunnable - The Runnable to executeduration - The time to wait (in seconds) until executing the RunnableDeferredRunnable that can be cancelledprotected void processDeferred()
public java.lang.String getId()
Hoverablepublic Visibility getVisibility()
Visibility of this UiElementpublic abstract void setVisibility(Visibility visibility)
Visibility of this UiElementvisibility - The Visibility to setpublic java.lang.String getStyleId()
UiElementUiTheme.DEFAULT_STYLE_ID by defaultpublic abstract void setStyleId(java.lang.String styleId)
UiElementstyleId - The style id to setpublic int getZIndex()
UiElementpublic 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)
HoverableHoverListener to listen for hover eventsaddHoverListener in interface Hoverablelistener - The HoverListener to addpublic void removeHoverListener(HoverListener listener)
HoverableHoverListener from this HoverableremoveHoverListener in interface Hoverablelistener - The HoverListener to removepublic void notifyHoverListenersOnBeginHover()
HoverListeners of the begin hover eventnotifyHoverListenersOnBeginHover in interface Hoverablepublic void addEffectListener(UiEffectListener listener)
UiEffectListener to this UiElementlistener - The UiEffectListener to addpublic void removeEffectListener(UiEffectListener listener)
UiEffectListener from this UiElementlistener - The UiEffectListener to removepublic void notifyHoverListenersOnEndHover()
HoverListeners of the end hover eventnotifyHoverListenersOnEndHover in interface Hoverablepublic void notifyEffectListenersOnFinished(UiEffect effect)
UiEffectListeners 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.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic boolean isDebugEnabled()
public void setDebugEnabled(boolean debugEnabled)