Class PolylineElement
java.lang.Object
com.vaadin.flow.dom.Node<com.vaadin.flow.dom.Element>
com.vaadin.flow.dom.Element
org.vaadin.firitin.element.svg.SvgElement
org.vaadin.firitin.element.svg.SvgGraphicsElement
org.vaadin.firitin.element.svg.PolylineElement
- All Implemented Interfaces:
Serializable
A typed Java API for the SVG
<polyline> element.
The <polyline> element defines a shape consisting of a set of
connected straight line segments. Unlike a polygon, the last point is
NOT automatically connected to the first point.
For a closed shape (where the last point connects to the first), use a polygon element instead.
Write-Only vs Read-Write Methods
This class provides two variants for attribute setters:
- Default methods (e.g.,
points(),pathLength()) - Use an optimized write-only approach. Attribute values are NOT stored on the server and cannot be retrieved viagetAttribute(). - RW methods (e.g.,
pointsRW(),pathLengthRW()) - 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 TypeMethodDescriptionaddPoint(double x, double y) Adds a point to the polyline.addPoints(double... coords) Adds multiple points to the polyline.Clears all points from the polyline.pathLength(double pathLength) Sets the total length for the polyline in user units.pathLengthRW(double pathLength) Sets the total length for the polyline in user units (read-write).points(double... coords) Sets the points from an array of coordinate pairs.Sets the points directly as a string.Sets the points directly as a string (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
-
PolylineElement
public PolylineElement()
-
-
Method Details
-
points
Sets the points directly as a string.This replaces any points added using the fluent methods.
Uses write-only optimization. Use
pointsRW(String)if you need to read the value back.- Parameters:
points- the points string (e.g., "0,40 40,40 40,80 80,80 80,120")- Returns:
- this element for method chaining
-
pointsRW
Sets the points directly as a string (read-write).This replaces any points added using the fluent methods.
- Parameters:
points- the points string (e.g., "0,40 40,40 40,80 80,80 80,120")- Returns:
- this element for method chaining
-
points
Sets the points from an array of coordinate pairs.Each pair of values represents an x,y coordinate.
- Parameters:
coords- the coordinates as x1,y1,x2,y2,... sequence- Returns:
- this element for method chaining
-
addPoint
Adds a point to the polyline.- Parameters:
x- the x coordinatey- the y coordinate- Returns:
- this element for method chaining
-
addPoints
Adds multiple points to the polyline.- Parameters:
coords- the coordinates as x1,y1,x2,y2,... sequence- Returns:
- this element for method chaining
-
clearPoints
Clears all points from the polyline.- Returns:
- this element for method chaining
-
pathLength
Sets the total length for the polyline in user units.Uses write-only optimization. Use
pathLengthRW(double)if you need to read the value back.- Parameters:
pathLength- the total path length- Returns:
- this element for method chaining
-
pathLengthRW
Sets the total length for the polyline in user units (read-write).- Parameters:
pathLength- the total path length- Returns:
- this element for method chaining
-