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

TreeTableView Indention Rendering Issue in TreeStructureColumn

    XMLWordPrintable

Details

    Description

      I noticed a rendering issue within the TreeStructureColumn-Cells, when creating a TreeTableView with setShowRoot( false ). As long as every Root-Child has no children, their indention is not correctly calculated. It is set directly to the border of the cell, instead of beeing aligned with the other Root-Children with Children. After the first Root-Child has children, further Root-Children without Children are displayed correctly. When resizing the Stage or using the handles, the idention is correct again.

      I created a small example to demonstrate the issue:

      import javafx.application.Application;
      import javafx.beans.property.ReadOnlyStringWrapper;
      import javafx.scene.Scene;
      import javafx.scene.control.TreeItem;
      import javafx.scene.control.TreeTableColumn;
      import javafx.scene.control.TreeTableView;
      import javafx.stage.Stage;

      public class TreeTableViewIndentErrorMain extends Application
      {
          @Override
          public void start( final Stage primaryStage )
          {
              TreeItem<String> root = new TreeItem<>( "Root" );

              TreeItem<String> item1 = new TreeItem<>( "Item1" );
              TreeItem<String> item2 = new TreeItem<>( "Item2" );
              TreeItem<String> item3 = new TreeItem<>( "Item3" );
              TreeItem<String> item4 = new TreeItem<>( "Item4" );

              root.getChildren().add( item1 );
              root.getChildren().add( item2 );
              item2.getChildren().add( item3 );
              root.getChildren().add( item4 );

              TreeTableColumn<String, String> column = new TreeTableColumn<>( "Column" );
              column.setCellValueFactory(p -> new ReadOnlyStringWrapper( p.getValue().getValue() ));

              final TreeTableView<String> treeTableView = new TreeTableView<>( root );
              treeTableView.getColumns().add( column );
              treeTableView.setShowRoot( false );
              treeTableView.setColumnResizePolicy( TreeTableView.CONSTRAINED_RESIZE_POLICY );

              Scene scene = new Scene( treeTableView, 400, 400 );
              primaryStage.setScene( scene );
              primaryStage.show();
          }

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

      PS: Honestly I didnt really know what affected Version to choose, so i just picked the latest released Version, since I currently use the latest JDK Version (1.8.0-b132).

      Attachments

        Issue Links

          Activity

            People

              jgiles Jonathan Giles
              duke J. Duke
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported: