In Scala Swing, a
Publisher is the observable subject and a Reactor supplies an observer's reactions. A reactor calls listenTo(pounds, euros, rate) to subscribe to the relevant publishing components. It adds a partial function from events to actions with reactions += { case ... => ... }; unmatched event types need no action. When a publisher calls publish(e), subscribed reactions that handle that event are notified. Calling deafTo removes subscriptions that are no longer wanted.[ref]Scala Swing event-system documentation. README, About scala-swing: Publisher/Reactor, listenTo and reactions; archived Reactor API: deafTo
The publisher does not need to know the concrete frame or its currency-conversion code. A
TextField supplies the relevant editing events, and the frame's reaction distinguishes the source field using EditDone(source). Both registration and a matching reaction are needed: installing a case handler without subscribing does not establish the notification path. The observer logic should update the conversion model once and then refresh the other fields from that coherent state. Articles by others on the same topic
There are currently no matching articles.