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 MutableListener
s 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> void
addListener
(MutableListener<T> listener) Registers aMutableListener
.default <T> void
addListener1
(MutableListener1<T> listener) Registers aMutableListener
.default <T> void
addListener2
(MutableListener2<T> listener) Registers aMutableListener
.void
Registers aPropertyChangeListener
.void
addPropertyChangeListener
(String propertyName, PropertyChangeListener listener) Registers aPropertyChangeListener
for the given property.Returns all the boundPropertyChangeListener
s.getPropertyChangeListeners
(String propertyName) Returns the boundPropertyChangeListener
s for the given property.boolean
hasListeners
(String propertyName) Checks whether the given property has been bound to listeners.<T> void
removeListener
(MutableListener<T> listener) Unregisters aMutableListener
.void
Unregisters aPropertyChangeListener
.void
removePropertyChangeListener
(String propertyName, PropertyChangeListener listener) Removes aPropertyChangeListener
for the given property.
-
Method Details
-
addPropertyChangeListener
Registers aPropertyChangeListener
.- Parameters:
listener
- the listener
-
addPropertyChangeListener
void addPropertyChangeListener(@Nonnull String propertyName, @Nonnull PropertyChangeListener listener) Registers aPropertyChangeListener
for 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 aPropertyChangeListener
for the given property.- Parameters:
propertyName
- the name of the propertylistener
- the listener
-
getPropertyChangeListeners
Returns all the boundPropertyChangeListener
s.- Returns:
- the listeners
-
getPropertyChangeListeners
Returns the boundPropertyChangeListener
s 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:
true
if 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
-