java.lang.Object
dev.prozilla.pine.core.component.Component
dev.prozilla.pine.core.component.ui.Node
All Implemented Interfaces:
EventDispatcherContext<NodeEventType,Node,NodeEvent>, EventDispatcherProvider<NodeEventType,Node,NodeEvent>, Destructible, Printable, ApplicationContext, ApplicationProvider, ComponentsContext, ComponentsProvider, EntityContext, EntityProvider, SceneContext, SceneProvider

public class Node extends Component implements EventDispatcherProvider<NodeEventType,Node,NodeEvent>
Component for nodes that make up the user interface.

Nodes are similar to HTML elements and the CSS box model.

  • Field Details

    • currentPosition

      public Vector2f currentPosition
    • currentInnerSize

      public Vector2f currentInnerSize
    • currentOuterSize

      public Vector2f currentOuterSize
    • offset

      public Vector2f offset
    • cursorHit

      public boolean cursorHit
    • readyToRender

      public boolean readyToRender
    • iterations

      public int iterations
    • anchor

      public GridAlignment anchor
    • passThrough

      public boolean passThrough
      If true, allows the cursor to pass through this element.
    • absolutePosition

      public boolean absolutePosition
      If true, this node won't be arranged by a layout node.
    • tooltipText

      public String tooltipText
    • tabIndex

      public int tabIndex
    • autoFocus

      public boolean autoFocus
    • color

      public Color color
    • backgroundColor

      public Color backgroundColor
    • borderColor

      public Color borderColor
    • size

      public DualDimension size
    • padding

      public DualDimension padding
    • margin

      public DualDimension margin
    • border

      public Dimension border
    • borderImage

      public TextureBase borderImage
    • borderImageSlice

      public Vector4f borderImageSlice
    • borderImageSliceFill

      public boolean borderImageSliceFill
    • classes

      public final Set<String> classes
    • modifiers

      public final Set<String> modifiers
    • root

      public NodeRoot root
    • DEFAULT_COLOR

      public static final Color DEFAULT_COLOR
    • DEFAULT_BACKGROUND_COLOR

      public static final Color DEFAULT_BACKGROUND_COLOR
    • DEFAULT_ANCHOR

      public static final GridAlignment DEFAULT_ANCHOR
    • HOVER_MODIFIER

      public static final String HOVER_MODIFIER
      See Also:
    • FOCUS_MODIFIER

      public static final String FOCUS_MODIFIER
      See Also:
  • Constructor Details

    • Node

      public Node()
  • Method Details

    • getName

      public String getName()
      Overrides:
      getName in class Component
    • isInside

      public boolean isInside(Vector2i point)
      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 position
      y - Y position
      Returns:
      True if the point is inside the rectangle
    • isInsideRect

      public static boolean isInsideRect(Vector2f point, Vector2f rectPosition, Vector2f rectSize)
      Checks if a point is inside a given rectangle.
      Parameters:
      rectPosition - Position of the rectangle
      rectSize - Size of the rectangle
      Returns:
      True if the point is inside the rectangle
    • isInsideRect

      public static boolean isInsideRect(float x, float y, Vector2f rectPosition, Vector2f rectSize)
      Checks if a point is inside a given rectangle.
      Parameters:
      rectPosition - Position of the rectangle
      rectSize - Size of the rectangle
      Returns:
      True if the point is inside the rectangle
    • getContext

      public NodeContext getContext()
    • isInLayout

      public boolean isInLayout()
    • isInTooltip

      public boolean isInTooltip()
    • getRoot

      public NodeRoot getRoot() throws IllegalStateException
      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()
    • getEventDispatcher

      public EventDispatcher<NodeEventType,Node,NodeEvent> getEventDispatcher()
      Specified by:
      getEventDispatcher in interface EventDispatcherProvider<NodeEventType,Node,NodeEvent>
    • toggleClass

      public void toggleClass(String className)
    • toggleClass

      public void toggleClass(String className, boolean active)
    • addClass

      public void addClass(String className)
    • removeClass

      public void removeClass(String className)
    • toggleModifier

      public void toggleModifier(String modifier)
    • toggleModifier

      public void toggleModifier(String modifier, boolean active)
    • addModifier

      public void addModifier(String modifier)
    • removeModifier

      public void removeModifier(String modifier)
    • click

      public void click()
    • focus

      public void focus()
    • isFocused

      public boolean isFocused()