private static class FXCollections.CheckedObservableSet<E> extends java.util.AbstractSet<E> implements ObservableSet<E>
Modifier and Type | Field and Description |
---|---|
private ObservableSet<E> |
backingSet |
private SetChangeListener<E> |
listener |
private SetListenerHelper |
listenerHelper |
private java.lang.Class<E> |
type |
Constructor and Description |
---|
CheckedObservableSet(ObservableSet<E> set,
java.lang.Class<E> type) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(E e) |
boolean |
addAll(java.util.Collection<? extends E> c) |
void |
addListener(InvalidationListener listener)
Adds an
InvalidationListener which will be notified whenever the
Observable becomes invalid. |
void |
addListener(SetChangeListener<? super E> listener)
Add a listener to this observable set.
|
private void |
callObservers(SetChangeListener.Change<? extends E> c) |
void |
clear() |
boolean |
contains(java.lang.Object o) |
boolean |
containsAll(java.util.Collection<?> c) |
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
boolean |
isEmpty() |
java.util.Iterator<E> |
iterator() |
boolean |
remove(java.lang.Object o) |
boolean |
removeAll(java.util.Collection<?> c) |
void |
removeListener(InvalidationListener listener)
Removes the given listener from the list of listeners, that are notified
whenever the value of the
Observable becomes invalid. |
void |
removeListener(SetChangeListener<? super E> listener)
Tries to removed a listener from this observable set.
|
boolean |
retainAll(java.util.Collection<?> c) |
int |
size() |
java.lang.Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
(package private) void |
typeCheck(java.lang.Object o) |
private final ObservableSet<E> backingSet
private final java.lang.Class<E> type
private SetListenerHelper listenerHelper
private final SetChangeListener<E> listener
CheckedObservableSet(ObservableSet<E> set, java.lang.Class<E> type)
private void callObservers(SetChangeListener.Change<? extends E> c)
void typeCheck(java.lang.Object o)
public void addListener(InvalidationListener listener)
Observable
InvalidationListener
which will be notified whenever the
Observable
becomes invalid. If the same
listener is added more than once, then it will be notified more than
once. That is, no check is made to ensure uniqueness.
Note that the same actual InvalidationListener
instance may be
safely registered for different Observables
.
The Observable
stores a strong reference to the listener
which will prevent the listener from being garbage collected and may
result in a memory leak. It is recommended to either unregister a
listener by calling removeListener
after use or to use an instance of
WeakInvalidationListener
avoid this situation.
addListener
in interface Observable
listener
- The listener to registerObservable.removeListener(InvalidationListener)
public void removeListener(InvalidationListener listener)
Observable
Observable
becomes invalid.
If the given listener has not been previously registered (i.e. it was never added) then this method call is a no-op. If it had been previously added then it will be removed. If it had been added more than once, then only the first occurrence will be removed.
removeListener
in interface Observable
listener
- The listener to removeObservable.addListener(InvalidationListener)
public void addListener(SetChangeListener<? super E> listener)
ObservableSet
addListener
in interface ObservableSet<E>
listener
- the listener for listening to the set changespublic void removeListener(SetChangeListener<? super E> listener)
ObservableSet
removeListener
in interface ObservableSet<E>
listener
- a listener to removepublic int size()
public boolean isEmpty()
public boolean contains(java.lang.Object o)
public java.lang.Object[] toArray()
public <T> T[] toArray(T[] a)
public boolean add(E e)
public boolean remove(java.lang.Object o)
public boolean containsAll(java.util.Collection<?> c)
public boolean addAll(java.util.Collection<? extends E> c)
public boolean retainAll(java.util.Collection<?> c)
public boolean removeAll(java.util.Collection<?> c)
public void clear()
public boolean equals(java.lang.Object o)
public int hashCode()