Package it.tidalwave.ui.core
Interface Mutable
- All Known Subinterfaces:
BoundFunction<DOMAIN_TYPE,,CODOMAIN_TYPE> ChangingSource<T>,MutableDisplayable,MutableIconProvider,PresentationModel
- All Known Implementing Classes:
AndFunction,BooleanBoundFunctionSupport,BoundFunctionSupport,BoundProperty,CopyIfEmptyOrConform,MutableIconProviderSupport,NonEmptyFunction,OrFunction,UnaryBoundFunctionSupport,WeakCopyFunctionSupport
@API(status=EXPERIMENTAL)
public interface Mutable
An interface that describes the capability of mutate status and of supporting listeners. Both old-style
PropertyChangeListener and a new
experimental MutableListeners are supported. The three different methods addListener1(MutableListener1),
addListener2(MutableListener2) and addListener(MutableListener) allow shorter syntaxes when only one or two parameters
of the callback are needed, that is:
mutable.addMutableListener1(newValue -> consumer1.accept(newValue));
mutable.addMutableListener2((oldValue, newValue) -> consumer2.accept(oldValue, newValue));
mutable.addMutableListener((source, oldValue, newValue) -> consumer3.accept(source, oldValue, newValue));
- Since:
- 2.0-ALPHA-2
- Author:
- Fabrizio Giudici
- See Also:
-
Method Summary
Modifier and TypeMethodDescription<T> voidaddListener(MutableListener<T> listener) Registers aMutableListener.default <T> voidaddListener1(MutableListener1<T> listener) Registers aMutableListener.default <T> voidaddListener2(MutableListener2<T> listener) Registers aMutableListener.voidRegisters aPropertyChangeListener.voidaddPropertyChangeListener(String propertyName, PropertyChangeListener listener) Registers aPropertyChangeListenerfor the given property.Returns all the boundPropertyChangeListeners.getPropertyChangeListeners(String propertyName) Returns the boundPropertyChangeListeners for the given property.booleanhasListeners(String propertyName) Checks whether the given property has been bound to listeners.<T> voidremoveListener(MutableListener<T> listener) Unregisters aMutableListener.voidUnregisters aPropertyChangeListener.voidremovePropertyChangeListener(String propertyName, PropertyChangeListener listener) Removes aPropertyChangeListenerfor the given property.
-
Method Details
-
addPropertyChangeListener
Registers aPropertyChangeListener.- Parameters:
listener- the listener
-
addPropertyChangeListener
void addPropertyChangeListener(@Nonnull String propertyName, @Nonnull PropertyChangeListener listener) Registers aPropertyChangeListenerfor the given property.- Parameters:
propertyName- the name of the propertylistener- the listener
-
removePropertyChangeListener
Unregisters aPropertyChangeListener.- Parameters:
listener- the listener
-
removePropertyChangeListener
void removePropertyChangeListener(@Nonnull String propertyName, @Nonnull PropertyChangeListener listener) Removes aPropertyChangeListenerfor the given property.- Parameters:
propertyName- the name of the propertylistener- the listener
-
getPropertyChangeListeners
Returns all the boundPropertyChangeListeners.- Returns:
- the listeners
-
getPropertyChangeListeners
Returns the boundPropertyChangeListeners for the given property.- Parameters:
propertyName- the name of the property- Returns:
- the listeners
-
hasListeners
Checks whether the given property has been bound to listeners.- Parameters:
propertyName- the name of the property- Returns:
trueif the property is bound
-
addListener
Registers aMutableListener.- Type Parameters:
T- the type of the listener- Parameters:
listener- the listener
-
addListener1
Registers aMutableListener. This method is needed to allow the compiler to infer the correct type of lambdas.- Type Parameters:
T- the type of the listener- Parameters:
listener- the listener
-
addListener2
Registers aMutableListener. This method is needed to allow the compiler to infer the correct type of lambdas.- Type Parameters:
T- the type of the listener- Parameters:
listener- the listener
-
removeListener
Unregisters aMutableListener.- Type Parameters:
T- the type of the listener- Parameters:
listener- the listener
-