CallbackRegistration

class CallbackRegistration<in T : Component, C : Any, L : Any>(adapter: (callback: DeclaredCallback<C>) -> L, registration: ListenerRegistration<T, L>)

A registration together with the adapter that builds the listener riding it: what a modifier taking a callback of type C, rather than a listener of type L, registers.

Declare one per builder and hold it in a val, as for a ListenerRegistration. The callback is not part of it: a fresh callback on every pass costs one field write.

In adapter, call the callback through DeclaredCallback.report where Swing raises the event inside a write - a property change, a child insertion, a model write - so a throw from it is reported and the listener returns normally. Keep adapter checks and vetoes outside the report block. A listener that only a gesture or a posted event reaches may call DeclaredCallback.current directly, and Swing's event pump handles its throw; so does a veto, whose throw must reach Swing.

Parameters

registration

where the built listener is registered.

Constructors

Link copied to clipboard
constructor(adapter: (callback: DeclaredCallback<C>) -> L, registration: ListenerRegistration<T, L>)

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int