Class SymbolElement
- All Implemented Interfaces:
Serializable
<symbol> element.
The <symbol> element is used to define graphical template objects
that can be instantiated by a <use> element. Using <symbol>
elements for graphics that are used multiple times adds structure and
semantics.
Unlike <g>, a <symbol> element itself is not rendered.
Only instances of a <symbol> element (i.e., a reference to it
from a <use> element) are rendered.
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 classes/interfaces inherited from class SvgElement
SvgElement.PreserveAspectRatio -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(SvgElement... children) Adds child elements to this symbol.height(double height) Sets the height for this symbol.heightRW(double height) Sets the height for this symbol (read-write).preserveAspectRatio(String value) Sets the preserveAspectRatio attribute.Sets the preserveAspectRatio attribute.preserveAspectRatioRW(String value) Sets the preserveAspectRatio attribute (read-write).Sets the preserveAspectRatio attribute (read-write).viewBox(double minX, double minY, double width, double height) Sets the viewBox for this symbol.viewBoxRW(double minX, double minY, double width, double height) Sets the viewBox for this symbol (read-write).width(double width) Sets the width for this symbol.widthRW(double width) Sets the width for this symbol (read-write).x(double x) Sets the x coordinate for symbol positioning (when used in certain contexts).xRW(double x) Sets the x coordinate for symbol positioning (read-write).y(double y) Sets the y coordinate for symbol positioning (when used in certain contexts).yRW(double y) Sets the y coordinate for symbol positioning (read-write).Methods inherited from class SvgElement
emptySvgRoot, flushPendingAttributes, getOuterHTML, getPendingOrAttribute, getStyle, height, id, scheduleBeforeClientResponse, setAttribute, setWriteOnlyAttribute, size, size, 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
-
SymbolElement
public SymbolElement() -
SymbolElement
Creates a symbol with the given ID.- Parameters:
id- the ID for this symbol (used by use element to reference it)
-
-
Method Details
-
viewBox
Sets the viewBox for this symbol.The viewBox defines the coordinate system for the symbol's contents.
Uses write-only optimization. Use
viewBoxRW(double, double, double, double)if you need to read the value back.- Overrides:
viewBoxin classSvgElement- Parameters:
minX- the minimum x valueminY- the minimum y valuewidth- the width of the viewBoxheight- the height of the viewBox- Returns:
- this element for method chaining
-
viewBoxRW
Sets the viewBox for this symbol (read-write).The viewBox defines the coordinate system for the symbol's contents.
- Parameters:
minX- the minimum x valueminY- the minimum y valuewidth- the width of the viewBoxheight- the height of the viewBox- Returns:
- this element for method chaining
-
preserveAspectRatio
Sets the preserveAspectRatio attribute.Uses write-only optimization. Use
preserveAspectRatioRW(String)if you need to read the value back.- Overrides:
preserveAspectRatioin classSvgElement- Parameters:
value- the preserveAspectRatio value (e.g., "xMidYMid meet")- Returns:
- this element for method chaining
-
preserveAspectRatioRW
Sets the preserveAspectRatio attribute (read-write).- Parameters:
value- the preserveAspectRatio value (e.g., "xMidYMid meet")- Returns:
- this element for method chaining
-
preserveAspectRatio
Sets the preserveAspectRatio attribute.Uses write-only optimization. Use
preserveAspectRatioRW(PreserveAspectRatio)if you need to read the value back.- Overrides:
preserveAspectRatioin classSvgElement- Parameters:
ratio- the preserveAspectRatio setting- Returns:
- this element for method chaining
-
preserveAspectRatioRW
Sets the preserveAspectRatio attribute (read-write).- Parameters:
ratio- the preserveAspectRatio setting- Returns:
- this element for method chaining
-
x
Sets the x coordinate for symbol positioning (when used in certain contexts).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
-
xRW
Sets the x coordinate for symbol positioning (read-write).- Parameters:
x- the x coordinate- Returns:
- this element for method chaining
-
y
Sets the y coordinate for symbol positioning (when used in certain contexts).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
-
yRW
Sets the y coordinate for symbol positioning (read-write).- Parameters:
y- the y coordinate- Returns:
- this element for method chaining
-
width
Sets the width for this symbol.Uses write-only optimization. Use
widthRW(double)if you need to read the value back.- Overrides:
widthin classSvgElement- Parameters:
width- the width- Returns:
- this element for method chaining
-
widthRW
Sets the width for this symbol (read-write).- Parameters:
width- the width- Returns:
- this element for method chaining
-
height
Sets the height for this symbol.Uses write-only optimization. Use
heightRW(double)if you need to read the value back.- Overrides:
heightin classSvgElement- Parameters:
height- the height- Returns:
- this element for method chaining
-
heightRW
Sets the height for this symbol (read-write).- Parameters:
height- the height- Returns:
- this element for method chaining
-
add
Adds child elements to this symbol.- Parameters:
children- the elements to add- Returns:
- this element for method chaining
-