- 
    Enhancement 
- 
    Resolution: Fixed
- 
     P4 P4
- 
    None
                    .. just the same as done for changeListeners:
/**
* Subclasses can invoke this method to register that they want to listen to
* invalidation events for the given property. Registered {@link Consumer} instances
* will be executed in the order in which they are registered.
* @param property the property
* @param consumer the consumer
*/
protected final void registerInvalidationListener(ObservableValue<?> property, Consumer<ObservableValue<?>> consumer) {
 
/**
* Unregisters all invalidation listeners that have been registered using {@link #registerInvalidationListener(ObservableValue, Consumer)}
* for the given property. The end result is that the given property is no longer observed by any of the invalidation
* listeners, but it may still have additional listeners registered on it through means outside of
* {@link #registerInvalidationListener(ObservableValue, Consumer)}.
*
* @param property The property for which all listeners should be removed.
* @return A single chained {@link Consumer} consisting of all {@link Consumer consumers} registered through
* {@link #registerInvalidationListener(ObservableValue, Consumer)}. If no consumers have been registered on this
* property, null will be returned.
* @since 9
*/
protected final Consumer<ObservableValue<?>> unregisterInvalidationListeners(ObservableValue<?> property) {
Internally, this boils down to adding api to LambdaMultiplePropertyChangeListenerHandler (though doing so will make the name a bit .. inappropriate), probably simply duplicating the existing xxChangeYY to xxInvalidationYY and including both in its dispose.
Why?
There are skins (f.i. TextFieldSkin, seeJDK-8240506) that rely heavily on manually registered InvalidationListeners - each of which must be removed manually in dispose. With enhanced skin api, those could be registered via the multipleProp listener and automatically removed in dispose.
            
/**
* Subclasses can invoke this method to register that they want to listen to
* invalidation events for the given property. Registered {@link Consumer} instances
* will be executed in the order in which they are registered.
* @param property the property
* @param consumer the consumer
*/
protected final void registerInvalidationListener(ObservableValue<?> property, Consumer<ObservableValue<?>> consumer) {
/**
* Unregisters all invalidation listeners that have been registered using {@link #registerInvalidationListener(ObservableValue, Consumer)}
* for the given property. The end result is that the given property is no longer observed by any of the invalidation
* listeners, but it may still have additional listeners registered on it through means outside of
* {@link #registerInvalidationListener(ObservableValue, Consumer)}.
*
* @param property The property for which all listeners should be removed.
* @return A single chained {@link Consumer} consisting of all {@link Consumer consumers} registered through
* {@link #registerInvalidationListener(ObservableValue, Consumer)}. If no consumers have been registered on this
* property, null will be returned.
* @since 9
*/
protected final Consumer<ObservableValue<?>> unregisterInvalidationListeners(ObservableValue<?> property) {
Internally, this boils down to adding api to LambdaMultiplePropertyChangeListenerHandler (though doing so will make the name a bit .. inappropriate), probably simply duplicating the existing xxChangeYY to xxInvalidationYY and including both in its dispose.
Why?
There are skins (f.i. TextFieldSkin, see
- csr for
- 
                    JDK-8265063 SkinBase: add api to un-/register invalidation-/listChange listeners -           
- Closed
 
-         
- relates to
- 
                    JDK-8265401 Rename internal class LambdaMultiplePropertyChangeListenerHandler -           
- Open
 
-         
- 
                    JDK-8265277 SkinBase::registerChangeListener​ missing '@since 9' javadoc tag -           
- Resolved
 
-         
- 
                    JDK-8240506 TextFieldSkin/Behavior: misbehavior on switching skin -           
- Resolved
 
-         
             (1 links to)
        
     
        