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

Tree/TableView SelectionModel in wrong state after selectFirst

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P3
    • Resolution: Unresolved
    • Affects Version/s: 8u301, openjfx11, openjfx17, openjfx18
    • Fix Version/s: tbd
    • Component/s: javafx
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      A DESCRIPTION OF THE PROBLEM :
      When i select cells in code and then a use is selecting cells after that with arrow keys + shift key, worng cells got selected.

      It seems to be that the ANCHOR_PROPERTY_KEY in the CellBehaviorBase class is not updated, when I use selectFirst or selectBelow

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Run Application
      2. Press Shift+Arrow Key Down Twice


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      first three cells selected
      ACTUAL -
      last both cells selected

      ---------- BEGIN SOURCE ----------
      public class Main extends Application {


          public static void main(String[] args) {
              launch(args);
          }

          @Override
          public void start(Stage primaryStage) throws IOException {
              TableView<String> tableView = new TableView();

              TableColumn<String, Object> tableColumn = new TableColumn<>("fuu");
              tableColumn.setCellValueFactory(param -> new SimpleObjectProperty<>("fuu"));

              tableView.getColumns().add(tableColumn);

              IntStream.range(0, 100).forEach(t -> tableView.getItems().add("fuu"));

              tableView.getSelectionModel().setCellSelectionEnabled(true);
              tableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
              tableView.getSelectionModel().selectFirst();

              primaryStage.setScene(new Scene(tableView));

              primaryStage.show();

              Platform.runLater(() -> tableView.requestFocus());
          }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


        Attachments

          Activity

            People

            Assignee:
            aghaisas Ajit Ghaisas
            Reporter:
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated: