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

Lists,Trees and Tables do not work with wrapped text

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P2
    • Resolution: Duplicate
    • Affects Version/s: 8
    • Fix Version/s: 8
    • Component/s: javafx
    • Labels:

      Description

      When you try implementing a cell who's height is dependent on its width for example wrapped text. It failed to layout correctly because VirtualFlow always passes in "-1" for the width to prefHeight() method. This should be simply reproducible by creating a ListView where each item is a long String with a paragraph of text. Then setWrap(true) on all the cells.

      Looking at VirtualFlow line 1548 there are these two method.

          private double getCellPrefLength(IndexedCell cell) {
              return isVertical() ?
                  cell.prefHeight(-1)
                  : cell.prefWidth(-1);
          }

          /**
           * Gets the breadth of a specific cell
           */
          private double getCellBreadth(Cell cell) {
              return isVertical() ?
                  cell.prefWidth(-1)
                  : cell.prefHeight(-1);
          }

      I think they need to pass in the width or height. They will need to check getContentBias() of the cell first to see if it needs it as passing "-1" is faster as its cached and we do not want to loose performance when ContentBias is not needed.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jgiles Jonathan Giles
                Reporter:
                jasper Jasper Potts
              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved:
                  Imported: