Module technology.sola.engine
Record Class Position
java.lang.Object
java.lang.Record
technology.sola.engine.graphics.gui.style.property.Position
- Record Components:
x- the x position of the elementy- the y position of the element
- All Implemented Interfaces:
MergeableProperty<Position>
@NullMarked
public record Position(@Nullable StyleValue x, @Nullable StyleValue y)
extends Record
implements MergeableProperty<Position>
Position contains the properties for absolutely positioning a
GuiElement
within its container. If x and y are both null then the element is not considered absolutely positioned.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPosition()Creates a new Position instance with x and y not set.Creates a new Position instance with x and y set.Position(@Nullable StyleValue x, @Nullable StyleValue y) Creates an instance of aPositionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanChecks if this Position is absolute or not.Returns a new instance of the property with the resulting values being a merge of the right on top of the left.final StringtoString()Returns a string representation of this record class.@Nullable StyleValuex()Returns the value of thexrecord component.@Nullable StyleValuey()Returns the value of theyrecord component.
-
Field Details
-
NONE
Position with x and y not set. Element will be relatively positioned in the flow.
-
-
Constructor Details
-
Position
public Position()Creates a new Position instance with x and y not set. Element will be relatively positioned in the flow. -
Position
Creates a new Position instance with x and y set.- Parameters:
x- the x position of the elementy- the y position of the element
-
Position
Creates an instance of aPositionrecord class.
-
-
Method Details
-
isAbsolute
public boolean isAbsolute()Checks if this Position is absolute or not. Position is considered absolute if x or y is not null.- Returns:
- true if absolute
-
mergeWith
Description copied from interface:MergeablePropertyReturns a new instance of the property with the resulting values being a merge of the right on top of the left.- Specified by:
mergeWithin interfaceMergeableProperty<Position>- Parameters:
otherProperty- the other property object to merge values on top of this one- Returns:
- a new instance with the merged properties
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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. All components in this record class are compared withObjects::equals(Object,Object). -
x
Returns the value of thexrecord component.- Returns:
- the value of the
xrecord component
-
y
Returns the value of theyrecord component.- Returns:
- the value of the
yrecord component
-