-
Notifications
You must be signed in to change notification settings - Fork 23
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
Is adding a ChangeEventSource or similar possible? #27
Comments
Or maybe in public static Observable<ChangeEvent> fromChangeEventsOf(final JSlider slider) {
return ChangeEventSource.fromChangeEventsOf(slider);
}
public static Observable<ChangeEvent> fromChangeEventsOf(final JSpinner spinner) {
return fromChangeEventsOf((JSlider)(Object) spinner);
} (Though that seems like a terrible idea.) |
Too bad that these components don't implement a common interface. Or that Java doesn't support structural typing... |
Neat! We can close this issue and continue discussion on those PRs. |
@mikebaum, I think we can close this issue. Best regards! Peti |
@whymarrh @Petikoch Closing this issue since we merged, #31. I like the concept of generalizing the From Events Source logic though. Perhaps we can raise a separate PR or use the changes made by @samuelgruetter in #28 as a starting point. |
Reading through the source, it would look like adding a
ChangeEventSource
(or something similar) would be possible—it would behave a lot like some of the existing sources. The catch is though that unrelated components have change event listeners.The components that have change listeners:
JSpinner
AbstractButton
JSlider
None of the classes above really share anything that would allow saying: "create events from this x". They're all
JComponent
s, but aJComponent
itself doesn't have change events.So something like the following wouldn't work:
I was thinking that it might be possible to extract the idea of a listener that emits events to a subscriber, passing to it the subscriber in question, and use that to share something amongst these components, but that would still look something like this:
Do you have any ideas on what the best way to introduce a source for
ChangeEvent
s would be?Related:
ChangeEvent
ChangeListener
The text was updated successfully, but these errors were encountered: