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

TableView: Editable (pseudo-editable) cells should respect the row editability

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      windows_10

      Description

      A DESCRIPTION OF THE PROBLEM :
      When 'editableProperty' of the row is set to 'false', it should not be possible to edit its editable (and pseudo-editable) cells.
      Now cells remain editable when the row is set not editable. It's not correct.
      This problem is actual both for TableView and TreeTableView.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Execute the attached test case

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Check box in the first column is not selectable
      ACTUAL -
      Check box in the first column is selectable, while it should not be

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.TableColumn;
      import javafx.scene.control.TableRow;
      import javafx.scene.control.TableView;
      import javafx.scene.control.cell.CheckBoxTableCell;
      import javafx.scene.layout.Pane;
      import javafx.stage.Stage;

      public class TableViewBug extends Application {
          public static void main(String[] args) {
              launch(args);
          }

          @Override
          public void start(Stage primaryStage) {
              TableView<Object> table = new TableView<>();
              table.setEditable(true);
              table.getItems().add(new Object());
              TableColumn<Object, Boolean> column = new TableColumn<>("Select Me");
              column.setCellFactory(p -> new CheckBoxTableCell<>());
              table.getColumns().add(column);
              table.setRowFactory(p -> {
                  TableRow<Object> row = new TableRow<>();
                  row.setEditable(false);
                  return row;
              });
              Pane root = new Pane();
              root.getChildren().add(table);
              Scene scene = new Scene(root);
              primaryStage.setScene(scene);
              primaryStage.show();
          }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      As a temporary workaround, one can use the utility method suggested in https://stackoverflow.com/a/58905149

      FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mhanl Marius Hanl
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: