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

public class Node extends Component implements EventDispatcherContext<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
    • color

      public Color color
    • backgroundColor

      public Color backgroundColor
    • 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
    • eventDispatcher

      public final EventDispatcher<NodeEvent> eventDispatcher
    • 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
  • 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()
    • addListener

      public void addListener(NodeEvent eventType, EventListener listener)
      Description copied from interface: EventDispatcherContext
      Adds a listener that listens to a given type of event.
      Specified by:
      addListener in interface EventDispatcherContext<NodeEvent>
      Parameters:
      eventType - The type of event to listen to
      listener - The listener to add
    • removeListener

      public void removeListener(NodeEvent eventType, EventListener listener)
      Description copied from interface: EventDispatcherContext
      Removes a listener that listened to a given type of event.
      Specified by:
      removeListener in interface EventDispatcherContext<NodeEvent>
      Parameters:
      eventType - The type of event that was being listened to
      listener - The listener to remove
    • invoke

      public void invoke(NodeEvent eventType)
      Description copied from interface: EventDispatcherContext
      Invokes the event of a given type.
      Specified by:
      invoke in interface EventDispatcherContext<NodeEvent>
      Parameters:
      eventType - The type of event to invoke
    • 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)