StopEventPropagationWrapper
Stop event propagation of child component
StopEventPropagationWrapper is a custom component to stop the event propagation of its child component. It is mainly beneficial when the child component is a disabled button like explained in the sample code.
Sample code
Button activeButton = new Button("ActiveButton"); StopEventPropagationWrapper activeButtonWrapper = new StopEventPropagationWrapper(activeButton); activeButton.addClickListener(event -> { Notification.show("Active Button Clicked"); // Do whatever you want to do on click of the button. }); Button inactiveButton = new Button("InactiveButton"); inactiveButton.setEnabled(false); StopEventPropagationWrapper inactiveButtonWrapper = new StopEventPropagationWrapper(inactiveButton); Span name = new Span("Sophia Williams"); Span email = new Span("sophia.williams@company.com"); Span phone = new Span("(501) 555-9128"); VerticalLayout content = new VerticalLayout(name, email, phone); content.setSpacing(false); content.setPadding(false); NativeLabel summaryLabel = new NativeLabel("Contact information"); HorizontalLayout summary = new HorizontalLayout(summaryLabel, activeButtonWrapper, inactiveButtonWrapper); summary.addClassName("detailsSummary"); Details details = new Details(summary); details.setContent(content); add(details);
Links
Compatibility
Was this helpful? Need more help?
Leave a comment or a question below. You can also join
the chat on Discord or
ask questions on StackOverflow.
Version
- Released
- 2023-07-27
- Maturity
- EXPERIMENTAL
- License
- Apache License 2.0
Compatibility
- Framework
- Vaadin 23
- Vaadin 24
- Browser
- N/A
StopEventPropagationWrapper - Vaadin Add-on Directory
Stop event propagation of child componentStopEventPropagationWrapper is a custom component to stop the event propagation of its child component.
It is mainly beneficial when the child component is a disabled button like explained in the sample code.
View on GitHub