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

ListView et al: selectedIndices/Items fires incorrect event on selectIndices

    XMLWordPrintable

Details

    Description

      another variant of incorrect change notification from selectedIndices/Items: doesn't report all of the additions. Below is a failing test snippet (nearly standalone, the complete tests are in MultipleSelectionIssues, as always ;-) for selectedIndices

          /**
           * Test list change of selectedIndices on setIndices. Fails for core ..
           */
          @Test
          public void testEventIndicesOnSelectIndices() {
              if (!multipleMode) return;
              int[] indices = new int[]{2, 5, 7};
              ListChangeListener l = c -> {
                  int subChanges = 0;
                  while(c.next()) {
                      subChanges++;
                  }
                  assertEquals(1, subChanges);
                  c.reset();
                  c.next();
                  assertEquals(indices.length, c.getAddedSize());
              };
              getSelectionModel().getSelectedIndices().addListener(l);
              getSelectionModel().selectIndices(indices[0], indices);
          }


       

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:
              Imported: