Class RectElement
- All Implemented Interfaces:
Serializable
<rect> element.
The <rect> element is a basic SVG shape that draws rectangles,
defined by their position, width, and height. The rectangles may have
their corners rounded.
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 SvgGraphicsElement
SvgGraphicsElement.LineCap, SvgGraphicsElement.LineJoinNested classes/interfaces inherited from class SvgElement
SvgElement.PreserveAspectRatio -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbounds(double x, double y, double width, double height) Convenience method to set bounds (x, y, width, height) at once.boundsRW(double x, double y, double width, double height) Convenience method to set bounds (x, y, width, height) at once (read-write).cornerRadius(double radius) Convenience method to set equal corner radius for both axes.cornerRadius(double rx, double ry) Convenience method to set different corner radii for horizontal and vertical axes.cornerRadiusRW(double radius) Convenience method to set equal corner radius for both axes (read-write).cornerRadiusRW(double rx, double ry) Convenience method to set different corner radii for horizontal and vertical axes (read-write).height(double height) Sets the height of the rectangle.Sets the height of the rectangle with a unit or percentage.heightRW(double height) Sets the height of the rectangle (read-write).Sets the height of the rectangle with a unit or percentage (read-write).pathLength(double pathLength) Sets the total length of the rectangle's perimeter in user units.pathLengthRW(double pathLength) Sets the total length of the rectangle's perimeter in user units (read-write).position(double x, double y) Convenience method to set position (x, y) at once.positionRW(double x, double y) Convenience method to set position (x, y) at once (read-write).rx(double rx) Sets the horizontal corner radius of the rectangle.Sets the horizontal corner radius of the rectangle with a unit or percentage.rxRW(double rx) Sets the horizontal corner radius of the rectangle (read-write).Sets the horizontal corner radius of the rectangle with a unit or percentage (read-write).ry(double ry) Sets the vertical corner radius of the rectangle.Sets the vertical corner radius of the rectangle with a unit or percentage.ryRW(double ry) Sets the vertical corner radius of the rectangle (read-write).Sets the vertical corner radius of the rectangle with a unit or percentage (read-write).size(double width, double height) Convenience method to set size (width, height) at once.sizeRW(double width, double height) Convenience method to set size (width, height) at once (read-write).width(double width) Sets the width of the rectangle.Sets the width of the rectangle with a unit or percentage.widthRW(double width) Sets the width of the rectangle (read-write).Sets the width of the rectangle with a unit or percentage (read-write).x(double x) Sets the x coordinate of the rectangle.Sets the x coordinate of the rectangle with a unit or percentage.xRW(double x) Sets the x coordinate of the rectangle (read-write).Sets the x coordinate of the rectangle with a unit or percentage (read-write).y(double y) Sets the y coordinate of the rectangle.Sets the y coordinate of the rectangle with a unit or percentage.yRW(double y) Sets the y coordinate of the rectangle (read-write).Sets the y coordinate of the rectangle with a unit or percentage (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, id, preserveAspectRatio, preserveAspectRatio, scheduleBeforeClientResponse, setAttribute, setWriteOnlyAttribute, size, viewBoxMethods 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
-
RectElement
public RectElement()
-
-
Method Details
-
x
Sets the x coordinate of the rectangle.Uses write-only optimization. Use
xRW(double)if you need to read the value back.- Parameters:
x- the x coordinate in user units- Returns:
- this element for method chaining
-
x
Sets the x coordinate of the rectangle with a unit or percentage.Uses write-only optimization. Use
xRW(String)if you need to read the value back.- Parameters:
x- the x coordinate (e.g., "10", "50%", "10px")- Returns:
- this element for method chaining
-
xRW
Sets the x coordinate of the rectangle (read-write).- Parameters:
x- the x coordinate in user units- Returns:
- this element for method chaining
-
xRW
Sets the x coordinate of the rectangle with a unit or percentage (read-write).- Parameters:
x- the x coordinate (e.g., "10", "50%", "10px")- Returns:
- this element for method chaining
-
y
Sets the y coordinate of the rectangle.Uses write-only optimization. Use
yRW(double)if you need to read the value back.- Parameters:
y- the y coordinate in user units- Returns:
- this element for method chaining
-
y
Sets the y coordinate of the rectangle with a unit or percentage.Uses write-only optimization. Use
yRW(String)if you need to read the value back.- Parameters:
y- the y coordinate (e.g., "10", "50%", "10px")- Returns:
- this element for method chaining
-
yRW
Sets the y coordinate of the rectangle (read-write).- Parameters:
y- the y coordinate in user units- Returns:
- this element for method chaining
-
yRW
Sets the y coordinate of the rectangle with a unit or percentage (read-write).- Parameters:
y- the y coordinate (e.g., "10", "50%", "10px")- Returns:
- this element for method chaining
-
width
Sets the width of the rectangle.Uses write-only optimization. Use
widthRW(double)if you need to read the value back.- Overrides:
widthin classSvgElement- Parameters:
width- the width in user units- Returns:
- this element for method chaining
-
width
Sets the width of the rectangle with a unit or percentage.Uses write-only optimization. Use
widthRW(String)if you need to read the value back.- Overrides:
widthin classSvgElement- Parameters:
width- the width (e.g., "100", "50%", "100px")- Returns:
- this element for method chaining
-
widthRW
Sets the width of the rectangle (read-write).- Parameters:
width- the width in user units- Returns:
- this element for method chaining
-
widthRW
Sets the width of the rectangle with a unit or percentage (read-write).- Parameters:
width- the width (e.g., "100", "50%", "100px")- Returns:
- this element for method chaining
-
height
Sets the height of the rectangle.Uses write-only optimization. Use
heightRW(double)if you need to read the value back.- Overrides:
heightin classSvgElement- Parameters:
height- the height in user units- Returns:
- this element for method chaining
-
height
Sets the height of the rectangle with a unit or percentage.Uses write-only optimization. Use
heightRW(String)if you need to read the value back.- Overrides:
heightin classSvgElement- Parameters:
height- the height (e.g., "100", "50%", "100px")- Returns:
- this element for method chaining
-
heightRW
Sets the height of the rectangle (read-write).- Parameters:
height- the height in user units- Returns:
- this element for method chaining
-
heightRW
Sets the height of the rectangle with a unit or percentage (read-write).- Parameters:
height- the height (e.g., "100", "50%", "100px")- Returns:
- this element for method chaining
-
rx
Sets the horizontal corner radius of the rectangle.If
ryis not specified, it defaults to the value ofrx.Uses write-only optimization. Use
rxRW(double)if you need to read the value back.- Parameters:
rx- the horizontal corner radius in user units- Returns:
- this element for method chaining
-
rx
Sets the horizontal corner radius of the rectangle with a unit or percentage.If
ryis not specified, it defaults to the value ofrx.Uses write-only optimization. Use
rxRW(String)if you need to read the value back.- Parameters:
rx- the horizontal corner radius (e.g., "10", "50%", "10px")- Returns:
- this element for method chaining
-
rxRW
Sets the horizontal corner radius of the rectangle (read-write).- Parameters:
rx- the horizontal corner radius in user units- Returns:
- this element for method chaining
-
rxRW
Sets the horizontal corner radius of the rectangle with a unit or percentage (read-write).- Parameters:
rx- the horizontal corner radius (e.g., "10", "50%", "10px")- Returns:
- this element for method chaining
-
ry
Sets the vertical corner radius of the rectangle.If
rxis not specified, it defaults to the value ofry.Uses write-only optimization. Use
ryRW(double)if you need to read the value back.- Parameters:
ry- the vertical corner radius in user units- Returns:
- this element for method chaining
-
ry
Sets the vertical corner radius of the rectangle with a unit or percentage.If
rxis not specified, it defaults to the value ofry.Uses write-only optimization. Use
ryRW(String)if you need to read the value back.- Parameters:
ry- the vertical corner radius (e.g., "10", "50%", "10px")- Returns:
- this element for method chaining
-
ryRW
Sets the vertical corner radius of the rectangle (read-write).- Parameters:
ry- the vertical corner radius in user units- Returns:
- this element for method chaining
-
ryRW
Sets the vertical corner radius of the rectangle with a unit or percentage (read-write).- Parameters:
ry- the vertical corner radius (e.g., "10", "50%", "10px")- Returns:
- this element for method chaining
-
pathLength
Sets the total length of the rectangle's perimeter in user units.This value is used to calibrate the browser's distance calculations with those of the author, by scaling all distance computations using the ratio pathLength / (computed value of perimeter).
Uses write-only optimization. Use
pathLengthRW(double)if you need to read the value back.- Parameters:
pathLength- the total path length in user units- Returns:
- this element for method chaining
-
pathLengthRW
Sets the total length of the rectangle's perimeter in user units (read-write).- Parameters:
pathLength- the total path length in user units- Returns:
- this element for method chaining
-
position
Convenience method to set position (x, y) at once.Uses write-only optimization. Use
positionRW(double, double)if you need to read the values back.- Parameters:
x- the x coordinate in user unitsy- the y coordinate in user units- Returns:
- this element for method chaining
-
positionRW
Convenience method to set position (x, y) at once (read-write).- Parameters:
x- the x coordinate in user unitsy- the y coordinate in user units- Returns:
- this element for method chaining
-
size
Convenience method to set size (width, height) at once.Uses write-only optimization. Use
sizeRW(double, double)if you need to read the values back.- Overrides:
sizein classSvgElement- Parameters:
width- the width in user unitsheight- the height in user units- Returns:
- this element for method chaining
-
sizeRW
Convenience method to set size (width, height) at once (read-write).- Parameters:
width- the width in user unitsheight- the height in user units- Returns:
- this element for method chaining
-
bounds
Convenience method to set bounds (x, y, width, height) at once.Uses write-only optimization. Use
boundsRW(double, double, double, double)if you need to read the values back.- Parameters:
x- the x coordinate in user unitsy- the y coordinate in user unitswidth- the width in user unitsheight- the height in user units- Returns:
- this element for method chaining
-
boundsRW
Convenience method to set bounds (x, y, width, height) at once (read-write).- Parameters:
x- the x coordinate in user unitsy- the y coordinate in user unitswidth- the width in user unitsheight- the height in user units- Returns:
- this element for method chaining
-
cornerRadius
Convenience method to set equal corner radius for both axes.Uses write-only optimization. Use
cornerRadiusRW(double)if you need to read the values back.- Parameters:
radius- the corner radius in user units- Returns:
- this element for method chaining
-
cornerRadiusRW
Convenience method to set equal corner radius for both axes (read-write).- Parameters:
radius- the corner radius in user units- Returns:
- this element for method chaining
-
cornerRadius
Convenience method to set different corner radii for horizontal and vertical axes.Uses write-only optimization. Use
cornerRadiusRW(double, double)if you need to read the values back.- Parameters:
rx- the horizontal corner radius in user unitsry- the vertical corner radius in user units- Returns:
- this element for method chaining
-
cornerRadiusRW
Convenience method to set different corner radii for horizontal and vertical axes (read-write).- Parameters:
rx- the horizontal corner radius in user unitsry- the vertical corner radius in user units- Returns:
- this element for method chaining
-