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

ChoiceBox: selectPrevious doesn't move selection if previous is separator

    XMLWordPrintable

Details

    Description

      Below is a failing test case: a selection one below the separator isn't changed on selectPrevious - would expect the new selection one above the separator.

      Culprit is an incorrect override of select(int): it may reject the new index if that would select a separator, but it must not select an arbitrary index instead. That's the task of navigation methods selectNext et al.


          @Test
          public void testSeparatorSelectPrevious() {
              int index = 2;
              items.set(index, new Separator());
              getSelectionModel().select(index + 1);
              getSelectionModel().selectPrevious();
              assertEquals("selecting previous must move over separator",
                      index - 1, getSelectionModel().getSelectedIndex());
          }

      Attachments

        Issue Links

          Activity

            People

              jgiles Jonathan Giles
              fastegal Jeanette Winzenburg
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported: