Class AutomaticRowHeightTextPainter
java.lang.Object
org.eclipse.nebula.widgets.nattable.painter.cell.AbstractCellPainter
org.eclipse.nebula.widgets.nattable.painter.cell.CellPainterWrapper
org.eclipse.nebula.widgets.nattable.painter.cell.BackgroundPainter
org.eclipse.nebula.widgets.nattable.painter.cell.AbstractTextPainter
org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter
org.eclipse.nebula.widgets.nattable.painter.cell.AutomaticRowHeightTextPainter
- All Implemented Interfaces:
ICellPainter
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.
-
Field Summary
Fields inherited from class org.eclipse.nebula.widgets.nattable.painter.cell.AbstractTextPainter
calculateByTextHeight, calculateByTextLength, DOT, EMPTY, LINE_SEPARATOR, lineSpacing, NEW_LINE_PATTERN, NEW_LINE_REGEX, paintBg, paintFg, spacing, wordWrapping, wrapText
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
performRowResize
(int contentHeight, org.eclipse.swt.graphics.Rectangle rectangle) Checks if a row resize needs to be triggered.Methods inherited from class org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter
calculatePadding, getPreferredHeight, getPreferredWidth, isCalculateWrappedHeight, paintCell, setCalculateWrappedHeight, setNewMinLength
Methods inherited from class org.eclipse.nebula.widgets.nattable.painter.cell.AbstractTextPainter
convertDataType, getLengthFromCache, getLineSpacing, getNumberOfNewLines, getTextToDisplay, isCalculateByTextHeight, isCalculateByTextLength, isCutText, isTrimText, isWordWrapping, isWrapText, paintDecoration, renderStrikethrough, renderUnderlined, resetGC, setCalculateByTextHeight, setCalculateByTextLength, setCutText, setLineSpacing, setStrikethrough, setTrimText, setUnderline, setupGCFromConfig, setWordWrapping, setWrapText
Methods inherited from class org.eclipse.nebula.widgets.nattable.painter.cell.BackgroundPainter
getBackgroundColour
Methods inherited from class org.eclipse.nebula.widgets.nattable.painter.cell.CellPainterWrapper
getCellPainterAt, getWrappedPainter, getWrappedPainterBounds, setWrappedPainter
-
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 classTextPainter
- Parameters:
contentHeight
- The necessary height to show the content completelyrectangle
- The available rectangle to render to- Returns:
true
if a row resize needs to be performed,false
if not
-