Class RadialGradientElement
- All Implemented Interfaces:
Serializable
<radialGradient> element.
The <radialGradient> element defines a radial gradient to be used
as a fill or stroke for other SVG elements. The gradient radiates from
a focal point to the edge of a circle.
Radial gradients must be placed inside a <defs> element and
referenced by ID (e.g., fill="url(#myGradient)").
Write-Only vs Read-Write Methods
This class provides two variants for each attribute setter:
- Default methods (e.g.,
cx(),cy()) - Use an optimized write-only approach. Attribute values are NOT stored on the server and cannot be retrieved viagetAttribute(). - RW methods (e.g.,
cxRW(),cyRW()) - Use traditionalsetAttribute()which stores values on the server for later retrieval.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class SvgElement
SvgElement.PreserveAspectRatio -
Constructor Summary
ConstructorsConstructorDescriptionCreates a radial gradient with the given ID. -
Method Summary
Modifier and TypeMethodDescriptionaddStop(double offset, in.virit.color.Color color) Adds a stop at the specified offset with the given color.Adds a stop at the specified offset with the given color.addStops(StopElement... stops) Adds stop elements to this gradient.center(double cx, double cy) Sets the center of the gradient circle.centerRW(double cx, double cy) Sets the center of the gradient circle (read-write).cx(double cx) Sets the x coordinate of the gradient circle center.Sets the x coordinate of the gradient circle center with a unit.cxRW(double cx) Sets the x coordinate of the gradient circle center (read-write).Sets the x coordinate of the gradient circle center with a unit (read-write).cy(double cy) Sets the y coordinate of the gradient circle center.Sets the y coordinate of the gradient circle center with a unit.cyRW(double cy) Sets the y coordinate of the gradient circle center (read-write).Sets the y coordinate of the gradient circle center with a unit (read-write).focalPoint(double fx, double fy) Sets the focal point of the gradient.focalPointRW(double fx, double fy) Sets the focal point of the gradient (read-write).fr(double fr) Sets the radius of the focal point circle.frRW(double fr) Sets the radius of the focal point circle (read-write).fx(double fx) Sets the x coordinate of the focal point.Sets the x coordinate of the focal point with a unit.fxRW(double fx) Sets the x coordinate of the focal point (read-write).Sets the x coordinate of the focal point with a unit (read-write).fy(double fy) Sets the y coordinate of the focal point.Sets the y coordinate of the focal point with a unit.fyRW(double fy) Sets the y coordinate of the focal point (read-write).Sets the y coordinate of the focal point with a unit (read-write).gradientTransform(String transform) Sets a transform on the gradient.gradientTransformRW(String transform) Sets a transform on the gradient (read-write).Sets the coordinate system for the gradient.Sets the coordinate system for the gradient (read-write).References another gradient to inherit stops and attributes from.References another gradient to inherit stops and attributes from (read-write).r(double r) Sets the radius of the gradient circle.Sets the radius of the gradient circle with a unit.rRW(double r) Sets the radius of the gradient circle (read-write).Sets the radius of the gradient circle with a unit (read-write).Sets how the gradient behaves outside its bounds.Sets how the gradient behaves outside its bounds (read-write).Methods inherited from class SvgElement
emptySvgRoot, flushPendingAttributes, getOuterHTML, getPendingOrAttribute, getStyle, height, height, id, preserveAspectRatio, preserveAspectRatio, scheduleBeforeClientResponse, setAttribute, setWriteOnlyAttribute, size, size, viewBox, width, widthMethods inherited from class com.vaadin.flow.dom.Element
addAttachListener, addDetachListener, addEventListener, addPropertyChangeListener, addPropertyChangeListener, as, attachShadow, bindAttribute, bindProperty, bindText, callJsFunction, callJsFunction, createText, executeJs, executeJs, get, get, getAttribute, getAttributeNames, getChild, getChildCount, getChildren, getClassList, getComponent, getParent, getProperty, getProperty, getProperty, getProperty, getProperty, getPropertyBean, getPropertyBean, getPropertyNames, getPropertyRaw, getSelf, getShadowRoot, getTag, getText, getTextRecursively, getThemeList, hasAttribute, hasProperty, isEnabled, isTextNode, isVisible, removeAttribute, removeFromParent, removeFromTree, removeFromTree, removeProperty, scrollIntoView, scrollIntoView, setAttribute, setAttribute, setAttribute, setEnabled, setProperty, setProperty, setProperty, setPropertyBean, setPropertyJson, setPropertyList, setPropertyMap, setText, setVisible, toStringMethods inherited from class com.vaadin.flow.dom.Node
accept, appendChild, appendChild, appendVirtualChild, appendVirtualChild, ensureChildHasParent, equals, getNode, getParentNode, getStateProvider, hashCode, indexOfChild, insertChild, insertChild, isVirtualChild, removeAllChildren, removeChild, removeChild, removeChild, removeVirtualChild, removeVirtualChild, setChild
-
Constructor Details
-
RadialGradientElement
public RadialGradientElement() -
RadialGradientElement
Creates a radial gradient with the given ID.- Parameters:
id- the ID for referencing this gradient
-
-
Method Details
-
cx
Sets the x coordinate of the gradient circle center.Uses write-only optimization. Use
cxRW(double)if you need to read the value back.- Parameters:
cx- the x coordinate (default is 0.5 or 50%)- Returns:
- this element for method chaining
-
cx
Sets the x coordinate of the gradient circle center with a unit.Uses write-only optimization. Use
cxRW(String)if you need to read the value back.- Parameters:
cx- the x coordinate (e.g., "50%")- Returns:
- this element for method chaining
-
cxRW
Sets the x coordinate of the gradient circle center (read-write).- Parameters:
cx- the x coordinate (default is 0.5 or 50%)- Returns:
- this element for method chaining
-
cxRW
Sets the x coordinate of the gradient circle center with a unit (read-write).- Parameters:
cx- the x coordinate (e.g., "50%")- Returns:
- this element for method chaining
-
cy
Sets the y coordinate of the gradient circle center.Uses write-only optimization. Use
cyRW(double)if you need to read the value back.- Parameters:
cy- the y coordinate (default is 0.5 or 50%)- Returns:
- this element for method chaining
-
cy
Sets the y coordinate of the gradient circle center with a unit.Uses write-only optimization. Use
cyRW(String)if you need to read the value back.- Parameters:
cy- the y coordinate (e.g., "50%")- Returns:
- this element for method chaining
-
cyRW
Sets the y coordinate of the gradient circle center (read-write).- Parameters:
cy- the y coordinate (default is 0.5 or 50%)- Returns:
- this element for method chaining
-
cyRW
Sets the y coordinate of the gradient circle center with a unit (read-write).- Parameters:
cy- the y coordinate (e.g., "50%")- Returns:
- this element for method chaining
-
r
Sets the radius of the gradient circle.Uses write-only optimization. Use
rRW(double)if you need to read the value back.- Parameters:
r- the radius (default is 0.5 or 50%)- Returns:
- this element for method chaining
-
r
Sets the radius of the gradient circle with a unit.Uses write-only optimization. Use
rRW(String)if you need to read the value back.- Parameters:
r- the radius (e.g., "50%")- Returns:
- this element for method chaining
-
rRW
Sets the radius of the gradient circle (read-write).- Parameters:
r- the radius (default is 0.5 or 50%)- Returns:
- this element for method chaining
-
rRW
Sets the radius of the gradient circle with a unit (read-write).- Parameters:
r- the radius (e.g., "50%")- Returns:
- this element for method chaining
-
fx
Sets the x coordinate of the focal point.The focal point is where the gradient starts (0% stop). If not specified, defaults to the center (cx).
Uses write-only optimization. Use
fxRW(double)if you need to read the value back.- Parameters:
fx- the x coordinate- Returns:
- this element for method chaining
-
fx
Sets the x coordinate of the focal point with a unit.Uses write-only optimization. Use
fxRW(String)if you need to read the value back.- Parameters:
fx- the x coordinate (e.g., "25%")- Returns:
- this element for method chaining
-
fxRW
Sets the x coordinate of the focal point (read-write).- Parameters:
fx- the x coordinate- Returns:
- this element for method chaining
-
fxRW
Sets the x coordinate of the focal point with a unit (read-write).- Parameters:
fx- the x coordinate (e.g., "25%")- Returns:
- this element for method chaining
-
fy
Sets the y coordinate of the focal point.Uses write-only optimization. Use
fyRW(double)if you need to read the value back.- Parameters:
fy- the y coordinate- Returns:
- this element for method chaining
-
fy
Sets the y coordinate of the focal point with a unit.Uses write-only optimization. Use
fyRW(String)if you need to read the value back.- Parameters:
fy- the y coordinate (e.g., "25%")- Returns:
- this element for method chaining
-
fyRW
Sets the y coordinate of the focal point (read-write).- Parameters:
fy- the y coordinate- Returns:
- this element for method chaining
-
fyRW
Sets the y coordinate of the focal point with a unit (read-write).- Parameters:
fy- the y coordinate (e.g., "25%")- Returns:
- this element for method chaining
-
fr
Sets the radius of the focal point circle.This creates a focal ring instead of a focal point.
Uses write-only optimization. Use
frRW(double)if you need to read the value back.- Parameters:
fr- the focal radius (default is 0)- Returns:
- this element for method chaining
-
frRW
Sets the radius of the focal point circle (read-write).- Parameters:
fr- the focal radius (default is 0)- Returns:
- this element for method chaining
-
center
Sets the center of the gradient circle.Uses write-only optimization. Use
centerRW(double, double)if you need to read the values back.- Parameters:
cx- the x coordinatecy- the y coordinate- Returns:
- this element for method chaining
-
centerRW
Sets the center of the gradient circle (read-write).- Parameters:
cx- the x coordinatecy- the y coordinate- Returns:
- this element for method chaining
-
focalPoint
Sets the focal point of the gradient.Uses write-only optimization. Use
focalPointRW(double, double)if you need to read the values back.- Parameters:
fx- the x coordinatefy- the y coordinate- Returns:
- this element for method chaining
-
focalPointRW
Sets the focal point of the gradient (read-write).- Parameters:
fx- the x coordinatefy- the y coordinate- Returns:
- this element for method chaining
-
gradientUnits
Sets the coordinate system for the gradient.Uses write-only optimization. Use
gradientUnitsRW(LinearGradientElement.GradientUnits)if you need to read the value back.- Parameters:
units- the gradient units- Returns:
- this element for method chaining
-
gradientUnitsRW
Sets the coordinate system for the gradient (read-write).- Parameters:
units- the gradient units- Returns:
- this element for method chaining
-
spreadMethod
Sets how the gradient behaves outside its bounds.Uses write-only optimization. Use
spreadMethodRW(LinearGradientElement.SpreadMethod)if you need to read the value back.- Parameters:
method- the spread method- Returns:
- this element for method chaining
-
spreadMethodRW
Sets how the gradient behaves outside its bounds (read-write).- Parameters:
method- the spread method- Returns:
- this element for method chaining
-
gradientTransform
Sets a transform on the gradient.Uses write-only optimization. Use
gradientTransformRW(String)if you need to read the value back.- Parameters:
transform- the transform string- Returns:
- this element for method chaining
-
gradientTransformRW
Sets a transform on the gradient (read-write).- Parameters:
transform- the transform string- Returns:
- this element for method chaining
-
href
References another gradient to inherit stops and attributes from.Uses write-only optimization. Use
hrefRW(String)if you need to read the value back.- Parameters:
href- the reference (e.g., "#otherGradient")- Returns:
- this element for method chaining
-
hrefRW
References another gradient to inherit stops and attributes from (read-write).- Parameters:
href- the reference (e.g., "#otherGradient")- Returns:
- this element for method chaining
-
addStops
Adds stop elements to this gradient.- Parameters:
stops- the stop elements- Returns:
- this element for method chaining
-
addStop
Adds a stop at the specified offset with the given color.- Parameters:
offset- the offset (0.0 to 1.0)color- the color- Returns:
- this element for method chaining
-
addStop
Adds a stop at the specified offset with the given color.- Parameters:
offset- the offset (0.0 to 1.0)color- the color string- Returns:
- this element for method chaining
-