- Type Parameters:
T
- the type of data propagated to listeners.
- All Known Subinterfaces:
ComponentValue<T,
,C> EntityEditModel.EditableEntity
,EntityEditModel.EditableEntity.Exists
,EntityEditModel.EditableEntity.Modified
,EntityEditModel.EditableValue<T>
,Event<T>
,FilterComboBoxModel.ComboBoxItems<T>
,FilterComboBoxModel.NullItem<T>
,FilterModel.FilteredItems<T>
,FilterModel.Items<T>
,FilterModel.VisibleItems<T>
,MultiItemSelection.Indexes
,MultiItemSelection.Items<R>
,Mutable<T>
,Observable<T>
,PropertyValue<T>
,State
,State.Combination
,StateObserver
,Value<T>
,ValueList<T>
,ValueListObserver<T>
,ValueObserver<T>
,Values<T,
,C> ValueSet<T>
,ValueSetObserver<T>
,ValuesObserver<T,
C>
- All Known Implementing Classes:
AbstractComponentValue
,AbstractTextComponentValue
,AbstractValue
,NullableToggleButtonModel.ToggleState
public interface Observer<T>
Manages event listeners. Implemented by
Event
.-
Method Summary
Modifier and TypeMethodDescriptionboolean
addConsumer
(Consumer<? super T> consumer) Addsconsumer
to thisObserver
.boolean
addListener
(Runnable listener) Addslistener
to thisObserver
.boolean
addWeakConsumer
(Consumer<? super T> consumer) Uses aWeakReference
, addingconsumer
does not prevent it from being garbage collected.boolean
addWeakListener
(Runnable listener) Uses aWeakReference
, addinglistener
does not prevent it from being garbage collected.boolean
removeConsumer
(Consumer<? super T> consumer) Removesconsumer
from thisObserver
boolean
removeListener
(Runnable listener) Removeslistener
from thisObserver
boolean
removeWeakConsumer
(Consumer<? super T> consumer) Removesconsumer
from thisObserver
.boolean
removeWeakListener
(Runnable listener) Removeslistener
from thisObserver
-
Method Details
-
addListener
Addslistener
to thisObserver
. Adding the same listener a second time has no effect.- Parameters:
listener
- the listener to add- Returns:
- true if this observer did not already contain the specified listener
- Throws:
NullPointerException
- in case listener is null
-
removeListener
Removeslistener
from thisObserver
- Parameters:
listener
- the listener to remove- Returns:
- true if this observer contained the specified listener
-
addConsumer
Addsconsumer
to thisObserver
. Adding the same consumer a second time has no effect.- Parameters:
consumer
- the consumer to add- Returns:
- true if this observer did not already contain the specified consumer
- Throws:
NullPointerException
- in case consumer is null
-
removeConsumer
Removesconsumer
from thisObserver
- Parameters:
consumer
- the consumer to remove- Returns:
- true if this observer contained the specified consumer
-
addWeakListener
Uses aWeakReference
, addinglistener
does not prevent it from being garbage collected. Adding the same listener a second time has no effect.- Parameters:
listener
- the listener- Returns:
- true if this observer did not already contain the specified listener
-
removeWeakListener
Removeslistener
from thisObserver
- Parameters:
listener
- the listener to remove- Returns:
- true if this observer contained the specified listener
-
addWeakConsumer
Uses aWeakReference
, addingconsumer
does not prevent it from being garbage collected. Adding the same consumer a second time has no effect.- Parameters:
consumer
- the consumer- Returns:
- true if this observer did not already contain the specified consumer
-
removeWeakConsumer
Removesconsumer
from thisObserver
.- Parameters:
consumer
- the consumer to remove- Returns:
- true if this observer contained the specified consumer
-