Record Class DrawCommand.ComponentTarget
- All Implemented Interfaces:
DrawCommand, DrawCommand.Primitive
- Enclosing interface:
DrawCommand
Carries no geometry: the producer stores (interfaceId, componentId)
and re-resolves the on-screen rect on the game thread once per tick, because
the client recomputes a component's rect on every layout pass. A stored
rectangle would drift the moment the UI relaid out, the window resized, or a
scrollpane moved.
The optional caption is the only way to tell highlights apart, and it has
to travel with the command precisely because the caller never learns
where the rect landed — with six highlights on screen there is nothing else
to distinguish them by. The producer draws it against the resolved rect.
DrawCaption.NONE for an uncaptioned highlight.
-
Nested Class Summary
Nested classes/interfaces inherited from interface DrawCommand
DrawCommand.Area, DrawCommand.ComponentTarget, DrawCommand.Ellipse, DrawCommand.Entity, DrawCommand.Highlight, DrawCommand.Line, DrawCommand.Poly, DrawCommand.Primitive, DrawCommand.Rect, DrawCommand.Text, DrawCommand.Tile -
Constructor Summary
ConstructorsConstructorDescriptionComponentTarget(String key, DrawSpace space, DrawStyle style, int interfaceId, int componentId, DrawCaption caption) Creates an instance of aComponentTargetrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringautoKey(int interfaceId, int componentId) The key a component highlight gets when the caller names none:comp:<iface>:<comp>, for examplecomp:1473:5.caption()Returns the value of thecaptionrecord component.intReturns the value of thecomponentIdrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of theinterfaceIdrecord component.key()Returns the value of thekeyrecord component.kind()The primitive this command draws.space()Returns the value of thespacerecord component.style()Returns the value of thestylerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ComponentTarget
public ComponentTarget(String key, DrawSpace space, DrawStyle style, int interfaceId, int componentId, DrawCaption caption) Creates an instance of aComponentTargetrecord class.- Parameters:
key- the value for thekeyrecord componentspace- the value for thespacerecord componentstyle- the value for thestylerecord componentinterfaceId- the value for theinterfaceIdrecord componentcomponentId- the value for thecomponentIdrecord componentcaption- the value for thecaptionrecord component
-
-
Method Details
-
autoKey
The key a component highlight gets when the caller names none:comp:<iface>:<comp>, for examplecomp:1473:5.That format is part of the producer's contract, and it exists so a caller who omitted a key still has a way to name the highlight in order to clear it. This host computes it rather than reading it back, so the key is known before the command is sent — but the producer echoes the key it actually used on every reply, and a live test asserts the two agree rather than assuming it.
-
kind
Description copied from interface:DrawCommandThe primitive this command draws.- Specified by:
kindin interfaceDrawCommand
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
key
Returns the value of thekeyrecord component.- Specified by:
keyin interfaceDrawCommand- Returns:
- the value of the
keyrecord component
-
space
Returns the value of thespacerecord component.- Specified by:
spacein interfaceDrawCommand- Returns:
- the value of the
spacerecord component
-
style
Returns the value of thestylerecord component.- Specified by:
stylein interfaceDrawCommand- Returns:
- the value of the
stylerecord component
-
interfaceId
public int interfaceId()Returns the value of theinterfaceIdrecord component.- Returns:
- the value of the
interfaceIdrecord component
-
componentId
public int componentId()Returns the value of thecomponentIdrecord component.- Returns:
- the value of the
componentIdrecord component
-
caption
Returns the value of thecaptionrecord component.- Returns:
- the value of the
captionrecord component
-