Package com.valhalla.sdk.api.widgets
Class Widget
java.lang.Object
com.valhalla.sdk.api.widgets.Widget
- All Implemented Interfaces:
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 -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(int pointX, int pointY) Tests a point against visible half-open widget bounds.booleanintgetArea()Computes rectangular area.intReturns the horizontal center.intReturns the vertical center.intUnpacks the child identifier.intUnpacks the widget group.intReturns the widget height.intgetId()Returns the packed widget identifier.intReturns the parent identifier.getText()Returns captured widget text.intgetType()Returns the native widget type.intgetWidth()Returns the widget width.intgetX()Returns the left bound.intgetY()Returns the top bound.inthashCode()booleanTests full text equality, ignoring case.booleanisChildOf(int packedParentId) Tests the packed parent relationship.booleanisHidden()Reports whether the widget is hidden.booleanReturns captured visibility.booleantextContains(String value) Tests whether captured text contains a fragment, ignoring case.toString()
-
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 identifierparentId- packed parent identifier, or-1for no parenttype- native widget typetext- captured text, possibly blankvisible- native visibility flagx- native-surface left coordinatey- native-surface top coordinatewidth- non-negative widthheight- non-negative height
-
-
Method Details
-
getId
public int getId()Returns the packed widget identifier.- Specified by:
getIdin interfaceIdentifiable- Returns:
groupId << 16 | childId
-
getParentId
public int getParentId()Returns the parent identifier.- Returns:
- packed parent identifier, or
-1when 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
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
Tests full text equality, ignoring case.- Parameters:
expected- expected full text- Returns:
truewhen non-null text matches
-
textContains
Tests whether captured text contains a fragment, ignoring case.- Parameters:
value- text fragment- Returns:
truewhen a non-null fragment is present
-
isChildOf
public boolean isChildOf(int packedParentId) Tests the packed parent relationship.- Parameters:
packedParentId- expected packed parent identifier- Returns:
truewhen 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 coordinatepointY- native-surface Y coordinate- Returns:
truewhen visible and inside[x, x+width) x [y, y+height)
-
equals
-
hashCode
public int hashCode() -
toString
-