Permutation of scene graph children

Werner Lehmann lehmann at
Tue Dec 2 10:50:44 UTC 2014


I know about Collections.swap but it looks like a bad idea to use on 
scene graph children because it seems to temporarily have a duplicate 
element in the list and I can't have a node twice in the scene graph. 
The setAll approach is what I am using now but native permutation or 
swap support would be better because it does not remove/add nodes, 
triggering CSS and possibly some listeners on scene or parent properties.

On 02.12.2014 10:21, Tom Schindl wrote:
> I'd rather like to see ObservableList.move()/swap() which since we now
> have Java8 this could be implemented as a default methods.
> I think what you can do to make the swap only fire one event is to use
> Object[] data = l.toArray();
> // reorder
> l.setAll(data);
> Tom

More information about the openjfx-dev mailing list