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 TypeMethodDescriptionvoidEncode the JSON string with the properties of this.voidencodeJSON(String name, StringBuilder sb) Encodes the offset values into a JSON-compatible format and appends the resulting string to the providedStringBuilder.voidSets the x and y offset values for this object based on the givenSizeparameters.
-
Constructor Details
-
Offset
public Offset()
-
-
Method Details
-
encodeJSON
Description copied from interface:ComponentPropertyEncode the JSON string with the properties of this.- Specified by:
encodeJSONin 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- TheStringBuilderto which the JSON representation will be appended.
-
set
Sets the x and y offset values for this object based on the givenSizeparameters. Only values of typeSize.pixels(int)andSize.percentage(int)are accepted.
-