Class BorderCss

java.lang.Object
com.vaadin.swingbridge.surrogates.util.BorderCss

public final class BorderCss extends Object
Border ↔ CSS conversion for the surrogate JComponentMixin.setBorder / getBorder path: applyBorderCss(Element, Border) writes a JDK Border as inline CSS, borderFromCss(Element) reconstructs the closest Border back (lossy per SD_border_css_lossy). Includes the TitledBorder pseudo-element rendering, whose one-off ::before rule is injected per UI via the generic VaadinUtils.injectStyleOnce(UI, String, String, String) primitive.

Color conversion delegates to CssConvert. Shared with :emulators in the SD_shelper_statics-allowed direction — the emulator vaadinx.swing.border.TitledBorder calls ensureTitledBorderStyleInjected(UI) directly.

  • Method Details

    • clearBorderCss

      public static void clearBorderCss(com.vaadin.flow.dom.Element element)
      Remove every border-related CSS key we might have written, plus the data-emul-border-title attribute that applyBorderCss(Element, Border) writes for TitledBorder. Used before each write, and on setBorder(null).
    • ensureTitledBorderStyleInjected

      public static void ensureTitledBorderStyleInjected(com.vaadin.flow.component.UI ui)
      Ensure the [data-emul-border-title]::before rule is installed on the current page (and stays installed across @PreserveOnRefresh reloads). Thin wrapper over VaadinUtils.injectStyleOnce(UI, String, String, String); no-op when no UI is current.
    • applyBorderCss

      public static void applyBorderCss(com.vaadin.flow.dom.Element element, Border border)
      Write the CSS representation of border onto element. Dispatches by runtime type across the JDK border hierarchy:

      clearBorderCss(Element) runs first so the previous border's keys can't linger.

      border = null clears without writing — same semantics as Swing's setBorder(null).

    • borderFromCss

      public static Border borderFromCss(com.vaadin.flow.dom.Element element)
      Reconstruct the closest JDK Border from the CSS currently written on element. Reverse of applyBorderCss(Element, Border) — lossy per SD_border_css_lossy: custom Borders, TitledBorder, CompoundBorder with a non-EmptyBorder inner, and icon-backed MatteBorder can't round-trip.

      Dispatch: