Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8144907

Support sorted children

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 8u60
    • javafx
    • None

      I suggest adding support for the automatic sorting of a Parent's children.
      Motivation: In our app we show a map with pins marking places of interest. A pin which is lower on screenshould always be in front of a pin which is higher, creating the illusion that pins to the south are in front of pins to the north.
      Since the children of a JavaFX Parent are not sorted, we have to trigger sorting by listening to changes to the list. This works, but I think our code would be a lot simpler, if we could just invoke

      Comparator comparator = new Comparator() {...};
      someParent.setChildrenSort(comparator);
      someParent.setChildrenSortEnabled(true);

      Moreover, such a default implementation could be written in a performance optimising way which would group multiple list changes into a single sort, if you added a method
      Parent.setChildrenSortInterval(Duration);

      For us to be able to still write list change listeners, we would also require the ability to distinguish between ordinary list changes and sorting permutations, so a method like
      boolean Parent.isSorting()
      might be relevant.

            Unassigned Unassigned
            risaksen Randahl Isaksen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: