public interface ControlPropertyListenerHandle extends ListenerHandle
This is a handle
on a ControlPropertyListener
, which can be used to attach()
and detach()
it. The ControlPropertyListener
is no type on its own so it is described here.
A control property listener listens to the changes in a Control's
propertyMap
. It is created to listen for a specific key and
hands all new values for that key to a value processor (a Consumer
)..
Even though the property map's value type is Object
, the processor might limit the value's type to any other
class. If the actual value can not be cast to that type, it is silently ignored.
Regardless of whether a value could be cast and processed or not, it will be removed from the map. So if the same value is set repeatedly, the specified value processor is called every time.
Listener handles are not thread-safe. See ListenerHandle
for details. Additionally, a new value might be
processed twice if inserted into a map by another thread while attach()
is executed. This behavior should
not be relied upon and might change (i.e. be fixed) in the future.
A listener handle is best created with the ControlPropertyListenerBuilder
.
Modifier and Type | Method and Description |
---|---|
void |
attach()
Attaches/adds the listener to the properties map.
|
void |
detach()
Detaches/removes the listener from the properties map.
|
void attach()
attach
in interface ListenerAttachHandle
void detach()
detach
in interface ListenerDetachHandle
This documentation is licensed under CC-BY 4.0, attributed to Nicolai Parlog from CodeFX.