Interface ComponentSupport
- All Known Implementing Classes:
FlowComponentsSupport
The component tree walk, the pretty printer, the dialog clean-up and the
label, caption and data provider lookups ask every registered implementation
before falling back to what Flow alone can tell. The label lookup is the
exception: a component's own HasLabel label
wins, so getLabel(Component) is only asked for components that don't
implement it. An implementation is registered with
ServiceLoader, in
META-INF/services/com.vaadin.browserless.internal.ComponentSupport.
Every method has a default that handles nothing, so an implementation only
overrides what its components need.
Implementations are consulted in ServiceLoader order. For
getAllChildren(Component), getDataProvider(Component),
getLabel(Component) and getCaption(Component) the first
implementation that handles the component wins. The other methods combine the
answers of all implementations: isClosedDialog(Component) and
firesClosedEvent(Component) apply if any implementation returns
true, getDialogTypes() uses the types of all implementations
together, and describe(Component, List) lets every implementation
add its details.
This is an internal extension point and may change without notice.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidAdds component-specific details to the one-line description produced byPrettyPrintTree.toPrettyString(Component).default booleanfiresClosedEvent(Component component) Checks whether the component is an overlay whose client-side part fires aclosedDOM event once it has closed, which the mocked environment then simulates.getAllChildren(Component component) Returns all children of the component as seen by component lookups, including the ones that are not part of the regular component hierarchy, such as a Grid's header components.default StringgetCaption(Component component) Returns the caption of a component that shows it directly on itself, such as a button's text.default DataProvider<?, ?> getDataProvider(Component component) Returns the data provider currently set to the component.default Collection<Class<? extends Component>> Returns the dialog types thatLocator._expectNoDialogs()checks for.default StringReturns the label of a component that doesn't implementHasLabel.default booleanisClosedDialog(Component component) Checks whether the component is a closed dialog that a browser would have removed from the DOM after closing it.
-
Method Details
-
getAllChildren
Returns all children of the component as seen by component lookups, including the ones that are not part of the regular component hierarchy, such as a Grid's header components.- Parameters:
component- the component, not null.- Returns:
- the children, or
nullif this implementation doesn't handle the component.
-
isClosedDialog
Checks whether the component is a closed dialog that a browser would have removed from the DOM after closing it. Such components are removed from the UI after every round trip. The component is removed if any implementation returns true.- Parameters:
component- the component, not null.- Returns:
- true if the component should be removed.
-
getDialogTypes
Returns the dialog types thatLocator._expectNoDialogs()checks for. The types of all implementations are checked together.- Returns:
- the dialog types, not null.
-
firesClosedEvent
Checks whether the component is an overlay whose client-side part fires aclosedDOM event once it has closed, which the mocked environment then simulates. The event is simulated if any implementation returns true.- Parameters:
component- the component, not null.- Returns:
- true if the
closedevent should be simulated.
-
describe
Adds component-specific details to the one-line description produced byPrettyPrintTree.toPrettyString(Component). Every implementation is asked, in order.- Parameters:
component- the component, not null.description- the description parts collected so far, to add to.
-
getDataProvider
Returns the data provider currently set to the component.- Parameters:
component- the component, not null.- Returns:
- the data provider, or
nullif this implementation doesn't handle the component or none is set.
-
getLabel
Returns the label of a component that doesn't implementHasLabel.- Parameters:
component- the component, not null.- Returns:
- the label, an empty string if the component has none, or
nullif this implementation doesn't handle the component.
-
getCaption
Returns the caption of a component that shows it directly on itself, such as a button's text.- Parameters:
component- the component, not null.- Returns:
- the caption, or
nullif this implementation doesn't handle the component.
-