-
Bug
-
Resolution: Duplicate
-
P2
-
8
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.
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.
- relates to
-
JDK-8088100 ListView/ListCell: setWrapText/setMaxWidth has no effect
- Open