org.eclipse.nebula.widgets.nattable.painter.cell
Class AutomaticRowHeightTextPainter

java.lang.Object
  extended by org.eclipse.nebula.widgets.nattable.painter.cell.AbstractCellPainter
      extended by org.eclipse.nebula.widgets.nattable.painter.cell.CellPainterWrapper
          extended by org.eclipse.nebula.widgets.nattable.painter.cell.BackgroundPainter
              extended by org.eclipse.nebula.widgets.nattable.painter.cell.AbstractTextPainter
                  extended by org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter
                      extended by org.eclipse.nebula.widgets.nattable.painter.cell.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.

Author:
Dirk Fauth
See Also:
TextPainter, DataLayer.setColumnPercentageSizing(boolean)

Field Summary
 
Fields inherited from class org.eclipse.nebula.widgets.nattable.painter.cell.AbstractTextPainter
calculateByTextHeight, calculateByTextLength, DOT, EMPTY, LINE_SEPARATOR, NEW_LINE_REGEX, paintBg, paintFg, spacing, wrapText
 
Constructor Summary
AutomaticRowHeightTextPainter()
           
AutomaticRowHeightTextPainter(int spacing)
           
 
Method Summary
protected  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, paintCell, setNewMinLength
 
Methods inherited from class org.eclipse.nebula.widgets.nattable.painter.cell.AbstractTextPainter
convertDataType, getLengthFromCache, getNumberOfNewLines, getTextToDisplay, isCalculateByTextHeight, isCalculateByTextLength, isTrimText, renderStrikethrough, renderUnderlined, setCalculateByTextHeight, setCalculateByTextLength, setStrikethrough, setTrimText, setUnderline, setupGCFromConfig
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AutomaticRowHeightTextPainter

public AutomaticRowHeightTextPainter()

AutomaticRowHeightTextPainter

public AutomaticRowHeightTextPainter(int spacing)
Method Detail

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


Copyright © 2015. All rights reserved.