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

[VirtualFlow controls] Support for variable height based on actual number of rows (up to a maximum)

      It seems that TableView returns a fixed preferred height since even if you only have one row in the model the table shows about 10 of them, with a lot of empty rows as a result.

      Preferred size of a Control should reflect its content. This is so in a text controls for instance. I am not sure why this is not the case for TableView.

      Returning a fixed value is problematic since it is almost impossible for the developer to set/get the correct preferred height in a platform and content presentation independent way. It needs to be bound to the number of rows but the actual height of each row can be different depending on CSS leading to big performance problems of one were to bound it to the row count and have a model that change a lot.

      There needs to be a way to tell how many rows should be in the preferred calculation since you don't want a preferred height to be thousands of pixels if you have many rows.

      I suggest a property, preferredVisibleRows, that is by default bound to the number of rows in the model but has an upper limit of 10. That property can easily be set to a fixed value or bound to some other semantic. Preferred height calculation can then check this property and make the calculation only when needed for layout purpose.

      I am filing this as a bug since I think preferred height really should reflect the content, such as would be very clear if we were talking about a wrapping text component.

            Unassigned Unassigned
            mgrev Mikael Grev
            Votes:
            3 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Imported: