Permutation of scene graph children

Jens Kapitza j.kapitza at schwarze-allianz.de
Tue Dec 2 13:55:43 UTC 2014


maybe this

https://docs.oracle.com/javase/8/javafx/api/javafx/collections/ModifiableObservableListBase.html 


can help you?


you can implement your swap onto a delegate and then just wrap 
ModifiableObservableListBase around.

Jens

Am 02.12.2014 um 12:23 schrieb Tom Schindl:
> I think the only really effecient way is to have the methods on the interface of observablelist because the algorithm has to have access to the internal datastructure.
>
> Tom
>
> Von meinem iPhone gesendet
>
>> Am 02.12.2014 um 12:15 schrieb Werner Lehmann <lehmann at media-interactive.de>:
>>
>> Hi Peter,
>>
>> didn't know about that one. It basically does what Tom suggested: makes a copy, sorts that one, then uses ObservableList.setAll to get one change event. So it is what I am doing already but still removes/adds children ;-)  The remove/add approach also does work for now, it just could be a little more efficent...
>>
>> Werner
>>
>>> On 02.12.2014 12:08, Pete Moss wrote:
>>> You can also try using FXCollections.sort() directly on the children and
>>> see if that helps since you were wondering about a sort operation. This is
>>> intended specifically for use with ObservableList objects. This has worked
>>> well for me. I don't know how many events this will end up firing, since it
>>> wasn't important to me, but it is worth investigating.
>>>
>>> - Peter



More information about the openjfx-dev mailing list