Package com.vaadin.browserless.internal
Class ComponentUtils
java.lang.Object
com.vaadin.browserless.internal.ComponentUtils
Utilities for working with
Components.
For internal use only. May be renamed or removed in a future release.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetCaption(com.vaadin.flow.component.Component component) Determines the caption of given component: the first non-null caption provided by a registeredComponentSupport(for example the text of aButton), otherwisegetLabel(Component).static StringgetLabel(com.vaadin.flow.component.Component component) Determines thelabelof given component:HasLabel.getLabel()for components that have one, otherwise the first non-null label provided by a registeredComponentSupport(for example the text in thelabelslot of aFormItem), otherwise thelabelproperty of the element.static StringgetPlaceholder(com.vaadin.flow.component.Component component) A component placeholder, usually shown when there's no value selected.static voidsimulateClosedEvent(com.vaadin.flow.component.Component component) Sets up an event listener for overlay components that fires aclosedDOM event when the component is closed.
-
Method Details
-
getPlaceholder
A component placeholder, usually shown when there's no value selected. Not all components support a placeholder; those that don't will return null.- Parameters:
component- the component, not null.- Returns:
- the placeholder, or null.
-
getLabel
Determines thelabelof given component:HasLabel.getLabel()for components that have one, otherwise the first non-null label provided by a registeredComponentSupport(for example the text in thelabelslot of aFormItem), otherwise thelabelproperty of the element. Returns an empty string when there is no label.getCaption(Component)is displayed directly on the component while label is displayed next to the component in a layout (e.g. aTextFieldnested in a form layout).Vote for issue #3241.
- Parameters:
component- the component, not null.- Returns:
- the label, never null.
- See Also:
-
getCaption
Determines the caption of given component: the first non-null caption provided by a registeredComponentSupport(for example the text of aButton), otherwisegetLabel(Component).Caption is generally displayed directly on the component (e.g. the Button text), while label is displayed next to the component in a layout (e.g. a
TextFieldnested in a form layout).- Parameters:
component- the component, not null.- Returns:
- the caption.
- See Also:
-
simulateClosedEvent
public static void simulateClosedEvent(com.vaadin.flow.component.Component component) Sets up an event listener for overlay components that fires aclosedDOM event when the component is closed. This simulates the event being fired from the browser after the closing animation has finished.- Parameters:
component- the component, not null.
-