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

[TreeTableView] autosizing for the first column is applied incorrectly: root arrows are not taken into account.

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • P4
    • Resolution: Fixed
    • 8
    • 8
    • javafx
    • 8.0b69

    Description

      Look at the attached movie.

      When I do autosize, width is set so that text is truncated.

      Code:
          TreeTableView<Data> treeTableView;

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

          @Override
          public void start(Stage stage) throws Exception {
              treeTableView = new TreeTableView<Data>();
              treeTableView.setMaxWidth(100);
              treeTableView.setRoot(new TreeItem<Data>(new Data("Root")));
              for (int i = 0; i < 100; i++) {
                  treeTableView.getRoot().getChildren().add(new TreeItem<Data>(new Data("item " + String.valueOf(i))));
              }

              treeTableView.getRoot().setExpanded(true);

              treeTableView.getColumns().add(new TreeTableColumn<Data, String>("Data"));
              ((TreeTableColumn<Data, String>) treeTableView.getColumns().get(0)).setCellValueFactory(new Callback<CellDataFeatures<Data, String>, ObservableValue<String>>() {
                  @Override
                  public ObservableValue<String> call(CellDataFeatures<Data, String> p) {
                      return p.getValue().getValue().property;
                  }
              });

              HBox vb = new HBox(5);
              vb.getChildren().addAll(treeTableView, new Button("Some button"));

              Scene scene = new Scene(vb, 300, 300);
              stage.setScene(scene);
              stage.show();
          }

          class Data {

              public StringProperty property;

              public Data(String data) {
                  property = new SimpleStringProperty(data);
              }

              @Override
              public String toString() {
                  return property.get();
              }
          }

      Affected tests:
      ControlsAutomatedTestSuite/javafx/scene/control/test/treetable/TreeTableAsTableTest/columnAutoSize

      Attachments

        Activity

          People

            jgiles Jonathan Giles
            akirov Alexander Kirov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported: