Package com.sun.javafx.collections
Class VetoableListDecorator<E>
java.lang.Object
com.sun.javafx.collections.VetoableListDecorator<E>
- All Implemented Interfaces:
Iterable<E>
,Collection<E>
,List<E>
,Observable
,ObservableList<E>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
boolean
boolean
addAll
(int index, Collection<? extends E> c) boolean
A convenient method for var-arg adding of elements.boolean
addAll
(Collection<? extends E> c) void
addListener
(InvalidationListener listener) Adds anInvalidationListener
which will be notified whenever theObservable
becomes invalid.void
addListener
(ListChangeListener<? super E> listener) Add a listener to this observable list.void
clear()
boolean
boolean
containsAll
(Collection<?> c) boolean
get
(int index) int
hashCode()
int
boolean
isEmpty()
iterator()
int
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.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
boolean
A convenient method for var-arg usage of removaAll method.boolean
removeAll
(Collection<?> c) void
removeListener
(InvalidationListener listener) Removes the given listener from the list of listeners, that are notified whenever the value of theObservable
becomes invalid.void
removeListener
(ListChangeListener<? super E> listener) Tries to removed a listener from this observable list.boolean
A convenient method for var-arg usage of retain method.boolean
retainAll
(Collection<?> c) boolean
Clears the ObservableList and add all the elements passed as var-args.boolean
setAll
(Collection<? extends E> col) Clears the ObservableList and add all elements from the collection.int
size()
subList
(int fromIndex, int toIndex) Object[]
toArray()
<T> T[]
toArray
(T[] a) toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream
Methods inherited from interface java.util.List
replaceAll, sort, spliterator
Methods inherited from interface javafx.collections.ObservableList
filtered, sorted
-
Constructor Details
-
VetoableListDecorator
-
-
Method Details
-
onProposedChange
The type of the change can be observed from the combination of arguments.- If something is going to be added
toBeAdded
is non-empty andindexes
contain two indexes that are pointing to the position, e.g. {2, 2} - If something is going to be removed, the
indexes
are paired by two: from(inclusive)-to(exclusive) and are pointing to the current list.
E.g. if we remove 2,3,5 from list {0,1,2,3,4,5}, the indexes will be {2, 4, 5, 6}. If there's more than one pair of indexes,toBeAdded
is always empty. - for set
toBeAdded
contains 1 element andindexes
are like with removal: {index, index + 1} - for setAll,
toBeAdded
contains all new elements andindexes
looks like this: {0, size()}
- Parameters:
toBeAdded
- the list to be added- Throws:
IllegalArgumentException
- when the change is vetoed
- If something is going to be added
-
addListener
Description copied from interface:ObservableList
Add a listener to this observable list.- Specified by:
addListener
in interfaceObservableList<E>
- Parameters:
listener
- the listener for listening to the list changes
-
removeListener
Description copied from interface:ObservableList
Tries to removed a listener from this observable list. If the listener is not attached to this list, nothing happens.- Specified by:
removeListener
in interfaceObservableList<E>
- Parameters:
listener
- a listener to remove
-
addListener
Description copied from interface:Observable
Adds anInvalidationListener
which will be notified whenever theObservable
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 differentObservables
.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 callingremoveListener
after use or to use an instance ofWeakInvalidationListener
avoid this situation.- Specified by:
addListener
in interfaceObservable
- Parameters:
listener
- The listener to register- See Also:
-
removeListener
Description copied from interface:Observable
Removes the given listener from the list of listeners, that are notified whenever the value of theObservable
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.
- Specified by:
removeListener
in interfaceObservable
- Parameters:
listener
- The listener to remove- See Also:
-
addAll
Description copied from interface:ObservableList
A convenient method for var-arg adding of elements.- Specified by:
addAll
in interfaceObservableList<E>
- Parameters:
elements
- the elements to add- Returns:
- true (as specified by Collection.add(E))
-
setAll
Description copied from interface:ObservableList
Clears the ObservableList and add all the elements passed as var-args.- Specified by:
setAll
in interfaceObservableList<E>
- Parameters:
elements
- the elements to set- Returns:
- true (as specified by Collection.add(E))
-
setAll
Description copied from interface:ObservableList
Clears the ObservableList and add all elements from the collection.- Specified by:
setAll
in interfaceObservableList<E>
- Parameters:
col
- the collection with elements that will be added to this observableArrayList- Returns:
- true (as specified by Collection.add(E))
-
removeAll
Description copied from interface:ObservableList
A convenient method for var-arg usage of removaAll method.- Specified by:
removeAll
in interfaceObservableList<E>
- Parameters:
elements
- the elements to be removed- Returns:
- true if list changed as a result of this call
-
retainAll
Description copied from interface:ObservableList
A convenient method for var-arg usage of retain method.- Specified by:
retainAll
in interfaceObservableList<E>
- Parameters:
elements
- the elements to be retained- Returns:
- true if list changed as a result of this call
-
remove
public void remove(int from, int to) Description copied from interface:ObservableList
Basically a shortcut to sublist(from, to).clear() As this is a common operation, ObservableList has this method for convenient usage.- Specified by:
remove
in interfaceObservableList<E>
- Parameters:
from
- the start of the range to remove (inclusive)to
- the end of the range to remove (exclusive)
-
size
public int size() -
isEmpty
public boolean isEmpty() -
contains
-
iterator
-
toArray
-
toArray
public <T> T[] toArray(T[] a) -
add
-
remove
-
containsAll
- Specified by:
containsAll
in interfaceCollection<E>
- Specified by:
containsAll
in interfaceList<E>
-
addAll
-
addAll
-
removeAll
-
retainAll
-
clear
public void clear() -
get
-
set
-
add
-
remove
-
indexOf
-
lastIndexOf
- Specified by:
lastIndexOf
in interfaceList<E>
-
listIterator
- Specified by:
listIterator
in interfaceList<E>
-
listIterator
- Specified by:
listIterator
in interfaceList<E>
-
subList
-
toString
-
equals
-
hashCode
public int hashCode()
-