Class TextPathElement
- All Implemented Interfaces:
Serializable
<textPath> element.
The <textPath> element renders text along the shape of a path.
The text is enclosed within a <text> element and references a
<path> element using the href attribute.
Write-Only vs Read-Write Methods
This class provides two variants for each attribute setter:
- Default methods (e.g.,
startOffset(),method()) - Use an optimized write-only approach. Attribute values are NOT stored on the server and cannot be retrieved viagetAttribute(). - RW methods (e.g.,
startOffsetRW(),methodRW()) - Use traditionalsetAttribute()which stores values on the server for later retrieval.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumText path method options.static enumText path side options.static enumText path spacing options.Nested classes/interfaces inherited from class SvgGraphicsElement
SvgGraphicsElement.LineCap, SvgGraphicsElement.LineJoinNested classes/interfaces inherited from class SvgElement
SvgElement.PreserveAspectRatio -
Constructor Summary
ConstructorsConstructorDescriptionTextPathElement(PathElement path) Creates a textPath element referencing the given path.TextPathElement(PathElement path, String text) Creates a textPath element with path reference and text. -
Method Summary
Modifier and TypeMethodDescriptionfontFamily(String fontFamily) Sets the font family.fontFamilyRW(String fontFamily) Sets the font family (read-write).fontSize(double size) Sets the font size.Sets the font size with a unit.fontSizeRW(double size) Sets the font size (read-write).fontSizeRW(String size) Sets the font size with a unit (read-write).fontWeight(TextElement.FontWeight weight) Sets the font weight.fontWeightRW(TextElement.FontWeight weight) Sets the font weight (read-write).Sets the href to reference a path element by ID.Sets the href to reference a path element by ID (read-write).method(TextPathElement.Method method) Sets the method used to render individual glyphs along the path.methodRW(TextPathElement.Method method) Sets the method used to render individual glyphs along the path (read-write).path(PathElement path) Sets the path element for the text to follow.side(TextPathElement.Side side) Sets which side of the path the text is rendered on.sideRW(TextPathElement.Side side) Sets which side of the path the text is rendered on (read-write).spacing(TextPathElement.Spacing spacing) Sets the spacing between glyphs.spacingRW(TextPathElement.Spacing spacing) Sets the spacing between glyphs (read-write).startOffset(double offset) Sets the offset along the path where text rendering starts.startOffset(String offset) Sets the offset along the path with a unit.startOffsetRW(double offset) Sets the offset along the path where text rendering starts (read-write).startOffsetRW(String offset) Sets the offset along the path with a unit (read-write).Sets the text content.textLength(double length) Sets the total length of the text.textLengthRW(double length) Sets the total length of the text (read-write).Methods inherited from class SvgGraphicsElement
clearTransform, clipPath, clipPathRW, fill, fill, fill, fill, fill, fillOpacity, fillOpacityRW, fillRW, fillRW, fillRW, fillRW, fillRW, mask, maskRW, matrix, matrixRW, noFill, noFillRW, noStroke, noStrokeRW, opacity, opacityRW, rotate, rotate, rotateRW, rotateRW, scale, scale, scaleRW, scaleRW, skewX, skewXRW, skewY, skewYRW, stroke, stroke, stroke, stroke, stroke, strokeDasharray, strokeDasharray, strokeDasharrayRW, strokeDasharrayRW, strokeDashoffset, strokeDashoffsetRW, strokeLinecap, strokeLinecapRW, strokeLinejoin, strokeLinejoinRW, strokeMiterlimit, strokeMiterlimitRW, strokeOpacity, strokeOpacityRW, strokeRW, strokeRW, strokeRW, strokeRW, strokeRW, strokeWidth, strokeWidth, strokeWidthRW, strokeWidthRW, transform, transformRW, translate, translateRW, translateX, translateXRW, translateY, translateYRWMethods 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
-
TextPathElement
public TextPathElement() -
TextPathElement
Creates a textPath element referencing the given path. An ID is automatically generated for the path if not already set.- Parameters:
path- the path element to follow
-
TextPathElement
Creates a textPath element with path reference and text. An ID is automatically generated for the path if not already set.- Parameters:
path- the path element to followtext- the text content
-
-
Method Details
-
text
Sets the text content.- Parameters:
text- the text content- Returns:
- this element for method chaining
-
path
Sets the path element for the text to follow. An ID is automatically generated for the path if not already set.Note: This method uses read-write approach to ensure ID is properly set.
- Parameters:
path- the path element- Returns:
- this element for method chaining
-
href
Sets the href to reference a path element by ID.Uses write-only optimization. Use
hrefRW(String)if you need to read the value back.- Parameters:
href- the reference URL (e.g., "#myPath")- Returns:
- this element for method chaining
-
hrefRW
Sets the href to reference a path element by ID (read-write).- Parameters:
href- the reference URL (e.g., "#myPath")- Returns:
- this element for method chaining
-
startOffset
Sets the offset along the path where text rendering starts.Uses write-only optimization. Use
startOffsetRW(double)if you need to read the value back.- Parameters:
offset- the start offset- Returns:
- this element for method chaining
-
startOffset
Sets the offset along the path with a unit.Uses write-only optimization. Use
startOffsetRW(String)if you need to read the value back.- Parameters:
offset- the start offset (e.g., "50%", "100px")- Returns:
- this element for method chaining
-
startOffsetRW
Sets the offset along the path where text rendering starts (read-write).- Parameters:
offset- the start offset- Returns:
- this element for method chaining
-
startOffsetRW
Sets the offset along the path with a unit (read-write).- Parameters:
offset- the start offset (e.g., "50%", "100px")- Returns:
- this element for method chaining
-
method
Sets the method used to render individual glyphs along the path.Uses write-only optimization. Use
methodRW(Method)if you need to read the value back.- Parameters:
method- the rendering method- Returns:
- this element for method chaining
-
methodRW
Sets the method used to render individual glyphs along the path (read-write).- Parameters:
method- the rendering method- Returns:
- this element for method chaining
-
spacing
Sets the spacing between glyphs.Uses write-only optimization. Use
spacingRW(Spacing)if you need to read the value back.- Parameters:
spacing- the spacing mode- Returns:
- this element for method chaining
-
spacingRW
Sets the spacing between glyphs (read-write).- Parameters:
spacing- the spacing mode- Returns:
- this element for method chaining
-
side
Sets which side of the path the text is rendered on.Uses write-only optimization. Use
sideRW(Side)if you need to read the value back.- Parameters:
side- the side- Returns:
- this element for method chaining
-
sideRW
Sets which side of the path the text is rendered on (read-write).- Parameters:
side- the side- Returns:
- this element for method chaining
-
textLength
Sets the total length of the text.Uses write-only optimization. Use
textLengthRW(double)if you need to read the value back.- Parameters:
length- the text length- Returns:
- this element for method chaining
-
textLengthRW
Sets the total length of the text (read-write).- Parameters:
length- the text length- Returns:
- this element for method chaining
-
fontFamily
Sets the font family.Uses write-only optimization. Use
fontFamilyRW(String)if you need to read the value back.- Parameters:
fontFamily- the font family- Returns:
- this element for method chaining
-
fontFamilyRW
Sets the font family (read-write).- Parameters:
fontFamily- the font family- Returns:
- this element for method chaining
-
fontSize
Sets the font size.Uses write-only optimization. Use
fontSizeRW(double)if you need to read the value back.- Parameters:
size- the font size- Returns:
- this element for method chaining
-
fontSize
Sets the font size with a unit.Uses write-only optimization. Use
fontSizeRW(String)if you need to read the value back.- Parameters:
size- the font size (e.g., "12px", "1em")- Returns:
- this element for method chaining
-
fontSizeRW
Sets the font size (read-write).- Parameters:
size- the font size- Returns:
- this element for method chaining
-
fontSizeRW
Sets the font size with a unit (read-write).- Parameters:
size- the font size (e.g., "12px", "1em")- Returns:
- this element for method chaining
-
fontWeight
Sets the font weight.Uses write-only optimization. Use
fontWeightRW(TextElement.FontWeight)if you need to read the value back.- Parameters:
weight- the font weight- Returns:
- this element for method chaining
-
fontWeightRW
Sets the font weight (read-write).- Parameters:
weight- the font weight- Returns:
- this element for method chaining
-