public abstract class VetoableListDecorator<E> extends Object implements ObservableList<E>
Constructor and Description |
---|
VetoableListDecorator(ObservableList<E> decorated) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(E e) |
void |
add(int index,
E element) |
boolean |
addAll(Collection<? extends E> c) |
boolean |
addAll(E... elements)
A convenient method for var-arg adding of elements.
|
boolean |
addAll(int index,
Collection<? extends E> c) |
void |
addListener(InvalidationListener listener)
Adds an
InvalidationListener which will be notified whenever the
Observable becomes invalid. |
void |
addListener(ListChangeListener<? super E> listener)
Add a listener to this observable list.
|
void |
clear() |
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
boolean |
equals(Object obj) |
E |
get(int index) |
int |
hashCode() |
int |
indexOf(Object o) |
boolean |
isEmpty() |
Iterator<E> |
iterator() |
int |
lastIndexOf(Object o) |
ListIterator<E> |
listIterator() |
ListIterator<E> |
listIterator(int index) |
protected abstract void |
onProposedChange(List<E> toBeAdded,
int... indexes)
The type of the change can be observed from the combination of arguments.
|
E |
remove(int index) |
void |
remove(int from,
int to)
Basically a shortcut to sublist(from, to).clear()
As this is a common operation, ObservableList has this method for convenient usage.
|
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
boolean |
removeAll(E... elements)
A convenient method for var-arg usage of removaAll method.
|
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(ListChangeListener<? super E> listener)
Tries to removed a listener from this observable list.
|
boolean |
retainAll(Collection<?> c) |
boolean |
retainAll(E... elements)
A convenient method for var-arg usage of retain method.
|
E |
set(int index,
E element) |
boolean |
setAll(Collection<? extends E> col)
Clears the ObservableList and add all elements from the collection.
|
boolean |
setAll(E... elements)
Clears the ObservableList and add all the elements passed as var-args.
|
int |
size() |
List<E> |
subList(int fromIndex,
int toIndex) |
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
filtered, sorted, sorted
replaceAll, sort, spliterator
parallelStream, removeIf, stream
public VetoableListDecorator(ObservableList<E> decorated)
protected abstract void onProposedChange(List<E> toBeAdded, int... indexes)
toBeAdded
is non-empty
and indexes
contain two indexes that are pointing to the position, e.g. {2, 2}
indexes
are paired by two:
from(inclusive)-to(exclusive) and are pointing to the current list.
toBeAdded
is always empty.
toBeAdded
contains 1 element and indexes
are like with removal: {index, index + 1}
toBeAdded
contains all new elements and indexes
looks like this: {0, size()}
toBeAdded
- the list to be addedIllegalArgumentException
- when the change is vetoedpublic void addListener(ListChangeListener<? super E> listener)
ObservableList
addListener
in interface ObservableList<E>
listener
- the listener for listening to the list changespublic void removeListener(ListChangeListener<? super E> listener)
ObservableList
removeListener
in interface ObservableList<E>
listener
- a listener to removepublic 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 boolean addAll(E... elements)
ObservableList
addAll
in interface ObservableList<E>
elements
- the elements to addpublic boolean setAll(E... elements)
ObservableList
setAll
in interface ObservableList<E>
elements
- the elements to setpublic boolean setAll(Collection<? extends E> col)
ObservableList
setAll
in interface ObservableList<E>
col
- the collection with elements that will be added to this observableArrayListpublic boolean removeAll(E... elements)
ObservableList
removeAll
in interface ObservableList<E>
elements
- the elements to be removedpublic boolean retainAll(E... elements)
ObservableList
retainAll
in interface ObservableList<E>
elements
- the elements to be retainedpublic void remove(int from, int to)
ObservableList
remove
in interface ObservableList<E>
from
- the start of the range to remove (inclusive)to
- the end of the range to remove (exclusive)public int size()
public boolean isEmpty()
public boolean contains(Object o)
public Object[] toArray()
public <T> T[] toArray(T[] a)
public boolean add(E e)
public boolean remove(Object o)
public boolean containsAll(Collection<?> c)
containsAll
in interface Collection<E>
containsAll
in interface List<E>
public boolean addAll(Collection<? extends E> c)
public boolean addAll(int index, Collection<? extends E> c)
public boolean removeAll(Collection<?> c)
public boolean retainAll(Collection<?> c)
public void clear()
public int lastIndexOf(Object o)
lastIndexOf
in interface List<E>
public ListIterator<E> listIterator()
listIterator
in interface List<E>
public ListIterator<E> listIterator(int index)
listIterator
in interface List<E>
public boolean equals(Object obj)
Copyright © 2020. All rights reserved.