Class VStyle

java.lang.Object
org.vaadin.firitin.util.VStyle
All Implemented Interfaces:
com.vaadin.flow.dom.Style, Serializable

public class VStyle extends Object implements com.vaadin.flow.dom.Style
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from interface com.vaadin.flow.dom.Style

    com.vaadin.flow.dom.Style.AlignItems, com.vaadin.flow.dom.Style.AlignSelf, com.vaadin.flow.dom.Style.BoxSizing, com.vaadin.flow.dom.Style.Clear, com.vaadin.flow.dom.Style.Display, com.vaadin.flow.dom.Style.FlexBasis, com.vaadin.flow.dom.Style.FlexDirection, com.vaadin.flow.dom.Style.FlexWrap, com.vaadin.flow.dom.Style.FloatCss, com.vaadin.flow.dom.Style.FontWeight, com.vaadin.flow.dom.Style.JustifyContent, com.vaadin.flow.dom.Style.Overflow, com.vaadin.flow.dom.Style.Position, com.vaadin.flow.dom.Style.TextAlign, com.vaadin.flow.dom.Style.Visibility, com.vaadin.flow.dom.Style.WhiteSpace
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    VStyle(com.vaadin.flow.dom.Style wrapped)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    apply(com.vaadin.flow.component.Component component)
    Applies the styles defined in this VStyle to the given component.
    void
    apply(com.vaadin.flow.component.Component component, String cssSelector)
    Applies the styles defined in this VStyle to an element specified by the context component and css selector.
    void
    applyToShadowRoot(com.vaadin.flow.component.Component component, String cssSelector)
    Applies the styles defined in this VStyle to an element specified by the context component and css selector, but specifically to the shadow root of the component.
     
    get(String name)
     
    in.virit.color.Color
     
    in.virit.color.Color
     
     
    boolean
    has(String name)
     
    void
    injectWithSelectors(String... cssSelectors)
    Injects the styles defined in this object to the host page as CSS, for the given CSS selector.
    remove(String name)
     
    set(String name, String value)
     
    setBackgroundColor(in.virit.color.Color color)
     
    void
    Sets the CSS border-radius property in pixels.
    void
    Sets the CSS border-width property in pixels.
    void
    Sets the CSS bottom property in pixels.
    setColor(in.virit.color.Color color)
     
    void
    Sets the CSS column-gap property in pixels.
    void
    Sets the CSS font-size property in pixels.
    void
    setGapPx(Number pixels)
    Sets the CSS gap property in pixels.
    void
    Sets the CSS height property in pixels.
    void
    setLeftPx(Number pixels)
    Sets the CSS left property in pixels.
    void
    Sets the CSS line-height property in pixels.
    void
    Sets the CSS margin-bottom property in pixels.
    void
    Sets the CSS margin-left property in pixels.
    void
    Sets the CSS margin property in pixels (all sides).
    void
    Sets the CSS margin-right property in pixels.
    void
    Sets the CSS margin-top property in pixels.
    void
    Sets the CSS max-height property in pixels.
    void
    Sets the CSS max-width property in pixels.
    void
    Sets the CSS min-height property in pixels.
    void
    Sets the CSS min-width property in pixels.
    void
    Sets the CSS padding-bottom property in pixels.
    void
    Sets the CSS padding-left property in pixels.
    void
    Sets the CSS padding property in pixels (all sides).
    void
    Sets the CSS padding-right property in pixels.
    void
    Sets the CSS padding-top property in pixels.
    void
    Sets the CSS right property in pixels.
    void
    Sets the CSS row-gap property in pixels.
    void
    setTopPx(Number pixels)
    Sets the CSS top property in pixels.
    void
    Sets the CSS width property in pixels.
    toCss(String... cssSelectors)
     
    static VStyle
    wrap(com.vaadin.flow.dom.Style original)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.vaadin.flow.dom.Style

    bind, getColorScheme, setAlignItems, setAlignSelf, setBackground, setBackgroundColor, setBackgroundPosition, setBackgroundSize, setBorder, setBorderBottom, setBorderLeft, setBorderRadius, setBorderRight, setBorderTop, setBottom, setBoxShadow, setBoxSizing, setClear, setColor, setColorScheme, setCursor, setDisplay, setFilter, setFlexBasis, setFlexBasis, setFlexDirection, setFlexGrow, setFlexShrink, setFlexWrap, setFloat, setFont, setFontSize, setFontWeight, setFontWeight, setFontWeight, setGap, setHeight, setJustifyContent, setLeft, setLineHeight, setMargin, setMarginBottom, setMarginInlineEnd, setMarginInlineStart, setMarginLeft, setMarginRight, setMarginTop, setMaxHeight, setMaxWidth, setMinHeight, setMinWidth, setOpacity, setOutline, setOverflow, setPadding, setPaddingBottom, setPaddingLeft, setPaddingRight, setPaddingTop, setPosition, setRight, setRotate, setScale, setTextAlign, setTextDecoration, setTop, setTransform, setTransformOrigin, setTransition, setVisibility, setWhiteSpace, setWidth, setZIndex
  • Constructor Details

    • VStyle

      public VStyle(com.vaadin.flow.dom.Style wrapped)
    • VStyle

      public VStyle()
  • Method Details

    • wrap

      public static VStyle wrap(com.vaadin.flow.dom.Style original)
    • getColor

      public in.virit.color.Color getColor()
    • setColor

      public VStyle setColor(in.virit.color.Color color)
    • getBackgroundColor

      public in.virit.color.Color getBackgroundColor()
    • setBackgroundColor

      public VStyle setBackgroundColor(in.virit.color.Color color)
    • get

      public String get(String name)
      Specified by:
      get in interface com.vaadin.flow.dom.Style
    • set

      public VStyle set(String name, String value)
      Specified by:
      set in interface com.vaadin.flow.dom.Style
    • remove

      public VStyle remove(String name)
      Specified by:
      remove in interface com.vaadin.flow.dom.Style
    • clear

      public VStyle clear()
      Specified by:
      clear in interface com.vaadin.flow.dom.Style
    • has

      public boolean has(String name)
      Specified by:
      has in interface com.vaadin.flow.dom.Style
    • getNames

      public Stream<String> getNames()
      Specified by:
      getNames in interface com.vaadin.flow.dom.Style
    • apply

      public void apply(com.vaadin.flow.component.Component component)
      Applies the styles defined in this VStyle to the given component.
      Parameters:
      component - the component to which the styles will be applied
    • apply

      public void apply(com.vaadin.flow.component.Component component, String cssSelector)
      Applies the styles defined in this VStyle to an element specified by the context component and css selector.

      Note that the styles are applied to the element after it has been rendered using JS. If you happen to use "preserve on refresh" feature of Vaadin, you might need to call this method again after the refresh, as the styles are not preserved automatically.

      Parameters:
      component - the component to which the styles will be applied
      cssSelector - the CSS selector to target the specific element within the component
    • injectWithSelectors

      public void injectWithSelectors(String... cssSelectors)
      Injects the styles defined in this object to the host page as CSS, for the given CSS selector.
      Parameters:
      cssSelectors - the CSS selector to target the specific element within the host page
    • toCss

      public String toCss(String... cssSelectors)
    • applyToShadowRoot

      public void applyToShadowRoot(com.vaadin.flow.component.Component component, String cssSelector)
      Applies the styles defined in this VStyle to an element specified by the context component and css selector, but specifically to the shadow root of the component.

      Note that the styles are applied to the element after it has been rendered using JS. If you happen to use "preserve on refresh" feature of Vaadin, you might need to call this method again after the refresh, as the styles are not preserved automatically.

      Parameters:
      component - the component to which the styles will be applie
      cssSelector - the CSS selector to target the specific element within the component's shadow root
    • setLeftPx

      public void setLeftPx(Number pixels)
      Sets the CSS left property in pixels.
      Parameters:
      pixels - the value in pixels, or null to clear the property
    • setTopPx

      public void setTopPx(Number pixels)
      Sets the CSS top property in pixels.
      Parameters:
      pixels - the value in pixels, or null to clear the property
    • setRightPx

      public void setRightPx(Number pixels)
      Sets the CSS right property in pixels.
      Parameters:
      pixels - the value in pixels, or null to clear the property
    • setBottomPx

      public void setBottomPx(Number pixels)
      Sets the CSS bottom property in pixels.
      Parameters:
      pixels - the value in pixels, or null to clear the property
    • setWidthPx

      public void setWidthPx(Number pixels)
      Sets the CSS width property in pixels.
      Parameters:
      pixels - the value in pixels, or null to clear the property
    • setHeightPx

      public void setHeightPx(Number pixels)
      Sets the CSS height property in pixels.
      Parameters:
      pixels - the value in pixels, or null to clear the property
    • setMinWidthPx

      public void setMinWidthPx(Number pixels)
      Sets the CSS min-width property in pixels.
      Parameters:
      pixels - the value in pixels, or null to clear the property
    • setMaxWidthPx

      public void setMaxWidthPx(Number pixels)
      Sets the CSS max-width property in pixels.
      Parameters:
      pixels - the value in pixels, or null to clear the property
    • setMinHeightPx

      public void setMinHeightPx(Number pixels)
      Sets the CSS min-height property in pixels.
      Parameters:
      pixels - the value in pixels, or null to clear the property
    • setMaxHeightPx

      public void setMaxHeightPx(Number pixels)
      Sets the CSS max-height property in pixels.
      Parameters:
      pixels - the value in pixels, or null to clear the property
    • setMarginPx

      public void setMarginPx(Number pixels)
      Sets the CSS margin property in pixels (all sides).
      Parameters:
      pixels - the value in pixels, or null to clear the property
    • setMarginTopPx

      public void setMarginTopPx(Number pixels)
      Sets the CSS margin-top property in pixels.
      Parameters:
      pixels - the value in pixels, or null to clear the property
    • setMarginRightPx

      public void setMarginRightPx(Number pixels)
      Sets the CSS margin-right property in pixels.
      Parameters:
      pixels - the value in pixels, or null to clear the property
    • setMarginBottomPx

      public void setMarginBottomPx(Number pixels)
      Sets the CSS margin-bottom property in pixels.
      Parameters:
      pixels - the value in pixels, or null to clear the property
    • setMarginLeftPx

      public void setMarginLeftPx(Number pixels)
      Sets the CSS margin-left property in pixels.
      Parameters:
      pixels - the value in pixels, or null to clear the property
    • setPaddingPx

      public void setPaddingPx(Number pixels)
      Sets the CSS padding property in pixels (all sides).
      Parameters:
      pixels - the value in pixels, or null to clear the property
    • setPaddingTopPx

      public void setPaddingTopPx(Number pixels)
      Sets the CSS padding-top property in pixels.
      Parameters:
      pixels - the value in pixels, or null to clear the property
    • setPaddingRightPx

      public void setPaddingRightPx(Number pixels)
      Sets the CSS padding-right property in pixels.
      Parameters:
      pixels - the value in pixels, or null to clear the property
    • setPaddingBottomPx

      public void setPaddingBottomPx(Number pixels)
      Sets the CSS padding-bottom property in pixels.
      Parameters:
      pixels - the value in pixels, or null to clear the property
    • setPaddingLeftPx

      public void setPaddingLeftPx(Number pixels)
      Sets the CSS padding-left property in pixels.
      Parameters:
      pixels - the value in pixels, or null to clear the property
    • setGapPx

      public void setGapPx(Number pixels)
      Sets the CSS gap property in pixels.

      This property is used with flexbox and grid layouts to set the spacing between items.

      Parameters:
      pixels - the value in pixels, or null to clear the property
    • setRowGapPx

      public void setRowGapPx(Number pixels)
      Sets the CSS row-gap property in pixels.

      This property is used with flexbox and grid layouts to set the spacing between rows.

      Parameters:
      pixels - the value in pixels, or null to clear the property
    • setColumnGapPx

      public void setColumnGapPx(Number pixels)
      Sets the CSS column-gap property in pixels.

      This property is used with flexbox and grid layouts to set the spacing between columns.

      Parameters:
      pixels - the value in pixels, or null to clear the property
    • setBorderWidthPx

      public void setBorderWidthPx(Number pixels)
      Sets the CSS border-width property in pixels.
      Parameters:
      pixels - the value in pixels, or null to clear the property
    • setBorderRadiusPx

      public void setBorderRadiusPx(Number pixels)
      Sets the CSS border-radius property in pixels.
      Parameters:
      pixels - the value in pixels, or null to clear the property
    • setFontSizePx

      public void setFontSizePx(Number pixels)
      Sets the CSS font-size property in pixels.
      Parameters:
      pixels - the value in pixels, or null to clear the property
    • setLineHeightPx

      public void setLineHeightPx(Number pixels)
      Sets the CSS line-height property in pixels.
      Parameters:
      pixels - the value in pixels, or null to clear the property