Class StopElement

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.StopElement
All Implemented Interfaces:
Serializable

public class StopElement extends SvgElement
A typed Java API for the SVG <stop> element.

The <stop> element defines a color and its position in a gradient. It is used inside <linearGradient> or <radialGradient> elements.

Write-Only vs Read-Write Methods

This class provides two variants for each attribute setter:

  • Default methods (e.g., offset(), stopColor()) - Use an optimized write-only approach. Attribute values are NOT stored on the server and cannot be retrieved via getAttribute().
  • RW methods (e.g., offsetRW(), stopColorRW()) - Use traditional setAttribute() 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
    Constructor
    Description
     
    StopElement(double offset, in.virit.color.Color color)
    Creates a stop element with offset and color.
    StopElement(double offset, String color)
    Creates a stop element with offset and color string.
  • Method Summary

    Modifier and Type
    Method
    Description
    offset(double offset)
    Sets the offset where this gradient stop is placed.
    offset(String offset)
    Sets the offset where this gradient stop is placed.
    offsetRW(double offset)
    Sets the offset where this gradient stop is placed (read-write).
    offsetRW(String offset)
    Sets the offset where this gradient stop is placed (read-write).
    stopColor(in.virit.color.Color color)
    Sets the color at this gradient stop.
    Sets the color at this gradient stop.
    stopColorRW(in.virit.color.Color color)
    Sets the color at this gradient stop (read-write).
    Sets the color at this gradient stop (read-write).
    stopOpacity(double opacity)
    Sets the opacity at this gradient stop.
    stopOpacityRW(double opacity)
    Sets the opacity at this gradient stop (read-write).

    Methods 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, toString

    Methods 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

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • StopElement

      public StopElement()
    • StopElement

      public StopElement(double offset, in.virit.color.Color color)
      Creates a stop element with offset and color.
      Parameters:
      offset - the offset (0.0 to 1.0 or percentage string like "50%")
      color - the stop color
    • StopElement

      public StopElement(double offset, String color)
      Creates a stop element with offset and color string.
      Parameters:
      offset - the offset (0.0 to 1.0)
      color - the stop color as string
  • Method Details

    • offset

      public StopElement offset(double offset)
      Sets the offset where this gradient stop is placed.

      Uses write-only optimization. Use offsetRW(double) if you need to read the value back.

      Parameters:
      offset - the offset from 0.0 (start) to 1.0 (end)
      Returns:
      this element for method chaining
    • offset

      public StopElement offset(String offset)
      Sets the offset where this gradient stop is placed.

      Uses write-only optimization. Use offsetRW(String) if you need to read the value back.

      Parameters:
      offset - the offset as percentage string (e.g., "50%")
      Returns:
      this element for method chaining
    • offsetRW

      public StopElement offsetRW(double offset)
      Sets the offset where this gradient stop is placed (read-write).
      Parameters:
      offset - the offset from 0.0 (start) to 1.0 (end)
      Returns:
      this element for method chaining
    • offsetRW

      public StopElement offsetRW(String offset)
      Sets the offset where this gradient stop is placed (read-write).
      Parameters:
      offset - the offset as percentage string (e.g., "50%")
      Returns:
      this element for method chaining
    • stopColor

      public StopElement stopColor(in.virit.color.Color color)
      Sets the color at this gradient stop.

      Uses write-only optimization. Use stopColorRW(Color) if you need to read the value back.

      Parameters:
      color - the stop color
      Returns:
      this element for method chaining
    • stopColor

      public StopElement stopColor(String color)
      Sets the color at this gradient stop.

      Uses write-only optimization. Use stopColorRW(String) if you need to read the value back.

      Parameters:
      color - the stop color (e.g., "red", "#ff0000", "rgb(255,0,0)")
      Returns:
      this element for method chaining
    • stopColorRW

      public StopElement stopColorRW(in.virit.color.Color color)
      Sets the color at this gradient stop (read-write).
      Parameters:
      color - the stop color
      Returns:
      this element for method chaining
    • stopColorRW

      public StopElement stopColorRW(String color)
      Sets the color at this gradient stop (read-write).
      Parameters:
      color - the stop color (e.g., "red", "#ff0000", "rgb(255,0,0)")
      Returns:
      this element for method chaining
    • stopOpacity

      public StopElement stopOpacity(double opacity)
      Sets the opacity at this gradient stop.

      Uses write-only optimization. Use stopOpacityRW(double) if you need to read the value back.

      Parameters:
      opacity - the opacity from 0.0 (transparent) to 1.0 (opaque)
      Returns:
      this element for method chaining
    • stopOpacityRW

      public StopElement stopOpacityRW(double opacity)
      Sets the opacity at this gradient stop (read-write).
      Parameters:
      opacity - the opacity from 0.0 (transparent) to 1.0 (opaque)
      Returns:
      this element for method chaining