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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanbooleanaddAll(int index, Collection<? extends E> c) booleanA convenient method for var-arg adding of elements.booleanaddAll(Collection<? extends E> c) voidaddListener(InvalidationListener listener) Adds anInvalidationListenerwhich will be notified whenever theObservablebecomes invalid.voidaddListener(ListChangeListener<? super E> listener) Add a listener to this observable list.voidclear()booleanbooleancontainsAll(Collection<?> c) booleanget(int index) inthashCode()intbooleanisEmpty()iterator()intlistIterator(int index) protected abstract voidonProposedChange(List<E> toBeAdded, int... indexes) The type of the change can be observed from the combination of arguments.remove(int index) voidremove(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.booleanbooleanA convenient method for var-arg usage of removaAll method.booleanremoveAll(Collection<?> c) voidremoveListener(InvalidationListener listener) Removes the given listener from the list of listeners, that are notified whenever the value of theObservablebecomes invalid.voidremoveListener(ListChangeListener<? super E> listener) Tries to removed a listener from this observable list.booleanA convenient method for var-arg usage of retain method.booleanretainAll(Collection<?> c) booleanClears the ObservableList and add all the elements passed as var-args.booleansetAll(Collection<? extends E> col) Clears the ObservableList and add all elements from the collection.intsize()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, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, streamMethods inherited from interface java.util.List
replaceAll, sort, spliteratorMethods 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
toBeAddedis non-empty andindexescontain two indexes that are pointing to the position, e.g. {2, 2} - If something is going to be removed, the
indexesare 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,toBeAddedis always empty. - for set
toBeAddedcontains 1 element andindexesare like with removal: {index, index + 1} - for setAll,
toBeAddedcontains all new elements andindexeslooks 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:ObservableListAdd a listener to this observable list.- Specified by:
addListenerin interfaceObservableList<E>- Parameters:
listener- the listener for listening to the list changes
-
removeListener
Description copied from interface:ObservableListTries to removed a listener from this observable list. If the listener is not attached to this list, nothing happens.- Specified by:
removeListenerin interfaceObservableList<E>- Parameters:
listener- a listener to remove
-
addListener
Description copied from interface:ObservableAdds anInvalidationListenerwhich will be notified whenever theObservablebecomes 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
InvalidationListenerinstance may be safely registered for differentObservables.The
Observablestores 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 callingremoveListenerafter use or to use an instance ofWeakInvalidationListeneravoid this situation.- Specified by:
addListenerin interfaceObservable- Parameters:
listener- The listener to register- See Also:
-
removeListener
Description copied from interface:ObservableRemoves the given listener from the list of listeners, that are notified whenever the value of theObservablebecomes 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:
removeListenerin interfaceObservable- Parameters:
listener- The listener to remove- See Also:
-
addAll
Description copied from interface:ObservableListA convenient method for var-arg adding of elements.- Specified by:
addAllin interfaceObservableList<E>- Parameters:
elements- the elements to add- Returns:
- true (as specified by Collection.add(E))
-
setAll
Description copied from interface:ObservableListClears the ObservableList and add all the elements passed as var-args.- Specified by:
setAllin interfaceObservableList<E>- Parameters:
elements- the elements to set- Returns:
- true (as specified by Collection.add(E))
-
setAll
Description copied from interface:ObservableListClears the ObservableList and add all elements from the collection.- Specified by:
setAllin 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:ObservableListA convenient method for var-arg usage of removaAll method.- Specified by:
removeAllin 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:ObservableListA convenient method for var-arg usage of retain method.- Specified by:
retainAllin 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:ObservableListBasically a shortcut to sublist(from, to).clear() As this is a common operation, ObservableList has this method for convenient usage.- Specified by:
removein 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:
containsAllin interfaceCollection<E>- Specified by:
containsAllin interfaceList<E>
-
addAll
-
addAll
-
removeAll
-
retainAll
-
clear
public void clear() -
get
-
set
-
add
-
remove
-
indexOf
-
lastIndexOf
- Specified by:
lastIndexOfin interfaceList<E>
-
listIterator
- Specified by:
listIteratorin interfaceList<E>
-
listIterator
- Specified by:
listIteratorin interfaceList<E>
-
subList
-
toString
-
equals
-
hashCode
public int hashCode()
-