public class AutomaticRowHeightTextPainter extends TextPainter
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.
TextPainter
,
DataLayer.setColumnPercentageSizing(boolean)
calculateByTextHeight, calculateByTextLength, DOT, EMPTY, LINE_SEPARATOR, NEW_LINE_REGEX, paintBg, paintFg, spacing, wrapText
Constructor and Description |
---|
AutomaticRowHeightTextPainter() |
AutomaticRowHeightTextPainter(int spacing) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
performRowResize(int contentHeight,
org.eclipse.swt.graphics.Rectangle rectangle)
Checks if a row resize needs to be triggered.
|
calculatePadding, getPreferredHeight, getPreferredWidth, paintCell, setNewMinLength
convertDataType, getLengthFromCache, getNumberOfNewLines, getTextToDisplay, renderStrikethrough, renderUnderlined, setStrikethrough, setUnderline, setupGCFromConfig
getBackgroundColour
getCellPainterAt, getWrappedPainter, getWrappedPainterBounds, setWrappedPainter
public AutomaticRowHeightTextPainter()
public AutomaticRowHeightTextPainter(int spacing)
protected boolean performRowResize(int contentHeight, org.eclipse.swt.graphics.Rectangle rectangle)
TextPainter
performRowResize
in class TextPainter
contentHeight
- The necessary height to show the content completelyrectangle
- The available rectangle to render totrue
if a row resize needs to be performed, false
if notCopyright © 2013. All Rights Reserved.