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

SortedList should provide a way to map source index to view index

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P4
    • 9
    • 8u60
    • javafx
    • x86
    • windows_8

    Description

      A DESCRIPTION OF THE REQUEST :
      SortedList.getSourceIndex(int) allows translation from view index to source index. However, there is no way to determine view index from source. "sourceList.indexOf(sortedList.get(viewIdx))" (a) is inefficient and (b) won't work for lists with duplicate items.

      JUSTIFICATION :
      SortedList is a general purpose class. Mapping between model and view indices is its primary purpose so this functionality should be exposed. At present, relevant code is private (thus inaccessible to even subclasses).

      Sample use-case: controls may be backed by SortedList populated with immutable items. In this case, user updates trigger list element replacements rather than in-place modifications. Developer must be able to identify index within source list.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Add "public int getViewIndex(int index)" to SortedList. Possibly add corresponding abstract method to TransformationList as well.
      ACTUAL -
      No such method.

      Attachments

        Issue Links

          Activity

            People

              vadim Vadim Pakhnushev
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: