Class TSpanElement
- All Implemented Interfaces:
Serializable
<tspan> element.
The <tspan> element defines a subtext within a <text> element
or another <tspan> element. It allows for adjustment of the style
and/or position of that subtext as needed.
Write-Only vs Read-Write Methods
This class provides two variants for each attribute setter:
- Default methods (e.g.,
x(),y()) - Use an optimized write-only approach. Attribute values are NOT stored on the server and cannot be retrieved viagetAttribute(). - RW methods (e.g.,
xRW(),yRW()) - Use traditionalsetAttribute()which stores values on the server for later retrieval.
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class SvgGraphicsElement
SvgGraphicsElement.LineCap, SvgGraphicsElement.LineJoinNested classes/interfaces inherited from class SvgElement
SvgElement.PreserveAspectRatio -
Constructor Summary
ConstructorsConstructorDescriptionTSpanElement(String text) Creates a tspan element with the given text content. -
Method Summary
Modifier and TypeMethodDescriptionbaselineShift(String shift) Sets the baseline shift with a custom value.Sets the baseline shift (for subscript/superscript).baselineShiftRW(String shift) Sets the baseline shift with a custom value (read-write).Sets the baseline shift (for subscript/superscript) (read-write).dx(double dx) Sets the horizontal shift from the previous text position.Sets the horizontal shift with a unit.dxRW(double dx) Sets the horizontal shift from the previous text position (read-write).Sets the horizontal shift with a unit (read-write).dy(double dy) Sets the vertical shift from the previous text position.Sets the vertical shift with a unit.dyRW(double dy) Sets the vertical shift from the previous text position (read-write).Sets the vertical shift with a unit (read-write).fontFamily(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).fontStyle(TextElement.FontStyle style) Sets the font style.fontStyleRW(TextElement.FontStyle style) Sets the font style (read-write).fontWeight(TextElement.FontWeight weight) Sets the font weight.fontWeightRW(TextElement.FontWeight weight) Sets the font weight (read-write).Sets the rotation for each character.Sets the rotation for each character (read-write).Sets the text content.textDecoration(TextElement.TextDecoration decoration) Sets the text decoration.textDecorationRW(TextElement.TextDecoration decoration) Sets the text decoration (read-write).textLength(double length) Sets the total length of the text in this tspan.textLengthRW(double length) Sets the total length of the text in this tspan (read-write).x(double x) Sets the absolute x coordinate for this tspan.Sets the absolute x coordinate with a unit.xRW(double x) Sets the absolute x coordinate for this tspan (read-write).Sets the absolute x coordinate with a unit (read-write).y(double y) Sets the absolute y coordinate for this tspan.Sets the absolute y coordinate with a unit.yRW(double y) Sets the absolute y coordinate for this tspan (read-write).Sets the absolute y coordinate with a unit (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
-
TSpanElement
public TSpanElement() -
TSpanElement
Creates a tspan element with the given text content.- Parameters:
text- the text content
-
-
Method Details
-
text
Sets the text content.- Parameters:
text- the text content- Returns:
- this element for method chaining
-
x
Sets the absolute x coordinate for this tspan.Uses write-only optimization. Use
xRW(double)if you need to read the value back.- Parameters:
x- the x coordinate- Returns:
- this element for method chaining
-
x
Sets the absolute x coordinate with a unit.Uses write-only optimization. Use
xRW(String)if you need to read the value back.- Parameters:
x- the x coordinate (e.g., "50%")- Returns:
- this element for method chaining
-
xRW
Sets the absolute x coordinate for this tspan (read-write).- Parameters:
x- the x coordinate- Returns:
- this element for method chaining
-
xRW
Sets the absolute x coordinate with a unit (read-write).- Parameters:
x- the x coordinate (e.g., "50%")- Returns:
- this element for method chaining
-
y
Sets the absolute y coordinate for this tspan.Uses write-only optimization. Use
yRW(double)if you need to read the value back.- Parameters:
y- the y coordinate- Returns:
- this element for method chaining
-
y
Sets the absolute y coordinate with a unit.Uses write-only optimization. Use
yRW(String)if you need to read the value back.- Parameters:
y- the y coordinate (e.g., "50%")- Returns:
- this element for method chaining
-
yRW
Sets the absolute y coordinate for this tspan (read-write).- Parameters:
y- the y coordinate- Returns:
- this element for method chaining
-
yRW
Sets the absolute y coordinate with a unit (read-write).- Parameters:
y- the y coordinate (e.g., "50%")- Returns:
- this element for method chaining
-
dx
Sets the horizontal shift from the previous text position.Uses write-only optimization. Use
dxRW(double)if you need to read the value back.- Parameters:
dx- the horizontal offset- Returns:
- this element for method chaining
-
dx
Sets the horizontal shift with a unit.Uses write-only optimization. Use
dxRW(String)if you need to read the value back.- Parameters:
dx- the horizontal offset (e.g., "1em")- Returns:
- this element for method chaining
-
dxRW
Sets the horizontal shift from the previous text position (read-write).- Parameters:
dx- the horizontal offset- Returns:
- this element for method chaining
-
dxRW
Sets the horizontal shift with a unit (read-write).- Parameters:
dx- the horizontal offset (e.g., "1em")- Returns:
- this element for method chaining
-
dy
Sets the vertical shift from the previous text position.Uses write-only optimization. Use
dyRW(double)if you need to read the value back.- Parameters:
dy- the vertical offset- Returns:
- this element for method chaining
-
dy
Sets the vertical shift with a unit.Uses write-only optimization. Use
dyRW(String)if you need to read the value back.- Parameters:
dy- the vertical offset (e.g., "1em")- Returns:
- this element for method chaining
-
dyRW
Sets the vertical shift from the previous text position (read-write).- Parameters:
dy- the vertical offset- Returns:
- this element for method chaining
-
dyRW
Sets the vertical shift with a unit (read-write).- Parameters:
dy- the vertical offset (e.g., "1em")- Returns:
- this element for method chaining
-
rotate
Sets the rotation for each character.Uses write-only optimization. Use
rotateRW(String)if you need to read the value back.- Parameters:
rotate- the rotation angle(s) in degrees- Returns:
- this element for method chaining
-
rotateRW
Sets the rotation for each character (read-write).- Parameters:
rotate- the rotation angle(s) in degrees- Returns:
- this element for method chaining
-
textLength
Sets the total length of the text in this tspan.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 in this tspan (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
-
fontStyle
Sets the font style.Uses write-only optimization. Use
fontStyleRW(TextElement.FontStyle)if you need to read the value back.- Parameters:
style- the font style- Returns:
- this element for method chaining
-
fontStyleRW
Sets the font style (read-write).- Parameters:
style- the font style- Returns:
- this element for method chaining
-
textDecoration
Sets the text decoration.Uses write-only optimization. Use
textDecorationRW(TextElement.TextDecoration)if you need to read the value back.- Parameters:
decoration- the text decoration- Returns:
- this element for method chaining
-
textDecorationRW
Sets the text decoration (read-write).- Parameters:
decoration- the text decoration- Returns:
- this element for method chaining
-
baselineShift
Sets the baseline shift (for subscript/superscript).Uses write-only optimization. Use
baselineShiftRW(BaselineShift)if you need to read the value back.- Parameters:
shift- the baseline shift- Returns:
- this element for method chaining
-
baselineShiftRW
Sets the baseline shift (for subscript/superscript) (read-write).- Parameters:
shift- the baseline shift- Returns:
- this element for method chaining
-
baselineShift
Sets the baseline shift with a custom value.Uses write-only optimization. Use
baselineShiftRW(String)if you need to read the value back.- Parameters:
shift- the baseline shift (e.g., "30%", "-5px")- Returns:
- this element for method chaining
-
baselineShiftRW
Sets the baseline shift with a custom value (read-write).- Parameters:
shift- the baseline shift (e.g., "30%", "-5px")- Returns:
- this element for method chaining
-