Class Widget

java.lang.Object
com.valhalla.sdk.api.widgets.Widget
All Implemented Interfaces:
Identifiable

public final class Widget extends Object implements Identifiable
Immutable widget snapshot populated only by a validated native UI adapter.

Widget coordinates are measured on the native game surface. An identifier is packed as groupId << 16 | childId. Snapshots are observational; use the appropriate capability-backed facade to perform UI actions.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Widget(int id, int parentId, int type, String text, boolean visible, int x, int y, int width, int height)
    Creates a complete immutable widget snapshot.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    contains(int pointX, int pointY)
    Tests a point against visible half-open widget bounds.
    boolean
    equals(Object value)
     
    int
    Computes rectangular area.
    int
    Returns the horizontal center.
    int
    Returns the vertical center.
    int
    Unpacks the child identifier.
    int
    Unpacks the widget group.
    int
    Returns the widget height.
    int
    Returns the packed widget identifier.
    int
    Returns the parent identifier.
    Returns captured widget text.
    int
    Returns the native widget type.
    int
    Returns the widget width.
    int
    Returns the left bound.
    int
    Returns the top bound.
    int
     
    boolean
    hasText(String expected)
    Tests full text equality, ignoring case.
    boolean
    isChildOf(int packedParentId)
    Tests the packed parent relationship.
    boolean
    Reports whether the widget is hidden.
    boolean
    Returns captured visibility.
    boolean
    Tests whether captured text contains a fragment, ignoring case.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Widget

      public Widget(int id, int parentId, int type, String text, boolean visible, int x, int y, int width, int height)
      Creates a complete immutable widget snapshot.
      Parameters:
      id - non-negative packed widget identifier
      parentId - packed parent identifier, or -1 for no parent
      type - native widget type
      text - captured text, possibly blank
      visible - native visibility flag
      x - native-surface left coordinate
      y - native-surface top coordinate
      width - non-negative width
      height - non-negative height
  • Method Details

    • getId

      public int getId()
      Returns the packed widget identifier.
      Specified by:
      getId in interface Identifiable
      Returns:
      groupId << 16 | childId
    • getParentId

      public int getParentId()
      Returns the parent identifier.
      Returns:
      packed parent identifier, or -1 when absent
    • getGroupId

      public int getGroupId()
      Unpacks the widget group.
      Returns:
      unsigned high 16 bits of the packed identifier
    • getChildId

      public int getChildId()
      Unpacks the child identifier.
      Returns:
      low 16 bits of the packed identifier
    • getType

      public int getType()
      Returns the native widget type.
      Returns:
      native widget type
    • getText

      public String getText()
      Returns captured widget text.
      Returns:
      captured widget text, possibly blank
    • isVisible

      public boolean isVisible()
      Returns captured visibility.
      Returns:
      native visibility flag
    • getX

      public int getX()
      Returns the left bound.
      Returns:
      native-surface left coordinate
    • getY

      public int getY()
      Returns the top bound.
      Returns:
      native-surface top coordinate
    • getWidth

      public int getWidth()
      Returns the widget width.
      Returns:
      non-negative widget width
    • getHeight

      public int getHeight()
      Returns the widget height.
      Returns:
      non-negative widget height
    • getCenterX

      public int getCenterX()
      Returns the horizontal center.
      Returns:
      integer X coordinate of the bounds center
    • getCenterY

      public int getCenterY()
      Returns the vertical center.
      Returns:
      integer Y coordinate of the bounds center
    • getArea

      public int getArea()
      Computes rectangular area.
      Returns:
      rectangular area as width * height
    • isHidden

      public boolean isHidden()
      Reports whether the widget is hidden.
      Returns:
      inverse of isVisible()
    • hasText

      public boolean hasText(String expected)
      Tests full text equality, ignoring case.
      Parameters:
      expected - expected full text
      Returns:
      true when non-null text matches
    • textContains

      public boolean textContains(String value)
      Tests whether captured text contains a fragment, ignoring case.
      Parameters:
      value - text fragment
      Returns:
      true when a non-null fragment is present
    • isChildOf

      public boolean isChildOf(int packedParentId)
      Tests the packed parent relationship.
      Parameters:
      packedParentId - expected packed parent identifier
      Returns:
      true when the captured parent equals the supplied value
    • contains

      public boolean contains(int pointX, int pointY)
      Tests a point against visible half-open widget bounds.
      Parameters:
      pointX - native-surface X coordinate
      pointY - native-surface Y coordinate
      Returns:
      true when visible and inside [x, x+width) x [y, y+height)
    • equals

      public boolean equals(Object value)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object