Class Node
java.lang.Object
dev.prozilla.pine.core.component.Component
dev.prozilla.pine.core.component.ui.Node
- All Implemented Interfaces:
EventDispatcherContext<NodeEvent>
,Lifecycle
,Printable
,ApplicationContext
,ApplicationProvider
,ComponentsContext
,ComponentsProvider
,EntityContext
,EntityProvider
,SceneContext
,SceneProvider
Component for nodes that make up the user interface.
Nodes are similar to HTML elements and the CSS box model.
-
Field Summary
FieldsModifier and TypeFieldDescriptionboolean
If true, this node won't be arranged by a layout node.boolean
boolean
static final GridAlignment
static final Color
static final Color
final EventDispatcher
<NodeEvent> int
boolean
If true, allows the cursor to pass through this element.boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
addListener
(NodeEvent eventType, EventListener listener) Adds a listener that listens to a given type of event.void
addModifier
(String modifier) float
float
float
float
float
getName()
float
float
float
float
getRoot()
Gets the node root of this node.float
getX()
float
getY()
void
Invokes the event of a given type.boolean
boolean
isInside
(int x, int y) Checks if a point is inside this rectangle.boolean
Checks if a point is inside this rectangle.static boolean
isInsideRect
(float x, float y, Vector2f rectPosition, Vector2f rectSize) Checks if a point is inside a given rectangle.static boolean
isInsideRect
(Vector2f point, Vector2f rectPosition, Vector2f rectSize) Checks if a point is inside a given rectangle.boolean
void
removeClass
(String className) void
removeListener
(NodeEvent eventType, EventListener listener) Removes a listener that listened to a given type of event.void
removeModifier
(String modifier) void
toggleClass
(String className) void
toggleClass
(String className, boolean active) void
toggleModifier
(String modifier) void
toggleModifier
(String modifier, boolean active) Methods inherited from class dev.prozilla.pine.core.component.Component
equals, getApplication, getEntity, getScene, hashCode, setActive, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface dev.prozilla.pine.core.ApplicationProvider
getConfig, getInput, getLogger, getModManager, getRenderer, getTimer, getTracker, getWindow
Methods inherited from interface dev.prozilla.pine.core.component.ComponentsProvider
getComponent, getComponentInParent, getComponentInParent, getComponents, getComponentsInChildren
Methods inherited from interface dev.prozilla.pine.core.entity.EntityContext
isDescendantOf
Methods inherited from interface dev.prozilla.pine.core.entity.EntityProvider
getChildWithTag, getFirstChild, getLastChild, getParentWithTag, getTransform, isDescendantOf
Methods inherited from interface dev.prozilla.pine.common.Lifecycle
destroy, init, init, input, input, render, render, start, update, update
Methods inherited from interface dev.prozilla.pine.core.scene.SceneProvider
getCameraData, getWorld
-
Field Details
-
currentPosition
-
currentInnerSize
-
currentOuterSize
-
offset
-
cursorHit
public boolean cursorHit -
readyToRender
public boolean readyToRender -
iterations
public int iterations -
anchor
-
passThrough
public boolean passThroughIf true, allows the cursor to pass through this element. -
absolutePosition
public boolean absolutePositionIf true, this node won't be arranged by a layout node. -
tooltipText
-
color
-
backgroundColor
-
size
-
padding
-
margin
-
border
-
borderImage
-
borderImageSlice
-
borderImageSliceFill
public boolean borderImageSliceFill -
classes
-
modifiers
-
root
-
eventDispatcher
-
DEFAULT_COLOR
-
DEFAULT_BACKGROUND_COLOR
-
DEFAULT_ANCHOR
-
-
Constructor Details
-
Node
public Node()
-
-
Method Details
-
getName
-
isInside
Checks if a point is inside this rectangle.- Returns:
- True if the point is inside the rectangle
-
isInside
public boolean isInside(int x, int y) Checks if a point is inside this rectangle.- Parameters:
x
- X positiony
- Y position- Returns:
- True if the point is inside the rectangle
-
isInsideRect
Checks if a point is inside a given rectangle.- Parameters:
rectPosition
- Position of the rectanglerectSize
- Size of the rectangle- Returns:
- True if the point is inside the rectangle
-
isInsideRect
Checks if a point is inside a given rectangle.- Parameters:
rectPosition
- Position of the rectanglerectSize
- Size of the rectangle- Returns:
- True if the point is inside the rectangle
-
getContext
-
isInLayout
public boolean isInLayout() -
isInTooltip
public boolean isInTooltip() -
getRoot
Gets the node root of this node.- Throws:
IllegalStateException
- When this entity is not a child of an entity with a node root component.
-
getOuterSizeX
public float getOuterSizeX() -
getOuterSizeY
public float getOuterSizeY() -
getInnerSizeX
public float getInnerSizeX() -
getInnerSizeY
public float getInnerSizeY() -
getPaddingX
public float getPaddingX() -
getPaddingY
public float getPaddingY() -
getX
public float getX() -
getY
public float getY() -
getMarginX
public float getMarginX() -
getMarginY
public float getMarginY() -
getBorderWidth
public float getBorderWidth() -
addListener
Description copied from interface:EventDispatcherContext
Adds a listener that listens to a given type of event.- Specified by:
addListener
in interfaceEventDispatcherContext<NodeEvent>
- Parameters:
eventType
- The type of event to listen tolistener
- The listener to add
-
removeListener
Description copied from interface:EventDispatcherContext
Removes a listener that listened to a given type of event.- Specified by:
removeListener
in interfaceEventDispatcherContext<NodeEvent>
- Parameters:
eventType
- The type of event that was being listened tolistener
- The listener to remove
-
invoke
Description copied from interface:EventDispatcherContext
Invokes the event of a given type.- Specified by:
invoke
in interfaceEventDispatcherContext<NodeEvent>
- Parameters:
eventType
- The type of event to invoke
-
toggleClass
-
toggleClass
-
addClass
-
removeClass
-
toggleModifier
-
toggleModifier
-
addModifier
-
removeModifier
-