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

TableColumn setId doesn't appear to work

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8u20
    • Fix Version/s: 8u20
    • Component/s: javafx
    • Labels:
      None

      Description

      See community discussion https://community.oracle.com/message/12383076

      Using id in lookup on table should find the TableColumn. I dumped out the node structure of the table and the TableColumn didn't have the id.

          @Override
          public void start(Stage stage) {
              TableColumn<Fruit, String> fruitNameCol = new TableColumn<>(
                      "Fruit"
              );
              fruitNameCol.setCellValueFactory(
                      new PropertyValueFactory<>(
                              "name"
                      )
              );
              fruitNameCol.setId("column-not-found");
              TableView<Fruit> table = new TableView<>(
                      FXCollections.<Fruit>observableArrayList(
                              new Fruit("apple"),
                              new Fruit("orange")
                      )
              );
              table.getColumns().setAll(
                      fruitNameCol
              );
              stage.setScene(
                      new Scene(
                              table, 50, 100
                      )
              );
              stage.show();
              System.out.println("Found column => " + table.lookup("column-not-found"));
          }
          public class Fruit {
              private String name;
              public Fruit(String name) { this.name = name; }
              public String getName() { return name; }
              public void setName(String name) { this.name = name; }
          }

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jgiles Jonathan Giles
              Reporter:
              dgrieve David Grieve
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported: