Class VaadinUtils
java.lang.Object
com.vaadin.swingbridge.surrogates.util.VaadinUtils
Broad, generic Vaadin UI/DOM utilities used across the surrogate layer;
shared with
:emulators in the SD_shelper_statics-allowed direction where needed.-
Method Summary
Modifier and TypeMethodDescriptionstatic voidinjectStyleOnce(com.vaadin.flow.component.UI ui, String sentinelKey, String dataEmulValue, String css) Inject a server-managed<style>element into the given UI's element tree exactly once, guarded by a per-UI sentinel.
-
Method Details
-
injectStyleOnce
public static void injectStyleOnce(com.vaadin.flow.component.UI ui, String sentinelKey, String dataEmulValue, String css) Inject a server-managed<style>element into the given UI's element tree exactly once, guarded by a per-UI sentinel. Generic mechanism behind pseudo-element CSS that inlineStylecan't reach (e.g.BorderCss's TitledBorder::beforerule,SJProgressBar's progress-string::afterrule).The
<style>lives in the UI element tree rather than going throughPage.executeJs(String, Object...)/addStyleSheet: only a tree-attached Element survives a@PreserveOnRefreshreload, because Vaadin re-renders the preserved tree (it doesn't replay executeJs or re-emit already-sent dependencies). ThesentinelKeyguards against double-attach on a single UI and survives reload for the same reason.- Parameters:
ui- the target UI; no-op whennullsentinelKey- per-UIComponentUtildata key marking "already injected"dataEmulValue- value for thedata-emulattribute on the<style>(identifies the rule in DevTools)css- the stylesheet text
-