Package com.storedobject.chart
Class Offset
java.lang.Object
com.storedobject.chart.Offset
- All Implemented Interfaces:
ComponentProperty
Represents an "offset" configuration for a component, allowing the specification of
x and y offset values. This class implements
ComponentProperty
and provides functionality to encode the
offset values into a JSON-compatible format for client-side usage.- Author:
- Syam
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Encode the JSON string with the properties of this.void
encodeJSON
(String name, StringBuilder sb) Encodes the offset values into a JSON-compatible format and appends the resulting string to the providedStringBuilder
.void
Sets the x and y offset values for this object based on the givenSize
parameters.
-
Constructor Details
-
Offset
public Offset()
-
-
Method Details
-
encodeJSON
Description copied from interface:ComponentProperty
Encode the JSON string with the properties of this.- Specified by:
encodeJSON
in interfaceComponentProperty
- Parameters:
sb
- Encoded JSON string to be appended to this.
-
encodeJSON
Encodes the offset values into a JSON-compatible format and appends the resulting string to the providedStringBuilder
. The JSON representation includes the specified name as a key and the x and y offset values as an array. Negative values for x and y are rendered as percentages, while non-negative values are represented as integers.- Parameters:
name
- The name to use as the key in the JSON representation.sb
- TheStringBuilder
to which the JSON representation will be appended.
-
set
Sets the x and y offset values for this object based on the givenSize
parameters. Only values of typeSize.pixels(int)
andSize.percentage(int)
are accepted.
-