Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add javadoc for ComponentEvent.getSource #19850

Open
javier-godoy opened this issue Aug 29, 2024 · 0 comments
Open

Add javadoc for ComponentEvent.getSource #19850

javier-godoy opened this issue Aug 29, 2024 · 0 comments

Comments

@javier-godoy
Copy link
Contributor

Consider this case:

    HorizontalLayout layout = new HorizontalLayout(new Checkbox());
    layout.addAttachListener(ev -> System.out.println(ev.getSource()));
    layout.setSizeFull();
    add(layout);

ComponentEvent.getSource just inherits its documentation from java.util.EventObject, which is

 @return the object on which the Event initially occurred

Which may be read as if the source is expected to be CheckBox (the click event initially occurred in a checkbox) instead of HorizontalLayout (which is the component where the listener was attached).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants