Martin Sladecek martin.sladecek at
Wed Jan 9 01:01:09 PST 2013

On 01/08/2013 11:47 PM, Richard Bair wrote:
>>> TransformationList is not modifiable. We had a big discussion about this (together with Micheal Heinrichs) about 2 years ago a decided we have to make all TransformationList subclasses unmodifiable as otherwise it would break the List contract. We'd have to have special implementation of sort for the WrappedList.
>> Oh dear. That is a problem!
> I'd like a little more detail on this:
> 	- If the user attempts to add a row to a TransformationList or remove a row from the TransformationList or move rows on the TransformationList, you propose to throw an unmodifiable exception?
Yes, Transformation list should be clearly marked as unmodifiable in the 
javadoc. JDK8 will have annotations on types, I have to look if there's 
some Unmodifiable annotation for lists, maybe we can use that as well.

> 		- Note this impacts TableView, ListView, TreeView, and TreeTableView. Drag and drop cannot work (well) if a transformation list is used by any of these views (since they will not be able to drop items into the list in any case) -- at least, not out of the box. Developers will have to always manage this by hand.
Based on the last discussion, we'd either have to introduce special API 
for insertion or have TableView find the original list and add the item 
to the current position (by converting the index) or design the API 
differently, like some callback or something...

> 	- If the user adds an item to the source list, is the transformation list automatically updated?
> 	- If the state on an item changes that was used in the transformation list predicate / comparator for filtering / sorting, is the filter / sort recalculated?
Now this depends on the original list. We have ObservableLists that also 
fire "update" notifications for the list items. The original list would 
have to fire such notifications, otherwise sorted/filtered wrapped would 
have no way to know that some item changed. I have a wrapper lists in a 
com.sun. package that fires this notifications in case the original list 
doesn't. Maybe we can make this one also public (or maybe it's also a 
good candidate for a new defender method).
> 	- If my filter is based on criteria which changes (such as text in a TextBox), can I update the TransformedList or does it have to be replaced? That is, are the filter criteria / sort criteria state on the TransformationList that can be modified?
Yes, you can update them. I wanted to add filtered(ObservableValue<? 
extends Predicate<? super E>>) and sorted(ObservableValue<? extends 
Comparator<? super E>>) for this cases. I've proposed them later in the 


More information about the openjfx-dev mailing list