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

Lists,Trees and Tables do not work with wrapped text

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P2 P2
    • 8
    • 8
    • javafx

      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.

            jgiles Jonathan Giles
            jasper Jasper Potts (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: