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

[ListView][TableView][TreeView] : SHIFT + SPACE problem when in edit mode with TextFieldCell factory

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • P4
    • Resolution: Fixed
    • 7u21
    • 8
    • javafx
    • None
    • Windows 7

    Description

      In the same code below, double click on any tree item, start typing:
      "HELLO WORLD" using the shift key (not by toggling Caps Lock), when you get to the space key, the tree item looses focus and you loose your edited value.

      I think the problem is from behavior classes of ListView/TableView/TreeView which are consuming the SHIFT+SPACE event before it reaches the text field.

      Maybe when in edit mode (isEditing()), this keyEvent should not be consumed?




      package tests;

      import javafx.application.Application;

      import javafx.scene.Parent;
      import javafx.scene.Scene;
      import javafx.scene.SceneBuilder;
      import javafx.scene.control.TreeItem;
      import javafx.scene.control.TreeView;
      import javafx.scene.control.cell.TextFieldTreeCell;

      import javafx.stage.Stage;


      public class JFXTreeViewTest extends Application {
          public JFXTreeViewTest() {
          }


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

          @Override
          public void start(Stage stage) {
              Scene scene = SceneBuilder.create().width(800).height(600).root(createRoot()).build();
              stage.setScene(scene);
              stage.setTitle("TextField Test");
              stage.show();
          }

          private Parent createRoot() {
              TreeView<String> treeView = new TreeView<String>();
              treeView.setEditable(true);
              treeView.setCellFactory(TextFieldTreeCell.forTreeView());
              TreeItem<String> treeItem = new TreeItem<String>("test");
              treeView.setRoot(treeItem);

              TreeItem<String> item = new TreeItem<String>("test1");
              item.getChildren().add(new TreeItem<String>("test2"));
              item.getChildren().add(new TreeItem<String>("test3"));

              treeItem.getChildren().add(item);
              return treeView;

          }
      }

      Attachments

        Activity

          People

            jgiles Jonathan Giles
            rashajfx rasha (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported: