public class Element extends Object implements NiftyEvent<Void>
Modifier and Type | Class and Description |
---|---|
class |
Element.LocalEndNotify
LocalEndNotify helper class.
|
Constructor and Description |
---|
Element(Nifty newNifty,
ElementType newElementType,
String newId,
Element newParent,
FocusHandler newFocusHandler,
boolean newVisibleToMouseEvents,
TimeProvider newTimeProvider,
ElementRenderer... newElementRenderer)
construct new instance of Element.
|
Element(Nifty newNifty,
ElementType newElementType,
String newId,
Element newParent,
LayoutPart newLayoutPart,
FocusHandler newFocusHandler,
boolean newVisibleToMouseEvents,
TimeProvider newTimeProvider,
ElementRenderer... newElementRenderer)
construct new instance of Element using the given layoutPart instance.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Element widget)
add a child element.
|
void |
addInputHandler(KeyInputHandler handler)
add additional input handler to this element or childs of the elements.
|
void |
addPreInputHandler(KeyInputHandler handler)
add additional input handler to this element or childs of the elements.
|
void |
attachInputControl(NiftyInputControl newInputControl)
attach an input control to this element.
|
void |
bindControls(Screen target) |
void |
buildMouseOverElements(NiftyMouseInputEvent mouseEvent,
long eventTime,
MouseOverHandler mouseOverHandler)
This should check if the mouse event is inside the current element and if it is
forward the event to it's child.
|
void |
disable()
disable this element.
|
void |
disableFocus() |
void |
enable()
enable this element.
|
void |
enableInternal() |
<T extends Controller> |
findControl(String elementName,
Class<T> requestedControlClass) |
Element |
findElementByName(String name)
find an element by name.
|
<T extends NiftyControl> |
findNiftyControl(String elementName,
Class<T> requestedControlClass) |
NiftyInputControl |
getAttachedInputControl() |
SizeValue |
getConstraintHeight()
get current height constraint.
|
HorizontalAlign |
getConstraintHorizontalAlign()
get current horizontal align.
|
VerticalAlign |
getConstraintVerticalAlign()
get current vertical align.
|
SizeValue |
getConstraintWidth()
get current width constraint.
|
SizeValue |
getConstraintX() |
SizeValue |
getConstraintY() |
<T extends Controller> |
getControl(Class<T> requestedControlClass) |
EffectManager |
getEffectManager()
get the effect manager.
|
<T extends EffectImpl> |
getEffects(EffectEventId effectEventId,
Class<T> requestedClass) |
ElementInteraction |
getElementInteraction() |
ElementRenderer[] |
getElementRenderer()
get element renderer.
|
List<Element> |
getElements()
get all child elements of this element.
|
String |
getElementStateString(String offset)
get element state as string.
|
String |
getElementStateString(String offset,
String regex) |
ElementType |
getElementType()
get element type.
|
Falloff |
getFalloff() |
FocusHandler |
getFocusHandler() |
int |
getHeight()
get height.
|
String |
getId()
get the id of this element.
|
LayoutPart |
getLayoutPart()
Get LayoutPart.
|
Nifty |
getNifty() |
<T extends NiftyControl> |
getNiftyControl(Class<T> requestedControlClass) |
Element |
getParent()
get parent.
|
<T extends ElementRenderer> |
getRenderer(Class<T> requestedRendererClass) |
String |
getStyle() |
int |
getWidth()
get width.
|
int |
getX()
get x.
|
int |
getY()
get y.
|
void |
hide()
hide this element.
|
void |
hide(EndNotify perform) |
void |
hideWithoutEffect() |
void |
initControls() |
void |
initializeFromAttributes(Attributes attributes,
NiftyRenderEngine renderEngine)
This is used when the element is being created from an ElementType in the loading process.
|
void |
initializeFromPostAttributes(Attributes attributes) |
void |
internalHide() |
boolean |
isClipChildren()
Is clip children enabled?
|
boolean |
isEffectActive(EffectEventId effectEventId)
check if a certain effect is still active.
|
boolean |
isEnabled()
is this element enabled?
|
boolean |
isFocusable()
is focusable?
|
boolean |
isMouseInsideElement(int mouseX,
int mouseY) |
boolean |
isStarted() |
boolean |
isVisible()
check if this element is visible.
|
boolean |
isVisibleToMouseEvents()
Is this element visible to mouse events.
|
boolean |
keyEvent(KeyboardInputEvent inputEvent)
keyboard event.
|
void |
layoutElements() |
void |
markForMove(Element destination) |
void |
markForMove(Element destination,
EndNotify endNotify) |
void |
markForRemoval() |
void |
markForRemoval(EndNotify endNotify) |
boolean |
mouseEvent(NiftyMouseInputEvent mouseEvent,
long eventTime)
MouseEvent.
|
void |
mouseEventHoverPreprocess(NiftyMouseInputEvent mouseEvent,
long eventTime) |
boolean |
mouseOverEvent(NiftyMouseInputEvent mouseEvent,
long eventTime)
Handle the MouseOverEvent.
|
void |
onClick() |
void |
onEndScreen(Screen screen) |
void |
onStartScreen()
On start screen event.
|
void |
reactivate() |
void |
registerEffect(EffectEventId theId,
Effect e)
register an effect for this element.
|
void |
removeFromFocusHandler()
remove this and all children from the focushandler.
|
void |
render(NiftyRenderEngine r)
render this element.
|
void |
resetAllEffects() |
void |
resetEffects()
reset all effects.
|
void |
resetForHide() |
void |
resetLayout() |
void |
resetMouseDown() |
void |
resetSingleEffect(EffectEventId effectEventId) |
void |
resetSingleEffect(EffectEventId effectEventId,
String customKey) |
void |
setAlternateKey(String alternateKey)
set alternate key.
|
void |
setClipChildren(boolean clipChildrenParam)
Set clip children.
|
void |
setConstraintHeight(SizeValue newHeight)
set new height constraint.
|
void |
setConstraintHorizontalAlign(HorizontalAlign newHorizontalAlign)
set new horizontal align.
|
void |
setConstraintVerticalAlign(VerticalAlign newVerticalAlign)
set new vertical align.
|
void |
setConstraintWidth(SizeValue newWidth)
set new width constraint.
|
void |
setConstraintX(SizeValue newX)
set new x position constraint.
|
void |
setConstraintY(SizeValue newY)
set new y position constraint.
|
void |
setEffectManager(EffectManager effectManagerParam)
Set a New EffectManager.
|
void |
setFocus()
Set the focus to this element.
|
void |
setFocusable(boolean newFocusable)
set focusable flag.
|
void |
setHeight(int height)
Sets the height of this element
|
void |
setHotSpotFalloff(Falloff newFalloff)
set a new Falloff.
|
void |
setId(String newId)
set id.
|
void |
setLayoutManager(LayoutManager newLayout)
Set a new LayoutManager.
|
void |
setOnClickAlternateKey(String newAlternateKey)
set a new alternate key.
|
void |
setOnMouseOverMethod(NiftyMethodInvoker onMouseOverMethod)
Set onMouseOverMethod.
|
void |
setPaddingBottom(SizeValue paddingValue) |
void |
setPaddingLeft(SizeValue paddingValue) |
void |
setPaddingRight(SizeValue paddingValue) |
void |
setPaddingTop(SizeValue paddingValue) |
void |
setParent(Element element) |
void |
setStyle(String newStyle)
set a new style.
|
void |
setVisible(boolean visibleParam) |
void |
setVisibleToMouseEvents(boolean newVisibleToMouseEvents)
Set visible to mouse flag.
|
void |
setWidth(int width)
Sets the width of this element
|
void |
show()
show this element.
|
void |
showWithoutEffects() |
void |
startEffect(EffectEventId effectEventId) |
void |
startEffect(EffectEventId effectEventId,
EndNotify effectEndNotiy) |
void |
startEffect(EffectEventId effectEventId,
EndNotify effectEndNotiy,
String customKey) |
void |
startEffectWithoutChildren(EffectEventId effectEventId) |
void |
startEffectWithoutChildren(EffectEventId effectEventId,
EndNotify effectEndNotiy) |
void |
startEffectWithoutChildren(EffectEventId effectEventId,
EndNotify effectEndNotiy,
String customKey) |
void |
stopEffect(EffectEventId effectEventId)
stop the given effect.
|
void |
stopEffectWithoutChildren(EffectEventId effectEventId) |
String |
toString() |
public Element(Nifty newNifty, ElementType newElementType, String newId, Element newParent, FocusHandler newFocusHandler, boolean newVisibleToMouseEvents, TimeProvider newTimeProvider, ElementRenderer... newElementRenderer)
newNifty
- NiftynewElementType
- elementTypenewId
- the idnewParent
- new parentnewFocusHandler
- the new focus handlernewVisibleToMouseEvents
- visible to mousenewTimeProvider
- TimeProvidernewElementRenderer
- the element rendererpublic Element(Nifty newNifty, ElementType newElementType, String newId, Element newParent, LayoutPart newLayoutPart, FocusHandler newFocusHandler, boolean newVisibleToMouseEvents, TimeProvider newTimeProvider, ElementRenderer... newElementRenderer)
newNifty
- NiftynewElementType
- element typenewId
- the idnewParent
- new parentnewLayoutPart
- the layout partnewFocusHandler
- the new focus handlernewVisibleToMouseEvents
- visible to mousenewTimeProvider
- TimeProvidernewElementRenderer
- the element rendererpublic void initializeFromAttributes(Attributes attributes, NiftyRenderEngine renderEngine)
public void initializeFromPostAttributes(Attributes attributes)
public String getId()
public Element getParent()
public void setParent(Element element)
public String getElementStateString(String offset)
offset
- offset stringregex
- public int getX()
public int getY()
public int getHeight()
public int getWidth()
public void setHeight(int height)
height
- the new height in pixelspublic void setWidth(int width)
width
- the new width in pixelspublic List<Element> getElements()
public void add(Element widget)
widget
- the child to addpublic void render(NiftyRenderEngine r)
r
- the RenderDevice to usepublic void setLayoutManager(LayoutManager newLayout)
newLayout
- the new LayoutManager to use.public void resetLayout()
public void layoutElements()
public void resetEffects()
public void resetAllEffects()
public void resetForHide()
public void resetSingleEffect(EffectEventId effectEventId)
public void resetSingleEffect(EffectEventId effectEventId, String customKey)
public void resetMouseDown()
public void setConstraintX(SizeValue newX)
newX
- new x constraint.public void setConstraintY(SizeValue newY)
newY
- new y constaint.public void setConstraintWidth(SizeValue newWidth)
newWidth
- new width constraint.public void setConstraintHeight(SizeValue newHeight)
newHeight
- new height constraint.public SizeValue getConstraintX()
public SizeValue getConstraintY()
public SizeValue getConstraintWidth()
public SizeValue getConstraintHeight()
public void setConstraintHorizontalAlign(HorizontalAlign newHorizontalAlign)
newHorizontalAlign
- new horizontal align.public void setConstraintVerticalAlign(VerticalAlign newVerticalAlign)
newVerticalAlign
- new vertical align.public HorizontalAlign getConstraintHorizontalAlign()
public VerticalAlign getConstraintVerticalAlign()
public void registerEffect(EffectEventId theId, Effect e)
theId
- the effect ide
- the effectpublic void startEffect(EffectEventId effectEventId)
public void startEffect(EffectEventId effectEventId, EndNotify effectEndNotiy)
public void startEffect(EffectEventId effectEventId, EndNotify effectEndNotiy, String customKey)
public void startEffectWithoutChildren(EffectEventId effectEventId)
public void startEffectWithoutChildren(EffectEventId effectEventId, EndNotify effectEndNotiy)
public void startEffectWithoutChildren(EffectEventId effectEventId, EndNotify effectEndNotiy, String customKey)
public void stopEffect(EffectEventId effectEventId)
effectEventId
- effect event id to stoppublic void stopEffectWithoutChildren(EffectEventId effectEventId)
public boolean isEffectActive(EffectEventId effectEventId)
effectEventId
- the effect type id to checkpublic void enable()
public void enableInternal()
public void disable()
public void disableFocus()
public boolean isEnabled()
public void show()
public void setVisible(boolean visibleParam)
public void hide()
public void hide(EndNotify perform)
public void showWithoutEffects()
public void hideWithoutEffect()
public void internalHide()
public boolean isVisible()
public void setHotSpotFalloff(Falloff newFalloff)
newFalloff
- new Falloffpublic Falloff getFalloff()
public void buildMouseOverElements(NiftyMouseInputEvent mouseEvent, long eventTime, MouseOverHandler mouseOverHandler)
public void mouseEventHoverPreprocess(NiftyMouseInputEvent mouseEvent, long eventTime)
public boolean mouseEvent(NiftyMouseInputEvent mouseEvent, long eventTime)
mouseEvent
- mouse eventeventTime
- event timepublic boolean mouseOverEvent(NiftyMouseInputEvent mouseEvent, long eventTime)
mouseEvent
- mouse eventeventTime
- event timepublic boolean isMouseInsideElement(int mouseX, int mouseY)
public void onClick()
public Element findElementByName(String name)
name
- the name of the element (id)public void setOnClickAlternateKey(String newAlternateKey)
newAlternateKey
- new alternate key to usepublic void setAlternateKey(String alternateKey)
alternateKey
- new alternate keypublic EffectManager getEffectManager()
public void setEffectManager(EffectManager effectManagerParam)
effectManagerParam
- new Effectmanagerpublic void onStartScreen()
public <T extends ElementRenderer> T getRenderer(Class<T> requestedRendererClass)
T
- the ElementRenderer typerequestedRendererClass
- the special ElementRenderer type to check forpublic void setVisibleToMouseEvents(boolean newVisibleToMouseEvents)
newVisibleToMouseEvents
- true or falsepublic boolean keyEvent(KeyboardInputEvent inputEvent)
inputEvent
- keyboard eventpublic void setClipChildren(boolean clipChildrenParam)
clipChildrenParam
- clip children flagpublic boolean isClipChildren()
public void setFocus()
public void attachInputControl(NiftyInputControl newInputControl)
newInputControl
- input controlpublic void setId(String newId)
newId
- new idpublic ElementType getElementType()
public ElementRenderer[] getElementRenderer()
public void setFocusable(boolean newFocusable)
newFocusable
- focusable flagpublic NiftyInputControl getAttachedInputControl()
public void bindControls(Screen target)
public void initControls()
public void removeFromFocusHandler()
public FocusHandler getFocusHandler()
public void setStyle(String newStyle)
newStyle
- new style to setpublic String getStyle()
public void addInputHandler(KeyInputHandler handler)
handler
- additiona handlerpublic void addPreInputHandler(KeyInputHandler handler)
handler
- additiona handlerpublic <T extends Controller> T findControl(String elementName, Class<T> requestedControlClass)
public <T extends NiftyControl> T findNiftyControl(String elementName, Class<T> requestedControlClass)
public <T extends Controller> T getControl(Class<T> requestedControlClass)
public <T extends NiftyControl> T getNiftyControl(Class<T> requestedControlClass)
public boolean isFocusable()
public void setOnMouseOverMethod(NiftyMethodInvoker onMouseOverMethod)
onMouseOverMethod
- new on mouse over methodpublic LayoutPart getLayoutPart()
public boolean isVisibleToMouseEvents()
public void setPaddingLeft(SizeValue paddingValue)
public void setPaddingRight(SizeValue paddingValue)
public void setPaddingTop(SizeValue paddingValue)
public void setPaddingBottom(SizeValue paddingValue)
public boolean isStarted()
public void markForRemoval()
public void markForRemoval(EndNotify endNotify)
public void markForMove(Element destination)
public void reactivate()
public Nifty getNifty()
public <T extends EffectImpl> List<Effect> getEffects(EffectEventId effectEventId, Class<T> requestedClass)
public void onEndScreen(Screen screen)
public ElementInteraction getElementInteraction()
Copyright © 2013. All Rights Reserved.