Module MaterialFX
Class TransformableListWrapper<T>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<T>
io.github.palexdev.materialfx.collections.TransformableListWrapper<T>
- All Implemented Interfaces:
Iterable<T>,Collection<T>,List<T>,Observable,ObservableList<T>
For some idiot reason JavaFX's
TransformationLists do not allow modifying the
source list.
This class fixes that. It wraps an ObservableList which is the source list and
the new TransformableList which is built from that source.
This way you can benefit of the futures of the new TransformableList (sorting and filtering)
while also being able to directly modify the source list.
-
Property Summary
PropertiesTypePropertyDescriptionDelegate forTransformableList.comparatorProperty().Delegate forTransformableList.predicateProperty(). -
Field Summary
Fields inherited from class java.util.AbstractList
modCount -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanbooleanaddAll(int index, Collection<? extends T> c) booleanvoidaddListener(InvalidationListener listener) voidaddListener(ListChangeListener<? super T> listener) voidclear()Delegate forTransformableList.comparatorProperty().get(int index) Gets the value of the property comparator.Gets the value of the property predicate.ObservableList<? extends T>intbooleanDelegate forTransformableList.isReversed().intDelegate forTransformableList.predicateProperty().remove(int index) voidremove(int from, int to) booleanvoidremoveListener(InvalidationListener listener) voidremoveListener(ListChangeListener<? super T> listener) booleanbooleansetAll(Collection<? extends T> col) booleanvoidsetComparator(Comparator<T> comparator) Sets the value of the property comparator.voidsetComparator(Comparator<T> sorter, boolean reversed) Delegate forTransformableList.setComparator(Comparator, boolean).voidsetPredicate(Predicate<T> predicate) Sets the value of the property predicate.voidsetReversed(boolean reversed) Delegate forTransformableList.setReversed(boolean).intsize()intsourceToView(int index) Delegate forTransformableList.sourceToView(int).intviewToSource(int index) Delegate forTransformableList.viewToSource(int).Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, removeRange, subListMethods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
addAll, contains, containsAll, equals, hashCode, isEmpty, iterator, listIterator, listIterator, remove, removeAll, replaceAll, retainAll, sort, spliterator, subList, toArray, toArrayMethods inherited from interface javafx.collections.ObservableList
filtered, sorted, sorted
-
Property Details
-
predicate
Delegate forTransformableList.predicateProperty().- See Also:
-
comparator
Delegate forTransformableList.comparatorProperty().- See Also:
-
-
Constructor Details
-
TransformableListWrapper
-
-
Method Details
-
addListener
Added to theTransformableList.- Specified by:
addListenerin interfaceObservableList<T>
-
removeListener
Removed from theTransformableList.- Specified by:
removeListenerin interfaceObservableList<T>
-
add
Added to the source list.- Specified by:
addin interfaceCollection<T>- Specified by:
addin interfaceList<T>- Overrides:
addin classAbstractList<T>
-
set
Set on the source list. -
add
Added to the source list. -
remove
Removed from the source list. -
indexOf
Retrieved from theTransformableList. -
lastIndexOf
Retrieved from theTransformableList.- Specified by:
lastIndexOfin interfaceList<T>- Overrides:
lastIndexOfin classAbstractList<T>
-
clear
public void clear()The source list is cleared.- Specified by:
clearin interfaceCollection<T>- Specified by:
clearin interfaceList<T>- Overrides:
clearin classAbstractList<T>
-
addAll
Added to the source list. -
addAll
Added to the source list.- Specified by:
addAllin interfaceObservableList<T>
-
setAll
Set on the source list.- Specified by:
setAllin interfaceObservableList<T>
-
setAll
Set on the source list.- Specified by:
setAllin interfaceObservableList<T>
-
removeAll
Removed from the source list.- Specified by:
removeAllin interfaceObservableList<T>
-
retainAll
Retained on the source list.- Specified by:
retainAllin interfaceObservableList<T>
-
remove
public void remove(int from, int to) Removed from the source list.- Specified by:
removein interfaceObservableList<T>
-
addListener
Added to theTransformableList.- Specified by:
addListenerin interfaceObservable
-
removeListener
Removed from theTransformableList.- Specified by:
removeListenerin interfaceObservable
-
get
Retrieved from theTransformableList. -
size
public int size()Size of theTransformableList.- Specified by:
sizein interfaceCollection<T>- Specified by:
sizein interfaceList<T>- Specified by:
sizein classAbstractCollection<T>
-
getSource
- Returns:
- the source observable list
-
viewToSource
public int viewToSource(int index) Delegate forTransformableList.viewToSource(int). -
sourceToView
public int sourceToView(int index) Delegate forTransformableList.sourceToView(int). -
getPredicate
Gets the value of the property predicate.- Property description:
- Delegate for
TransformableList.predicateProperty().
-
predicateProperty
Delegate forTransformableList.predicateProperty().- See Also:
-
setPredicate
Sets the value of the property predicate.- Property description:
- Delegate for
TransformableList.predicateProperty().
-
getComparator
Gets the value of the property comparator.- Property description:
- Delegate for
TransformableList.comparatorProperty().
-
comparatorProperty
Delegate forTransformableList.comparatorProperty().- See Also:
-
setComparator
Sets the value of the property comparator.- Property description:
- Delegate for
TransformableList.comparatorProperty().
-
setComparator
Delegate forTransformableList.setComparator(Comparator, boolean). -
isReversed
public boolean isReversed()Delegate forTransformableList.isReversed(). -
setReversed
public void setReversed(boolean reversed) Delegate forTransformableList.setReversed(boolean). -
getTransformableList
- Returns:
- the wrapped
TransformableList
-