Class AutomaticRowHeightTextPainter

All Implemented Interfaces:
ICellPainter

public class AutomaticRowHeightTextPainter extends TextPainter
Special TextPainter that will always calculate the row height of the cell dependent to the content shown in the cell. It uses word wrapping and calculation of the cell height to support showing long texts in a single cell. It will grow/shrink the row height on resizing so always the optimal height is used for the row the cell resides.

This TextPainter should preferably be used for tables that use percentage sizing so the calculated row heights for example will grow/shrink correctly when resizing the composite that contains the table.

It shouldn't be used for large tables that can be scrolled as the growing/shrinking on scrolling can cause some side effects, like jumping layouts on scrolling.

See Also:
  • Constructor Details

    • AutomaticRowHeightTextPainter

      public AutomaticRowHeightTextPainter()
    • AutomaticRowHeightTextPainter

      public AutomaticRowHeightTextPainter(int spacing)
  • Method Details

    • performRowResize

      protected boolean performRowResize(int contentHeight, org.eclipse.swt.graphics.Rectangle rectangle)
      Description copied from class: TextPainter
      Checks if a row resize needs to be triggered.
      Overrides:
      performRowResize in class TextPainter
      Parameters:
      contentHeight - The necessary height to show the content completely
      rectangle - The available rectangle to render to
      Returns:
      true if a row resize needs to be performed, false if not