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

TableColumnHeader: calc of cell width must respect row styling

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 8u261, 9.0.4, openjfx14
    • Fix Version/s: tbd
    • Component/s: javafx

      Description

      The example below has a odd row style with a bigger font size. Compile and run:

      - expected: column width such that text in all rows fully visible
      - actual: text in odd row is eclipsed

      Technically, the reason is the cell setup in resizeColumnToFitContent: it's only partially configured by adding to the table but not to a row, thus row styling is not applied.

      The example:

          public class TableColumnAutoSizing extends Application {
          
              private Parent createContent() {
                  TableView<String> table = new TableView<>(FXCollections.observableArrayList
                          ("short name", "and now really really longish name that exceeds all"));
                  TableColumn<String, String> name = new TableColumn<>("Name");
                  name.setCellValueFactory(cc -> new SimpleStringProperty(cc.getValue()));
                  table.getColumns().addAll(name);
                  BorderPane content = new BorderPane(table);
                  return content;
              }
          
              @Override
              public void start(Stage stage) throws Exception {
                  stage.setScene(new Scene(createContent(), 400, 200));
                  //stage.setTitle(FXUtils.version());
                  URL uri = getClass().getResource("tablecolumnautosizing.css");
                  stage.getScene().getStylesheets().add(uri.toExternalForm());
                  stage.show();
              }
          
              public static void main(String[] args) {
                  launch(args);
              }
          
          }

      tablecolumnautosizing.css:

      /* row styling not taken into accout on autosize
      */
      .table-row-cell:odd {
      -fx-font-size: 20;
      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                aghaisas Ajit Ghaisas
                Reporter:
                fastegal Jeanette Winzenburg
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: