org.eclipse.nebula.widgets.nattable.painter.cell
Class VerticalTextPainter
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.VerticalTextPainter
- All Implemented Interfaces:
- ICellPainter
public class VerticalTextPainter
- extends AbstractTextPainter
TextPainter that draws text into a cell vertically. Can handle word wrapping
and/or word cutting and/or automatic calculation and resizing of the cell
width and height if the text does not fit into the cell.
Note:
This is the new implementation that uses Transform
to create the
rotated vertical text. If you face any issues with this implementation, e.g.
wrong automatic size calculations for the rotated text (which can appear for
several fonts), you can still try to use the old implementation which is now
called VerticalTextImagePainter
.
Constructor Summary |
VerticalTextPainter()
|
VerticalTextPainter(boolean wrapText,
boolean paintBg)
|
VerticalTextPainter(boolean wrapText,
boolean paintBg,
boolean calculate)
|
VerticalTextPainter(boolean wrapText,
boolean paintBg,
boolean calculateByTextLength,
boolean calculateByTextHeight)
|
VerticalTextPainter(boolean wrapText,
boolean paintBg,
int spacing)
|
VerticalTextPainter(boolean wrapText,
boolean paintBg,
int spacing,
boolean calculate)
|
VerticalTextPainter(boolean wrapText,
boolean paintBg,
int spacing,
boolean calculateByTextLength,
boolean calculateByTextHeight)
|
Methods inherited from class org.eclipse.nebula.widgets.nattable.painter.cell.AbstractTextPainter |
convertDataType, getLengthFromCache, getNumberOfNewLines, getTextToDisplay, isCalculateByTextHeight, isCalculateByTextLength, renderStrikethrough, renderUnderlined, setCalculateByTextHeight, setCalculateByTextLength, setStrikethrough, setUnderline, setupGCFromConfig |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
VerticalTextPainter
public VerticalTextPainter()
VerticalTextPainter
public VerticalTextPainter(boolean wrapText,
boolean paintBg)
- Parameters:
wrapText
- split text over multiple linespaintBg
- skips painting the background if is FALSE
VerticalTextPainter
public VerticalTextPainter(boolean wrapText,
boolean paintBg,
int spacing)
- Parameters:
wrapText
- split text over multiple linespaintBg
- skips painting the background if is FALSEspacing
- The space between text and cell border
VerticalTextPainter
public VerticalTextPainter(boolean wrapText,
boolean paintBg,
boolean calculate)
- Parameters:
wrapText
- split text over multiple linespaintBg
- skips painting the background if is FALSEcalculate
- tells the text painter to calculate the cell borders regarding
the content
VerticalTextPainter
public VerticalTextPainter(boolean wrapText,
boolean paintBg,
boolean calculateByTextLength,
boolean calculateByTextHeight)
- Parameters:
wrapText
- split text over multiple linespaintBg
- skips painting the background if is FALSEcalculateByTextLength
- tells the text painter to calculate the cell border by
containing text length. For horizontal text rendering, this
means the width of the cell is calculated by content, for
vertical text rendering the height is calculatedcalculateByTextHeight
- tells the text painter to calculate the cell border by
containing text height. For horizontal text rendering, this
means the height of the cell is calculated by content, for
vertical text rendering the width is calculated
VerticalTextPainter
public VerticalTextPainter(boolean wrapText,
boolean paintBg,
int spacing,
boolean calculate)
- Parameters:
wrapText
- split text over multiple linespaintBg
- skips painting the background if is FALSEspacing
- The space between text and cell bordercalculate
- tells the text painter to calculate the cell borders regarding
the content
VerticalTextPainter
public VerticalTextPainter(boolean wrapText,
boolean paintBg,
int spacing,
boolean calculateByTextLength,
boolean calculateByTextHeight)
- Parameters:
wrapText
- split text over multiple linespaintBg
- skips painting the background if is FALSEspacing
- The space between text and cell bordercalculateByTextLength
- tells the text painter to calculate the cell border by
containing text length. For horizontal text rendering, this
means the width of the cell is calculated by content, for
vertical text rendering the height is calculatedcalculateByTextHeight
- tells the text painter to calculate the cell border by
containing text height. For horizontal text rendering, this
means the height of the cell is calculated by content, for
vertical text rendering the width is calculated
getPreferredWidth
public int getPreferredWidth(ILayerCell cell,
org.eclipse.swt.graphics.GC gc,
IConfigRegistry configRegistry)
- Description copied from interface:
ICellPainter
- Get the preferred width of the cell when rendered by this painter. Used
for auto-resize.
- Specified by:
getPreferredWidth
in interface ICellPainter
- Overrides:
getPreferredWidth
in class CellPainterWrapper
- Parameters:
cell
- The cell for which the preferred width is requested.gc
- The GC that is used for rendering.configRegistry
- The IConfigRegistry that contains the configuration used for
rendering.
- Returns:
- The preferred width of the given cell when rendered by this
painter.
getPreferredHeight
public int getPreferredHeight(ILayerCell cell,
org.eclipse.swt.graphics.GC gc,
IConfigRegistry configRegistry)
- Description copied from interface:
ICellPainter
- Get the preferred height of the cell when rendered by this painter. Used
for auto-resize.
- Specified by:
getPreferredHeight
in interface ICellPainter
- Overrides:
getPreferredHeight
in class CellPainterWrapper
- Parameters:
cell
- The cell for which the preferred height is requested.gc
- The GC that is used for rendering.configRegistry
- The IConfigRegistry that contains the configuration used for
rendering.
- Returns:
- The preferred height of the given cell when rendered by this
painter.
paintCell
public void paintCell(ILayerCell cell,
org.eclipse.swt.graphics.GC gc,
org.eclipse.swt.graphics.Rectangle rectangle,
IConfigRegistry configRegistry)
- Specified by:
paintCell
in interface ICellPainter
- Overrides:
paintCell
in class BackgroundPainter
setNewMinLength
protected void setNewMinLength(ILayerCell cell,
int contentHeight)
- Description copied from class:
AbstractTextPainter
- This method gets only called if automatic length calculation is enabled.
Calculate the new cell width/height by using the given content length and
the difference from current cell width/height to available length. If the
calculated cell is greater than the current set contentLength, update the
contentLength and execute a corresponding resize command.
- Specified by:
setNewMinLength
in class AbstractTextPainter
- Parameters:
cell
- the current cell that is paintedcontentHeight
- the length of the content
calculatePadding
protected int calculatePadding(ILayerCell cell,
int availableLength)
- Description copied from class:
AbstractTextPainter
- This method is used to determine the padding from the cell to the
available length. A padding can occur for example by using a
BeveledBorderDecorator or PaddingDecorator. This TextPainter is called
with the available space rectangle which is calculated by the wrapping
painters and decorators by subtracting paddings. As this TextPainter does
not know his wrapping painters and decorators the existing padding needs
to be calculated for automatic resizing. Abstract because a horizontal
TextPainter uses the width while a VerticalTextPainter uses the height of
the cell and the Rectangle.
- Specified by:
calculatePadding
in class AbstractTextPainter
- Parameters:
cell
- the current cell which should be resizedavailableLength
- the length value that is available and was given into
paintCell() as Rectangle argument
- Returns:
- the padding between the current cell length - availableLength
isRotateClockwise
public boolean isRotateClockwise()
- Returns:
true
if the rotation transformation should be
performed clockwise (90 degree), false
if it should
be performed counter-clockwise (-90 degree). Default is
false
.
setRotateClockwise
public void setRotateClockwise(boolean rotateClockwise)
- Parameters:
rotateClockwise
- true
if the rotation transformation should be
performed clockwise (90 degree), false
if it
should be performed counter-clockwise (-90 degree).
Copyright © 2015. All rights reserved.